From 7ac3da2a446b32d02259ab764c3c254ca65ae357 Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Wed, 27 Nov 2019 16:05:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Common/Controller/SmsController.class.php | 11 ++++++++++- Application/Common/Model/SmsLogModel.class.php | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Application/Common/Controller/SmsController.class.php b/Application/Common/Controller/SmsController.class.php index 9c5f7104..d6cb38bd 100644 --- a/Application/Common/Controller/SmsController.class.php +++ b/Application/Common/Controller/SmsController.class.php @@ -3,6 +3,7 @@ namespace Common\Controller; use Think\Controller; use Org\XiguSDK\Xigu; use Think\Exception; +use Common\Model\SmsLogModel; /** * 短信类 @@ -211,10 +212,18 @@ class SmsController extends Controller { } + } elseif(get_tool_status('zhongwang')) { + $this->check_sms($phone,C('zhongwang.limit'),true,$pid); + $re = (new SmsLogModel())->sendCode($phone, $rand); + $result['create_time'] = time(); + if($re['error'] != 0) { + $sms_return = ['code'=>1010,'msg'=>$re['message']]; + } + } else { $sms_return = ['code'=>1008,'msg'=>'没有配置短信发送']; - + } if(empty($sms_return)) { diff --git a/Application/Common/Model/SmsLogModel.class.php b/Application/Common/Model/SmsLogModel.class.php index fcb97bfb..f6f7cf02 100644 --- a/Application/Common/Model/SmsLogModel.class.php +++ b/Application/Common/Model/SmsLogModel.class.php @@ -7,7 +7,7 @@ // | Author: 麦当苗儿 // +---------------------------------------------------------------------- -namespace Sdk\Model; +namespace Common\Model; use Think\Model; @@ -37,10 +37,10 @@ class SmsLogModel extends Model '30974' => '{1}您的验证码为{2},10分钟内有效,为保证账户安全,请勿向他人泄露验证信息。', ]; - public function sendCode($strPhone, $type = '') + public function sendCode($strPhone, $code = '') { $params[0] = self::$sms_sign['001']; - $params[1] = rand(100000, 999999); + $params[1] = $code; $str = self::getContent(self::$msgContent['30974'], $params); $msg = $this->sms($str, $strPhone, $params[1]); return $msg; @@ -70,8 +70,8 @@ class SmsLogModel extends Model public function sms($content, $phone, $code) { $data = [ - 'apName' => 'wmtxhy', - 'apPassword' => 'wmtxhy158', + 'apName' => C('zhongwang.smtp_account'), + 'apPassword' => C('zhongwang.smtp_password'), 'calledNumber' => $phone, 'content' => $content, ];