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