|
@@ -42,12 +42,7 @@ class AuthController extends BaseController
|
|
|
app(WechatService::class)->decryptUserInfo($params);
|
|
|
/** @var User $user */
|
|
|
$user = \Auth::user();
|
|
|
- return $this->ok([
|
|
|
- "token" => app(AuthService::class)->encryptToken($user->id),
|
|
|
- "name" => $user->name,
|
|
|
- "phone" => $user->phone,
|
|
|
- "email" => $user->email,
|
|
|
- ]);
|
|
|
+ return $this->ok($user->format());
|
|
|
}
|
|
|
|
|
|
public function updateUserInfo()
|
|
@@ -57,12 +52,8 @@ class AuthController extends BaseController
|
|
|
"name" => "string",
|
|
|
]);
|
|
|
$user = app(AuthService::class)->updateUserInfo(Auth::user(), $params);
|
|
|
- return $this->ok([
|
|
|
- "token" => app(AuthService::class)->encryptToken($user->id),
|
|
|
- "name" => $user->name,
|
|
|
- "phone" => $user->phone,
|
|
|
- "email" => $user->email,
|
|
|
- ]);
|
|
|
+ return $this->ok($user->format());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function decryptPhone()
|
|
@@ -75,12 +66,7 @@ class AuthController extends BaseController
|
|
|
app(WechatService::class)->decryptPhone($params);
|
|
|
/** @var User $user */
|
|
|
$user = \Auth::user();
|
|
|
- return $this->ok([
|
|
|
- "token" => app(AuthService::class)->encryptToken($user->id),
|
|
|
- "name" => $user->name,
|
|
|
- "phone" => $user->phone,
|
|
|
- "email" => $user->email,
|
|
|
- ]);
|
|
|
+ return $this->ok($user->format());
|
|
|
}
|
|
|
|
|
|
public function profile()
|
|
@@ -130,12 +116,7 @@ class AuthController extends BaseController
|
|
|
throw new ClientException("验证码错误");
|
|
|
}
|
|
|
$user = app(AuthService::class)->register($params);
|
|
|
- return $this->ok([
|
|
|
- "token" => app(AuthService::class)->encryptToken($user->id),
|
|
|
- "name" => $user->name,
|
|
|
- "phone" => $user->phone,
|
|
|
- "email" => $user->email,
|
|
|
- ]);
|
|
|
+ return $this->ok($user->format());
|
|
|
}
|
|
|
|
|
|
public function login()
|
|
@@ -145,12 +126,8 @@ class AuthController extends BaseController
|
|
|
"password" => "required",
|
|
|
]);
|
|
|
$user = app(AuthService::class)->login($params);
|
|
|
- return $this->ok([
|
|
|
- "token" => app(AuthService::class)->encryptToken($user->id),
|
|
|
- "name" => $user->name,
|
|
|
- "phone" => $user->phone,
|
|
|
- "email" => $user->email,
|
|
|
- ]);
|
|
|
+ return $this->ok($user->format());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function resetPassword()
|
|
@@ -164,11 +141,6 @@ class AuthController extends BaseController
|
|
|
throw new ClientException("验证码错误");
|
|
|
}
|
|
|
$user = app(AuthService::class)->resetPassword($params);
|
|
|
- return $this->ok([
|
|
|
- "token" => app(AuthService::class)->encryptToken($user->id),
|
|
|
- "name" => $user->name,
|
|
|
- "phone" => $user->phone,
|
|
|
- "email" => $user->email,
|
|
|
- ]);
|
|
|
+ return $this->ok($user->format());
|
|
|
}
|
|
|
}
|