laowu пре 2 недеља
родитељ
комит
904cb87fbb

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

@@ -0,0 +1,87 @@
+<?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')];
+
+        $q = DB::table('QPRecordDB.dbo.RecordUserDataStatisticsNew as ruds');
+        if ($req->input('sort')) {
+            $sort = $req->input('sort') == 1 ? 'rtp asc' : 'rtp desc';
+            $q->orderByRaw($sort);
+        }
+        $page = $q
+            ->leftJoin('QPAccountsDB.dbo.AccountPhone as ap', 'ruds.UserID', '=', 'ap.UserID')
+            ->leftJoin('QPAccountsDB.dbo.AccountsInfo as ai', 'ruds.UserID', '=', 'ai.UserID')
+            ->leftJoin('QPAccountsDB.dbo.AccountWithdrawInfo as awi', 'awi.UserID', '=', 'ruds.UserID')
+            ->leftJoin('QPRecordDB.dbo.RecordUserDataStatistics as ruds_old', 'ruds.UserID', '=', 'ruds_old.UserID')
+            ->select([
+            'ruds.UserID',
+            'ap.PhoneNum',
+            'ai.GameID',
+            'awi.EmailAddress',
+            'ruds.WinScore',
+            'ruds.LostScore',
+            'ruds.TotalBet',
+            'ruds_old.Recharge',
+            'ruds_old.Withdraw',
+            DB::raw('CASE WHEN TotalBet > 0 THEN (ruds.WinScore - ruds.LostScore)/ruds.TotalBet ELSE 0 END as rtp'),
+            DB::raw('0 as sameRW'),
+            DB::raw('0 as KindID'),
+        ])->where($condition)
+        ->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 = 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)
+                    ->pluck('UserID', 'PhoneNum')->toArray();
+                if (count($phoneUids) > 0) {
+                    $res = DB::table('QPRecordDB.dbo.RecordUserDataStatistics')->whereIn('UserID', $phoneUids)
+                        ->get();
+                    foreach ($res as $row) {
+                        $phone = array_search($row->UserID, $phoneUids);
+                        $phoneRWs[$phone] = $row->Recharge - $row->Withdraw/NumConfig::NUM_VALUE;
+                    }
+                }
+            }
+            $emailRWs = [];
+            if (count($emails) > 0) {
+                $emailUids = DB::table('QPAccountsDB.dbo.AccountWithdrawInfo')
+                    ->whereIn('EmailAddress', $emails)
+                    ->pluck('UserID', 'EmailAddress')->toArray();
+                if (count($emailUids) > 0) {
+                    $res = DB::table('QPRecordDB.dbo.RecordUserDataStatistics')->whereIn('UserID', $emailUids)
+                        ->get();
+                    foreach ($res as $row) {
+                        $email = array_search($row->UserID, $emailUids);
+                        $emailRWs[$email] = $row->Recharge - $row->Withdraw/NumConfig::NUM_VALUE;
+                    }
+                }
+            }
+
+            foreach ($page as $k => $v) {
+                $page[$k]->sameRW = ($emailRWs[$v->EmailAddress] ?? 0) + ($phoneRWs[$v->PhoneNum] ?? 0);
+                $page[$k]->KindID = $lockers[$v->UserID] ?? 0;
+            }
+        }
+        $gameServerNames = DB::table(TableName::QPPlatformDB() . 'RoomConfig')
+            ->pluck('RoomName', 'GameID')->toArray();
+
+        return view('admin.win_lose_rank.index', ['list' => $page, 'gameServerNames' => $gameServerNames, 'request' => $req]);
+    }
+}

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

@@ -736,28 +736,6 @@ class GlobalLogicController extends BaseLogicController
                 ->where('EmailAddress', $awi->EmailAddress)->pluck('UserID')->toArray();
         }
 
-        $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');
-        }
-        $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();
-        }
-
         $uids = array_unique(array_merge($samePhoneUids, $sameEmailUids));
         $uids[] = $UserID;
         if (count($uids) > 0) {

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

@@ -0,0 +1,68 @@
+@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>
+                                    @component('components.select', [ 'name' => 'sort', 'options' => [0 => '', 1 =>'rtp正序', 2 => 'rtp倒序'],
+                                            'default' => $request->input('sort', 0)
+                                    ])
+                                    @endcomponent
+                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
+                                    <a href="/admin/blacklist" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>
+                                </form>
+                                <table class="table table-bordered">
+                                    <thead>
+                                        <tr>
+                                            <th>GameID</th>
+                                            <th>当日输赢</th>
+                                            <th>当日rtp</th>
+                                            <th>历史充值减提现</th>
+                                            <th>关联用户充值历史减提现</th>
+                                            <th>在线状态</th>
+                                        </tr>
+                                    </thead>
+                                    <tbody>
+                                        @foreach ($list as $row)
+                                            <tr>
+                                                <td>{{ $row->GameID }}</td>
+                                                <td>{{ ($row->WinScore - $row->LostScore)/\App\Http\helper\NumConfig::NUM_VALUE }}</td>
+                                                <td>{{ $row->TotalBet ? ($row->WinScore - $row->LostScore)/$row->TotalBet : 0 }}</td>
+                                                <td>{{ $row->Recharge - $row->Withdraw/\App\Http\helper\NumConfig::NUM_VALUE }}</td>
+                                                <td>{{ $row->sameRW }}</td>
+                                                <td>{{ $row->KindID == 0 ? '离线' : $gameServerNames[$row->KindID] ?? '' }}</td>
+                                            </tr>
+                                        @endforeach
+                                    </tbody>
+                                </table>
+                                <div class="box-footer clearfix">
+                                    {{ trans('messages.总共') }} <b>{{ $list->total() }}</b> {{ trans('messages.条,分为') }}<b>{{ $list->lastPage() }}</b> {{ trans('messages.页') }}
+                                    {!! $list->links() !!}
+                                </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection

+ 2 - 0
routes/web.php

@@ -845,6 +845,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');
     });
 
 });