添加新短信

master
zhanglingsheng 5 years ago
parent 789c05e89f
commit 7ac3da2a44

@ -3,6 +3,7 @@ namespace Common\Controller;
use Think\Controller; use Think\Controller;
use Org\XiguSDK\Xigu; use Org\XiguSDK\Xigu;
use Think\Exception; 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 { } else {
$sms_return = ['code'=>1008,'msg'=>'没有配置短信发送']; $sms_return = ['code'=>1008,'msg'=>'没有配置短信发送'];
} }
if(empty($sms_return)) { if(empty($sms_return)) {

@ -7,7 +7,7 @@
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn> // | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace Sdk\Model; namespace Common\Model;
use Think\Model; use Think\Model;
@ -37,10 +37,10 @@ class SmsLogModel extends Model
'30974' => '{1}您的验证码为{2}10分钟内有效为保证账户安全请勿向他人泄露验证信息。', '30974' => '{1}您的验证码为{2}10分钟内有效为保证账户安全请勿向他人泄露验证信息。',
]; ];
public function sendCode($strPhone, $type = '') public function sendCode($strPhone, $code = '')
{ {
$params[0] = self::$sms_sign['001']; $params[0] = self::$sms_sign['001'];
$params[1] = rand(100000, 999999); $params[1] = $code;
$str = self::getContent(self::$msgContent['30974'], $params); $str = self::getContent(self::$msgContent['30974'], $params);
$msg = $this->sms($str, $strPhone, $params[1]); $msg = $this->sms($str, $strPhone, $params[1]);
return $msg; return $msg;
@ -70,8 +70,8 @@ class SmsLogModel extends Model
public function sms($content, $phone, $code) public function sms($content, $phone, $code)
{ {
$data = [ $data = [
'apName' => 'wmtxhy', 'apName' => C('zhongwang.smtp_account'),
'apPassword' => 'wmtxhy158', 'apPassword' => C('zhongwang.smtp_password'),
'calledNumber' => $phone, 'calledNumber' => $phone,
'content' => $content, 'content' => $content,
]; ];

Loading…
Cancel
Save