|
@ -16,21 +16,21 @@ class UserVerifyService extends BaseHomeService |
|
|
{ |
|
|
{ |
|
|
try { |
|
|
try { |
|
|
// 参数校验 |
|
|
// 参数校验 |
|
|
if(empty($params['surname']) || !is_string($params['surname'])){ |
|
|
// if(empty($params['surname']) || !is_string($params['surname'])){ |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
// return $this->toData('400', lang('parameter_error')); |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
if(empty($params['name']) || !is_string($params['name'])){ |
|
|
if(empty($params['name']) || !is_string($params['name'])){ |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(empty($params['code']) || !is_string($params['code'])){ |
|
|
// if(empty($params['code']) || !is_string($params['code'])){ |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
// return $this->toData('400', lang('parameter_error')); |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
if(empty($params['country']) || !is_numeric($params['country'])){ |
|
|
// if(empty($params['country']) || !is_numeric($params['country'])){ |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
// return $this->toData('400', lang('parameter_error')); |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
if(empty($params['front_img'])){ |
|
|
if(empty($params['front_img'])){ |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
return $this->toData('400', lang('parameter_error')); |
|
@ -48,12 +48,12 @@ class UserVerifyService extends BaseHomeService |
|
|
// if (empty($params['zip_code'])) { |
|
|
// if (empty($params['zip_code'])) { |
|
|
// return $this->toData('400','zip_code 参数无效'); |
|
|
// return $this->toData('400','zip_code 参数无效'); |
|
|
// } |
|
|
// } |
|
|
if (empty($params['email'])) { |
|
|
// if (empty($params['email'])) { |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
// return $this->toData('400', lang('parameter_error')); |
|
|
} |
|
|
// } |
|
|
if (empty($params['email_code'])) { |
|
|
// if (empty($params['email_code'])) { |
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
// return $this->toData('400', lang('parameter_error')); |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
// if(empty($params['back_img']) || !is_numeric($params['back_img'])){ |
|
|
// if(empty($params['back_img']) || !is_numeric($params['back_img'])){ |
|
|
// return $this->toData('100400','Invalid back_img'); |
|
|
// return $this->toData('100400','Invalid back_img'); |
|
@ -75,24 +75,26 @@ class UserVerifyService extends BaseHomeService |
|
|
return $this->toData('500','status error'); |
|
|
return $this->toData('500','status error'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$country = CountryModel::where('id',$params['country'])->find(); |
|
|
if (!empty($params['country'])) { |
|
|
if(empty($country)){ |
|
|
$country = CountryModel::where('id',$params['country'])->find(); |
|
|
return $this->toData('500','country error'); |
|
|
if(empty($country)){ |
|
|
|
|
|
return $this->toData('500','country error'); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证邮箱 |
|
|
// 验证邮箱 |
|
|
$emailKey = 'USER:sendEmailLoginNoTrade:' . $params['email']; |
|
|
// $emailKey = 'USER:sendEmailLoginNoTrade:' . $params['email']; |
|
|
$cacheCode = Cache::store('redis')->get($emailKey); |
|
|
// $cacheCode = Cache::store('redis')->get($emailKey); |
|
|
if (empty($cacheCode) || $cacheCode != $params['email_code']) { |
|
|
// if (empty($cacheCode) || $cacheCode != $params['email_code']) { |
|
|
return $this->toData('500', lang('incorrect_verification_code')); |
|
|
// return $this->toData('500', lang('incorrect_verification_code')); |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
// 写入数据库 |
|
|
// 写入数据库 |
|
|
$userVerify = new UserVerifyLogModel; |
|
|
$userVerify = new UserVerifyLogModel; |
|
|
$userVerify->user_id = $userId; |
|
|
$userVerify->user_id = $userId; |
|
|
$userVerify->country = $params['country']; |
|
|
$userVerify->country = $params['country'] ?? 0; |
|
|
$userVerify->code = $params['code']; |
|
|
$userVerify->code = $params['code'] ?? ''; |
|
|
$userVerify->surname = $params['surname']; |
|
|
$userVerify->surname = $params['surname'] ?? ''; |
|
|
$userVerify->name = $params['name']; |
|
|
$userVerify->name = $params['name']; |
|
|
$userVerify->front_img = $params['front_img']; |
|
|
$userVerify->front_img = $params['front_img']; |
|
|
$userVerify->back_img = $params['back_img'] ?? ""; |
|
|
$userVerify->back_img = $params['back_img'] ?? ""; |
|
@ -102,7 +104,7 @@ class UserVerifyService extends BaseHomeService |
|
|
$userVerify->gender = $params['gender']; |
|
|
$userVerify->gender = $params['gender']; |
|
|
// $userVerify->addr = $params['addr']; |
|
|
// $userVerify->addr = $params['addr']; |
|
|
// $userVerify->zip_code = $params['zip_code']; |
|
|
// $userVerify->zip_code = $params['zip_code']; |
|
|
$userVerify->email = $params['email']; |
|
|
$userVerify->email = $params['email'] ?? ''; |
|
|
$userVerify->save(); |
|
|
$userVerify->save(); |
|
|
|
|
|
|
|
|
// 更改用户状态 |
|
|
// 更改用户状态 |
|
|