预留模板到货短信
This commit is contained in:
parent
80d24acad4
commit
1976367b3c
@ -314,7 +314,7 @@ class StoreOrderLogic extends BaseLogic
|
||||
}
|
||||
|
||||
|
||||
public function dealSendSms($param)
|
||||
public function dealSendSms($param,$type = 0)
|
||||
{
|
||||
$code = generateRandomCode();
|
||||
$phone = User::where('id',$param['uid'])->value('mobile');
|
||||
@ -322,8 +322,12 @@ class StoreOrderLogic extends BaseLogic
|
||||
throw new \Exception('用户未设置手机号');
|
||||
}
|
||||
$template = getenv('SMS_TEMPLATE');
|
||||
if($type){
|
||||
$check =(new SmsService())->client($phone,$template,$code,1);
|
||||
}else{
|
||||
$check =(new SmsService())->client($phone,$template,$code);
|
||||
}
|
||||
|
||||
$check =(new SmsService())->client($phone,$template,$code);
|
||||
if($check){
|
||||
$remark = $param['uid'].'_smsPay';
|
||||
Cache::set($remark,$code,5*60);
|
||||
|
@ -45,18 +45,30 @@ class SmsService
|
||||
|
||||
}
|
||||
|
||||
public function client($phone,$template,$code)
|
||||
public function client($phone,$template,$code,$type = 0)
|
||||
{
|
||||
try{
|
||||
$easySms = new EasySms($this->config);
|
||||
|
||||
$res = $easySms->send($phone, [
|
||||
'content' => '您的验证码为: '.$code,
|
||||
'template' => $template,
|
||||
'data' => [
|
||||
'code' => $code
|
||||
],
|
||||
]);
|
||||
if($type){//预留发送到货短信
|
||||
$res = $easySms->send($phone, [
|
||||
'content' => '您的验证码为: '.$code,
|
||||
'template' => $template,
|
||||
'data' => [
|
||||
'code' => $code
|
||||
],
|
||||
]);
|
||||
|
||||
}else{
|
||||
$res = $easySms->send($phone, [
|
||||
'content' => '您的验证码为: '.$code,
|
||||
'template' => $template,
|
||||
'data' => [
|
||||
'code' => $code
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
if($res && $res['aliyun']['status'] == 'success'){
|
||||
return true;
|
||||
}else{
|
||||
|
@ -373,5 +373,18 @@ class StoreOrderController extends BaseAdminController
|
||||
}
|
||||
return $this->fail('支付失败');
|
||||
}
|
||||
|
||||
public function stocking()
|
||||
{
|
||||
$uid = $this->request->post('uid');
|
||||
$res = (new StoreOrderLogic())->dealSendSms(['uid'=>$uid],1);
|
||||
if($res){
|
||||
return $this->success('发送成功',[],0,1);
|
||||
}else{
|
||||
return $this->fail('发送失败');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user