diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 762d2e5d84fbf6e1c2548f405e3416cda212c693..9f18630b22392b04f8479d62bcf841d2ccdf989c 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -157,6 +157,8 @@ class User extends Api * @param string $username 用户名 * @param string $nickname 昵称 * @param string $bio 个人简介 + * @param string $birthday 生日 + * @param string $gender 性别 */ public function profile() { @@ -164,6 +166,8 @@ class User extends Api $username = $this->request->post('username'); $nickname = $this->request->post('nickname'); $bio = $this->request->post('bio'); + $birthday = $this->request->post('birthday'); + $gender = $this->request->post('gender'); $avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars'); if ($username) { $exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find(); @@ -180,7 +184,9 @@ class User extends Api $user->nickname = $nickname; } $user->bio = $bio; - $user->avatar = $avatar; + if ($avatar) $user->avatar = $avatar; + if ($birthday) $user->birthday = $birthday; + if ($gender) $user->gender = $gender; $user->save(); $this->success(); }