/** * 发送手机验证码 * @param string $mobile 手机号码 */ public function sendSmsCodeAction() { $mobile = $this->getParameter('mobile'); if ($mobile == NULL) { $this->responseMissArgumentMessageError(); } //图形验证码是否正确 /*$sess = new XF_Session('XF_ImageVerify'); if ($sess->read() != strtolower($this->getParameter('imgCode'))) { $this->responseError('图形验证码不正确'); }*/ if ($this->getParam('jsonp') && $this->getParam('_')) { $smsCode = (string) mt_rand(123456, 911638); $mod = new Application_Model_MailSmsEvent(); try { $status = $mod->sendSmsCode($mobile, $smsCode); if ($status === TRUE) { $this->responseOK(); } else { $this->responseError('验证码发送失败,请稍后再试'); } } catch (XF_Exception $e) { $this->responseError($e->getMessage()); } } $this->responseError('请求错误1'); }
/** * 短信提醒到BD人员 * @param string $message 提醒内容 */ function funcPutMsmMessageToBD($message) { //return; $phones = array('13260266954'); //国庆 /*if (in_array(date('d'), array('01', '02', '03', '04', '05', '06', '07'))) { $mod = new Application_Model_MailSmsEvent(); foreach ($phones as $phone) { $mod->sendSms($phone, $message, 'other'); } }*/ //当天是星期五、六、日 if (in_array(date('w'), array('0', '5', '6'))) { //周期五18点后才提醒 if (date('w') == '5' && date('H') < 18) { return; } if (date('w') != '0') { return; } $mod = new Application_Model_MailSmsEvent(); foreach ($phones as $phone) { $mod->sendSms($phone, $message, 'other'); } } }