[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

View File

@@ -57,8 +57,8 @@ class Test extends Command
*/
public function handle()
{
$rep = new UserRepository();
$r = $rep->getDetail(1);
$r = floatval(25.32);
dd($r);
}
}

View File

@@ -29,7 +29,7 @@ class UserResource extends JsonResource
'downloaded' => $this->downloaded,
'downloaded_text' => mksize($this->downloaded),
'seed_bonus' => $this->seedbonus,
'seed_points' => $this->seed_points,
'seed_points' => floatval($this->seed_points),
'seedtime' => $this->seedtime,
'seedtime_text' => mkprettytime($this->seedtime),
'leechtime' => $this->leechtime,

View File

@@ -19,6 +19,7 @@ class AuthenticateRepository extends BaseRepository
if (IS_PLATFORM_ADMIN && !$user->canAccessAdmin()) {
throw new UnauthorizedException('Unauthorized!');
}
$user->checkIsNormal();
$tokenName = __METHOD__ . __LINE__;
$token = DB::transaction(function () use ($user, $tokenName) {
$user->tokens()->delete();