wesmiler vor 2 Jahren
Ursprung
Commit
303a1b6734

+ 0 - 62
app/Http/Controllers/Api/LoginController.php

@@ -1,62 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Api;
-
-use App\Helpers\Jwt;
-use App\Services\RedisService;
-
-/**
- * 授权登录控制器基类
- * Class LoginController
- * @package App\Http\Controllers
- */
-class LoginController extends webApp
-{
-    /**
-     * 用户登录
-     * @return array
-     */
-    public function login(){
-        $code = request()->all();
-        if(empty($code)){
-            return showJson('code参数错误',false);
-        }
-
-        // 授权
-        $openid = isset($this->userInfo['openid'])? $this->userInfo['openid'] : '';
-        $status = isset($this->userInfo['status'])? $this->userInfo['status'] : '';
-        $userId = isset($this->userInfo['id'])? $this->userInfo['id'] : 0;
-        if(empty($this->userInfo) || empty($openid) || $userId<=0){
-            return showJson('用户授权失败',false);
-        }
-
-        if($status != 1){
-            return showJson('用户账户已被冻结不可操作',false);
-        }
-
-        // 获取授权TOKEN
-        $jwt = new Jwt('jwt_wx');
-        $token = $jwt->getToken($userId, 3);
-
-        // 结果返回
-        $result = [
-            'access_token' => $token,
-            'info'=> $this->userInfo,
-        ];
-
-        // 用户信息
-        RedisService::set("auths:info:{$userId}", $this->userInfo, 4*24*3600);
-        return showJson('获取授权成功', true, $result);
-    }
-
-    public function register()
-    {
-
-    }
-
-    public function sendmsm()
-    {
-        $username = request()->post('username');
-        return showJson(1011, true);
-    }
-}

+ 15 - 5
app/Http/Controllers/Api/v1/LoginController.php

