wesmiler 4 hónapja
szülő
commit
bffc5eeed2

+ 0 - 23
app/Http/Controllers/Api/v1/LoginController.php

@@ -5,11 +5,8 @@ namespace App\Http\Controllers\Api\v1;
 use App\Http\Controllers\Api\webApp;
 use App\Http\Validator\MemberValidator;
 use App\Services\Api\MemberService;
-use App\Services\ConfigService;
 use App\Services\RedisService;
 use App\Services\SmsService;
-use App\Services\WechatService;
-use Illuminate\Http\Request;
 
 /**
  * 授权登录控制器基类
@@ -65,26 +62,6 @@ class LoginController extends webApp
         }
     }
 
-
-    /**
-     * 账号注册
-     * @return array
-     */
-    public function register(MemberValidator $validator)
-    {
-        $params = request()->all();
-        $params = $validator->check($params, 'register');
-        if (!is_array($params)) {
-            return showJson($params, false);
-        }
-
-        if(!$result = MemberService::make()->register($params)){
-            return showJson(MemberService::make()->getError(), false);
-        }
-
-        return showJson(MemberService::make()->getError(), true, $result);
-    }
-
     /**
      * 重置密码
      * @param MemberValidator $validator

+ 3 - 104
app/Services/Api/MemberService.php

@@ -193,7 +193,7 @@ class MemberService extends BaseService
         $status = isset($data['status']) ? $data['status'] : 0;
         $mark = isset($data['mark']) ? $data['mark'] : 0;
         if ($data && $userId && $status != 1 && $mark == 1) {
-            $this->error = 2011;
+            $this->error = 2015;
             return false;
         }
 
@@ -238,7 +238,7 @@ class MemberService extends BaseService
                 'device' => $appSources == 'ios' ? 1 : 2,
             ];
             if (!$userId = $this->model->insertGetId($data)) {
-                $this->error = 2012;
+                $this->error = 2018;
                 return false;
             }
         } // 更新登录信息
@@ -277,14 +277,10 @@ class MemberService extends BaseService
         ];
 
         // 用户缓存信息
-        $this->error = 2013;
+        $this->error = 2019;
         $data['token'] = $token;
         unset($data['mobile']);
         RedisService::set("auths:info:{$userId}", $data, 24 * 3600);
-        RedisService::set("auths:info:{$userId}", $data, 24 * 3600);
-        RedisService::clear("caches:storeId:id_{$userId}");
-        RedisService::clear("caches:storeId:uuid_{$uuid}");
-        RedisService::clear("caches:storeId:ip_".get_client_ip());
         return $result;
     }
 
@@ -330,103 +326,6 @@ class MemberService extends BaseService
     }
 
     /**
-     * 账号注册
-     * @param $params
-     * @return array|false
-     */
-    public function register($params)
-    {
-        // 账号登录
-        $mobile = isset($params['mobile']) ? trim($params['mobile']) : '';
-        $password = isset($params['password']) ? trim($params['password']) : '';
-        $nickname = isset($params['nockname']) ? trim($params['nockname']) : '';
-        if (empty($params) || empty($mobile) || empty($password)) {
-            $this->error = 1041;
-            return false;
-        }
-
-        // 验证码验证
-        $smsCode = isset($params['sms_code']) ? trim($params['sms_code']) : '';
-        if (!SmsService::make()->check($mobile, $smsCode, 'register')) {
-            $this->error = SmsService::make()->getError();
-            return false;
-        }
-
-        // 验证是否注册
-        if ($this->model->where(['mobile' => $mobile, 'mark' => 1])->value('id')) {
-            $this->error = 2002;
-            return false;
-        }
-
-        // 驾驶证
-        $drivingLicense = isset($params['driving_license']) && $params['driving_license'] ? get_image_path($params['driving_license']) : '';
-        if (empty($drivingLicense)) {
-            $this->error = 2007;
-            return false;
-        }
-
-        // 行驶证
-        $driversLicense = isset($params['drivers_license']) && $params['drivers_license'] ? get_image_path($params['drivers_license']) : '';
-        if (empty($driversLicense)) {
-            $this->error = 2008;
-            return false;
-        }
-
-        $id = $this->model->max('id') + 1;
-        $system = isset($params['system']) ? $params['system'] : [];
-        $system = $system && !is_array($system) ? json_decode($system, true) : $system;
-        $appSources = isset($system['app_sources']) ? $system['app_sources'] : '';
-        $uuid = isset($system['uuid']) ? $system['uuid'] : '';
-        $data = [
-            'mobile' => $mobile,
-            'user_type' => 2,
-            'avatar' => '',
-            'nickname' => $nickname ? $nickname : 'DU' . rand(10, 99) . substr($mobile, -6, 6),
-            'realname' => isset($params['realname']) ? trim($params['realname']) : '',
-            'password' => get_password($password),
-            'car_number' => isset($params['car_number']) ? trim($params['car_number']) : '',
-            'car_type' => isset($params['car_type']) ? trim($params['car_type']) : '',
-            'driving_license' => $drivingLicense,
-            'drivers_license' => $driversLicense,
-            'code' => strtoupper(get_random_code(9, 'D', "{$id}")),
-            'app_uuid' => $uuid,
-            'device' => $appSources == 'android' ? 2 : 1,
-            'create_time' => time(),
-            'status' => 1,
-            'picker_status' => 1,
-            'confirm_remark' => '',
-            'confirm_status' => 2,
-            'balance' => 0,
-            'deposit' => 0,
-            'mark' => 1,
-            'login_ip' => get_client_ip(),
-        ];
-
-        if (!$userId = $this->model->insertGetId($data)) {
-            $this->error = 2003;
-            return false;
-        }
-
-        // 获取登录授权token
-        $token = JwtService::make()->encode($userId);
-
-        // 结果返回
-        $result = [
-            'access_token' => $token,
-            'info' => ['uid' => $userId, 'nickname' => $data['nickname']],
-        ];
-
-        // 注册成功
-        $this->error = 2004;
-        $data['token'] = $token;
-        unset($data['password']);
-        unset($data['mobile']);
-        RedisService::keyDel("caches:members:count*");
-        RedisService::set("auths:info:{$userId}", $data, 24 * 3600);
-        return $result;
-    }
-
-    /**
      * 设置资料
      * @param $userId
      * @param $params

+ 1 - 0
app/Services/JwtService.php

@@ -45,6 +45,7 @@ class JwtService extends BaseService
     {
        try {
            $payload = JWT::decode($token, new Key(env('JWT_KEY'), $this->alg));
+           var_dump($payload);
            if(empty($payload)){
                $this->error = 'TOKEN无效';
                return false;

+ 0 - 3
routes/api.php

@@ -20,9 +20,6 @@ Route::prefix('v1')->group(function() {
     // 登录
     Route::post('/login', [\App\Http\Controllers\Api\v1\LoginController::class, 'login']);
     Route::post('/mpAuth', [\App\Http\Controllers\Api\v1\LoginController::class, 'mpAuth']);
-    // 注册
-    Route::post('/register', [\App\Http\Controllers\Api\v1\LoginController::class, 'register']);
-    Route::post('/forget', [\App\Http\Controllers\Api\v1\LoginController::class, 'forget']);
     Route::post('/sms/send', [\App\Http\Controllers\Api\v1\LoginController::class, 'smsSend']);
 
     // 上传文件