Răsfoiți Sursa

后台代码同步

laowu 1 săptămână în urmă
părinte
comite
7bc7fb1d6e

+ 73 - 13
app/Http/Controllers/Admin/RechargeController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers\Admin;
 
 use App\AdminConfig;
+use App\dao\Estatisticas\RechargeWithDraw;
 use App\Facade\TableName;
 use App\Http\Controllers\Controller;
 use App\Http\helper\NumConfig;
@@ -45,6 +46,8 @@ class RechargeController extends Controller
         $chargeMoney = $request->chargeMoney ?: '';
         $payMethod = (int)$request->input('payMethod', 0);
         $amountSort = $request->amountSort ?: '';
+        // 操作人筛选:空=全部,0=无操作人,正整数=指定管理员 id
+        $operator_admin_id = $request->input('operator_admin_id', '');
 
         $type_list = DB::table('agent.dbo.admin_configs')->where('type', 'pay')
             ->pluck('name');
@@ -170,35 +173,79 @@ class RechargeController extends Controller
             $where[] = ['o.pay_at', '<=', $time->subHours(11)->format('Y-m-d H:i:s')];
         }
 
+        // 操作人(补单等)筛选:与列表相同的 AccountsRecord 关联
+        if ($operator_admin_id !== '' && $operator_admin_id !== null) {
+            if ((string)$operator_admin_id === '0') {
+                $where[] = [function ($q) {
+                    $q->whereNull('ar.admin_id');
+                }];
+            } elseif (ctype_digit((string)$operator_admin_id) && (int)$operator_admin_id > 0) {
+                $where[] = ['ar.admin_id', '=', (int)$operator_admin_id];
+            }
+        }
+
         $order ? $orderby = 'g.price desc' : $orderby = 'sum(o.amount) desc';
 
-        // 充值总金额、手续费汇总(管理员可见)
-        $payTotalMoney = DB::connection('write')->table('agent.dbo.order as o')
-            ->leftJoin('QPAccountsDB.dbo.AccountsInfo as ai', 'o.user_id', '=', 'ai.UserID')
-            ->lock('with(nolock)')
-            ->where($where)->selectRaw('sum(amount) as amount,sum(ISNULL(payment_fee,0)) as total_payment_fee,count(distinct(user_id)) count_u,count(id) count_id')->first();
+        $operatorFilterActive = $operator_admin_id !== '' && $operator_admin_id !== null
+            && ((string)$operator_admin_id === '0'
+                || (ctype_digit((string)$operator_admin_id) && (int)$operator_admin_id > 0));
+
+        $aggregateBase = function () use ($table, $operatorFilterActive) {
+            $q = DB::connection('write')->table($table)
+                ->leftJoin('QPAccountsDB.dbo.AccountsInfo as ai', 'o.user_id', '=', 'ai.UserID')
+                ->lock('with(nolock)');
+            if ($operatorFilterActive) {
+                $q->leftJoin('QPAccountsDB.dbo.AccountsRecord as ar', function ($join) {
+                    $join->on('o.id', '=', 'ar.RecordID');
+                    $join->where('ar.type', 2);
+                });
+            }
+            return $q;
+        };
+
+        // 充值总金额、手续费汇总(管理员可见);有操作人筛选时 join ar,汇总用 distinct 避免重复行
+        $payTotalMoney = $aggregateBase()
+            ->where($where)
+            ->selectRaw(
+                $operatorFilterActive
+                    ? 'sum(o.amount) as amount,sum(ISNULL(o.payment_fee,0)) as total_payment_fee,count(distinct o.user_id) count_u,count(distinct o.id) count_id'
+                    : 'sum(amount) as amount,sum(ISNULL(payment_fee,0)) as total_payment_fee,count(distinct(user_id)) count_u,count(id) count_id'
+            )
+            ->first();
 
         $totalMoney = isset($payTotalMoney->amount) ? number_float($payTotalMoney->amount / NumConfig::NUM_VALUE) : 0;
         $totalPaymentFee = isset($payTotalMoney->total_payment_fee) ? number_float($payTotalMoney->total_payment_fee / NumConfig::NUM_VALUE) : 0;
 
         // 已到账
         if ($recharge_type == 1) {
-            $payOverMoney = DB::connection('write')->table('agent.dbo.order as o')
-                ->join('QPAccountsDB.dbo.AccountsInfo as ai', 'o.user_id', '=', 'ai.UserID')
+            $payOverMoney = $aggregateBase()
                 ->where($where)
-                ->lock('with(nolock)')
-                ->selectRaw('sum(amount) as amount,count(distinct(user_id)) count_u,count(id) count_id')
+                ->selectRaw(
+                    $operatorFilterActive
+                        ? 'sum(o.amount) as amount,count(distinct o.user_id) count_u,count(distinct o.id) count_id'
+                        : 'sum(amount) as amount,count(distinct(user_id)) count_u,count(id) count_id'
+                )
                 ->first();
         } elseif (empty($recharge_type)) {
-            $payOverMoney = DB::connection('write')->table('agent.dbo.order as o')
-                ->join('QPAccountsDB.dbo.AccountsInfo as ai', 'o.user_id', '=', 'ai.UserID')
+            $payOverMoney = $aggregateBase()
                 ->where($where)
-                ->lock('with(nolock)')
                 ->where('pay_status', 1)
-                ->selectRaw('sum(amount) as amount,count(distinct(user_id)) count_u,count(id) count_id')->first();
+                ->selectRaw(
+                    $operatorFilterActive
+                        ? 'sum(o.amount) as amount,count(distinct o.user_id) count_u,count(distinct o.id) count_id'
+                        : 'sum(amount) as amount,count(distinct(user_id)) count_u,count(id) count_id'
+                )->first();
         }
 
         $overMoney = isset($payOverMoney->amount) ? number_float($payOverMoney->amount / NumConfig::NUM_VALUE) : 0;
