main
liutk 2024-07-10 22:09:56 +08:00
parent fb2822c9d9
commit 8548206d33
1 changed files with 9 additions and 8 deletions

View File

@ -45,14 +45,15 @@ class UserGameResource extends JsonResource
return ($this->game?->state ?? 0) < 2 ?'0':($this->is_right ? '1':'2'); return ($this->game?->state ?? 0) < 2 ?'0':($this->is_right ? '1':'2');
}, '0'), }, '0'),
'history' => $this->whenLoaded('userActivity', function () { 'history' => $this->whenLoaded('userActivity', function () {
// if($num = UserGame::whereHas('game', function($q){ $num = UserGame::whereHas('game', function($q){
// return $q->where('state', 2); return $q->where('state', 2);
// })->where([ })->where([
// 'user_id' => $this->user_id, 'user_id' => $this->user_id,
// 'activity_id' => $this->activity_id, 'activity_id' => $this->activity_id,
// ])->count() > 0) { ])->count();
if($this->userActivity->join_times > 0) { if($num > 0) {
return '最近他猜'.$this->userActivity->join_times.'中'.($this->userActivity->right_times ?? 0); // if($this->userActivity->join_times > 0) {
return '最近他猜'.$num.'中'.($this->userActivity->right_times ?? 0);
}else{ }else{
return ''; return '';
} }