function message_sms_push_submit() { $id = $this->input->post('id'); if (!$this->utility->chk_id($id)) { $this->json->output(array('success' => false, 'errors' => array('name' => '输入的记录编号错误'))); } $message = $this->Proj_model->get_proj_message_by_id($id); if (!$message) { $this->json->output(array('success' => false, 'errors' => array('name' => '未找到符合的数据记录'))); } if (!$this->utility->is_admin() && !(($this->utility->is_pm() || $this->utility->is_director() || $this->utility->is_director_2()) && $this->Proj_model->get_proj_manager($proj_id) == $this->get_user_info('realname')) && !(($this->utility->is_director() || $this->utility->is_director_2()) && $this->Proj_model->get_proj_director($proj_id) == $this->get_user_info('realname'))) { $this->json->output(array('success' => false, 'errors' => array('name' => '您不能对他人的记录进行操作'))); } $proj = $this->Proj_model->get_proj($message->proj_id); $sendmessage = '彩虹桥项目消息【' . $proj->issue . ' ' . $proj->name . '】' . $message->message; $api = new apibus(); $sms = $api->load("sms"); $allusers = $this->User_model->get_all(); if ($message->msg_cat == '内部消息') { foreach ($allusers as $auser) { if ((title2group($auser->title) == 'administrator' || title2group($auser->title) == 'product_manager') && $this->utility->chk_mobile($auser->mobile)) { $sms->send($auser->mobile, $sendmessage, "UTF-8"); } } } else { if ($message->msg_cat == '渠道消息') { foreach ($allusers as $auser) { if ((title2group($auser->title) == 'administrator' || title2group($auser->title) == 'product_manager' || title2group($auser->title) == 'staff') && $this->utility->chk_mobile($auser->mobile)) { $sms->send($auser->mobile, $sendmessage, "UTF-8"); } } } else { foreach ($allusers as $auser) { if ($this->utility->chk_mobile($auser->mobile)) { $sms->send($auser->mobile, $sendmessage, "UTF-8"); } } } } $this->json->output(array('success' => true)); }
public function send_sms() { // if(!IS_SAE && !C('SAE_AKEY')){ // exit('在本地执行发送短信函数,需要配置SAE_AKEY和SAE_SKEY<br />'); // } // $ret=send_sms(18611052787,'发送一条短信'); // if(!$ret){ // $this->show('短信发送失败,请在trace信息中看失败原因'); // }else{ // $this->show('短信发送成功'); // } // $sms = apibus::init( "sms"); //创建短信服务对象 // $mobile = "15626519209"; // $msg = "你好, SAE!"; // $obj = $sms->send( $mobile, $msg , "UTF-8"); // print_r( $obj ); // echo 'sms'; // //错误输出 Tips: 亲,如果调用失败是不收费的 // if ( $sms->isError( $obj ) ) // { // print_r( $obj->ApiBusError->errcode ); // print_r( $obj->ApiBusError->errdesc ); // } $api = new apibus(); //创建 ApiBus 对象 $sms = $api->load("sms"); //创建短信服务对象 $mobile = "15626519209"; $msg = "你好,SAE "; $obj = $sms->send($mobile, $msg, "UTF-8"); print_r($obj); echo 'good'; //错误输出 Tips: 亲,如果调用失败是不收费的 if ($sms->isError($obj)) { print_r($obj->ApiBusError->errcode); print_r($obj->ApiBusError->errdesc); } }
<meta charset=utf-8> <?php $api = new apibus(); //创建 ApiBus 对象 $Geo = $api->load("geoone"); //创建一级地理位置服务对象 $begin = "116.317245,39.981437"; $end = "116.328422,40.077796"; $drive_route = $Geo->getDriveRoute($begin, $end); echo "drive_rote: "; echo 'print_r($drive_route);'; print_r($drive_route); //错误输出 Tips: 亲,如果调用失败是不收费的 if ($Geo->isError($drive_route)) { print_r($drive_route->ApiBusError->errcode); print_r($drive_route->ApiBusError->errdesc); }