[api] authenticate check is normal

This commit is contained in:
xiaomlove
2022-02-21 23:20:25 +08:00
parent 4d82f5cffa
commit e9d6aac31a
3 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -57,8 +57,8 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
$rep = new UserRepository(); $r = floatval(25.32);
$r = $rep->getDetail(1); dd($r);
} }
} }
+1 -1
View File
@@ -29,7 +29,7 @@ class UserResource extends JsonResource
'downloaded' => $this->downloaded, 'downloaded' => $this->downloaded,
'downloaded_text' => mksize($this->downloaded), 'downloaded_text' => mksize($this->downloaded),
'seed_bonus' => $this->seedbonus, 'seed_bonus' => $this->seedbonus,
'seed_points' => $this->seed_points, 'seed_points' => floatval($this->seed_points),
'seedtime' => $this->seedtime, 'seedtime' => $this->seedtime,
'seedtime_text' => mkprettytime($this->seedtime), 'seedtime_text' => mkprettytime($this->seedtime),
'leechtime' => $this->leechtime, 'leechtime' => $this->leechtime,
@@ -19,6 +19,7 @@ class AuthenticateRepository extends BaseRepository
if (IS_PLATFORM_ADMIN && !$user->canAccessAdmin()) { if (IS_PLATFORM_ADMIN && !$user->canAccessAdmin()) {
throw new UnauthorizedException('Unauthorized!'); throw new UnauthorizedException('Unauthorized!');
} }
$user->checkIsNormal();
$tokenName = __METHOD__ . __LINE__; $tokenName = __METHOD__ . __LINE__;
$token = DB::transaction(function () use ($user, $tokenName) { $token = DB::transaction(function () use ($user, $tokenName) {
$user->tokens()->delete(); $user->tokens()->delete();