|
@@ -94,7 +94,7 @@ class User extends Api
|
|
|
|
|
|
$user = \app\common\model\User::getByMobile($mobile);
|
|
|
if ($user) {
|
|
|
- if ($user->status != 'normal') {
|
|
|
+ if ($user->status != 1) {
|
|
|
$this->error(__('Account is locked'));
|
|
|
}
|
|
|
//如果已经有账号则直接登录
|
|
@@ -115,6 +115,11 @@ class User extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function getUserinfo(){
|
|
|
+ $info = $this->auth->getUserinfo();
|
|
|
+ $this->success(1,$info);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 注册会员
|
|
|
*
|
|
@@ -179,25 +184,10 @@ class User extends Api
|
|
|
public function profile()
|
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
|
- $username = $this->request->post('username');
|
|
|
$nickname = $this->request->post('nickname');
|
|
|
- $bio = $this->request->post('bio');
|
|
|
$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();
|
|
|
- if ($exists) {
|
|
|
- $this->error(__('Username already exists'));
|
|
|
- }
|
|
|
- $user->username = $username;
|
|
|
- }
|
|
|
- if ($nickname) {
|
|
|
- $exists = \app\common\model\User::where('nickname', $nickname)->where('id', '<>', $this->auth->id)->find();
|
|
|
- if ($exists) {
|
|
|
- $this->error(__('Nickname already exists'));
|
|
|
- }
|
|
|
- $user->nickname = $nickname;
|
|
|
- }
|
|
|
- $user->bio = $bio;
|
|
|
+
|
|
|
+ $user->nickname = $nickname;
|
|
|
$user->avatar = $avatar;
|
|
|
$user->save();
|
|
|
$this->success();
|