+        $successUserRate = 0;
+        $successOrderRate = 0;
+        if (!empty($payTotalMoney->count_u)) {
+            $successUserRate = round((($payOverMoney->count_u ?? 0) / $payTotalMoney->count_u) * 100, 2);
+        }
+        if (!empty($payTotalMoney->count_id)) {
+            $successOrderRate = round((($payOverMoney->count_id ?? 0) / $payTotalMoney->count_id) * 100, 2);
+        }
 
         if ($excel) {
             $cellData = $build_sql
@@ -297,8 +344,19 @@ class RechargeController extends Controller
             if(!in_array($admin->roles[0]->id,[1,12,2010,2011])){
                 $viewAll=0;
             }
+            $operatorOptions = DB::connection('write')
+                ->table('QPAccountsDB.dbo.AccountsRecord as ar')
+                ->join('agent.dbo.admin_users as au', 'ar.admin_id', '=', 'au.id')
+                ->where('ar.type', 2)
+                ->whereNotNull('ar.admin_id')
+                ->select('au.id', 'au.account')
+                ->distinct()
+                ->orderBy('au.account')
+                ->get();
             return view('admin.recharge.list', [
                 'viewAll' => $viewAll,
+                'operator_admin_id' => $operator_admin_id,
+                'operatorOptions' => $operatorOptions,
                 'list' => $list,
                 'UserID' => $userid,
                 'order_sn' => $order_sn,
@@ -315,6 +373,8 @@ class RechargeController extends Controller
                 'overMoney' => $overMoney,
                 'payOverMoney' => $payOverMoney ?? 0,
                 'payTotalMoney' => $payTotalMoney,
+                'successUserRate' => $successUserRate,
+                'successOrderRate' => $successOrderRate,
                 'date' => $date,
                 'dates' => $dates,
                 'allChannel' => $allChannel,

+ 173 - 0
app/Http/Controllers/Admin/WinLoseRankController.php

@@ -0,0 +1,173 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Facade\TableName;
+use App\Http\Controllers\Controller;
+use App\Http\helper\NumConfig;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class WinLoseRankController extends Controller
+{
+    public function index(Request $req)
+    {
+        $condition = ['DateID' => date('Ymd'), ['v.Recharge', '>', 0]];
+
+        $q = DB::table('QPRecordDB.dbo.RecordUserDataStatisticsNew as ruds');
+        
+        // 排序逻辑
+        if ($req->input('sortBy')) {
+            $sortBy = $req->input('sortBy');
+            $sortType = $req->input('sortType', 'asc');
+            
+            if ($sortBy == 'rtp') {
+                $sort = 'CASE WHEN ruds.TotalBet > 0 THEN (ruds.TotalBet + (ruds.WinScore + ruds.LostScore))*1.0/ruds.TotalBet ELSE 0 END ' . $sortType;
+                $q->orderByRaw($sort);
+            } elseif ($sortBy == 'winlose') {
+                $sort = '(ruds.WinScore + ruds.LostScore) ' . $sortType;
+                $q->orderByRaw($sort);
+            }
+        }
+        
+        $q->select([
+                'ruds.UserID',
+                'ruds.WinScore',
+                'ruds.LostScore',
+                'ruds.TotalBet',
+                DB::raw('CASE WHEN ruds.TotalBet > 0 THEN (ruds.TotalBet + (ruds.WinScore + ruds.LostScore))*1.0/ruds.TotalBet ELSE 0 END as rtp'),
+                DB::raw('0 as sameRW'),
+                DB::raw('-1 as KindID'), DB::raw('0 as TotalRecharge'), DB::raw('0 as TotalWithdraw'),
+                DB::raw('\'\' as EmailAddress'), DB::raw('\'\' as PhoneNum'), DB::raw('0 as GameID'),
+            ])
+            ->leftJoin('QPAccountsDB.dbo.YN_VIPAccount as v', 'v.UserID', '=', 'ruds.UserID')
+            ->where($condition);
+        
+        // 在线状态筛选
+        $onlineStatus = $req->input('online_status');
+        if ($onlineStatus == 1) {
+            // 在线:有记录
+            $q->leftJoin('QPTreasureDB.dbo.GameScoreLocker as gsl', 'gsl.UserID', '=', 'ruds.UserID')
+                ->whereNotNull('gsl.UserID');
+        } elseif ($onlineStatus == 2) {
+            // 离线:无记录
+            $q->leftJoin('QPTreasureDB.dbo.GameScoreLocker as gsl', 'gsl.UserID', '=', 'ruds.UserID')
+                ->whereNull('gsl.UserID');
+        }
+        
+        $page = $q->paginate(15);
+
+        if ($page->count() > 0) {
+            $uids = array_column($page->items(), 'UserID');
+            $lockers = DB::table('QPTreasureDB.dbo.GameScoreLocker')->whereIn('UserID', $uids)
+                ->pluck('KindID', 'UserID')->toArray();
+            $phones = DB::table('QPAccountsDB.dbo.AccountPhone as ap')->whereIn('UserID', $uids)
+                ->pluck('PhoneNum', 'UserID')->toArray();
+            foreach ($page->items() as $key => $item) {
+                $item->PhoneNum = $phones[$item->UserID] ?? '';
+            }
+            $GameIDs = DB::table('QPAccountsDB.dbo.AccountsInfo as ai')->whereIn('UserID', $uids)
+                ->pluck('GameID', 'UserID')->toArray();
+            foreach ($page->items() as $key => $item) {
+                $item->GameID = $GameIDs[$item->UserID] ?? '';
+            }
+            $emails = DB::table('QPAccountsDB.dbo.AccountWithdrawInfo as awi')->whereIn('UserID', $uids)
+                ->pluck('EmailAddress', 'UserID')->toArray();
+            foreach ($page->items() as $key => $item) {
+                $item->EmailAddress = $emails[$item->UserID] ?? '';
+            }
+            // 身上的钱
+            $gameScores = DB::table('QPTreasureDB.dbo.GameScoreInfo')
+                ->lock('with(nolock)')
+                ->whereIn('UserID', $uids)
+                ->pluck('Score', 'UserID')->toArray();
+            // 待审核提现
+            $orderWtihdraws = DB::table('QPAccountsDB.dbo.OrderWithDraw')
+                ->lock('with(nolock)')
+                ->whereIn('UserID', $uids)
+                ->where('State', 1)
+                ->selectRaw('SUM(WithDraw) as WithDraw, UserID')
+                ->groupBy('UserID')
+                ->pluck('WithDraw', 'UserID')->toArray();
+            $totals = DB::table('QPRecordDB.dbo.RecordUserTotalStatistics as ruts')->whereIn('UserID', $uids)
+                ->get()->toArray();
+            foreach ($page->items() as $key => $item) {
+                $item->Score = $gameScores[$item->UserID] ?? 0;
+                $item->WithDrawWaitAudit = $orderWtihdraws[$item->UserID] ?? 0;
+                foreach ($totals as $total) {
+                    if ($item->UserID == $total->UserID) {
+                        $item->TotalRecharge = $total->Recharge;
+                        $item->TotalWithdraw = $total->Withdraw;
+                    }
+                }
+            }
+
+            //关联用户信息
+            $phones = array_filter(array_column($page->items(), 'PhoneNum'));
+            $emails = array_filter(array_column($page->items(), 'EmailAddress'));
+            $phoneRWs = [];
+            if (count($phones) > 0) {
+                $phoneUids = DB::table('QPAccountsDB.dbo.AccountPhone')->whereIn('PhoneNum', $phones)
+                    ->get()->toArray();
+                if (count($phoneUids) > 0) {
+                    $res = DB::table('QPRecordDB.dbo.RecordUserTotalStatistics')
+                        ->whereIn('UserID', array_column($phoneUids, 'UserID'))
+                        ->get();
+                    foreach ($res as $row) {
+                        foreach ($phoneUids as $ap) {
+                            if ($ap->UserID == $row->UserID) {
+                                $phone = $ap->PhoneNum;
+                                if (!isset($phoneRWs[$phone])) {
+                                    $phoneRWs[$phone] = [];
+                                }
+                                $phoneRWs[$phone][$row->UserID] = $row->Recharge - $row->Withdraw / NumConfig::NUM_VALUE;
+                            }
+                        }
+                    }
+                }
+            }
+            $emailRWs = [];
+            if (count($emails) > 0) {
+                $emailUids = DB::table('QPAccountsDB.dbo.AccountWithdrawInfo')
+                    ->whereIn('EmailAddress', $emails)
+                    ->get()->toArray();
+                if (count($emailUids) > 0) {
+                    $res = DB::table('QPRecordDB.dbo.RecordUserTotalStatistics')
+                        ->whereIn('UserID', array_column($emailUids, 'UserID'))
+                        ->get();
+                    foreach ($res as $row) {
+                        foreach ($emailUids as $awi) {
+                            if ($awi->UserID == $row->UserID) {
+                                $email = $awi->EmailAddress;
+                                if (!isset($emailRWs[$email])) {
+                                    $emailRWs[$email] = [];
+                                }
+                                $emailRWs[$email][$row->UserID] = $row->Recharge - $row->Withdraw / NumConfig::NUM_VALUE;
+                            }
+                        }
+                    }
+                }
+            }
+            foreach ($page as $k => $v) {
+                $uidRws = [];
+                if ($v->EmailAddress) {
+                    foreach ($emailRWs[$v->EmailAddress] ?? [] as $uid => $value) {
+                        $uidRws[$uid] = $value;
+                    }
+                }
+                if ($v->PhoneNum) {
+                    foreach ($phoneRWs[$v->PhoneNum] ?? [] as $uid => $value) {
+                        $uidRws[$uid] = $value;
+                    }
+                }
+                $page[$k]->sameRW = array_sum($uidRws);
+                $page[$k]->KindID = $lockers[$v->UserID] ?? -1;
+            }
+
+        }
+        $gameServerNames = DB::table(TableName::QPPlatformDB() . 'RoomConfig')
+            ->pluck('RoomName', 'GameID')->toArray();
+
+        return view('admin.win_lose_rank.index', ['list' => $page, 'gameServerNames' => $gameServerNames, 'request' => $req]);
+    }
+}

+ 22 - 29
app/Http/logic/admin/GlobalLogicController.php

@@ -719,37 +719,30 @@ class GlobalLogicController extends BaseLogicController
         }
         // 退款信息
         $data['refund_flag'] = DB::table('agent.dbo.order')
-                ->where(['user_id' => $UserID, 'pay_status' => 9])
-                ->count() > 0;
+            ->where(['user_id' => $UserID, 'pay_status' => 9])
+            ->sum('amount');
         $data['refund_total'] = 0;
-        if ($data['refund_flag']) {
-            $samePhoneUids = [];
-            if ($userInfo->phone) {
-                $samePhoneUids = DB::connection('read')->table('QPAccountsDB.dbo.AccountPhone')
-                    ->where('PhoneNum', $userInfo->phone)->pluck('UserID')->toArray();
-            }
+        $samePhoneUids = [];
+        if ($userInfo->phone) {
+            $samePhoneUids = DB::connection('read')->table('QPAccountsDB.dbo.AccountPhone')
+                ->where('PhoneNum', $userInfo->phone)->pluck('UserID')->toArray();
+        }
+        $awi = DB::table('QPAccountsDB.dbo.AccountWithDrawInfo')
+            ->where(['UserID' => $UserID])
+            ->first();
+        $sameEmailUids = [];
+        if ($awi && $awi->EmailAddress) {
+            $sameEmailUids = DB::connection('read')->table('QPAccountsDB.dbo.AccountWithDrawInfo')
+                ->where('EmailAddress', $awi->EmailAddress)->pluck('UserID')->toArray();
+        }
 
-            $sameRegIpUids = DB::connection('read')->table('QPAccountsDB.dbo.AccountsInfo')
-                ->where('IsAndroid', 0)
-                ->where('RegisterIP', $userInfo->RegisterIP)
-                ->pluck('UserID')->toArray();
-            $ips = DB::connection('read')->table('QPRecordDB.dbo.RecordUserLogonStatistics')
-                ->where('UserID', $user->UserID ?? 0)
-                ->distinct()
-                ->pluck('LogonIP');
-
-            $sameLoginIpUids = DB::connection('read')->table('QPRecordDB.dbo.RecordUserLogonStatistics')
-                ->whereIn('LogonIP', $ips)
-                ->selectRaw('UserID')
-                ->pluck('UserID')->toArray();
-            $uids = array_unique(array_merge($samePhoneUids, $sameRegIpUids, $sameLoginIpUids));
-            $uids[] = $UserID;
-            if (count($uids) > 0) {
-                $data['refund_total'] = DB::table('agent.dbo.order')->lock('WITH(NOLOCK)')
-                    ->whereIn('user_id', $uids)
-                    ->where('pay_status', 9)
-                    ->sum('amount');
-            }
+        $uids = array_unique(array_merge($samePhoneUids, $sameEmailUids));
+        $uids[] = $UserID;
+        if (count($uids) > 0) {
+            $data['refund_total'] = DB::table('agent.dbo.order')->lock('WITH(NOLOCK)')
+                ->whereIn('user_id', $uids)
+                ->where('pay_status', 9)
+                ->sum('amount');
         }
 
         return compact('data', 'userInfo', 'registerInviteSwitches', 'gameCount', 'userSource', 'OpenPage','platformData');

+ 1 - 1
app/Http/logic/admin/WithdrawalLogic.php

@@ -575,7 +575,7 @@ class WithdrawalLogic extends BaseLogicController
         StoredProcedure::addPlatformData($UserID, 4, $TakeMoney);
 
         // 数据统计后台 -- 提现记录添加
-        (new RechargeWithDraw())->withDraw($UserID, $TakeMoney);
+        (new RechargeWithDraw())->withDraw($UserID, $TakeMoney, $withdrawOrder->withdraw_fee);
 
         $redis = Redis::connection();
         $redis->incr('draw_'.date('Ymd').$UserID);

+ 3 - 2
app/Http/logic/api/StarPayCashierLogic.php

@@ -235,8 +235,9 @@ class StarPayCashierLogic implements CashierInterFace
 
                 $ServiceFee = $query->ServiceFee;
                 RecordUserDataStatistics::updateOrAdd($UserID, $TakeMoney, 0, $ServiceFee);
-
-                (new RechargeWithDraw())->withDraw($UserID, $TakeMoney);
+                $fee = DB::table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderId', $OrderId)
+                    ->value('withdraw_fee');
+                (new RechargeWithDraw())->withDraw($UserID, $TakeMoney, $fee, $ServiceFee);
 
                 $redis = Redis::connection();
                 $redis->incr('draw_'.date('Ymd').$UserID);

+ 1 - 1
app/Http/logic/api/StarPayLogic.php

@@ -159,7 +159,7 @@ class StarPayLogic extends BaseApiLogic
                 [$give, $favorable_price, $Recharge, $czReason, $cjReason] = $service->getPayInfo($GiftsID, $userID, $payAmt);
             }
 
-            [$Score] = $service->addRecord($userID, $payAmt, $favorable_price, $r->orderSn, $GiftsID, $Recharge, $czReason, $give, $cjReason, $AdId, $eventType);
+            [$Score] = $service->addRecord($userID, $payAmt, $favorable_price, $r->orderSn, $GiftsID, $Recharge, $czReason, $give, $cjReason, $AdId, $eventType, $body['payment_fee'] ?? 0);
             Order::dispatch([$userID, $payAmt, $Score, $favorable_price, $GiftsID, $r->orderSn]);
 
             DB::connection('write')->table('agent.dbo.order')->where('order_sn', $r->orderSn)->update($body);

+ 3 - 2
app/Http/logic/api/SupefinaSpeiCashierLogic.php

@@ -289,8 +289,9 @@ class SupefinaSpeiCashierLogic implements CashierInterFace
 
                 $ServiceFee = $query->ServiceFee;
                 RecordUserDataStatistics::updateOrAdd($UserID, $TakeMoney, 0, $ServiceFee);
-
-                (new RechargeWithDraw())->withDraw($UserID, $TakeMoney);
+                $fee = DB::table('QPAccountsDB.dbo.OrderWithDraw')->where('OrderId', $OrderId)
+                    ->value('withdraw_fee');
+                (new RechargeWithDraw())->withDraw($UserID, $TakeMoney, $fee, $ServiceFee);
 
                 $redis = Redis::connection();
                 $redis->incr('draw_'.date('Ymd').$UserID);

+ 2 - 1
app/Http/logic/api/SupefinaSpeiLogic.php

@@ -196,7 +196,8 @@ class SupefinaSpeiLogic extends BaseApiLogic
                 [$give, $favorable_price, $Recharge, $czReason, $cjReason] = $service->getPayInfo($GiftsID, $userID, $payAmt);
             }
 
-            [$Score] = $service->addRecord($userID, $payAmt, $favorable_price, $order_sn, $GiftsID, $Recharge, $czReason, $give, $cjReason, $AdId, $eventType);
+            [$Score] = $service->addRecord($userID, $payAmt, $favorable_price, $order_sn, $GiftsID, $Recharge, $czReason, $give, $cjReason, $AdId, $eventType,
+                $body['payment_fee'] ?? 0);
             Order::dispatch([$userID, $payAmt, $Score, $favorable_price, $GiftsID, $order_sn]);
 
             DB::connection('write')->table('agent.dbo.order')->where('order_sn', $order_sn)->update($body);

+ 2 - 2
app/Services/OrderServices.php

@@ -271,7 +271,7 @@ class  OrderServices
      * @param $AdId
      * @param $eventType
      */
-    public function addRecord($user_id, $payAmt, $favorable_price, $order_sn, $GiftsID, $Recharge, $czReason, $give, $cjReason, $AdId, $eventType)
+    public function addRecord($user_id, $payAmt, $favorable_price, $order_sn, $GiftsID, $Recharge, $czReason, $give, $cjReason, $AdId, $eventType, $fee = 0)
     {
 
         if ($payAmt > 0) {
@@ -474,7 +474,7 @@ class  OrderServices
 //        }
 
         // 数据统计后台 -- 充值记录添加
-        (new RechargeWithDraw())->recharge($user_id, $payAmt);
+        (new RechargeWithDraw())->recharge($user_id, $payAmt, $fee);
 //        (new RechargeWithDraw())->recharge($user_id, $Recharge);
 
         // 连续未充值 VIP 新礼包(gift_id=305)—— 充值成功后写入 7 日礼包记录(仅在首次充值时)

+ 47 - 6
app/dao/Estatisticas/RechargeWithDraw.php

@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
 
 class RechargeWithDraw
 {
-    public function recharge($UserID, $Recharge)
+    public function recharge($UserID, $Recharge, $Fee = 0)
     {
         $Recharge = $Recharge * NumConfig::NUM_VALUE;
 
@@ -28,19 +28,25 @@ class RechargeWithDraw
             DB::connection('mysql')->table('rummy_ltv_statistics')
                 ->where('channel', $UserRegisterDate->Channel)
                 ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
-                ->increment('total_recharge', $Recharge);
+                ->update([
+                    'total_recharge' => DB::raw('total_recharge+' . $Recharge),
+                    'total_recharge_fee' => DB::raw('total_recharge_fee+' . $Fee),
+                ]);
 
             DB::connection('mysql')->table('rummy_ltv_statistics')
                 ->where('channel', -1)
                 ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
-                ->increment('total_recharge', $Recharge);
+                ->update([
+                    'total_recharge' => DB::raw('total_recharge+' . $Recharge),
+                    'total_recharge_fee' => DB::raw('total_recharge_fee+' . $Fee),
+                ]);
         } catch (\Exception $exception) {
             Log::info('【充值】数据统计后台信息添加失败' . $UserID . ' - ' . $Recharge);
         }
 
     }
 
-    public function withDraw($UserID, $WithDraw)
+    public function withDraw($UserID, $WithDraw, $Fee = 0, $ServiceFee = 0)
     {
         try {
 
@@ -54,14 +60,49 @@ class RechargeWithDraw
             DB::connection('mysql')->table('rummy_cash_statistics')
                 ->where('channel', $UserRegisterDate->Channel)
                 ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
-                ->increment('total_cash', $WithDraw);
+                ->update([
+                    'total_cash' => DB::raw('total_cash+' . $WithDraw),
+                    'total_cash_fee' => DB::raw('total_cash_fee+' . $Fee),
+                    'total_service_fee' => DB::raw('total_service_fee+' . $ServiceFee),
+                ]);
 
             DB::connection('mysql')->table('rummy_cash_statistics')
                 ->where('channel', -1)
                 ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
-                ->increment('total_cash', $WithDraw);
+                ->update([
+                    'total_cash' => DB::raw('total_cash+' . $WithDraw),
+                    'total_cash_fee' => DB::raw('total_cash_fee+' . $Fee),
+                    'total_service_fee' => DB::raw('total_service_fee+' . $ServiceFee),
+                ]);
         } catch (\Exception $exception) {
             Log::info('【提现】数据统计后台信息添加失败' . $UserID . ' - ' . $WithDraw);
         }
     }
+
+    public function refund($UserID, $Recharge, $Fee)
+    {
+        try {
+
+            // 数据统计后台 -- 退款记录添加
+            $UserRegisterDate = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')->where('UserID', $UserID)->select('RegisterDate', 'Channel')->first();
+
+            DB::connection('mysql')->table('rummy_ltv_statistics')
+                ->where('channel', $UserRegisterDate->Channel)
+                ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
+                ->update([
+                    'total_refund' => DB::raw('total_refund+' . $Recharge),
+                    'total_refund_fee' => DB::raw('total_refund_fee+' . $Fee),
+                ]);
+
+            DB::connection('mysql')->table('rummy_ltv_statistics')
+                ->where('channel', -1)
+                ->where('at_date', Carbon::parse($UserRegisterDate->RegisterDate)->format('Ymd'))
+                ->update([
+                    'total_refund' => DB::raw('total_refund+' . $Recharge),
+                    'total_refund_fee' => DB::raw('total_refund_fee+' . $Fee),
+                ]);
+        } catch (\Exception $exception) {
+            Log::info('【充值】数据统计后台退款信息添加失败' . $UserID . ' - ' . $Fee);
+        }
+    }
 }

+ 1 - 1
resources/views/admin/global/id_list.blade.php

@@ -78,7 +78,7 @@
                             </tr>
                             <tr>
                                 <td>{{ __('auto.会员') }}ID</td>
-                                <td>{{$userInfo->GameID}} @if($data['refund_flag']) <b style="color:red;">退款({{round($data['refund_total']/100, 2)}})</b> @endif</td>
+                                <td>{{$userInfo->GameID}} @if($data['refund_flag'] || $data['refund_total']) <b style="color:red;">退款({{round($data['refund_flag']/100, 2)}}/{{round($data['refund_total']/100, 2)}})</b> @endif</td>
                             </tr>
 
                             <tr>

+ 15 - 2
resources/views/admin/recharge/list.blade.php

@@ -83,6 +83,15 @@
                                                 <option value="{{$methodValue}}" @if($methodValue == $payMethod) selected @endif>{{$methodName}}</option>
                                             @endforeach
                                         </select>
+
+                                        <span style="padding-left: 10px">操作人:</span>
+                                        <select class="form-control" name="operator_admin_id" style="color: black">
+                                            <option value="">{{ __('auto.请选择') }}</option>
+                                            <option value="0" @if ((string)($operator_admin_id ?? '') === '0') selected @endif>无操作人</option>
+                                            @foreach($operatorOptions ?? [] as $op)
+                                                <option value="{{ $op->id }}" @if ((string)($operator_admin_id ?? '') === (string)$op->id) selected @endif>{{ $op->account }}</option>
+                                            @endforeach
+                                        </select>
                                     </div>
                                     <div class="form-group">
                                         <span style="padding-left: 10px">{{ __('auto.选择支付时间') }}({{ __('auto.当地') }}):</span>
@@ -139,7 +148,7 @@
                                         <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
                                         <a href="?isEmpty=1"
                                            class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>&nbsp;&nbsp;
-                                        <a href="?excel=1&start_time={{$start_time}}&end_time={{$end_time}}&recharge_type={{$recharge_type}}&UserID={{$UserID}}&type={{$type}}&order={{$order}}&date={{$date}}&create_start_time={{$create_start_time}}&create_end_time={{$create_end_time}}&isEmpty=1&source={{$source}}&chargeMoney={{$chargeMoney}}&payMethod={{$payMethod}}"
+                                        <a href="?excel=1&start_time={{$start_time}}&end_time={{$end_time}}&recharge_type={{$recharge_type}}&UserID={{$UserID}}&type={{$type}}&order={{$order}}&date={{$date}}&create_start_time={{$create_start_time}}&create_end_time={{$create_end_time}}&isEmpty=1&source={{$source}}&chargeMoney={{$chargeMoney}}&payMethod={{$payMethod}}&operator_admin_id={{ urlencode((string)($operator_admin_id ?? '')) }}"
                                            class="btn btn-sm btn-gradient-light btn-icon-text">{{ __('auto.导出') }}</a>
                                     </div>
                                 </div>
@@ -207,6 +216,8 @@
                                         @if(!empty($viewAll))
                                             <h4>{{ __('auto.手续费汇总:') }}{{ $totalPaymentFee ?? 0 }}</h4>
                                         @endif
+                                        <h4>充值成功人数百分比:{{ $successUserRate ?? 0 }}%</h4>
+                                        <h4>充值成功笔数百分比:{{ $successOrderRate ?? 0 }}%</h4>
                                     </div>
                                 @endif
 
@@ -299,7 +310,8 @@
     'source' => $source,
     'chargeMoney' => $chargeMoney,
     'payMethod' => $payMethod,
-    'amountSort' => $amountSort
+    'amountSort' => $amountSort,
+    'operator_admin_id' => $operator_admin_id ?? '',
 
     ])->total() }}</b>
                                 {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
@@ -330,6 +342,7 @@
             'source' : '{{$source}}',
             'chargeMoney' : '{{$chargeMoney}}',
             'payMethod' : '{{$payMethod}}',
+            'operator_admin_id' : '{{ $operator_admin_id ?? '' }}',
         }
 
         function start_times(id) {

+ 122 - 0
resources/views/admin/win_lose_rank/index.blade.php

@@ -0,0 +1,122 @@
+@extends('base.base')
+@section('base')
+    <!-- 内容区域 -->
+    <div class="main-panel">
+        <div class="content-wrapper">
+            <div class="page-header">
+                <h3 class="page-title">
+                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
+                <i class="mdi mdi-wrench"></i>
+              </span>
+                    当日输赢排行
+                </h3>
+                <nav aria-label="breadcrumb">
+                    <ol class="breadcrumb">
+                        <li class="breadcrumb-item"><a href="#">数据统计</a></li>
+                        <li class="breadcrumb-item active" aria-current="page">当日输赢排行</li>
+                    </ol>
+                </nav>
+            </div>
+            <div class="row">
+                <div class="col-lg-12 grid-margin stretch-card">
+                    <div class="card">
+                        <div class="card-body">
+                            <h4 class="card-title">当日输赢排行</h4>
+                                <form class="well form-inline margin-top-20" method="get" action=''>
+                                    <span style="padding-left: 10px">在线状态:</span>
+                                    <select class="form-control" name="online_status" style="width: 120px">
+                                        <option value="">{{ __('auto.全部') }}</option>
+                                        <option value="1" @if ($request->input('online_status') == 1) selected @endif>在线</option>
+                                        <option value="2" @if ($request->input('online_status') == 2) selected @endif>离线</option>
+                                    </select>
+                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
+                                    <a href="/admin/win_lose_rank" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>
+                                </form>
+                                <table class="table table-bordered">
+                                    <thead>
+                                        <tr>
+                                            <th>GameID</th>
+                                            <th>
+                                                <div class="sort_winlose">
+                                                    当日输赢
+                                                    <svg t="1611284352657" class="icon2" onclick="sort_func(this,'winlose','asc')"
+                                                         viewBox="0 0 1024 1024" version="1.1"
+                                                         xmlns="http://www.w3.org/2000/svg" p-id="4118" width="14">
+                                                        <path
+                                                            d="M541.866667 285.866667l345.6 345.6c17.066667 17.066667 17.066667 42.666667 0 59.733333-8.533333 8.533333-19.2 12.8-29.866667 12.8H168.533333c-23.466667 0-42.666667-19.2-42.666666-42.666667 0-10.666667 4.266667-21.333333 12.8-29.866666l343.466666-345.6c17.066667-17.066667 42.666667-17.066667 59.733334 0z"
+                                                            p-id="4119" fill="{{ ($request->input('sortBy') == 'winlose' && $request->input('sortType') == 'asc') ? 'red' : '#707072' }}" />
+                                                        </svg>
+                                                    <svg t="1611283709864" class="icon1" onclick="sort_func(this,'winlose','desc')"
+                                                         viewBox="0 0 1024 1024" version="1.1"
+                                                         xmlns="http://www.w3.org/2000/svg" p-id="3148" width="14">
+                                                        <path
+                                                            d="M482.133333 738.133333L136.533333 392.533333c-17.066667-17.066667-17.066667-42.666667 0-59.733333 8.533333-8.533333 19.2-12.8 29.866667-12.8h689.066667c23.466667 0 42.666667 19.2 42.666666 42.666667 0 10.666667-4.266667-21.333333-12.8-29.866666L541.866667 738.133333c-17.066667 17.066667-42.666667 17.066667-59.733334 0z"
+                                                            p-id="3149" fill="{{ ($request->input('sortBy') == 'winlose' && $request->input('sortType') == 'desc') ? 'red' : '#707071' }}" />
+                                                        </svg>
+                                                </div>
+                                            </th>
+                                            <th>
+                                                <div class="sort_rtp">
+                                                    当日rtp
+                                                    <svg t="1611284352657" class="icon2" onclick="sort_func(this,'rtp','asc')"
+                                                         viewBox="0 0 1024 1024" version="1.1"
+                                                         xmlns="http://www.w3.org/2000/svg" p-id="4118" width="14">
+                                                        <path
+                                                            d="M541.866667 285.866667l345.6 345.6c17.066667 17.066667 17.066667 42.666667 0 59.733333-8.533333 8.533333-19.2 12.8-29.866667 12.8H168.533333c-23.466667 0-42.666667-19.2-42.666666-42.666667 0-10.666667 4.266667-21.333333 12.8-29.866666l343.466666-345.6c17.066667-17.066667 42.666667-17.066667 59.733334 0z"
+                                                            p-id="4119" fill="{{ ($request->input('sortBy') == 'rtp' && $request->input('sortType') == 'asc') ? 'red' : '#707072' }}" />
+                                                        </svg>
+                                                    <svg t="1611283709864" class="icon1" onclick="sort_func(this,'rtp','desc')"
+                                                         viewBox="0 0 1024 1024" version="1.1"
+                                                         xmlns="http://www.w3.org/2000/svg" p-id="3148" width="14">
+                                                        <path
+                                                            d="M482.133333 738.133333L136.533333 392.533333c-17.066667-17.066667-17.066667-42.666667 0-59.733333 8.533333-8.533333 19.2-12.8 29.866667-12.8h689.066667c23.466667 0 42.666667 19.2 42.666666 42.666667 0 10.666667-4.266667-21.333333-12.8-29.866666L541.866667 738.133333c-17.066667 17.066667-42.666667 17.066667-59.733334 0z"
+                                                            p-id="3149" fill="{{ ($request->input('sortBy') == 'rtp' && $request->input('sortType') == 'desc') ? 'red' : '#707071' }}" />
+                                                        </svg>
+                                                </div>
+                                            </th>
+                                            <th>历史充值减提现</th>
+                                            <th>关联用户充值历史减提现</th>
+                                            <th>在线状态</th>
+                                        </tr>
+                                    </thead>
+                                    <tbody>
+                                        @foreach ($list as $row)
+                                            <tr>
+                                                <td><a href='/admin/global/id_find?UserID={{ $row->UserID }}'>{{ $row->GameID }}</a></td>
+                                                <td>{{ ($row->WinScore + $row->LostScore)/\App\Http\helper\NumConfig::NUM_VALUE }}</td>
+                                                <td>{{ intval($row->rtp*100) }}%</td>
+                                                <td>{{ $row->TotalRecharge - ($row->TotalWithdraw + $row->Score + $row->WithDrawWaitAudit)/\App\Http\helper\NumConfig::NUM_VALUE}}</td>
+                                                <td>{{ $row->sameRW }}</td>
+                                                <td>{{ $row->KindID === -1 ? '离线' : $gameServerNames[$row->KindID] ?? '' }}</td>
+                                            </tr>
+                                        @endforeach
+                                    </tbody>
+                                </table>
+                                <div class="box-footer clearfix">
+                                    {{ trans('messages.总共') }} <b>{{ $list->appends($request->all())->total() }}</b> {{ trans('messages.条,分为') }}<b>{{ $list->lastPage() }}</b> {{ trans('messages.页') }}
+                                    {!! $list->links() !!}
+                                </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+<script>
+    function sort_func(obj, sortBy, sortType) {
+        if (sortBy === 'winlose') {
+            $(".sort_winlose svg:eq(1)").children('path').attr('fill', '#707071');
+            $(".sort_winlose svg:eq(0)").children('path').attr('fill', '#707071');
+            $(obj).children('path').attr('fill', 'red');
+        } else if (sortBy === 'rtp') {
+            $(".sort_rtp svg:eq(1)").children('path').attr('fill', '#707071');
+            $(".sort_rtp svg:eq(0)").children('path').attr('fill', '#707071');
+            $(obj).children('path').attr('fill', 'red');
+        }
+        let url = new URL(window.location.href);
+        url.searchParams.set('sortBy', sortBy);
+        url.searchParams.set('sortType', sortType);
+        window.location.href = url.toString();
+    }
+</script>
+@endsection

+ 2 - 0
routes/web.php

@@ -841,6 +841,8 @@ Route::group([
         $route->any('/protect-level/add', 'Admin\ProtectLevelController@add');
         $route->any('/protect-level/edit/{id}', 'Admin\ProtectLevelController@edit');
         $route->post('/protect-level/delete/{id}', 'Admin\ProtectLevelController@delete');
+
+        $route->any('/win_lose_rank', 'Admin\WinLoseRankController@index');
     });
 
 });