GlobalLogicController.php 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  1. <?php
  2. namespace App\Http\logic\admin;
  3. use App\Facade\TableName;
  4. use App\Game\AgentUser;
  5. use App\Game\GameCard;
  6. use App\Game\GlobalUserInfo;
  7. use App\Http\helper\Helper;
  8. use App\Http\helper\NumConfig;
  9. use App\Models\Account\UserBlacklist;
  10. use App\Models\AccountsInfo;
  11. use App\Models\AccountsSource;
  12. use App\Models\Control;
  13. use App\Models\Cpf;
  14. use App\Models\Order;
  15. use App\Services\Extensions;
  16. use App\Services\GameRoomInfo;
  17. use App\Services\GamesCount;
  18. use App\Services\StoredProcedure;
  19. use App\Services\VipService;
  20. use Illuminate\Http\Request;
  21. use Illuminate\Pagination\Paginator;
  22. use Illuminate\Support\Facades\DB;
  23. use Illuminate\Support\Facades\Redis;
  24. class GlobalLogicController extends BaseLogicController
  25. {
  26. // 定义税收值
  27. protected $Revenue = 100;
  28. // 单控系统
  29. public function dk($start_time, $end_time, $date)
  30. {
  31. // 今日流水,今日税收
  32. $todayGameInfo = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordServerDataStatistics WITH (NOLOCK)'))
  33. ->selectRaw('Isnull((sum(WinScore) + abs(sum(LostScore))),0) as flowing_water,Isnull(sum(Revenue),0) as Revenue')
  34. ->where('DateID', date('Ymd'))
  35. ->first();
  36. //今日税收
  37. $data['Revenue'] = isset($todayGameInfo->Revenue) ? number_float($todayGameInfo->Revenue / NumConfig::NUM_VALUE) : 0;
  38. //今日流水
  39. $data['flowing_water'] = isset($todayGameInfo->flowing_water) ? number_float(($todayGameInfo->flowing_water + $todayGameInfo->Revenue) / NumConfig::NUM_VALUE) : 0;
  40. //今日总充值金额
  41. $data['pay_sum'] = Order::today_pay()->today_pay_sum / NumConfig::NUM_VALUE ?? 0;
  42. // 今日总提现
  43. $data['today_withdrawal'] = DB::connection('read')->table(DB::raw("QPAccountsDB.dbo.OrderWithDraw as od WITH (NOLOCK)"))
  44. ->join(DB::raw('QPAccountsDB.dbo.AccountsRecord as ar WITH (NOLOCK)'), 'od.RecordID', 'ar.RecordID')
  45. ->whereDate('update_at', date('Y-m-d'))
  46. ->where('State', 2)
  47. ->selectRaw('IsNull((sum(WithDraw) + sum(ServiceFee)),0) WithDraw')
  48. ->first()->WithDraw / NumConfig::NUM_VALUE ?? 0;
  49. //今日彩金
  50. $data['cellData'] = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordUserDataStatisticsNew WITH (NOLOCK)'))
  51. ->selectRaw('Isnull(SUM(Handsel),0) as Handsel')
  52. ->where('DateID', date('Ymd'))
  53. ->first()->Handsel / NumConfig::NUM_VALUE ?? 0;
  54. // 今日杀率 => 被控制输的用户在总活跃用户中的占比
  55. // ---- 控制输的总用户
  56. $shu_member = DB::connection('read')->table(DB::raw('QPTreasureDB.dbo.UserScoreControl WITH (NOLOCK)'))
  57. ->where('ControlRadian', '<', 0)
  58. ->count();
  59. // ---- 总活跃用户占比
  60. $huoyue = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.accountsInfo WITH (NOLOCK)'))
  61. ->whereRaw("DateDiff(dd,LastLogonDate,getdate())<=7")
  62. ->count();
  63. // 今日杀率
  64. $data['shalv'] = number_float($shu_member / $huoyue);
  65. $start_time = str_replace('T', ' ', $start_time);
  66. $end_time = str_replace('T', ' ', $end_time);
  67. switch ($date) {
  68. case 2:
  69. $start_time = date("Y-m-d 00:00:00", strtotime("-1 day"));
  70. $end_time = date("Y-m-d 23:59:59", strtotime("-1 day"));
  71. break;
  72. case 3:
  73. //当前日期
  74. $sdefaultDate = date("Y-m-d 00:00:00");
  75. //$first =1 表示每周星期一为开始日期 0表示每周日为开始日期
  76. $first = 1;
  77. //获取当前周的第几天 周日是 0 周一到周六是 1 - 6
  78. $w = date('w', strtotime($sdefaultDate));
  79. $start_time = date('Y-m-d 00:00:00', strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) . ' days'));
  80. $end_time = date('Y-m-d 23:59:59', strtotime("$start_time +6 days"));
  81. break;
  82. case 4:
  83. $start_time = date("Y-m-01 00:00:00");
  84. $end_time = date("Y-m-t 23:59:59");
  85. break;
  86. }
  87. /* 游戏房间数据 */
  88. $gameRoomInfo = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordServerDataStatistics as rds WITH (NOLOCK)'))
  89. ->where('DateID', '>=', date('Ymd', strtotime($start_time)))
  90. ->where('DateID', '<=', date('Ymd', strtotime($end_time)))
  91. ->selectRaw('Isnull((sum(WinScore) + abs(sum(LostScore))),0) as flowing_water,Isnull(sum(Revenue),0) as Revenue,Isnull((sum(WinScore) + abs(sum(LostScore))),0) as win_lose')
  92. ->first();
  93. //平台输赢 目前计算的是机器人输赢
  94. $gameRoomInfo->win_lose = isset($gameRoomInfo->win_lose) ? number_float(-$gameRoomInfo->win_lose / NumConfig::NUM_VALUE) : 0;
  95. //流水
  96. $gameRoomInfo->flowing_water = isset($gameRoomInfo->flowing_water) ? number_float(($gameRoomInfo->flowing_water + $gameRoomInfo->Revenue) / NumConfig::NUM_VALUE) : 0;
  97. //税收
  98. $gameRoomInfo->Revenue = isset($gameRoomInfo->Revenue) ? number_float($gameRoomInfo->Revenue / NumConfig::NUM_VALUE) : 0;
  99. $game_list = DB::connection('read')->table('QPPlatformDB.dbo.GameRoomInfo as gi')
  100. ->leftJoin('QPRecordDB.dbo.RecordServerDataStatistics as rds', 'rds.ServerID', 'gi.ServerID')
  101. ->where('DateID', '>=', date('Ymd', strtotime($start_time)))
  102. ->where('DateID', '<=', date('Ymd', strtotime($end_time)))
  103. ->select('gi.GameID', 'gi.ServerName', 'gi.ServerID')
  104. ->selectRaw('Isnull((sum(WinScore) + abs(sum(LostScore))),0) as flowing_water,Isnull(sum(Revenue),0) as Revenue,Isnull((sum(WinScore) + abs(sum(LostScore))),0) as win_lose')
  105. ->groupBy('gi.GameID', 'gi.ServerName', 'gi.ServerID')
  106. ->get();
  107. foreach ($game_list as &$value) {
  108. $value->Score = number_float(-($value->win_lose / NumConfig::NUM_VALUE)); // 平台输赢
  109. $value->ri_Revenue = number_float($value->Revenue / NumConfig::NUM_VALUE); // 税收
  110. $value->liushui = number_float(($value->flowing_water) / NumConfig::NUM_VALUE); // 流水
  111. }
  112. $start_time = Helper::timeChange($start_time);
  113. $end_time = Helper::timeChange($end_time);
  114. return compact('data', 'game_list', 'gameRoomInfo', 'start_time', 'end_time', 'date');
  115. }
  116. public function sum()
  117. {
  118. // 玩家身上总金额
  119. $totalAmount = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo as ai WITH (NOLOCK)'))
  120. ->join(DB::raw('QPTreasureDB.dbo.GameScoreInfo as gi WITH (NOLOCK)'), 'ai.UserID', 'gi.UserID')
  121. ->leftJoin(DB::raw('QPAccountsDB.dbo.IDWhiteUser as wu WITH (NOLOCK)'), 'ai.UserID', 'wu.UserID')
  122. ->where('IsAndroid', 0)
  123. ->where('Nullity', 0)
  124. ->whereNull('wu.UserID')
  125. ->sum('Score');
  126. // 官方玩家身上总金额
  127. $official = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.IDWhiteUser as wu WITH (NOLOCK)'))
  128. ->join(DB::raw('QPTreasureDB.dbo.GameScoreInfo as gi WITH (NOLOCK)'), 'wu.UserID', 'gi.UserID')
  129. ->sum('Score');
  130. // 充值用户身上总金额--排除官方用户
  131. $payUser = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.YN_VIPAccount as vip WITH (NOLOCK)'))
  132. ->leftJoin(DB::raw('QPTreasureDB.dbo.GameScoreInfo as gi WITH (NOLOCK)'), 'vip.UserID', 'gi.UserID')
  133. ->leftJoin(DB::raw('QPAccountsDB.dbo.IDWhiteUser as wu WITH (NOLOCK)'), 'vip.UserID', 'wu.UserID')
  134. ->whereNull('wu.UserID')
  135. ->selectRaw('sum(Score) as Score')
  136. ->first()->Score;
  137. // Tp群控总库存
  138. $TpRoomStock = GameRoomInfo::RoomStock([1005], [32]);
  139. // Rm群控总库存
  140. $RmRoomStock = GameRoomInfo::RoomStock([2030, 2050], [33, 39]);
  141. // 总库存
  142. $groupControlTotalStock = $TpRoomStock + $RmRoomStock;
  143. // 房间总库存 = 群控库存 + 单控库存 + 新手池库存 + 旧房间库存
  144. $oldStock = -2289781;
  145. $oldStock1 = -2088570;
  146. $roomTotalStock = $groupControlTotalStock + ($oldStock) + ($oldStock1);
  147. return compact('totalAmount', 'official', 'payUser', 'groupControlTotalStock', 'roomTotalStock', 'TpRoomStock', 'RmRoomStock', 'oldStock', 'oldStock1');
  148. }
  149. // 月卡
  150. public function MonthCard()
  151. {
  152. // 白银
  153. $SilverVIP = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard')
  154. ->where('CardID', '1')
  155. ->first();
  156. // 黄金
  157. $GoldVIP = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard')
  158. ->where('CardID', '2')
  159. ->first();
  160. // 钻石
  161. $DiamondVIP = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard')
  162. ->where('CardID', '3')
  163. ->first();
  164. // 累计购买金额
  165. $TotalPrice = $SilverVIP->TotalPrice + $GoldVIP->TotalPrice + $DiamondVIP->TotalPrice;
  166. // 累计领取金额
  167. $TotalReward = $SilverVIP->TotalReward + $GoldVIP->TotalReward + $DiamondVIP->TotalReward;
  168. // 额外赠送金额 --- VIP月卡累计领取金额 - VIP月卡累计购买金额=VIP月卡额外赠送金额。
  169. $givePrice = $TotalReward - $TotalPrice > 0 ? $TotalReward - $TotalPrice : 0;
  170. // 总得付费人数
  171. $totalPay = DB::connection('read')->table('agent.dbo.order')->where('pay_status', 1)->selectRaw('count(distinct(user_id)) count_U')->first()->count_U ?? 0;
  172. // 付费玩家整体月卡购买人数
  173. $monthCardPay = DB::connection('read')->table('QPPlatformDB.dbo.UserMonthCard')
  174. ->selectRaw('count(distinct(UserID)) count_U')
  175. ->first()->count_U ?? 0;
  176. // 付费玩家白银月卡购买人数
  177. $silverPay = DB::connection('read')->table('QPPlatformDB.dbo.UserMonthCard')
  178. ->where('CardID', 1)
  179. ->selectRaw('count(distinct(UserID)) count_U')
  180. ->first()->count_U ?? 0;
  181. // 付费玩家黄金月卡购买人数
  182. $goldPay = DB::table('QPPlatformDB.dbo.UserMonthCard')
  183. ->where('CardID', 2)
  184. ->selectRaw('count(distinct(UserID)) count_U')
  185. ->first()->count_U ?? 0;
  186. // 付费玩家钻石月卡购买人数
  187. $diamondPay = DB::connection('read')->table('QPPlatformDB.dbo.UserMonthCard')
  188. ->where('CardID', 3)
  189. ->selectRaw('count(distinct(UserID)) count_U')
  190. ->first()->count_U ?? 0;
  191. $totalRate = $totalPay > 0 ? number_float(($monthCardPay / $totalPay) * NumConfig::NUM_VALUE) . ' %' : 0;
  192. $silverRate = $totalPay > 0 ? number_float(($silverPay / $totalPay) * NumConfig::NUM_VALUE) . ' %' : 0;
  193. $diamondRate = $totalPay > 0 ? number_float(($diamondPay / $totalPay) * NumConfig::NUM_VALUE) . ' %' : 0;
  194. $goldRate = $totalPay > 0 ? number_float(($goldPay / $totalPay) * NumConfig::NUM_VALUE) . ' %' : 0;
  195. $TotalPrice = number_float($TotalPrice / NumConfig::NUM_VALUE);
  196. $TotalReward = number_float($TotalReward / NumConfig::NUM_VALUE);
  197. $givePrice = number_float($givePrice / NumConfig::NUM_VALUE);
  198. return compact('SilverVIP', 'GoldVIP', 'DiamondVIP', 'TotalPrice', 'TotalReward', 'givePrice', 'totalRate', 'silverRate', 'goldRate', 'diamondRate');
  199. }
  200. public function FirstRechargeGifts()
  201. {
  202. // 白银首充礼包支付金额
  203. $silver = DB::connection('read')
  204. ->table('agent.dbo.order as o')
  205. ->join('QPAccountsDB.dbo.FirstRechargeGifts as frg', 'o.GiftsID', 'frg.GiftsID')
  206. ->where('o.GiftsID', 1)
  207. ->where('o.pay_status', 1)
  208. ->selectRaw('IsNull(sum(amount),0) amount,IsNull(TotalCount,0) TotalCount')
  209. ->groupBy('TotalCount')
  210. ->lock('with(nolock)')
  211. ->first();
  212. // 黄金首充礼包支付金额
  213. $gold = DB::connection('read')
  214. ->table('agent.dbo.order as o')
  215. ->join('QPAccountsDB.dbo.FirstRechargeGifts as frg', 'o.GiftsID', 'frg.GiftsID')
  216. ->where('o.GiftsID', 2)
  217. ->where('o.pay_status', 1)
  218. ->selectRaw('IsNull(sum(amount),0) amount,IsNull(TotalCount,0) TotalCount')
  219. ->groupBy('TotalCount')
  220. ->lock('with(nolock)')
  221. ->first();
  222. // 钻石首充礼包支付金额
  223. $diamonds = DB::connection('read')
  224. ->table('agent.dbo.order as o')
  225. ->join('QPAccountsDB.dbo.FirstRechargeGifts as frg', 'o.GiftsID', 'frg.GiftsID')
  226. ->where('o.GiftsID', 3)
  227. ->where('o.pay_status', 1)
  228. ->selectRaw('IsNull(sum(amount),0) amount,IsNull(TotalCount,0) TotalCount')
  229. ->groupBy('TotalCount')
  230. ->lock('with(nolock)')
  231. ->first();
  232. // 注册日期--开始时间
  233. $date = '2021-07-30 00:00:00';
  234. $silverMemberCount = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo WITH (NOLOCK)'))->where('RegisterDate', '>=', $date)->count();
  235. $goldMemberCount = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo WITH (NOLOCK)'))->where('RegisterDate', '>=', $date)->count();
  236. $diamondsMemberCount = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo WITH (NOLOCK)'))->where('RegisterDate', '>=', $date)->count();
  237. // 白银首充礼包购买率
  238. $silverBuyRate = ($silver && $silverMemberCount > 0) ? number_float(($silver->TotalCount / $silverMemberCount) * NumConfig::NUM_VALUE) . '%' : 0;
  239. // 黄金首充礼包购买率
  240. $goldBuyRate = ($gold && $goldMemberCount > 0) ? number_float(($gold->TotalCount / $goldMemberCount) * NumConfig::NUM_VALUE) . '%' : 0;
  241. // 钻石首充礼包购买率
  242. $diamondsBuyRate = ($diamonds && $diamondsMemberCount > 0) ? number_float(($diamonds->TotalCount / $diamondsMemberCount) * NumConfig::NUM_VALUE) . '%' : 0;
  243. // 首充礼包额外赠送总彩金
  244. $lottery = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.PD_RecordScoreInfo WITH (NOLOCK)'))
  245. ->where('Reason', 51)
  246. ->sum('Score');
  247. $lottery = number_float($lottery / NumConfig::NUM_VALUE);
  248. $waitPay = DB::connection('read')
  249. ->table('agent.dbo.order as o')
  250. ->join('QPAccountsDB.dbo.FirstRechargeGifts as frg', 'o.GiftsID', 'frg.GiftsID')
  251. ->whereNull('o.pay_at')
  252. ->whereIn('o.GiftsID', [1, 2, 3])
  253. ->lock('with(nolock)')
  254. ->count();
  255. $paySuc = DB::connection('read')
  256. ->table('agent.dbo.order as o')
  257. ->join('QPAccountsDB.dbo.FirstRechargeGifts as frg', 'o.GiftsID', 'frg.GiftsID')
  258. ->where('o.pay_status', 1)
  259. ->whereIn('o.GiftsID', [1, 2, 3])
  260. ->lock('with(nolock)')
  261. ->count();
  262. // 所有首充礼包购买成功率
  263. $paySucRate = $waitPay > 0 ? number_float(($paySuc / $waitPay) * NumConfig::NUM_VALUE) . '%' : 0;
  264. if ($silver)
  265. $silver->amount = number_float($silver->amount / NumConfig::NUM_VALUE);
  266. if ($gold)
  267. $gold->amount = number_float($gold->amount / NumConfig::NUM_VALUE);
  268. if ($diamonds)
  269. $diamonds->amount = number_float($diamonds->amount / NumConfig::NUM_VALUE);
  270. return compact('silver', 'gold', 'diamonds', 'silverBuyRate', 'goldBuyRate', 'diamondsBuyRate', 'lottery', 'paySucRate');
  271. }
  272. public function WeeklyCard()
  273. {
  274. // 未支付
  275. $totalWaitPay = DB::connection('read')
  276. ->table('agent.dbo.order as o')
  277. ->where('o.pay_status', 0)
  278. ->whereIn('o.GiftsID', [104, 105, 106, 107])
  279. ->selectRaw('IsNull(sum(amount),0) amount')
  280. ->lock('with(nolock)')
  281. ->first();
  282. // 周卡VIP1
  283. $weekVIP1 = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard')
  284. ->where('CardID', '4')
  285. ->select('Price', 'TotalPrice', 'TotalCount', 'TotalReward')
  286. ->first();
  287. // 周卡VIP2
  288. $weekVIP2 = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard')
  289. ->where('CardID', '5')
  290. ->select('Price', 'TotalPrice', 'TotalCount', 'TotalReward')
  291. ->first();
  292. // 周卡VIP3
  293. $weekVIP3 = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard')
  294. ->where('CardID', '6')
  295. ->select('Price', 'TotalPrice', 'TotalCount', 'TotalReward')
  296. ->first();
  297. // 周卡VIP4
  298. $weekVIP4 = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard')
  299. ->where('CardID', '7')
  300. ->select('Price', 'TotalPrice', 'TotalCount', 'TotalReward')
  301. ->first();
  302. // 累计购买金额
  303. $TotalPrice = $weekVIP1->TotalPrice + $weekVIP2->TotalPrice + $weekVIP3->TotalPrice + $weekVIP4->TotalPrice;
  304. // 累计领取金额
  305. $TotalReward = $weekVIP1->TotalReward + $weekVIP2->TotalReward + $weekVIP3->TotalReward + $weekVIP4->TotalReward;
  306. // 额外赠送金额 --- VIP月卡累计领取金额 - VIP月卡累计购买金额=VIP月卡额外赠送金额。
  307. //$givePrice = $TotalReward - $TotalPrice > 0 ? $TotalReward - $TotalPrice : 0;
  308. // 拉起的总单数
  309. $totalNum = DB::connection('read')->table(DB::raw('agent.dbo.[order] WITH (NOLOCK)'))
  310. ->whereIn('GiftsID', [104, 105, 106, 107])
  311. ->selectRaw('count(id) count,GiftsID')
  312. ->groupBy('GiftsID')
  313. ->pluck('count', 'GiftsID')->toArray();
  314. // 购买率 = 购买成功的单数 / 拉起的单数
  315. $VIP1Rate = isset($totalNum['104']) && $totalNum['104'] ? number_float(($weekVIP1->TotalCount / $totalNum['104']) * NumConfig::NUM_VALUE) . ' %' : 0;
  316. $VIP2Rate = isset($totalNum['105']) && $totalNum['105'] ? number_float(($weekVIP2->TotalCount / $totalNum['105']) * NumConfig::NUM_VALUE) . ' %' : 0;
  317. $VIP3Rate = isset($totalNum['106']) && $totalNum['106'] ? number_float(($weekVIP3->TotalCount / $totalNum['106'])) . ' %' : 0;
  318. $VIP4Rate = isset($totalNum['107']) && $totalNum['107'] ? number_float(($weekVIP4->TotalCount / $totalNum['107'])) . ' %' : 0;
  319. $totalWaitPay = isset($totalWaitPay->amount) ? $totalWaitPay->amount / NumConfig::NUM_VALUE : 0;
  320. $TotalReward = number_float($TotalReward / NumConfig::NUM_VALUE);
  321. return compact('VIP1Rate', 'VIP2Rate', 'VIP3Rate', 'VIP4Rate', 'totalWaitPay', 'TotalPrice', 'TotalReward', 'weekVIP1', 'weekVIP2', 'weekVIP3', 'weekVIP4');
  322. }
  323. // 房间实时数据
  324. public function room($list)
  325. {
  326. /*
  327. $WinUserCount = DB::connection('read')->table('QPRecordDB.dbo.RecordGameInfo')
  328. ->whereDate('CreateTime', date('Y-m-d'))
  329. ->selectRaw('count(distinct(UserID)) as count_u,ServerID')
  330. ->havingRaw('sum(Score) > ?', [0])
  331. ->groupBy('ServerID')
  332. ->pluck('count_u', 'ServerID');
  333. $LostUserCount = DB::connection('read')->table('QPRecordDB.dbo.RecordGameInfo')
  334. ->whereDate('CreateTime', date('Y-m-d'))
  335. ->selectRaw('count(distinct(UserID)) as count_u,ServerID')
  336. ->havingRaw('sum(Score) < ?', [0])
  337. ->groupBy('ServerID')
  338. ->pluck('count_u', 'ServerID');
  339. */
  340. $WinUserCount = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.PD_RecordScoreInfo WITH (NOLOCK)'))
  341. ->selectRaw('count(distinct(UserID)) as count_u,ServerID')
  342. ->where('AtDate', '=', date('Ymd'))
  343. ->where('Score', '>', 0)
  344. ->groupBy('ServerID')
  345. ->pluck('count_u', 'ServerID');
  346. $LostUserCount = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.PD_RecordScoreInfo WITH (NOLOCK)'))
  347. ->selectRaw('count(distinct(UserID)) as count_u,ServerID')
  348. ->where('AtDate', '=', date('Ymd'))
  349. ->where('Score', '<', 0)
  350. ->groupBy('ServerID')
  351. ->pluck('count_u', 'ServerID');
  352. foreach ($list as &$value) {
  353. // 库存
  354. $stock_toarr = explode(';', rtrim($value->RoomStock, ';'));
  355. if (isset($stock_toarr[0]) && !empty($stock_toarr[0])) {
  356. $stock = explode(':', $stock_toarr[0])[1];
  357. } else {
  358. $stock = 0;
  359. }
  360. // 当天房间胜率 --- 胜的局数 / 玩的总局数
  361. $value->winning_probability = $value->TotalInning > 0 ? number_float($value->WinInning / $value->TotalInning) : 0;
  362. $value->stock = $stock / NumConfig::NUM_VALUE;
  363. // 流水
  364. $value->flowing_water = number_float(($value->WinScore + abs($value->LostScore)) / NumConfig::NUM_VALUE);
  365. // 总输赢
  366. $value->win_lose = number_float(($value->WinScore + $value->LostScore) / NumConfig::NUM_VALUE);
  367. // 税收
  368. $value->Revenue = number_float($value->Revenue / NumConfig::NUM_VALUE);
  369. // 当天赢人数
  370. $value->WinUserCount = $WinUserCount[$value->ServerID] ?? 0;
  371. // 当天输人数
  372. $value->LostUserCount = $LostUserCount[$value->ServerID] ?? 0;
  373. }
  374. return $list;
  375. }
  376. public function teenpatti($ServerID)
  377. {
  378. $result = DB::connection('read')->table('QPPlatformDB.dbo.GameRoomInfo')
  379. ->where('ServerID', $ServerID)
  380. ->select('CellScore', 'MinEnterScore', 'MaxEnterScore', 'ServerName', 'CellScore')
  381. ->first();
  382. $result->CellScore = $result->CellScore / 100;
  383. $result->MinEnterScore = number_float($result->MinEnterScore / 100);
  384. $result->MaxEnterScore = number_float($result->MaxEnterScore / 100);
  385. return compact('result');
  386. }
  387. // 多选框搜索
  388. public function user_search($build_sql, $data)
  389. {
  390. if (!is_array($data)) {
  391. $data = [];
  392. }
  393. if (in_array(1, $data)) {
  394. $data['checked1'] = 1;
  395. // 游戏中用户
  396. // $build_sql->whereNotNull("ServerName")->whereDate('CollectDate', date('Y-m-d'));;
  397. $build_sql->whereRaw('datediff(hh,CollectDate,getdate())<=5');
  398. }
  399. if (in_array(2, $data)) {
  400. $data['checked2'] = 2;
  401. $build_sql->where('ai.PassPortID', '');
  402. }
  403. if (in_array(3, $data)) {
  404. $data['checked3'] = 3;
  405. $build_sql->whereNull('ap.PhoneNum');
  406. }
  407. if (in_array(4, $data)) {
  408. $data['checked4'] = 4;
  409. $IP = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo WITH (NOLOCK)'))
  410. ->selectRaw('LastLogonIP,count(*) as count ')
  411. ->groupBy('LastLogonIP')
  412. ->havingRaw('count(*) >1')
  413. ->get();
  414. if (!empty($IP)) {
  415. $arr = [];
  416. foreach ($IP as $k => $v) {
  417. if ($v->LastLogonIP != '未知') {
  418. $arr[$k] = $v->LastLogonIP;
  419. }
  420. }
  421. $build_sql->whereIn('ai.RegisterIP', $arr);
  422. }
  423. }
  424. if (in_array(5, $data)) {
  425. $data['checked5'] = 5;
  426. // 无渠道
  427. $build_sql->where('ai.Channel', 0);
  428. }
  429. if (in_array(6, $data)) {
  430. $data['checked6'] = 6;
  431. $VIP = DB::connection('read')->table('QPAccountsDB.dbo.YN_VIP')->select('ID')->get();
  432. $vip_id = [];
  433. if (!empty($VIP)) {
  434. foreach ($VIP as $k => $v) {
  435. $vip_id[$k] = $v->ID;
  436. }
  437. }
  438. $build_sql->whereNotIn('ai.UserID', $vip_id);
  439. }
  440. if (in_array(7, $data)) {
  441. $data['checked7'] = 7;
  442. $build_sql->where('ai.SpreaderID', '0');
  443. }
  444. if (in_array(8, $data)) {
  445. $data['checked8'] = 8;
  446. $build_sql->where('ai.Nullity', '1');
  447. }
  448. if (in_array(9, $data)) {
  449. $data['checked9'] = 9;
  450. $build_sql->whereNotNull('iu.UserID');
  451. }
  452. return compact('build_sql', 'data');
  453. }
  454. public function id_find($UserID, $OpenPage)
  455. {
  456. $AccountsInfoModel = new AccountsInfo();
  457. //玩家信息
  458. // $userInfo = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')
  459. // ->where('UserID', $UserID)
  460. // ->first();
  461. $userInfo = AccountsInfo::find($UserID);
  462. // dd($userInfo->gameScoreInfo);
  463. // 用户余额
  464. $score = $userInfo->gameScoreInfo->Score;
  465. $insureScore = $userInfo->gameScoreInfo->InsureScore;
  466. // 上级ID
  467. //$userInfo->spreaderID = $userInfo->SpreaderID;
  468. // 上级ID
  469. // $userInfo->spreaderGameId = AccountsInfo::GetUserGameID($userInfo->spreaderID);
  470. // 用户手机号
  471. $userInfo->phone = $userInfo->accountPhoneRelation->PhoneNum??"";
  472. // 用户游戏时长转换
  473. $userInfo->PlayTimeCount = $AccountsInfoModel->getUserPlayTimeCount($userInfo->PlayTimeCount);
  474. // 用户有没有在游戏
  475. $userInfo->getUserOnLine = $AccountsInfoModel->getUserOnLine($UserID);
  476. // 今日充值-- 今日提现-- 今日彩金 -- 总输赢
  477. $today = $AccountsInfoModel->accountTodayStatistics([$UserID]);
  478. // 全部充值 -- 提现 -- 彩金 -- 总输赢 -- 总得提现手续费
  479. $total = $AccountsInfoModel->accountTotalStatistics([$UserID]);
  480. // 未领取邮件金额
  481. $waitGetEmailScore = $AccountsInfoModel->waitGetEmailScore($UserID);
  482. // 月卡 -- 购买、已领
  483. [$buyMonthCard, $getMonthCard] = $AccountsInfoModel->monthCard($UserID);
  484. // 可提现金额
  485. $remainingBalance = $AccountsInfoModel->CashAble($UserID, 0, 0);
  486. // 关联IP数量-- 注册IP
  487. $userInfo->sameIpCount = $AccountsInfoModel->sameRegisterIPCount($userInfo->RegisterIP);
  488. $userInfo->samePhoneCount = $userInfo->phone?$AccountsInfoModel->samePhoneCount($userInfo->phone):0;
  489. $userInfo->sameWithDrawName = $AccountsInfoModel->sameWithDrawBankNameByUserID($UserID);
  490. // 关联IP数量-- 注册IP
  491. $userInfo->sameCpfCount = Cpf::getCpfCount($UserID);
  492. $rechargeCpf = Cpf::getCpf($UserID,1);
  493. $userInfo->rechargeCpf = $rechargeCpf?implode(',',$rechargeCpf):'';
  494. $userInfo->sameWithDrawMail = $AccountsInfoModel->sameWithDrawEmailByUserID($UserID);
  495. // 登录IP
  496. $userInfo->LastLogonIP = $AccountsInfoModel->sameLoginIPCount($UserID);
  497. // 关联银行卡数量
  498. $userInfo->sameBankNo = $AccountsInfoModel->sameBankNo($UserID);
  499. //关联设备
  500. $userInfo->sameMac = $AccountsInfoModel->sameLoginMacCount($UserID);
  501. // 充值奖金 已领
  502. $rechargeReward = $AccountsInfoModel->UserScoreChange($UserID, 53);
  503. // 充值奖金 可领
  504. $rechargeLastReward = (new Extensions())->recharge($UserID);
  505. // 推广赚金 注册已领
  506. $shareReward = $AccountsInfoModel->UserScoreChange($UserID, 72);
  507. // 推广赚金 注册可领
  508. $shareLastReward = (new Extensions())->register($UserID)['Register'];
  509. // 包名
  510. $userInfo->PackgeName = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordPackageName WITH (NOLOCK)'))
  511. ->where('UserID', $UserID)
  512. ->select('PackgeName')
  513. ->first()->PackgeName ?? '';
  514. // 裂变领取限制开关
  515. $redis = Redis::connection();
  516. $registerInviteSwitches = $redis->get('register_invite_switches_' . $UserID);
  517. // 黑名单
  518. $blacklist = UserBlacklist::where('UserID', $userInfo->UserID)->first();
  519. $userInfo->blacklist = $blacklist ? 1 : 0;
  520. $user = GlobalUserInfo::getGameUserInfo('UserID', $userInfo->UserID);
  521. $userInfo->GlobalUID = @$user->GlobalUID?:'';
  522. $agentUser=AgentUser::query()->where('UserID',$userInfo->UserID)->first();
  523. if($agentUser){
  524. $userInfo->spreaderID = $agentUser->Higher1ID;
  525. }else{
  526. $userInfo->spreaderID = 0;
  527. }
  528. $Record=DB::table(DB::raw('QPAccountsDB.dbo.OrderWithDraw WITH (NOLOCK)'))->where('UserID', $UserID)->where('State',1)->first();
  529. $WithDrawNow=$Record?($Record->WithDraw):0;
  530. $AccountWithDrawInfo = DB::table(DB::raw(TableName::QPAccountsDB() . 'AccountWithDrawInfo WITH (NOLOCK)'))
  531. ->where('UserID', $UserID)
  532. ->first();
  533. $data = [
  534. 'today_cellData' => $today[0]->Handsel ?? 0,
  535. 'total_cellData' => $total[0]->Handsel ?? 0,
  536. 'withdraw' => $total[0]->Withdraw ?? 0,
  537. 'serviceFee' => $total[0]->ServiceFee ?? 0,
  538. 'MaxDrawBase' => $total[0]->MaxDrawBase ?? 0,
  539. 'today_withdraw' => $today[0]->Withdraw ?? 0,
  540. 'total_profit' => $total[0]->Score ?? 0,
  541. 'today_profit' => $today[0]->Score ?? 0,
  542. 'total_realpay' => -(($total[0]->Recharge??0)*NumConfig::NUM_VALUE-($total[0]->Withdraw ??0)+($total[0]->ServiceFee ??0)-$WithDrawNow),
  543. 'today_realpay' => -(($today[0]->Recharge??0)*NumConfig::NUM_VALUE-($today[0]->Withdraw ?? 0)+($today[0]->ServiceFee ?? 0)-$WithDrawNow),
  544. 'revenue' => $total[0]->Revenue ?? 0,
  545. 'buyMonthCard' => $buyMonthCard,
  546. 'getMonthCard' => $getMonthCard,
  547. 'remainingBalance' => $remainingBalance,
  548. 'rechargeReward' => $rechargeReward,
  549. 'rechargeLastReward' => $rechargeLastReward,
  550. 'shareReward' => $shareReward,
  551. 'shareLastReward' => $shareLastReward,
  552. 'waitGetEmailScore' => $waitGetEmailScore,
  553. 'score' => $score,
  554. 'insureScore' => $insureScore,
  555. 'todayMaxScore' => $today[0]->MaxScore ?? 0,
  556. 'todayMaxWinScore' => $today[0]->MaxWinScore ?? 0,
  557. ];
  558. foreach ($data as $key=>&$value) {
  559. try {
  560. $value = number_float($value / NumConfig::NUM_VALUE);
  561. }catch (\Exception $exception){
  562. echo $key;
  563. var_dump($data);
  564. die;
  565. }
  566. }
  567. $data['pix_cpf'] = $AccountWithDrawInfo?$AccountWithDrawInfo->PixNum:0;
  568. // 不用/100
  569. $data['today_cz'] = $today[0]->Recharge ?? 0;
  570. $data['total_cz'] = $total[0]->Recharge ?? 0;
  571. $data['remainingBalance'] = $remainingBalance;
  572. // 对局
  573. $gameCount = (new GamesCount())->gameCount($UserID);
  574. // 用户来源
  575. $userSource = (new AccountsSource())->getUserSource($UserID);
  576. $platform = ['only','atmosfera','pg','pp'];
  577. $platformData = [];
  578. foreach ($platform as $pitem){
  579. $dkey = 'platform_' . $pitem .'_'.$UserID.'_win_'.date('Ymd');
  580. $key = 'platform_' . $pitem .'_'.$UserID.'_win';
  581. $platformData[$pitem]['total'] = (Redis::get($key)?:0)/100;
  582. $platformData[$pitem]['today'] = (Redis::get($dkey)?:0)/100;
  583. }
  584. // 手机型号
  585. $data['mobileBand'] = $userInfo->LastLogonMobile;
  586. // 退款信息
  587. $data['refund_flag'] = DB::table(DB::raw('agent.dbo.[order] WITH (NOLOCK)'))
  588. ->where(['user_id' => $UserID, 'pay_status' => 9])
  589. ->sum('amount');
  590. $data['refund_total'] = 0;
  591. $samePhoneUids = [];
  592. if ($userInfo->phone) {
  593. $samePhoneUids = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountPhone WITH (NOLOCK)'))
  594. ->where('PhoneNum', $userInfo->phone)->pluck('UserID')->toArray();
  595. }
  596. $awi = DB::table(DB::raw('QPAccountsDB.dbo.AccountWithDrawInfo WITH (NOLOCK)'))
  597. ->where(['UserID' => $UserID])
  598. ->first();
  599. $sameEmailUids = [];
  600. if ($awi && $awi->EmailAddress) {
  601. $sameEmailUids = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountWithDrawInfo WITH (NOLOCK)'))
  602. ->where('EmailAddress', $awi->EmailAddress)->pluck('UserID')->toArray();
  603. }
  604. $uids = array_unique(array_merge($samePhoneUids, $sameEmailUids));
  605. $uids[] = $UserID;
  606. if (count($uids) > 0) {
  607. $data['refund_total'] = DB::table(DB::raw('agent.dbo.[order] WITH (NOLOCK)'))
  608. ->whereIn('user_id', $uids)
  609. ->where('pay_status', 9)
  610. ->sum('amount');
  611. }
  612. // IP风险检测:查询 Redis Hash 中是否记录了该用户的可疑IP
  613. $data['ip_risk'] = Redis::hget('ip_risk_users', (string)$UserID) ?: '';
  614. //vip等级
  615. $userInfo->vip = VipService::calculateVipLevel($userInfo->UserID, $total[0]->Recharge ?? 0);
  616. return compact('data', 'userInfo', 'registerInviteSwitches', 'gameCount', 'userSource', 'OpenPage','platformData');
  617. }
  618. public function id_find1($UserID, $OpenPage)
  619. {
  620. $AccountsInfoModel = new AccountsInfo();
  621. //玩家信息
  622. $User = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo as ai WITH (NOLOCK)'))
  623. ->leftJoin(DB::raw('QPAccountsDB.dbo.AccountsInfo as ai1 WITH (NOLOCK)'), 'ai.SpreaderID', '=', 'ai1.UserID')
  624. ->leftJoin(DB::raw('QPTreasureDB.dbo.GameScoreInfo as gi WITH (NOLOCK)'), 'ai.UserID', '=', 'gi.UserID')
  625. ->leftJoin(DB::raw('QPAccountsDB.dbo.AccountPhone as ap WITH (NOLOCK)'), 'ai.UserID', 'ap.UserID')
  626. ->where('ai.UserID', $UserID)
  627. ->select('ai.*', 'ai1.GameID as SpreaderID', 'ap.PhoneNum', 'gi.Score', 'gi.Revenue', 'gi.InsureScore', 'gi.Score as gi_Score', 'gi.InsureScore as gi_InsureScore')
  628. ->first();
  629. if (empty($User)) return apiReturnFail('用户不存在');
  630. //////////
  631. /// 游戏时长
  632. $second = $User->PlayTimeCount;
  633. $day = floor($second / (3600 * 24));
  634. $second = $second % (3600 * 24);//除去整天之后剩余的时间
  635. $hour = floor($second / 3600);
  636. $second = $second % 3600;//除去整小时之后剩余的时间
  637. $minute = floor($second / 60);
  638. //返回字符串
  639. $User->PlayGameTime = $day . '天' . $hour . '小时' . $minute . '分';
  640. // 有没有在房间
  641. $User->ServerName = DB::connection('read')->table(DB::raw('QPTreasureDB.dbo.GameScoreLocker as gsl WITH (NOLOCK)'))
  642. ->join(DB::raw('QPPlatformDB.dbo.GameRoomInfo as gri WITH (NOLOCK)'), 'gsl.ServerID', 'gri.ServerID')
  643. ->where('UserID', $UserID)
  644. ->whereRaw('datediff(hh,CollectDate,getdate())<=5')
  645. ->select('ServerName')
  646. ->first()->ServerName ?? '';
  647. // 用户标签
  648. $accountsTab = StoredProcedure::getUserTab($UserID);
  649. $TabType = $accountsTab[0]->TabType ?? '';
  650. $types = [];
  651. if (!empty($accountsTab) && $TabType == 1) {
  652. foreach ($accountsTab[0] as $k => $v) {
  653. if ($k != 'UserID' || $k != 'TabType') {
  654. $types[] = $v;
  655. }
  656. }
  657. }
  658. $GetUserTabTypeEx = StoredProcedure::GetUserTabTypeEx($UserID);
  659. $GetUserTabTypeExType = [];
  660. foreach ($GetUserTabTypeEx as $val) {
  661. $GetUserTabTypeExType[] = $val->type;
  662. }
  663. $types = array_merge($types, $GetUserTabTypeExType);
  664. $explain = DB::connection('read')->table('QPAccountsDB.dbo.AccountsTabExplain')
  665. ->whereIn('TabID', $types)
  666. ->pluck('TypeName', 'TabID');
  667. // 走势图
  668. $r = DB::connection('game')->table(DB::raw(TableName::QPTreasureDB() . 'YN_RecordScoreInfo_' . date('Ym') . ' WITH (NOLOCK)'))
  669. ->selectRaw("Isnull(SUBSTRING(CONVERT(VARCHAR(13),UpdateTime,120),12,5),0) as Stime,Isnull(sum(ChangeScore),0) as Score")
  670. ->where('UserID', $UserID)
  671. ->whereDate('UpdateTime', date("Y-m-d"))
  672. ->groupBy(DB::raw('CONVERT(VARCHAR(13), UpdateTime, 120)'))
  673. ->get()->toArray();
  674. $list = $this->get_str($r);
  675. // +---------------------------充值--------------------------------
  676. // 今日充值-- 今日提现-- 今日彩金 -- 总输赢
  677. $today = $AccountsInfoModel->accountTodayStatistics([$UserID]);
  678. // 全部充值 -- 提现 -- 彩金 -- 总输赢 -- 总得提现手续费
  679. $total = $AccountsInfoModel->accountTotalStatistics([$UserID]);
  680. // 未领取邮件金币
  681. $mail = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.PrivateMail WITH (NOLOCK)'))
  682. ->where('UserID', $UserID)
  683. ->where('MailStatus', '<', 3)
  684. ->select('UserID', 'BonusString')
  685. ->get();
  686. foreach ($mail as $val) {
  687. $arr = explode(',', $val->BonusString);
  688. if (!empty($arr) && isset($arr[0]) && $arr[0] == 30000) {
  689. if (isset($mailData[$val->UserID])) {
  690. $mailData[$val->UserID] = $mailData[$val->UserID] + $arr[1] ?? 0;
  691. } else {
  692. $mailData[$val->UserID] = $arr[1];
  693. }
  694. }
  695. }
  696. // 月卡 -- 购买
  697. $buyMonthCard = DB::connection('read')->table('QPPlatformDB.dbo.MonthCard as mc')
  698. ->join('QPPlatformDB.dbo.UserMonthCard as uc', 'mc.CardID', 'uc.CardID')
  699. ->where('uc.UserID', $UserID)
  700. ->selectRaw('IsNull(sum(Price),0) TotalReward')
  701. ->first()->TotalReward / 100 ?? 0;
  702. // 月卡 -- 已领
  703. $getMonthCard = DB::connection('read')->table('QPPlatformDB.dbo.UserMonthCard')
  704. ->where('UserID', $UserID)
  705. ->selectRaw('IsNull(sum(TotalReward),0) Reward')
  706. ->first()->Reward / 100 ?? 0;
  707. # 保底值
  708. $StatusValue = 0;
  709. // 可提现金额
  710. $remainingBalance = $AccountsInfoModel->CashAble($UserID, $User->Score, $StatusValue);
  711. // 用户标签展示
  712. $Type12 = $accountsTab[0]->Type12 ?? 0;
  713. $first = in_array($Type12, [1301, 1302, 1303]) ? true : false;
  714. $AccountWithDrawInfo = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountWithDrawInfo WITH (NOLOCK)'))
  715. ->where('UserID', $UserID)
  716. ->select('Switch')
  717. ->first();
  718. if ($first) {
  719. $userTab = $AccountWithDrawInfo->Switch == 0 ? '已解除' : "<span style='color: #ff0000'>已禁止</span>";
  720. } else {
  721. $userTab = '未标记';
  722. }
  723. // 关联IP数量-- 注册IP
  724. $Ip = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo WITH (NOLOCK)'))
  725. ->where('IsAndroid', 0)
  726. ->where('RegisterIP', $User->RegisterIP)->count();
  727. // 登录IP
  728. $LastLogonIP = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordUserLogonStatistics as a WITH (NOLOCK)'))
  729. ->whereExists(function ($query) {
  730. $query->from(DB::raw(TableName::QPRecordDB() . 'RecordUserLogonStatistics as b WITH (NOLOCK)'))
  731. ->whereRaw('a.LogonIP=b.LogonIP');
  732. })
  733. ->where('UserID', $UserID)
  734. ->selectRaw('count(distinct(UserID)) count_u')
  735. ->first()->count_u;
  736. // 关联银行卡数量
  737. $BankNo = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountWithDrawInfo as di WITH (NOLOCK)'))
  738. ->join(DB::raw('QPAccountsDB.dbo.AccountWithDrawInfo as dif WITH (NOLOCK)'), 'di.BankNo', 'dif.BankNo')
  739. ->where('di.UserID', $UserID)
  740. ->whereNotNull('di.BankNo')
  741. ->where('di.BankNo', '<>', '')
  742. ->selectRaw('count(1) count,di.BankNo')
  743. ->groupBy('di.BankNo')
  744. ->first();
  745. // 充值奖金 已领
  746. $Reward = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordUserScoreChange WITH (NOLOCK)'))
  747. ->where('Reason', 53)
  748. ->where('UserID', $UserID)
  749. ->selectRaw('sum(ChangeScore) Score')
  750. ->first()->Score / NumConfig::NUM_VALUE ?? 0;
  751. // 充值奖金 可领
  752. $recharge = (new Extensions())->recharge($UserID);
  753. $rechargeScore['Balance'] = number_float($recharge / NumConfig::NUM_VALUE);
  754. $rechargeScore['Reward'] = $Reward;
  755. // 推广赚金 注册已领
  756. $reward = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordUserScoreChange WITH (NOLOCK)'))
  757. ->where('Reason', 72)
  758. ->where('UserID', $UserID)
  759. ->selectRaw('sum(ChangeScore) Score')
  760. ->first()->Score / NumConfig::NUM_VALUE ?? 0;
  761. // 推广赚金 注册可领
  762. $collectable = (new Extensions())->register($UserID)['Register'];
  763. $registerScore['collectable'] = ($collectable / NumConfig::NUM_VALUE);
  764. $registerScore['verify'] = 0;
  765. $registerScore['Reward'] = $reward;
  766. $todayReward = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordUserScoreStatisticsNew WITH (NOLOCK)'))
  767. ->whereIn('ScoreType', [53, 72])
  768. ->where('UserID', $UserID)
  769. ->selectRaw('sum(Score) Score')
  770. ->first()->Score / NumConfig::NUM_VALUE ?? 0;
  771. // 包名
  772. $PackgeName = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordPackageName WITH (NOLOCK)'))
  773. ->where('UserID', $UserID)
  774. ->select('PackgeName')
  775. ->first()->PackgeName ?? '';
  776. // 个人池控制:
  777. $RecordRechargeControl = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordRechargeControl as rc WITH (NOLOCK)'))
  778. ->leftJoin(DB::raw('QPTreasureDB.dbo.RechargeControlConfig as cnf WITH (NOLOCK)'), 'rc.State', 'cnf.ID')
  779. ->where('UserID', $UserID)
  780. ->select('ConfigName', 'State', 'Prob')
  781. ->first();
  782. isset($RecordRechargeControl->Prob) && $RecordRechargeControl->Prob = ($RecordRechargeControl->Prob / NumConfig::NUM_VALUE);
  783. // 反水活动
  784. $UserGameBet = DB::connection('write')->table('QPTreasureDB.dbo.UserGameBet')
  785. ->where('UserID', $UserID)
  786. ->selectRaw('IsNull(cast(HistoryBet as float),0) / 100 HistoryBet,IsNull(cast(NowBet as float),0) / 100 NowBet,RewardTime')
  787. ->first();
  788. $RewardTime = $UserGameBet->RewardTime ?? '';
  789. if ($UserGameBet) {
  790. if (!empty($RewardTime) && strtotime(date('Y-m-d H:i:s')) > strtotime($RewardTime)) {
  791. $UserGameBet->Collectable = number_float($UserGameBet->NowBet);
  792. $UserGameBet->HistoryBet = number_float($UserGameBet->HistoryBet);
  793. $UserGameBet->NowBet = number_float($UserGameBet->NowBet);
  794. } else {
  795. $UserGameBet->HistoryBet = number_float($UserGameBet->HistoryBet);
  796. $UserGameBet->NowBet = number_float($UserGameBet->NowBet);
  797. }
  798. }
  799. // 裂变领取限制开关
  800. $redis = Redis::connection();
  801. $register_invite_switches = $redis->get('register_invite_switches_' . $UserID);
  802. $data = [
  803. 'today_cz' => isset($today[0]->Recharge) ? $today[0]->Recharge : 0,
  804. 'total_cz' => isset($total[0]->Recharge) ? $total[0]->Recharge : 0,
  805. 'today_cellData' => isset($today[0]->Handsel) ? $today[0]->Handsel / NumConfig::NUM_VALUE : 0,
  806. 'total_cellData' => isset($total[0]->Handsel) ? $total[0]->Handsel / NumConfig::NUM_VALUE : 0,
  807. 'withdraw' => isset($total[0]->Withdraw) ? $total[0]->Withdraw / NumConfig::NUM_VALUE : 0,
  808. 'ServiceFee' => isset($total[0]->ServiceFee) ? $total[0]->ServiceFee / NumConfig::NUM_VALUE : 0,
  809. 'today_withdraw' => isset($today[0]->Withdraw) ? $today[0]->Withdraw / NumConfig::NUM_VALUE : 0,
  810. 'total_profit' => isset($total[0]->Score) ? $total[0]->Score / NumConfig::NUM_VALUE : 0,
  811. 'today_profit' => isset($today[0]->Score) ? $today[0]->Score / NumConfig::NUM_VALUE : 0,
  812. 'revenue' => isset($total[0]->Revenue) ? $total[0]->Revenue / NumConfig::NUM_VALUE : 0,
  813. 'buyMonthCard' => $buyMonthCard,
  814. 'getMonthCard' => $getMonthCard,
  815. 'remainingBalance' => $remainingBalance,
  816. 'reward' => $reward,
  817. ];
  818. foreach ($data as &$value) {
  819. $value = number_float($value);
  820. }
  821. $User->Score = number_float($User->Score / 100);
  822. $User->notReceived = isset($mailData[$User->UserID]) ? number_float($mailData[$User->UserID] / 100) : 0;
  823. // 对局
  824. $gameCount = (new GamesCount())->gameCount($UserID);
  825. // 用户来源
  826. $UserSource = (new AccountsSource())->getUserSource($UserID);
  827. return compact('User', 'list', 'data', 'explain', 'userTab', 'Ip', 'BankNo', 'LastLogonIP', 'PackgeName', 'RecordRechargeControl', 'UserGameBet', 'OpenPage', 'rechargeScore', 'registerScore', 'todayReward', 'register_invite_switches', 'gameCount', 'UserSource');
  828. }
  829. // 计算流水的值
  830. public function liushui($where = [])
  831. {
  832. $ServerIDs = [32, 33, 39]; // 过滤试玩场
  833. //$liushui = DB::connection('read')->table('QPRecordDB.dbo.RecordGameInfo')
  834. // ->where($where)
  835. // ->whereNotIn('ServerID', $ServerIDs)
  836. // ->selectRaw('Isnull(sum(ABS(Score)),0) as Score')
  837. // ->first()->Score;
  838. $liushui = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.PD_RecordScoreInfo WITH (NOLOCK)'))
  839. ->where($where)
  840. ->whereNotIn('ServerID', $ServerIDs)
  841. ->selectRaw('Isnull(sum(ABS(Score)),0) as Score')
  842. ->first()->Score;
  843. return $liushui;
  844. }
  845. // 返回字符串
  846. protected function get_str($list)
  847. {
  848. // 定义时间内容
  849. $time_arr = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
  850. $new_arr = [];
  851. foreach ($time_arr as $key => $value) {
  852. if (!empty($list)) {
  853. foreach ($list as &$v) {
  854. if ($value == $v->Stime) {
  855. // $temp_arr['Stime'] = $v->Stime;
  856. $temp_arr['Score'] = $v->Score;
  857. } else {
  858. // $temp_arr['Stime'] = $value;
  859. $temp_arr['Score'] = 0;
  860. }
  861. }
  862. } else {
  863. $temp_arr['Score'] = 0;
  864. }
  865. $new_arr[] = $temp_arr;
  866. }
  867. foreach ($new_arr as $v) {
  868. $v = join(",", $v); //可以用implode将一维数组转换为用逗号连接的字符串,join是别名
  869. $temp[] = $v;
  870. }
  871. $str = "[";
  872. foreach ($temp as $v) {
  873. $str .= $v . ",";
  874. }
  875. $str = substr($str, 0, -1);
  876. $str .= "]";
  877. return $str;
  878. }
  879. // 推广员奖励报表
  880. public function reward($UserID, $SpreaderID, $start_time, $end_time, $Type)
  881. {
  882. $where = [];
  883. !empty($UserID) ? $where[] = ['ai.GameID', '=', $UserID] : $UserID = '';
  884. !empty($SpreaderID) ? $where[] = ['ain.GameID', '=', $SpreaderID] : $SpreaderID = '';
  885. !empty($start_time) && $where[] = ['SendTime', '>=', $start_time];
  886. !empty($end_time) && $where[] = ['SendTime', '<=', $end_time];
  887. !empty($Type) && $where[] = ['ua.Type', $Type];
  888. $list = DB::connection('read')->table(DB::raw('QPRecordDB.dbo.RecordUserAgent as ua WITH (NOLOCK)'))
  889. ->join(DB::raw('QPAccountsDB.dbo.accountsInfo as ai WITH (NOLOCK)'), 'ua.UserID', '=', 'ai.UserID')
  890. ->leftJoin(DB::raw('QPAccountsDB.dbo.accountsInfo as ain WITH (NOLOCK)'), 'ain.UserID', '=', 'ai.SpreaderID')
  891. ->select('ua.Id', 'ai.GameID', 'ain.GameID as SpreaderID', 'DirectRebate', 'SendTime', 'SourceUserID', 'OrderSn', 'ua.UserID', 'ua.Level', 'ua.Type', 'ua.orderIds')
  892. ->where($where)
  893. ->orderBy('SendTime', 'desc')
  894. ->paginate(10);
  895. // 自动审核开关
  896. $AutoVerify = DB::connection('write')->table('QPAccountsDB.dbo.SystemStatusInfo')
  897. ->where('StatusName', 'AutoVerify')
  898. ->value('StatusValue');
  899. foreach ($list as &$value) {
  900. $value->DirectRebate = number_float($value->DirectRebate / NumConfig::NUM_VALUE);
  901. $SourceGameID = 1;
  902. switch ($value->Type) {
  903. case 1: // 注册
  904. $SourceGameID = DB::table(TableName::QPAccountsDB() . 'accountsInfo')
  905. ->where('UserID', $value->SourceUserID)
  906. ->value('GameID');
  907. break;
  908. }
  909. $value->SourceGameID = $SourceGameID;
  910. }
  911. unset($value);
  912. $start_time = Helper::timeChange($start_time);
  913. $end_time = Helper::timeChange($end_time);
  914. return compact('list', 'UserID', 'SpreaderID', 'start_time', 'end_time', 'Type', 'AutoVerify');
  915. }
  916. public function winloser($GameID, $UniqueCode, $room, $start_time, $end_time, $excel, $id_list, $ChangeScoreMin, $ChangeScoreMax, $ChangeScoreSort, $afterScoreSort, $searchGame)
  917. {
  918. $where = [];
  919. $UserID = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.AccountsInfo WITH (NOLOCK)'))
  920. ->where('GameID', $GameID)
  921. ->select('UserID')
  922. ->first()->UserID ?? '';
  923. if (!empty($id_list) && empty($start_time)) {
  924. $withDrawFinal = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.OrderWithDraw as ow WITH (NOLOCK)'))
  925. ->join(DB::raw('QPAccountsDB.dbo.AccountsInfo as ai WITH (NOLOCK)'), 'ow.UserID', 'ai.UserID')
  926. ->where('ow.State', 2)
  927. ->where('ai.GameID', $GameID)
  928. ->where('finishDate', '>=', date('Y-m-d 00:00:00'))
  929. ->select('finishDate')
  930. ->orderByDesc('finishDate')
  931. ->first()->finishDate ?? '';
  932. if (!empty($withDrawFinal)) {
  933. $start_time = date('Y-m-d H:i:s', strtotime($withDrawFinal));
  934. $end_time = date('Y-m-d 23:59:59', strtotime($start_time));
  935. }
  936. }
  937. $start_time = $start_time ?: date('Y-m-d 00:00:00');
  938. $end_time = $end_time ?: date('Y-m-d 23:59:59');
  939. ////////////////////////
  940. // 查询范围需要在同一个月份,暂时不支持跨月份查询
  941. $from_mm = intval(date('Ym', strtotime($start_time)));
  942. $to_mm = intval(date('Ym', strtotime($end_time)));
  943. if ($from_mm != $to_mm) {
  944. throw new \Exception('暂不支持跨月查询,开始时间和结束时间请选择相同月份');
  945. }
  946. //确定有效表范围,从202104月开始到当前月
  947. if ($from_mm < 202204 || $from_mm > intval(date('Ym'))) {
  948. throw new \Exception('超出时间范围,开始时间应大于等于2022年4月,小于等于当前月');
  949. }
  950. $table = TableName::QPTreasureDB() . 'YN_RecordScoreInfo_' . $from_mm;
  951. //////////////////////
  952. $where[] = ['ri.UpdateTime', '>=', date('Y-m-d H:i:s', strtotime($start_time))];
  953. $where[] = ['ri.UpdateTime', '<=', date('Y-m-d H:i:s', strtotime($end_time))];
  954. !empty($GameID) && $where[] = ['ri.UserID', $UserID];
  955. !empty($UniqueCode) && $where[] = ['UniqueCode', 'like', $UniqueCode . '%'];
  956. !empty($room) && $where[] = ['ri.ServerID', '=', $room];
  957. if (!empty($searchGame)) {
  958. $roomIds = DB::table(TableName::QPPlatformDB() . 'GameRoomInfo')
  959. ->where('GameID', $searchGame)
  960. ->select('ServerID')
  961. ->pluck('ServerID')->toArray();
  962. $where[] = [function ($query) use ($roomIds) {
  963. $query->whereIn('ServerID', $roomIds);
  964. }];
  965. }
  966. !empty($ChangeScoreMax) && $ChangeScoreMax = (int)$ChangeScoreMax * NumConfig::NUM_VALUE;
  967. !empty($ChangeScoreMin) && $ChangeScoreMin = (int)$ChangeScoreMin * NumConfig::NUM_VALUE;
  968. if ((!empty($ChangeScoreMax) || $ChangeScoreMax === '0') && (!empty($ChangeScoreMin) || $ChangeScoreMin === '0')) {
  969. $where[] = [function ($obj) use ($ChangeScoreMin, $ChangeScoreMax) {
  970. $obj->whereBetween('ChangeScore', [$ChangeScoreMin, $ChangeScoreMax]);
  971. }];
  972. } elseif (!empty($ChangeScoreMin) || $ChangeScoreMin === '0') {
  973. $where[] = ['ChangeScore', '>=', $ChangeScoreMin];
  974. } elseif (!empty($ChangeScoreMax) || $ChangeScoreMax === '0') {
  975. $where[] = ['ChangeScore', '<=', $ChangeScoreMax];
  976. }
  977. !empty($ChangeScoreSort) && $order = "ChangeScore $ChangeScoreSort";
  978. !empty($afterScoreSort) && $order = "afterScore $afterScoreSort";
  979. !isset($order) && $order = "ri.UpdateTime desc";
  980. // 房间列表
  981. $rooms = DB::connection('read')->table(TableName::QPPlatformDB() . 'GameRoomInfo')
  982. // ->whereIn('GameID', config('games.openKGame'))
  983. ->selectRaw('ServerID,ServerName')
  984. ->orderByDesc('ServerID')
  985. ->pluck('ServerName', 'ServerID')
  986. ->toArray();
  987. $build_sql = DB::connection('game')->table(DB::raw($table . ' as ri WITH (NOLOCK)'))
  988. ->where($where);
  989. // 游戏列表
  990. $games = DB::connection('read')->table(TableName::QPPlatformDB() . 'GameKindItem')
  991. // ->whereIn('GameID', config('games.openKGame'))
  992. ->select('KindName', 'GameID')
  993. ->pluck('KindName', 'GameID')
  994. ->toArray();
  995. // 输赢报表
  996. if (!empty($excel)) {
  997. $list = $build_sql
  998. //->leftJoin('QPPlatformDB.dbo.GameRoomInfo as gi', 'ri.ServerID', '=', 'gi.ServerID')
  999. ->select('UniqueCode', 'UserID', 'ri.UpdateTime', 'BeforeScore', 'ChangeScore', 'afterScore', 'Revenue', 'ServerID')
  1000. ->selectRaw('null ServerName')
  1001. ->orderBy('ri.UpdateTime', 'desc')->limit(10000)->get();
  1002. // 获取用户游戏ID
  1003. $getGameIDs = $this->getGameIDs($list);
  1004. foreach ($list as &$value) {
  1005. if (!empty($GameID)) {
  1006. $value->UserID = $GameID;
  1007. }else{
  1008. $value->UserID = $getGameIDs[$value->UserID] ?? '';
  1009. }
  1010. $value->ServerName = $rooms[$value->ServerID] ?? '';
  1011. $value->ChangeScore = number_float($value->ChangeScore / NumConfig::NUM_VALUE);
  1012. $value->Revenue = number_float($value->Revenue / NumConfig::NUM_VALUE);
  1013. $value->afterScore = number_float($value->afterScore / NumConfig::NUM_VALUE);
  1014. $value->BeforeScore = number_float($value->BeforeScore / NumConfig::NUM_VALUE);
  1015. $value->UniqueCode = (string)($value->UniqueCode) . ' ';
  1016. unset($value->ServerID);
  1017. }
  1018. unset($value);
  1019. $title = ['对局编码', '会员ID', '游戏时间', '变化前金豆', '税后输赢金豆', '变化后输赢金豆', '累计税收', '房间名称'];
  1020. $list = json_decode(json_encode($list), true);
  1021. downloadExcel($list, $title, '输赢报表列表' . date('YmdHis'));
  1022. } else {
  1023. $list = $build_sql
  1024. ->select('ri.UpdateTime', 'ri.ServerID', 'afterScore', 'UserID', 'UniqueCode', 'ChangeScore', 'Revenue', 'BeforeScore')
  1025. ->OrderByRaw($order)
  1026. ->paginate(50);
  1027. }
  1028. // 获取用户游戏ID
  1029. $getGameIDs = $this->getGameIDs($list);
  1030. // +----------------房间总输赢------------------+
  1031. $total = DB::connection('game')->table(DB::raw($table . ' as ri WITH (NOLOCK)'))
  1032. ->where($where)
  1033. ->selectRaw('IsNull(sum(abs(ChangeScore)),0) as water,count(distinct(UserID)) as UserID,sum(ChangeScore) as ChangeScore,sum(Revenue) as Revenue')
  1034. ->first();
  1035. // 税收
  1036. $data['Revenue'] = number_float($total->Revenue / NumConfig::NUM_VALUE);
  1037. // 总输赢
  1038. $data['ChangeScore'] = number_float(((-$total->ChangeScore / NumConfig::NUM_VALUE) - 0));
  1039. // 总人数
  1040. $data['UserID'] = $total->UserID;
  1041. // 流水
  1042. $data['liushui'] = number_float(($total->water) / NumConfig::NUM_VALUE);
  1043. $query=GameCard::query()->select(['brand','title','gid'])->where('state','>',0)->get()->toArray();
  1044. $thirdnames=[];
  1045. foreach ($query as $k=>$v){
  1046. $thirdnames[$v['gid']]=$v['brand'].'_'.$v['title'];
  1047. }
  1048. foreach ($list as &$value) {
  1049. $value->GameID = $getGameIDs[$value->UserID] ?? '';
  1050. $value->ServerName = $rooms[$value->ServerID] ?? '';
  1051. $value->ChangeScore = number_float($value->ChangeScore / NumConfig::NUM_VALUE);
  1052. $value->Revenue = number_float($value->Revenue / NumConfig::NUM_VALUE);
  1053. $value->afterScore = number_float($value->afterScore / NumConfig::NUM_VALUE);
  1054. $value->BeforeScore = number_float($value->BeforeScore / NumConfig::NUM_VALUE);
  1055. if(strstr($value->UniqueCode,'|')){
  1056. $values=explode('|',$value->UniqueCode);
  1057. // $value->ServerID=$values[1];
  1058. $value->thirdRoom=$thirdnames[$values[1]]??'';
  1059. // dd($values,$thirdnames);
  1060. $value->UniqueCode=null;
  1061. }
  1062. }
  1063. $start_time = strtotime($start_time);
  1064. $end_time = strtotime($end_time);
  1065. $start_time = date('Y-m-d', $start_time) . 'T' . date('H:i:s', $start_time);
  1066. $end_time = date('Y-m-d', $end_time) . 'T' . date('H:i:s', $end_time);
  1067. !empty($ChangeScoreMax) && $ChangeScoreMax /= NumConfig::NUM_VALUE;
  1068. !empty($ChangeScoreMin) && $ChangeScoreMin /= NumConfig::NUM_VALUE;
  1069. return compact('list', 'rooms', 'games', 'searchGame', 'GameID', 'data', 'UserID', 'UniqueCode', 'room', 'start_time', 'end_time', 'id_list', 'ChangeScoreMin', 'ChangeScoreMax', 'ChangeScoreSort', 'afterScoreSort');
  1070. }
  1071. public function game_record($UniqueCode, $gameId, $month)
  1072. {
  1073. $where[] = ['UniqueCode', '=', $UniqueCode];
  1074. $list = DB::connection('game')->table(DB::raw(TableName::QPTreasureDB() . 'YN_RecordScoreInfo_' . $month . ' as ri WITH (NOLOCK)'))
  1075. ->where($where)
  1076. ->whereNotNull('UniqueCode')
  1077. ->orderBy('UpdateTime', 'desc')
  1078. ->select('ri.UserID', 'ri.UpdateTime', 'UniqueCode', 'Revenue', 'AfterScore', 'ChangeScore', 'ServerID')
  1079. ->paginate(50);
  1080. // 获取用户游戏ID
  1081. $getGameIDs = $this->getGameIDs($list);
  1082. foreach ($list as &$value) {
  1083. $value->GameID = $getGameIDs[$value->UserID] ?? '';
  1084. $value->ServerName = $rooms[$value->ServerID] ?? '';
  1085. $value->ChangeScore = number_float(($value->ChangeScore + $value->Revenue) / 100);
  1086. $value->Revenue = number_float($value->Revenue / 100);
  1087. $value->AfterScore = number_float($value->AfterScore / 100);
  1088. }
  1089. return compact('list', 'gameId', 'UniqueCode');
  1090. }
  1091. // 获取用户游戏ID
  1092. protected function getGameIDs($list)
  1093. {
  1094. // 取出用户ID
  1095. $UserIDs = [];
  1096. foreach ($list as $value) {
  1097. $UserIDs[] = $value->UserID;
  1098. }
  1099. $getGameIDs = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')
  1100. ->whereIn('UserID', $UserIDs)
  1101. ->select('GameID', 'UserID')
  1102. ->pluck('GameID', 'UserID')->toArray();
  1103. return $getGameIDs;
  1104. }
  1105. }