generated from liutk/owl-admin-base
调整首页竞猜记录猜几中几
parent
2463ed69bb
commit
fb2822c9d9
|
|
@ -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 '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue