|
@@ -193,7 +193,7 @@ class MemberService extends BaseService
|
|
|
$status = isset($data['status']) ? $data['status'] : 0;
|
|
$status = isset($data['status']) ? $data['status'] : 0;
|
|
|
$mark = isset($data['mark']) ? $data['mark'] : 0;
|
|
$mark = isset($data['mark']) ? $data['mark'] : 0;
|
|
|
if ($data && $userId && $status != 1 && $mark == 1) {
|
|
if ($data && $userId && $status != 1 && $mark == 1) {
|
|
|
- $this->error = 2011;
|
|
|
|
|
|
|
+ $this->error = 2015;
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -238,7 +238,7 @@ class MemberService extends BaseService
|
|
|
'device' => $appSources == 'ios' ? 1 : 2,
|
|
'device' => $appSources == 'ios' ? 1 : 2,
|
|
|
];
|
|
];
|
|
|
if (!$userId = $this->model->insertGetId($data)) {
|
|
if (!$userId = $this->model->insertGetId($data)) {
|
|
|
- $this->error = 2012;
|
|
|
|
|
|
|
+ $this->error = 2018;
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
} // 更新登录信息
|
|
} // 更新登录信息
|
|
@@ -277,14 +277,10 @@ class MemberService extends BaseService
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
// 用户缓存信息
|
|
// 用户缓存信息
|
|
|
- $this->error = 2013;
|
|
|
|
|
|
|
+ $this->error = 2019;
|
|
|
$data['token'] = $token;
|
|
$data['token'] = $token;
|
|
|
unset($data['mobile']);
|
|
unset($data['mobile']);
|
|
|
RedisService::set("auths:info:{$userId}", $data, 24 * 3600);
|
|
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;
|
|
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 $userId
|
|
|
* @param $params
|
|
* @param $params
|