コード例 #1
0
ファイル: sendsms.php プロジェクト: 453111208/bbc
 public function exec($params = null)
 {
     $result = messenger::sendSms($params['sms'], $params['tmpl'], $params['content']);
     if ($result['rsp'] == "succ") {
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: send_sms.php プロジェクト: 453111208/bbc
 public function testSend()
 {
     $content = array('vcode' => rand(1000, 9999));
     $sms = "13816353470";
     $m = messenger::sendSms($sms, 'account-member', $content);
     if ($m['rsp'] == "fail") {
         echo $m['err_msg'];
         exit;
     }
     echo "发送短信成功";
     exit;
 }
コード例 #3
0
ファイル: vcode.php プロジェクト: 453111208/bbc
 public function send_sms($type, $mobile)
 {
     if (!($tmpl = $this->sendtypeToTmpl($type))) {
         return false;
     }
     $vcodeData = $this->checkVcode($mobile, $type);
     $vcode = $this->randomkeys(6);
     $vcodeData['account'] = $mobile;
     $vcodeData['vcode'] = $vcode;
     $vcodeData['count'] += 1;
     $vcodeData['createtime'] = date('Ymd');
     $vcodeData['lastmodify'] = time();
     $data['vcode'] = $vcode;
     $key = $this->getVcodeKey($mobile, $type);
     $result = messenger::sendSms($mobile, $tmpl, $data);
     if ($result['rsp'] == "fail") {
         throw new \LogicException(app::get('system')->_('验证码发送失败!'));
     }
     if (defined('WITHOUT_CACHE') && !constant('WITHOUT_CACHE')) {
         cacheobject::set($key, $vcodeData, $this->ttl + time());
     } else {
         base_kvstore::instance('vcode/account')->store($key, $vcodeData, $this->ttl);
     }
     return true;
 }