|
|
@@ -685,7 +685,7 @@ class MemberService extends BaseService
|
|
|
*/
|
|
|
public function modify($userId, $params)
|
|
|
{
|
|
|
- $username = isset($params['username']) ? $params['username'] : '';
|
|
|
+ $email = isset($params['email']) ? $params['email'] : '';
|
|
|
$password = isset($params['password']) ? $params['password'] : '';
|
|
|
$payPassword = isset($params['pay_password']) ? $params['pay_password'] : '';
|
|
|
|
|
|
@@ -713,35 +713,26 @@ class MemberService extends BaseService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 用户账号验证
|
|
|
- if (isset($params['username']) && $username) {
|
|
|
- $data['username'] = $username;
|
|
|
- $checkInfo = $this->model->where(['username' => $username, 'mark' => 1])->select(['id', 'status'])->first();
|
|
|
- if ($checkInfo && $checkInfo['id'] != $userId) {
|
|
|
- $this->error = 2005;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 手机号验证
|
|
|
- $mobile = isset($params['mobile']) ? $params['mobile'] : '';
|
|
|
- if (isset($params['mobile']) && $mobile) {
|
|
|
- $data['mobile'] = $mobile;
|
|
|
- $checkInfo = $this->model->where(['mobile' => $mobile, 'mark' => 1])->select(['id', 'status'])->first();
|
|
|
- if ($checkInfo && $checkInfo['id'] != $userId) {
|
|
|
- $this->error = 2009;
|
|
|
- return false;
|
|
|
+ // 邮箱验证
|
|
|
+ if (isset($params['email']) && $email) {
|
|
|
+ // 修改邮箱
|
|
|
+ $newEmail = isset($params['new_email'])? trim($params['new_email']) : '';
|
|
|
+ if(isset($params['new_email']) && $newEmail){
|
|
|
+ $data['email'] = $email;
|
|
|
+ $data['username'] = $email;
|
|
|
+ $checkInfo = $this->model->where(['username' => $newEmail, 'mark' => 1])->select(['id', 'status'])->first();
|
|
|
+ if ($checkInfo && $checkInfo['id'] != $userId) {
|
|
|
+ $this->error = 2005;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // 短信验证码
|
|
|
- $code = isset($params['code']) ? $params['code'] : '';
|
|
|
- if (empty($code)) {
|
|
|
- $this->error = 2013;
|
|
|
- return false;
|
|
|
- }
|
|
|
|
|
|
- if (!SmsService::make()->check($mobile, $code, 'modify')) {
|
|
|
- $this->error = SmsService::make()->getError();
|
|
|
+ // 邮箱验证码
|
|
|
+ $code = isset($params['code'])? trim($params['code']) : '';
|
|
|
+ $scene = isset($params['scene'])? trim($params['scene']) : '';
|
|
|
+ if (!EmailService::make()->check($email, $code, $scene)) {
|
|
|
+ $this->error = EmailService::make()->getError();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -752,9 +743,9 @@ class MemberService extends BaseService
|
|
|
$data['nickname'] = $nickname;
|
|
|
}
|
|
|
|
|
|
- $sex = isset($params['sex']) ? $params['sex'] : 0;
|
|
|
- if (isset($params['sex']) && $sex) {
|
|
|
- $data['sex'] = $sex;
|
|
|
+ $gender = isset($params['gender']) ? intval($params['gender']) : 3;
|
|
|
+ if (isset($params['gender']) && $gender) {
|
|
|
+ $data['gender'] = $gender;
|
|
|
}
|
|
|
|
|
|
$intro = isset($params['intro']) ? $params['intro'] : '';
|