generated from liutk/owl-admin-base
调整每日竞猜逻辑
parent
a74f49fdbf
commit
696171e93d
|
|
@ -31,9 +31,9 @@ class ActivityGameController extends ApiController
|
|||
|
||||
public function latestGame(Request $request)
|
||||
{
|
||||
//获取最新的活动;
|
||||
$activity = Activity::show()->sort()->first();
|
||||
$game = $activity?->games()->show()
|
||||
$game = ActivityGame::whereHas('activity', function($q){
|
||||
return $q->where('state', '>' ,0);
|
||||
})->show()
|
||||
->whereDate('game_at', now())
|
||||
->where('game_at', '>', now())
|
||||
->where('state', 1)
|
||||
|
|
@ -41,7 +41,9 @@ class ActivityGameController extends ApiController
|
|||
|
||||
//若已经没有最新的活动了, 则拿取当天最后一个
|
||||
if(!$game){
|
||||
$game = $activity?->games()->show()
|
||||
$game = ActivityGame::whereHas('activity', function($q){
|
||||
return $q->where('state', '>' ,0);
|
||||
})->show()
|
||||
->whereDate('game_at', now())
|
||||
->orderBy('game_at', 'desc')->first();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue