示例#1
0
 /**
  * 发送短息
  */
 public function sendSmsAction()
 {
     $vars = ['pho_phone', 'sign'];
     $data = $this->beforeGetVarExecVerify($vars);
     //验证码
     $pho_code = mt_rand(100000, 999999);
     //记录验证码
     $add_status = (new \Member())->addPhoneLog($data['pho_phone'], $pho_code);
     if ($add_status != OK) {
         $this->throwMessage($add_status);
     }
     //发送验证码
     $send_status = \Func::sendSMS($data['pho_phone'], $pho_code);
     if ($send_status != OK) {
         $this->throwMessage($send_status);
     }
     $this->throwMessage(OK, ['pho_code' => $pho_code]);
 }
示例#2
0
 /**
  * 发送短息
  */
 public function sendSmsAction()
 {
     $vars = ['pho_phone', 'sign'];
     //获取数据
     list($pho_phone, $sign) = \Verify::getQuery($vars);
     //验证参数
     if (\Verify::getMessage()) {
         $this->throwMessage(PARAMETER_FAIL, \Verify::getMessage());
     }
     //验证签名
     if (!$this->verifySign($pho_phone, $sign)) {
         $this->throwMessage(ILLEGAL_SIGN);
     }
     //发送验证码
     $pho_code = mt_rand(100000, 999999);
     $send_status = \Func::sendSMS($pho_phone, $pho_code);
     if ($send_status != OK) {
         $this->throwMessage($send_status);
     }
     //记录验证码
     $this->throwMessage((new \Member())->addPhoneLog($pho_phone, $pho_code), ['pho_code' => $pho_code]);
 }