generated from liutk/owl-admin-base
main
parent
3481c957ee
commit
4e96bb5d32
|
|
@ -45,10 +45,12 @@ 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::where([
|
if($num = UserGame::whereHas('game', function($q){
|
||||||
|
return $q->where('state', 2);
|
||||||
|
})->where([
|
||||||
'user_id' => $this->user_id,
|
'user_id' => $this->user_id,
|
||||||
'activity_id' => $this->activity_id,
|
'activity_id' => $this->activity_id,
|
||||||
])->where('state', 2)->count() > 0) {
|
])->count() > 0) {
|
||||||
return $num.'中'.($this->userActivity->right_times ?? 0);
|
return $num.'中'.($this->userActivity->right_times ?? 0);
|
||||||
}else{
|
}else{
|
||||||
return '';
|
return '';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue