From fb2822c9d9e6b0845c0b9e34111ae7c961f358fd Mon Sep 17 00:00:00 2001 From: liutk <961510893@qq.com> Date: Wed, 10 Jul 2024 21:45:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A6=96=E9=A1=B5=E7=AB=9E?= =?UTF-8?q?=E7=8C=9C=E8=AE=B0=E5=BD=95=E7=8C=9C=E5=87=A0=E4=B8=AD=E5=87=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Resources/Api/UserGameResource.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Http/Resources/Api/UserGameResource.php b/app/Http/Resources/Api/UserGameResource.php index c88eb9e..7091f76 100644 --- a/app/Http/Resources/Api/UserGameResource.php +++ b/app/Http/Resources/Api/UserGameResource.php @@ -45,13 +45,14 @@ class UserGameResource extends JsonResource return ($this->game?->state ?? 0) < 2 ?'0':($this->is_right ? '1':'2'); }, '0'), 'history' => $this->whenLoaded('userActivity', function () { - if($num = UserGame::whereHas('game', function($q){ - return $q->where('state', 2); - })->where([ - 'user_id' => $this->user_id, - 'activity_id' => $this->activity_id, - ])->count() > 0) { - return '最近他猜'.$num.'中'.($this->userActivity->right_times ?? 0); + // if($num = UserGame::whereHas('game', function($q){ + // return $q->where('state', 2); + // })->where([ + // 'user_id' => $this->user_id, + // 'activity_id' => $this->activity_id, + // ])->count() > 0) { + if($this->userActivity->join_times > 0) { + return '最近他猜'.$this->userActivity->join_times.'中'.($this->userActivity->right_times ?? 0); }else{ return ''; }