diff --git a/app/Http/Resources/Api/UserGameResource.php b/app/Http/Resources/Api/UserGameResource.php index bd38aaa..2c60ae2 100644 --- a/app/Http/Resources/Api/UserGameResource.php +++ b/app/Http/Resources/Api/UserGameResource.php @@ -41,7 +41,7 @@ class UserGameResource extends JsonResource }), 'score' => $this->score, 'status' => $this->whenLoaded('game', function () { - return $this->game?->state ==0 ?'0':($this->is_right ? '1':'2'); + return ($this->game?->state ?? 0) < 2 ?'0':($this->is_right ? '1':'2'); }, '0'), 'history' => $this->whenLoaded('userActivity', function () { return ($this->userActivity->join_times ?? 0).'δΈ­'.($this->userActivity->right_times ?? 0);