Esempio n. 1
0
 /**
  * @soap发短信
  *免申模板  'content' => '您的账号123,密码是987,欢迎您注册i代言。【i代言】',
  */
 public function SoapSend()
 {
     if (is_array($this->mobile)) {
         $phone = implode(',', $mobile);
     } else {
         $phone = $this->mobile;
         //检测 发送频率
         if (!$this->checkRate($phone)) {
             return '发送频率太高';
         }
     }
     $cx = new \SoapClient(Sms::CHUANGRUI_SOAPURL);
     //$cx = new \SoapClient("http://web.cr6868.com/asmx/webservice.asmx?wsdl");
     $sendcontent = array('sn' => Sms::CHUANGRUI_NAME, 'password' => Sms::CHUANGRUI_PWD, 'content' => $this->content, 'mobile' => $phone, 'ext' => '', 'stime' => $this->stime, 'issign' => 'N', 'sign' => '');
     $return = $cx->SendSMS($sendcontent);
     $result = $return->SendSMSResult;
     //写入日志
     $smslog_model = new SmsLog();
     $log = array('mobile' => $phone, 'status' => $result->code == 0 ? 0 : 1, 'errorcode' => $result->code, 'errorinfo' => '', 'sendmessage' => $this->content, 'from' => $this->from, 'client_info' => $this->client_info);
     $logreturn = $smslog_model->saveLog($log);
     return $log['status'];
 }
Esempio n. 2
0
 /**
  * @soap发短信
  *免申模板  'content' => '您的账号123,密码是987,欢迎您注册i代言。【i代言】',
  */
 protected function SoapSend()
 {
     if (is_array($this->mobile)) {
         $phone = implode(',', $mobile);
     } else {
         $phone = $this->mobile;
         //检测 发送频率
         if (!$this->checkRate($phone)) {
             return '发送频率太高';
         }
     }
     $cx = new \SoapClient($this->soapUrl);
     //$cx = new \SoapClient("http://web.cr6868.com/asmx/webservice.asmx?wsdl");
     $sendContent = ['sn' => $this->name, 'password' => $this->pwd, 'content' => $this->content, 'mobile' => $phone, 'ext' => '', 'stime' => $this->stime, 'issign' => 'N', 'sign' => ''];
     try {
         $return = $cx->SendSMS($sendContent);
         $result = $return->SendSMSResult;
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage(), 1003);
     }
     //写入日志
     $smslogModel = new SmsLog();
     $log = ['mobile' => $phone, 'status' => $result->code == 0 ? 0 : 1, 'errorcode' => $result->code, 'errorinfo' => '', 'sendmessage' => $this->content, 'from' => $this->from, 'client_info' => $this->clientInfo];
     $logreturn = $smslogModel->saveLog($log);
     return $result->code;
 }