Commit aefc7479 authored by jianghaiming's avatar jianghaiming

update:set

parent dcef14a1
...@@ -33,5 +33,6 @@ class DistributorException extends BaseException ...@@ -33,5 +33,6 @@ class DistributorException extends BaseException
14 => '用户id不能能为空', 14 => '用户id不能能为空',
15 => '活动id不能能为空', 15 => '活动id不能能为空',
16 => '商品id不能能为空', 16 => '商品id不能能为空',
17 => '验证码不正确或过期',
]; ];
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ use Api\PhpServices\ShopImage\GetImage; ...@@ -17,6 +17,7 @@ use Api\PhpServices\ShopImage\GetImage;
use Api\PhpServices\ShopImage\QR; use Api\PhpServices\ShopImage\QR;
use App\Exception\custom\InterfaceException; use App\Exception\custom\InterfaceException;
use App\Services\goods\GoodsService; use App\Services\goods\GoodsService;
use Api\PhpUtils\Http\Request;
class DistributorService class DistributorService
{ {
...@@ -182,6 +183,10 @@ class DistributorService ...@@ -182,6 +183,10 @@ class DistributorService
throw new DistributorException(['cus'=>11]); throw new DistributorException(['cus'=>11]);
} }
if (!self::checkSmsCode($params)) {
throw new DistributorException(['cus'=>17]);
}
$jwUserId = ''; $jwUserId = '';
// if (empty($distributorCode)) { // if (empty($distributorCode)) {
// throw new DistributorException(['cus'=>9]); // throw new DistributorException(['cus'=>9]);
...@@ -292,6 +297,39 @@ class DistributorService ...@@ -292,6 +297,39 @@ class DistributorService
} }
} }
/**
* 发送短信验证码
*
*/
public static function checkSmsCode($params)
{
$url = config('interface','service.user.check_sms_code');
if(!$url){
throw new CodeSpecialException("failed");
}
$params = [
'mobile' => !empty($params['mobile']) ? $params['mobile'] : '',
'appid' => !empty($params['appid']) ? $params['appid'] : 'hubble',
'code' => !empty($params['code']) ? $params['code'] : '',
'key' => 'f16bdd46292480b4b82c841d90a6ba02',
'partner' => !empty($params['appid']) ? $params['appid'] : 'hubble',
//'scene' => 'login',
];
$sms = (new Request())->get($url, $params);
if(!$sms){
throw new CodeSpecialException("timeout");
}
if (!empty($sms) && $sms['code'] == 0) {
return $sms;
}else{
return $sms;
}
}
/** /**
* 发送短信验证码 * 发送短信验证码
* *
...@@ -309,10 +347,10 @@ class DistributorService ...@@ -309,10 +347,10 @@ class DistributorService
$params = [ $params = [
'mobile' => !empty($params['mobile']) ? $params['mobile'] : '', 'mobile' => !empty($params['mobile']) ? $params['mobile'] : '',
'appid' => 'hubble', 'appid' => !empty($params['appid']) ? $params['appid'] : 'hubble',
'code' => '123456', 'code' => '123456',
'key' => 'f16bdd46292480b4b82c841d90a6ba02', 'key' => 'f16bdd46292480b4b82c841d90a6ba02',
'partner' => 'merchant-b', 'partner' => !empty($params['appid']) ? $params['appid'] : 'hubble',
'template' =>7, 'template' =>7,
'code_lenght' => 6, 'code_lenght' => 6,
'ticket_expire' => 86400, 'ticket_expire' => 86400,
...@@ -320,7 +358,7 @@ class DistributorService ...@@ -320,7 +358,7 @@ class DistributorService
'retry_times' => 100 'retry_times' => 100
]; ];
$sms = (new TimeOut())->runGet($url, $params); $sms = (new Request())->get($url, $params);
if(!$sms){ if(!$sms){
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment