|
|
@@ -549,7 +549,6 @@ class GameDataController extends Controller
|
|
|
$GameID = $request->get('GameID');
|
|
|
$SortID = $request->get('SortID');
|
|
|
$uid = $request->get('uid');
|
|
|
-
|
|
|
if($uid){
|
|
|
$where = [];
|
|
|
$where[] = ['ai.GameID', $uid];
|
|
|
@@ -560,17 +559,44 @@ class GameDataController extends Controller
|
|
|
!empty($SortID) && $where[] = ['gi.SortID', $SortID];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
$list = DB::connection('read')->table('QPTreasureDB.dbo.GameScoreLocker as gl')
|
|
|
->join('QPAccountsDB.dbo.AccountsInfo as ai', 'gl.UserID', 'ai.UserID')
|
|
|
->leftJoin('QPPlatformDB.dbo.GameRoomInfo as gi','gl.ServerID','gi.ServerID')
|
|
|
->leftJoin('QPTreasureDB.dbo.GameScoreInfo as gsi','gl.UserID','=','gsi.UserID')
|
|
|
->where($where)
|
|
|
->selectRaw('ai.GameID,ai.NickName,Channel,gi.ServerName,gi.SortID,gl.CollectDate,gl.UserID,gsi.Score')
|
|
|
-// ->orderByDesc('CreateTime')
|
|
|
+ // 按进入游戏时间倒序
|
|
|
+ ->orderByDesc('gl.CollectDate')
|
|
|
->paginate(10);
|
|
|
|
|
|
+ // 计算库存模式:总充值 > StockMode2SwitchRecharge
|
|
|
+ if ($list->count() > 0) {
|
|
|
+ $userIds = [];
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $userIds[] = $item->UserID;
|
|
|
+ }
|
|
|
+ $userIds = array_unique($userIds);
|
|
|
+
|
|
|
+ // 获取模式切换充值阈值
|
|
|
+ $switchRecharge = DB::connection('read')
|
|
|
+ ->table('QPAccountsDB.dbo.SystemStatusInfo')
|
|
|
+ ->where('StatusName', 'StockMode2SwitchRecharge')
|
|
|
+ ->value('StatusValue');
|
|
|
+ $switchRecharge = $switchRecharge ?? 0;
|
|
|
+
|
|
|
+ // 获取用户总充值(YN_VIPAccount.Recharge)
|
|
|
+ $rechargeMap = DB::connection('read')
|
|
|
+ ->table('QPAccountsDB.dbo.YN_VIPAccount')
|
|
|
+ ->whereIn('UserID', $userIds)
|
|
|
+ ->pluck('Recharge', 'UserID')
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $totalRecharge = $rechargeMap[$item->UserID] ?? 0;
|
|
|
+ $item->is_stock_mode = $totalRecharge > $switchRecharge ? 1 : 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$games = DB::connection('read')->table(TableName::QPPlatformDB() . 'GameKindItem')
|
|
|
->whereIn('GameID', config('games.openKGame'))
|
|
|
->select('KindName', 'GameID')
|