添加新短信

master
zhanglingsheng 5 years ago
parent 789c05e89f
commit 7ac3da2a44

@ -3,6 +3,7 @@ namespace Common\Controller;
use Think\Controller;
use Org\XiguSDK\Xigu;
use Think\Exception;
use Common\Model\SmsLogModel;
/**
* 短信类
@ -211,6 +212,14 @@ 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'=>'没有配置短信发送'];

@ -7,7 +7,7 @@
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
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,
];

Loading…
Cancel
Save