@@ -43,7 +43,7 @@ class LoginController extends webApp
     public function loginMobile(MemberValidator $validator)
     {
         $params = request()->all();
-        $params = $validator->check($params, 'sms_login');
+        $params = $validator->check($params, 'mobile_login');
         if (!is_array($params)) {
             return showJson($params, false);
         }
@@ -89,16 +89,26 @@ class LoginController extends webApp
 
         // 发送验证码处理
         $mobile = isset($params['mobile']) ? $params['mobile'] : '';
-        $type = isset($params['sms_type']) ? $params['sms_type'] : '';
-        switch ($type) {
+        $scene = isset($params['scene']) ? $params['scene'] : '';
+        switch ($scene) {
             case 'reg':
-                if (MemberService::make()->checkPhoneExists($mobile)) {
+                if (MemberService::make()->checkExists('mobile', $mobile)) {
+                    return showJson(2009, false, ['app_url' => ConfigService::make()->getConfigByCode("app_{$appSources}_url"),], 406);
+                }
+                break;
+            case 'modify_mobile':
+                if (MemberService::make()->checkExists('mobile', $mobile)) {
                     return showJson(2009, false, ['app_url' => ConfigService::make()->getConfigByCode("app_{$appSources}_url"),], 406);
                 }
                 break;
+            case 'login':
+                if (!MemberService::make()->checkExists('mobile',$mobile)) {
+                    return showJson(2001, false, ['app_url' => ConfigService::make()->getConfigByCode("app_{$appSources}_url"),], 406);
+                }
+                break;
         }
 
-        if (!SmsService::make()->send($mobile, $type)) {
+        if (!SmsService::make()->send($mobile, $scene)) {
             return showJson(SmsService::make()->getError(), false);
         }
 

+ 2 - 1
app/Http/Validator/MemberValidator.php

@@ -47,7 +47,8 @@ class MemberValidator extends BaseValidator
     public static $scenes = [
         'info'=> ['id'],
         'save'=> ['mobile','nickname','gender'],
-        'sms'=> ['mobile','code'],
+        'sms'=> ['mobile','scene'],
+        'mobile_login'=> ['mobile','code'],
         'email_login'=> ['email','code'],
         'email_register'=> ['email','code'],
         'email'=> ['email','scene'],

+ 153 - 0
app/Services/AliSmsService.php

@@ -0,0 +1,153 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Services;
+
+use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
+use AlibabaCloud\SDK\Dysmsapi\V20170525\Dysmsapi;
+use Darabonba\OpenApi\Models\Config;
+use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest;
+use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
+
+/**
+ * 阿里云短信管理-服务类
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class SmsService
+ * @package App\Services
+ */
+class AliSmsService extends BaseService
+{
+    // 静态对象
+    protected static $instance = null;
+    private $errors = [
+        'isv.BUSINESS_LIMIT_CONTROL'=> '验证码获取频繁,请5分钟后重试~',
+    ];
+
+    /**
+     * 静态入口
+     * @return SmsService|static|null
+     */
+    public static function make(){
+        if(!self::$instance){
+            self::$instance = new static();
+        }
+
+        return self::$instance;
+    }
+
+    /**
+     * @param $accessKeyId
+     * @param $accessKeySecret
+     * @return mixed
+     */
+    public function createClient($accessKeyId, $accessKeySecret, $endpoint){
+        $config = new Config([
+            // 必填,您的 AccessKey ID
+            "accessKeyId" => $accessKeyId,
+            // 必填,您的 AccessKey Secret
+            "accessKeySecret" => $accessKeySecret
+        ]);
+        // 访问的域名
+        $config->endpoint = $endpoint;
+        return new Dysmsapi($config);
+    }
+
+    /**
+     * 发送短信验证码
+     * @param $mobile
+     * @param string $type
+     * @return bool
+     */
+    public function send($mobile, $type='login')
+    {
+        $cacheKey = "caches:sms:ali_{$mobile}:{$type}";
+        if(RedisService::get($cacheKey.'_lock')){
+            $this->error = '2011';
+            return false;
+        }
+
+        $config = ConfigService::make()->getConfigOptionByGroup(2);
+        $accessKey = isset($config['ali_sms_access_key'])? trim($config['ali_sms_access_key']) : '';
+        $accessSecret = isset($config['ali_sms_access_secret'])? trim($config['ali_sms_access_secret']) : '';
+        $smsTemplateCode = isset($config['ali_sms_template_code'])? trim($config['ali_sms_template_code']) : '';
+        $smsSignName = isset($config['ali_sms_sign_name'])? trim($config['ali_sms_sign_name']) : '';
+        $endpoint = isset($config['sms_endpoint'])? trim($config['sms_endpoint']) : '';
+        if(empty($accessKey) || empty($accessSecret) || empty($smsTemplateCode) || empty($smsSignName) || empty($endpoint)){
+            $this->error = 2019;
+            return false;
+        }
+
+        // 发送逻辑
+        $code = rand(1000,9999);
+        $client = $this->createClient($accessKey, $accessSecret, $endpoint);
+        $request = new SendSmsRequest();
+        $request->phoneNumbers = $mobile;
+        $request->signName = $smsSignName;
+        $request->templateCode = $smsTemplateCode;
+        $request->templateParam = json_encode(['code'=> $code], 256);
+        $runtime = new RuntimeOptions();
+        $runtime->maxIdleConns = 5;
+        $runtime->connectTimeout = 10000;
+        $runtime->readTimeout = 10000;
+        try {
+            // 复制代码运行请自行打印 API 的返回值
+            $response = $client->sendSms($request, $runtime);
+            $resultCode = $response->body->code;
+            if($resultCode == 'OK'){
+                $this->error = 2020;
+                RedisService::set($cacheKey,['code'=> $code,'mobile'=>$mobile,'bizId'=>$response->body->bizId,'date'=> date('Y-m-d H:i:s')], 600);
+                return true;
+            }else{
+                $error = isset($this->errors[$response->body->code])? $this->errors[$response->body->code] : '';
+                $this->error = $error? $error : '获取失败';
+                RedisService::set($cacheKey.'_fail', ['mobile'=> $mobile,'config'=>$config,'response'=>$response->body,'error'=>$this->error], 6 * 3600);
+                return false;
+            }
+        } catch (TeaUnableRetryError  $e){
+            $date = date('Y-m-d H:i:s');
+            logger()->error("【{$date} SMS短信验证码】发送失败:".$e->getMessage());
+            RedisService::set($cacheKey.'_error', ['mobile'=> $mobile,'config'=>$config,'error'=>$e->getMessage()], 6 * 3600);
+        }
+
+        $this->error = 2021;
+        return false;
+    }
+
+    /**
+     * 短信验证码验证
+     * @param string $mobile 手机号
+     * @param string $code 当前验证码
+     * @param string $type 验证码场景类型,login-登录,reg-注册
+     * @return bool
+     */
+    public function check($mobile, $code, $type='login')
+    {
+        if($code == '1100'){
+            return true;
+        }
+
+        $cacheKey = "caches:sms:ali_{$mobile}:{$type}";
+        $data = RedisService::get($cacheKey);
+        $smsCode = isset($data['code'])? $data['code'] : '';
+        if(empty($data) || empty($smsCode)){
+            $this->error = '2012';
+            return false;
+        }
+
+        if($smsCode != $code){
+            $this->error = '2013';
+            return false;
+        }
+
+        return true;
+    }
+}

+ 67 - 107
app/Services/Api/MemberService.php

@@ -385,26 +385,52 @@ class MemberService extends BaseService
         // 授权
         $email = isset($params['email']) ? trim($params['email']) : '';
         $mobile = isset($params['mobile']) ? trim($params['mobile']) : '';
+        $registerType = isset($params['type']) ? intval($params['type']) : 1;
         $nickname = isset($params['nickname']) ? trim($params['nickname']) : '';
         $code = isset($params['code']) ? trim($params['code']) : '';
         $scene = isset($params['scene']) ? $params['scene'] : '';
         $appSources = isset($params['app_sources']) ? $params['app_sources'] : '';
         $inviteCode = isset($params['invite_code']) ? $params['invite_code'] : '';
-        if (empty($params) || empty($email) || $code <= 0) {
+        if (empty($params) || $code <= 0 || !in_array($registerType,[1,2])) {
             $this->error = 2014;
             return false;
         }
 
-        // 验证码
-        if (!EmailService::make()->check($email, $code, $scene)) {
-            $this->error = EmailService::make()->getError();
-            return false;
-        }
+        // 邮箱注册
+        if($registerType == 1){
+            if(empty($email)){
+                $this->error = 2014;
+                return false;
+            }
 
-        // 验证是否注册
-        if($this->model->where(['email'=> $email,'mark'=>1])->value('id')){
-            $this->error = 2009;
-            return false;
+            // 验证码
+            if (!EmailService::make()->check($email, $code, $scene)) {
+                $this->error = EmailService::make()->getError();
+                return false;
+            }
+
+            // 验证是否注册
+            if($this->model->where(['email'=> $email,'mark'=>1])->value('id')){
+                $this->error = 2009;
+                return false;
+            }
+        }else if($registerType == 2){
+            if(empty($mobile)){
+                $this->error = 2014;
+                return false;
+            }
+
+            // 验证码
+            if (!SmsService::make()->check($mobile, $code, $scene)) {
+                $this->error = SmsService::make()->getError();
+                return false;
+            }
+
+            // 验证是否注册
+            if($this->model->where(['mobile'=> $mobile,'mark'=>1])->value('id')){
+                $this->error = 2009;
+                return false;
+            }
         }
 
         // 推荐人
@@ -438,7 +464,6 @@ class MemberService extends BaseService
         $city = isset($ipData['city'])? $ipData['city'] : '';
         $emailName = explode('@', $email)[0];
 
-
         // 钱包
         $data = [
             'parent_id' => $parentId,
@@ -446,8 +471,8 @@ class MemberService extends BaseService
             'points' => $points,
             'openid' => '',
             'avatar' => '',
-            'nickname' => $nickname ? $nickname : '用户'.substr($emailName,-8,8),
-            'username' => $email,
+            'nickname' => $nickname ? $nickname : 'XL'.substr($emailName,-8,8),
+            'username' => $registerType==1? $email : $mobile,
             'password' => get_password('xl123456'),
             'code' => strtoupper(get_random_code(9, 'X', "{$id}")),
             'email' => $email,
@@ -456,6 +481,7 @@ class MemberService extends BaseService
             'parents' => $parents,
             'province_id' => CityService::make()->getFieldByName($province),
             'city_id' => CityService::make()->getFieldByName($city),
+            '$city' => $city,
             'app_uuid' => isset($system['uuid']) ? $system['uuid'] : '',
             'device' => $appSources == 'android' ? 2 : 1,
             'status' => 1,
@@ -555,112 +581,34 @@ class MemberService extends BaseService
     {
         // 授权
         $mobile = isset($params['mobile']) ? $params['mobile'] : '';
-        $code = isset($params['sms_code']) ? $params['sms_code'] : '';
-        $smsType = isset($params['sms_type']) ? $params['sms_type'] : '';
-        $nickname = isset($params['nickname']) ? $params['nickname'] : '';
-        $openid = isset($params['openid']) ? $params['openid'] : '';
-        $avatar = isset($params['avatar']) ? $params['avatar'] : '';
-        $regType = isset($params['type']) ? $params['type'] : 'app';
+        $code = isset($params['code']) ? $params['code'] : '';
+        $scene = isset($params['scene']) ? $params['scene'] : '';
         $appSources = isset($params['app_sources']) ? $params['app_sources'] : '';
-        $inviteCode = isset($params['invite_code']) ? $params['invite_code'] : '';
-        if (empty($params) || empty($mobile) || $code <= 0) {
+        if (empty($params) || empty($email) || empty($scene) || $code <= 0) {
             $this->error = 2014;
             return false;
         }
 
         // 验证码
-        if (!SmsService::make()->check($mobile, $code, $smsType?$smsType:'login')) {
+        if (!SmsService::make()->check($mobile, $code, $scene)) {
             $this->error = SmsService::make()->getError();
             return false;
         }
 
-        // 推荐人
-        $parentId = 0;
-        $parents = '';
-        if ($inviteCode) {
-            $inviteInfo = $this->model->where(['code' => $inviteCode, 'mark' => 1])
-                ->select(['id', 'parents', 'parent_id'])
-                ->first();
-            $parentId = isset($inviteInfo['id']) ? $inviteInfo['id'] : 0;
-            $parents = isset($inviteInfo['parents']) ? $inviteInfo['parents'] . $parentId . ',' : ($parentId ? $parentId . ',' : '');
-        }
-
         // 验证是否注册,没有则注册
-        $data = $this->model->with(['merchant','mechanic'])->where(['mobile' => $mobile, 'mark' => 1])->select(['id', 'openid', 'username', 'parent_id', 'code', 'push_cid', 'status'])->first();
+        $data = $this->model->where(['mobile' => $mobile, 'mark' => 1])->select(['id', 'username','point_id','mobile', 'parent_id', 'code', 'status'])->first();
         $data = $data ? $data->toArray() : [];
+
         $userId = isset($data['id']) ? $data['id'] : 0;
         $status = isset($data['status']) ? $data['status'] : 0;
-        if ($userId && $status != 1) {
-            $this->error = 2015;
+        if(empty($data) || $userId<=0){
+            $this->error = 2001;
             return false;
         }
 
-        // 是否是商家或技师,有订单提醒
-        $noticeUser = ['id'=> 0,'uid'=>$userId,'type'=>1];
-        $merchant = isset($data['merchant'])? $data['merchant'] : [];
-        $merchantStatus = isset($merchant['status'])? $merchant['status'] : 0;
-        $mechanic = isset($data['mechanic'])? $data['mechanic'] : [];
-        $mechanicStatus = isset($mechanic['status'])? $mechanic['status'] : 0;
-        if($merchantStatus==2){
-            $uid = isset($merchant['id'])? $merchant['id'] : 0;
-            if($uid>0){
-                $noticeUser = ['id'=>$uid,'type'=>2,'uid'=> $userId];
-            }
-        }else if($mechanicStatus == 2){
-            $uid = isset($mechanic['id'])? $mechanic['id'] : 0;
-            if($uid>0){
-                $noticeUser = ['id'=>$uid,'type'=>3,'uid'=>$userId];
-            }
-        }
-
-        $pushCid = isset($params['push_cid']) ? $params['push_cid'] : '';
-        if (!$userId) {
-            $id = $this->model->max('id') + 1;
-            $data = [
-                'parent_id' => $parentId,
-                'openid' => $openid,
-                'avatar' => $avatar,
-                'nickname' => $nickname ? $nickname : get_random_code(4, '用户u').substr($mobile,-4,4),
-                'username' => get_username($id),
-                'password' => get_password('123456'),
-                'code' => strtoupper(get_random_code(8, 'D', "{$id}")),
-                'mobile' => $mobile,
-                'parents' => $parents,
-                'push_cid' => isset($params['push_cid']) ? $params['push_cid'] : '',
-                'app_uuid' => isset($params['uuid']) ? $params['uuid'] : '',
-                'device' => $appSources == 'android' ? 2 : 1,
-                'status' => 1,
-                'balance' => 0,
-                'score' => 0,
-                'mark' => 1,
-                'login_time' => time(),
-                'login_ip' => get_client_ip(),
-                'create_time' => time(),
-            ];
-
-            $userId = $this->model->insertGetId($data);
-        } elseif ($regType != 'h5') {
-            // 登录更新
-            $updateData = [
-                'app_uuid' => isset($params['uuid']) ? $params['uuid'] : '',
-                'login_count' => DB::raw("login_count+1"),
-                'login_time' => time(),
-                'login_ip' => get_client_ip(),
-                'update_time' => time(),
-            ];
-            if ($pushCid) {
-                $updateData['push_cid'] = $pushCid;
-            }
-            $this->model->where(['id' => $userId])->update($updateData);
-        }
-
-        // H5 邀请注册,无需登录
-        if ($regType == 'h5') {
-            $this->error = $status ? 2023 : 2022;
-            return [
-                'app_url' => ConfigService::make()->getConfigByCode("app_{$appSources}_url"),
-                'info' => ['uid' => $userId, 'invite_id' => $parentId, 'username' => $data['username']],
-            ];
+        if ($status != 1) {
+            $this->error = 2015;
+            return false;
         }
 
         // 获取登录授权token
@@ -670,16 +618,28 @@ class MemberService extends BaseService
         // 结果返回
         $result = [
             'access_token' => $token,
-            'info' => ['uid' => $userId,'notice_user'=>$noticeUser, 'openid' => $data['openid'], 'username' => $data['username']],
+            'info' => ['uid' => $userId,'parent_id'=> $data['parent_id'], 'username' => $data['username']],
         ];
 
         // 用户信息
+        $ip = get_client_ip();
+        $updateData = [
+            'login_time' => time(),
+            'login_ip' => $ip,
+        ];
+
+        if(!RedisService::get("caches:member:updateArea:{$userId}")){
+            $ipData = ToolService::make()->getIpAddress($ip,'');
+            $province = isset($ipData['regionName'])? $ipData['regionName'] : '';
+            $city = isset($ipData['city'])? $ipData['city'] : '';
+            $updateData['province_id'] = CityService::make()->getFieldByName($province);
+            $updateData['city_id'] = CityService::make()->getFieldByName($city);
+        }
+
+        $this->model->where(['id'=> $userId])->update($updateData);
         $this->error = 2004;
         $data['token'] = $token;
-        unset($data['password']);
-        // 实现初始化账单明细表
-        AccountLogModel::where('id','<=',1)->value('id');
-        RedisService::clear( "caches:map:{$userId}");
+        RedisService::set("caches:member:updateArea:{$userId}", $updateData, 3600);
         RedisService::set("auths:info:{$userId}", $data, 3 * 24 * 3600);
         return $result;
     }

+ 19 - 39
app/Services/SmsService.php

@@ -18,7 +18,7 @@ use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest;
 use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
 
 /**
- * 短信管理-服务类
+ * 创信短信管理-服务类
  * @author laravel开发员
  * @since 2020/11/11
  * Class SmsService
@@ -28,9 +28,6 @@ class SmsService extends BaseService
 {
     // 静态对象
     protected static $instance = null;
-    private $errors = [
-        'isv.BUSINESS_LIMIT_CONTROL'=> '验证码获取频繁,请5分钟后重试~',
-    ];
 
     /**
      * 静态入口
@@ -45,23 +42,6 @@ class SmsService extends BaseService
     }
 
     /**
-     * @param $accessKeyId
-     * @param $accessKeySecret
-     * @return mixed
-     */
-    public function createClient($accessKeyId, $accessKeySecret, $endpoint){
-        $config = new Config([
-            // 必填,您的 AccessKey ID
-            "accessKeyId" => $accessKeyId,
-            // 必填,您的 AccessKey Secret
-            "accessKeySecret" => $accessKeySecret
-        ]);
-        // 访问的域名
-        $config->endpoint = $endpoint;
-        return new Dysmsapi($config);
-    }
-
-    /**
      * 发送短信验证码
      * @param $mobile
      * @param string $type
@@ -69,38 +49,38 @@ class SmsService extends BaseService
      */
     public function send($mobile, $type='login')
     {
-        $cacheKey = "caches:sms:{$mobile}:{$type}";
+        $cacheKey = "caches:sms:cx_{$mobile}:{$type}";
         if(RedisService::get($cacheKey.'_lock')){
             $this->error = '2011';
             return false;
         }
 
-        $config = ConfigService::make()->getConfigOptionByGroup(2);
-        $accessKey = isset($config['ali_sms_access_key'])? trim($config['ali_sms_access_key']) : '';
-        $accessSecret = isset($config['ali_sms_access_secret'])? trim($config['ali_sms_access_secret']) : '';
-        $smsTemplateCode = isset($config['ali_sms_template_code'])? trim($config['ali_sms_template_code']) : '';
-        $smsSignName = isset($config['ali_sms_sign_name'])? trim($config['ali_sms_sign_name']) : '';
-        $endpoint = isset($config['sms_endpoint'])? trim($config['sms_endpoint']) : '';
-        if(empty($accessKey) || empty($accessSecret) || empty($smsTemplateCode) || empty($smsSignName) || empty($endpoint)){
-            $this->error = 2019;
+        $config = ConfigService::make()->getConfigOptionByGroup(16);
+        $apiUrl = isset($config['cx_api_url'])? trim($config['cx_api_url']) : '';
+        $account = isset($config['cx_sms_account'])? trim($config['cx_sms_account']) : '';
+        $password = isset($config['cx_sms_password'])? trim($config['cx_sms_password']) : '';
+        $extno = isset($config['cx_sms_extno'])? trim($config['cx_sms_extno']) : '';
+        $signName = isset($config['cx_sms_signname']) && $config['cx_sms_signname']? trim($config['cx_sms_signname']) : '星链社交';
+        if(empty($apiUrl) || empty($account) || empty($password) || empty($extno)){
+            $this->error = 1056;
             return false;
         }
 
         // 发送逻辑
         $code = rand(1000,9999);
-        $client = $this->createClient($accessKey, $accessSecret, $endpoint);
-        $request = new SendSmsRequest();
-        $request->phoneNumbers = $mobile;
-        $request->signName = $smsSignName;
-        $request->templateCode = $smsTemplateCode;
-        $request->templateParam = json_encode(['code'=> $code], 256);
+        $content="【{$signName}】您的验证码是:{$code},请在10分钟内使用,请不要将验证码泄漏个他人。";//短信内容
+        $content = iconv("UTF-8", "GBK", $content);
+        $url="{$apiUrl}/sms?action=send&password={$password}&extno={$extno}&mobile={$mobile}&account={$account}&content={$content}";
+        $html = file_get_contents($url);
+
         $runtime = new RuntimeOptions();
         $runtime->maxIdleConns = 5;
         $runtime->connectTimeout = 10000;
         $runtime->readTimeout = 10000;
         try {
             // 复制代码运行请自行打印 API 的返回值
-            $response = $client->sendSms($request, $runtime);
+            $response = httpRequest($url,'','get','',5);
+             var_dump($response);
             $resultCode = $response->body->code;
             if($resultCode == 'OK'){
                 $this->error = 2020;
@@ -114,7 +94,7 @@ class SmsService extends BaseService
             }
         } catch (TeaUnableRetryError  $e){
             $date = date('Y-m-d H:i:s');
-            logger()->error("【{$date} SMS短信验证码】发送失败:".$e->getMessage());
+            logger()->error("【{$date} 创信SMS短信验证码】发送失败:".$e->getMessage());
             RedisService::set($cacheKey.'_error', ['mobile'=> $mobile,'config'=>$config,'error'=>$e->getMessage()], 6 * 3600);
         }
 
@@ -135,7 +115,7 @@ class SmsService extends BaseService
             return true;
         }
 
-        $cacheKey = "caches:sms:{$mobile}:{$type}";
+        $cacheKey = "caches:sms:cx_{$mobile}:{$type}";
         $data = RedisService::get($cacheKey);
         $smsCode = isset($data['code'])? $data['code'] : '';
         if(empty($data) || empty($smsCode)){

+ 2 - 0
resources/lang/en/api.php

@@ -54,6 +54,8 @@ return [
     '1051' => 'The shopping cart is empty',
     '1052' => 'The inventory of this style is insufficient',
     '1053' => 'Please do not place duplicate orders',
+    '1054' => 'Please fill in your email address',
+    '1055' => 'Please fill in your phone number',
 
     // 登录注册
     '2001'=> 'Illegal or nonexistent account',

+ 4 - 0
resources/lang/zh-cn/api.php

@@ -53,6 +53,10 @@ return [
     '1051' => '购物车是空的',
     '1052' => '该款式库存不足',
     '1053' => '请不要重复下单',
+    '1054' => '请填写邮箱地址',
+    '1055' => '请填写手机号码',
+    '1056' => '创信短信接口未配置',
+    '1057' => '请填写手机号码',
 
     // 登录注册
     '2001'=> '账号非法或未注册',