|
@@ -50,25 +50,26 @@ class User extends Api
|
|
|
$introcode = $this->request->post('introcode','');
|
|
|
$avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars');
|
|
|
|
|
|
+ $data = [
|
|
|
+ 'nickname' => $nickname,
|
|
|
+ 'avatar' => $avatar,
|
|
|
+ ];
|
|
|
+
|
|
|
if ($mobile) {
|
|
|
$exists = \app\common\model\User::where('mobile', $mobile)->where('id', '<>', $this->auth->id)->find();
|
|
|
if ($exists) {
|
|
|
$this->error('手机号已经被他人注册');
|
|
|
}
|
|
|
+ $data['mobile'] = $mobile;
|
|
|
}
|
|
|
if ($introcode) {
|
|
|
- $exists = \app\common\model\User::where('introcode', $introcode)->find();
|
|
|
- if (!$exists) {
|
|
|
+ $intro_uid = \app\common\model\User::where('introcode', $introcode)->value('id');
|
|
|
+ if (!$intro_uid) {
|
|
|
$this->error('不存在的邀请码');
|
|
|
}
|
|
|
+ $data['intro_uid'] = $intro_uid;
|
|
|
}
|
|
|
|
|
|
- $data = [
|
|
|
- 'nickname' => $nickname,
|
|
|
- 'mobile' => $mobile,
|
|
|
- 'introcode' => $introcode,
|
|
|
- 'avatar' => $avatar,
|
|
|
- ];
|
|
|
|
|
|
Db::name('user')->where('id',$this->auth->id)->update($data);
|
|
|
|