Bladeren bron

no message

Tree 1 maand geleden
bovenliggende
commit
653287e468

+ 9 - 11
app/Console/Commands/ExemptReview.php

@@ -98,7 +98,7 @@ class ExemptReview extends Command
                 Log::info('首次审核阻拦自动免审:'.$value->OrderId);
                 continue;
             }
-            if ($AccountsInfoModel->sameWithDrawEmail($value->EmailAddress) > $sameCountCheck) {
+            if ($AccountsInfoModel->sameWithDrawEmail($value->EmailAddress) > $sameCountCheck && ($value->WithDraw/NumConfig::NUM_VALUE)>20) {
                 Log::info('EMAIL重复过多阻拦自动免审:'.$value->OrderId.":::".$value->EmailAddress);
                 continue;
             }
@@ -114,35 +114,33 @@ class ExemptReview extends Command
             //                continue;
             //            }
 
-            if ($AccountsInfoModel->sameRegisterIPCountByUserID($value->UserID) > $sameCountCheckIP) {
+            if ($AccountsInfoModel->sameRegisterIPCountByUserID($value->UserID) > $sameCountCheckIP && ($value->WithDraw/NumConfig::NUM_VALUE)>20) {
                 Log::info('注册IP重复过多阻拦自动免审:'.$value->OrderId);
                 continue;
             }
 
-            if ($AccountsInfoModel->sameLoginIPCount($value->UserID) > $sameCountCheckIP) {
+            if ($AccountsInfoModel->sameLoginIPCount($value->UserID) > $sameCountCheckIP && ($value->WithDraw/NumConfig::NUM_VALUE)>20) {
                 Log::info('登录IP重复过多阻拦自动免审:'.$value->OrderId);
                 continue;
             }
-            if ($AccountsInfoModel->sameLoginMacCount($value->UserID) > $sameCountCheck) {
+            if ($AccountsInfoModel->sameLoginMacCount($value->UserID) > $sameCountCheck && ($value->WithDraw/NumConfig::NUM_VALUE)>20) {
                 Log::info('MAC地址码重复阻拦自动免审:'.$value->OrderId);
                 continue;
             }
-            if(Cpf::getCpfCount($value->UserID)>$sameCountCheck){
-                Log::info("CPF重复阻拦自动免审:".$value->OrderId);
-                continue;
-            }
+
             // 读取免审配置
 //            $config = DB::table(TableName::agent().'withdrawal_position_config')->where('status', 1)->first();
             if (true) {
 
                 if($value->PixType == 2){
-                    $agent = 101;
+//                    $agent = 101;
+                    rand(1,100)>60?$agent = 99:$agent = 101;
                 }else{
                     if(($value->WithDraw/NumConfig::NUM_VALUE)<20){
                         $agent = 99;
                     }else{
-                        rand(1,100)>30?$agent = 99:$agent = 101;
-//                        $agent = 101;
+//                        rand(1,100)>30?$agent = 99:$agent = 101;
+                        $agent = 101;
                     }
                 }
 

+ 79 - 0
app/Console/Commands/RecordServerGameCountYesterday.php

@@ -6,6 +6,7 @@ use App\Facade\TableName;
 use Carbon\Carbon;
 use Illuminate\Console\Command;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Redis;
 
 class RecordServerGameCountYesterday extends Command
 {
@@ -55,5 +56,83 @@ class RecordServerGameCountYesterday extends Command
                 ->updateOrInsert(['DateID' => $DateID, 'GameID' => $value->GameID], ['DateID' => $DateID, 'GameID' => $value->GameID, 'Cnt' => $value->Cnt, 'UserCount' => $value->UserCount]);
         }
 
+        // 计算并更新游戏RTP数据
+        $this->calculateAndStoreGameRtp();
+    }
+
+    /**
+     * 计算并存储游戏RTP数据
+     * 从RecordGameRoomDayInfo和RoomStockDay两张表中获取最近60天的数据
+     * 根据GameID分类求和PayTotalBet和PayWinLost,计算RTP并存储到Redis
+     */
+    private function calculateAndStoreGameRtp()
+    {
+        try {
+            // 计算最近60天的DateID范围
+            $endDate = date('Ymd', strtotime('-1 day')); // 昨天
+            $startDate = date('Ymd', strtotime('-60 days')); // 60天前
+
+            // 使用JOIN查询两张表中DateID和GameID相同,SortID=1的数据
+            // 按GameID分组求和PayTotalBet和PayWinLost
+            $gameStats = DB::connection('write')
+                ->table(TableName::QPRecordDB() . 'RecordGameRoomDayInfo as r')
+                ->join(TableName::QPPlatformDB() . 'RoomStockDay as rs', function($join) {
+                    $join->on('r.DateID', '=', 'rs.DateID')
+                         ->on('r.GameID', '=', 'rs.GameID')
+                         ->on('r.SortID', '=', 'rs.SortID');
+                })
+                ->where('r.SortID', 1)
+                ->whereBetween('r.DateID', [$startDate, $endDate])
+                ->select(
+                    'r.GameID',
+                    DB::raw('SUM(r.PayTotalBet) as PayTotalBet'),
+                    DB::raw('SUM(rs.PayWinLost) as PayWinLost')
+                )
+                ->groupBy('r.GameID')
+                ->get();
+
+            // 计算所有数据的总和
+            $totalPayTotalBet = 0;
+            $totalPayWinLost = 0;
+            
+            foreach ($gameStats as $item) {
+                $totalPayTotalBet += ($item->PayTotalBet ?? 0);
+                $totalPayWinLost += ($item->PayWinLost ?? 0);
+            }
+            
+            // 计算所有数据相加的RTP值作为g0
+            $totalRtp = intval((($totalPayTotalBet - $totalPayWinLost) / max($totalPayTotalBet, 1)) * 100);
+            $gameRtp = ["g0" => $totalRtp];
+
+            // 计算每个GameID的RTP
+            foreach ($gameStats as $item) {
+                $gameId = $item->GameID;
+                $payTotalBet = $item->PayTotalBet ?? 0;
+                $payWinLost = $item->PayWinLost ?? 0;
+                
+                // RTP计算公式: ((PayTotalBet-PayWinLost)/max(PayTotalBet,1))*100
+                $rtp = intval((($payTotalBet - $payWinLost) / max($payTotalBet, 1)) * 100);
+                $rtp = ($rtp<=80)?80:$rtp;
+                $rtp = ($rtp>=120)?120:$rtp;
+                $gameRtp["g" . $gameId] = $rtp;
+            }
+
+            // 将结果存储到Redis的SomeConfigSpecial键中
+            Redis::set("SomeConfigSpecial", json_encode($gameRtp));
+
+//            $this->info('游戏RTP数据计算完成并已存储到Redis');
+            \Log::info('游戏RTP数据更新成功', [
+                'date_range' => [$startDate, $endDate],
+                'game_count' => count($gameRtp) - 1, // 减去默认的g0
+                'rtp_data' => $gameRtp
+            ]);
+
+        } catch (\Exception $e) {
+//            $this->error('计算游戏RTP数据时发生错误: ' . $e->getMessage());
+            \Log::error('计算游戏RTP数据失败', [
+                'error' => $e->getMessage(),
+                'trace' => $e->getTraceAsString()
+            ]);
+        }
     }
 }

+ 62 - 1
app/Http/Controllers/Admin/GameDataController.php

@@ -8,7 +8,6 @@ use App\Http\helper\NumConfig;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 
-
 class GameDataController extends Controller
 {
 
@@ -201,6 +200,68 @@ class GameDataController extends Controller
         return view('admin.game_data.gate_record', $data);
 
     }
+
+    /**
+     * 用户保护日志
+     * 数据来源:QPRecordDB.dbo.RecordProtectLogs
+     * 关联:AccountsInfo(GameID / RegisterDate / LastLogonDate)、GameKindItem(KindName)
+     */
+    public function protectLogs(Request $request)
+    {
+        $gameID   = (int)($request->get('GameID') ?: 0);
+        $vip      = $request->get('vip', ''); // ''=全部, '1'=付费保护, '0'=非付费
+        $start_date = $request->get('start_date', '');
+        $end_date   = $request->get('end_date', '');
+
+        $query = DB::connection('read')
+            ->table('QPRecordDB.dbo.RecordProtectLogs as rpl')
+            ->join('QPAccountsDB.dbo.AccountsInfo as ai', 'rpl.UserID', '=', 'ai.UserID')
+            ->leftJoin('QPPlatformDB.dbo.GameKindItem as gk', 'rpl.GameCode', '=', 'gk.KindID');
+
+        // 会员ID筛选(GameID)
+        if ($gameID) {
+            $query->where('ai.GameID', $gameID);
+        }
+
+        // 付费保护筛选
+        if ($vip !== '' && $vip !== null) {
+            $query->where('rpl.VIP', (int)$vip);
+        }
+
+        // 日期筛选(按保护时间 CreateTime)
+        if (!empty($start_date)) {
+            $query->where('rpl.CreateTime', '>=', $start_date . ' 00:00:00');
+        }
+        if (!empty($end_date)) {
+            $query->where('rpl.CreateTime', '<=', $end_date . ' 23:59:59');
+        }
+
+        $list = $query
+            ->selectRaw('rpl.*, ai.GameID, ai.RegisterDate, ai.LastLogonDate, gk.KindName')
+            ->orderByDesc('rpl.CreateTime')
+            ->paginate(20);
+
+        // 金额除以 100
+        foreach ($list as $item) {
+            $item->WinAmount = number_float($item->WinAmount / NumConfig::NUM_VALUE);
+        }
+
+        // VIP 选项
+        $vipOptions = [
+            ''  => '全部',
+            '1' => '付费保护',
+            '0' => '非付费保护',
+        ];
+
+        return view('admin.game_data.protect_logs', [
+            'list'       => $list,
+            'gameID'     => $gameID ?: '',
+            'vip'        => (string)$vip,
+            'vipOptions' => $vipOptions,
+            'start_date' => $start_date,
+            'end_date'   => $end_date,
+        ]);
+    }
     public function NewOlympusBuyRecord(Request $request)
     {
 

+ 1 - 1
app/Http/Controllers/Game/PayRechargeController.php

@@ -1180,7 +1180,7 @@ class PayRechargeController extends Controller
             ->select('Recharge', 'RechargeTimes')
             ->first();
 
-        $totalRecharge = (float)($stat->Recharge ?? 0) / NumConfig::NUM_VALUE; // 转换为元
+        $totalRecharge = (float)($stat->Recharge ?? 0); // 转换为元
         $rechargeTimes = (int)($stat->RechargeTimes ?? 0);
 
         if ($totalRecharge <= 0 || $rechargeTimes <= 0) {

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

@@ -52,7 +52,7 @@ class PagYeepPayLogic extends BaseApiLogic
             1 => '1204',
 //            2 => '1207',
             4 => '1205',
-//            8 => 'GOOGLE_PAY'
+            8 => '1208'
         ];
 
         $payType = @$payMethods[$pay_method] ?: '1204';

+ 17 - 0
app/Services/GlobalUser.php

@@ -605,6 +605,11 @@ class GlobalUser extends BaseApiLogic
     // 全局报表 - 游戏相关
     public function games($StartDataID, $EndDataID)
     {
+
+        $redis = \Illuminate\Support\Facades\Redis::connection();
+        $gameRtp =$redis->get("SomeConfigSpecial");
+        $gameRtp = json_decode($gameRtp,true);
+
         // 流水、输赢、彩金
         $gameInfo = DB::connection('read')->table('QPRecordDB.dbo.RecordUserTotalStatistics')
 //                      ->selectRaw('sum(TotalBet) as flowing_water,Isnull(sum(Revenue),0) as Revenue,IsNull((sum(LostScore) + sum(WinScore)),0) Score,Isnull(SUM(Handsel),0) as ChangeScore')
@@ -641,6 +646,8 @@ class GlobalUser extends BaseApiLogic
 
         $gameRoomInfo->free_win_lose = $gameRoomInfo->win_lose-$gameRoomInfo->pay_win_lose;
 
+
+
         // 游戏人数
         $totalGameCount = DB::table(TableName::QPRecordDB() . 'RecordUserGameDayCount')
             ->whereBetween('DateID', [$StartDataID, $EndDataID])
@@ -656,6 +663,8 @@ class GlobalUser extends BaseApiLogic
             $value = number_float($value / NumConfig::NUM_VALUE);
         }
         unset($value);
+
+        $gameRoomInfo->Rtp = @$gameRtp['g0'];
         if (!empty($gameRoomInfo)) {
             // 平台输赢 = 输赢 + 税收
 //            $gameRoomInfo->win_lose = $gameRoomInfo->win_lose;
@@ -691,6 +700,8 @@ class GlobalUser extends BaseApiLogic
 //        dd($gameList);
         $gamesorts=[];
         $revenueGames = config('games.revenueGames');
+
+//        dd($gameRtp);
         foreach ($gameList as &$value) {
             $value->ServerName = '';
             $value->flowing_water = is_null($value->flowing_water) ? 0 : number_float($value->flowing_water / NumConfig::NUM_VALUE);
@@ -727,6 +738,10 @@ class GlobalUser extends BaseApiLogic
                     $value->win_lose = is_null($val->Winlost) ? $value->win_lose : $value->win_lose + ($val->Winlost / NumConfig::NUM_VALUE);
                 }
             }
+
+            if(is_array($gameRtp)){
+                $value->Rtp = @$gameRtp['g'.$value->GameID]??'';
+            }
 //            if($value->SortID == 1){
 //                $chu += $value->flowing_water;
 //                $chu_n += $value->flowing_water_new;
@@ -760,6 +775,8 @@ class GlobalUser extends BaseApiLogic
             $oldvalue->free_win_lose += $value->free_win_lose;
             $oldvalue->free_flowing_water += $value->free_flowing_water;
 
+            $oldvalue->Rtp = $value->Rtp;
+
         }
         $gameList=array_values($gamesorts);
         $gameList=Util::arraySort($gameList,'flowing_water_new',SORT_DESC);

+ 108 - 0
resources/views/admin/game_data/protect_logs.blade.php

@@ -0,0 +1,108 @@
+@extends('base.base')
+@section('base')
+    <!-- Content Area -->
+    <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-settings"></i>
+                    </span>
+                    User Protect Logs
+                </h3>
+                <nav aria-label="breadcrumb">
+                    <ol class="breadcrumb">
+                        <li class="breadcrumb-item"><a href="#">Game Data</a></li>
+                        <li class="breadcrumb-item active" aria-current="page">User Protect Logs</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">User Protect Logs</h4>
+
+                            <form class="well form-inline margin-top-20" method="get" action="/admin/game_data/protect_logs">
+                                <div class="form-group">
+                                    <span style="padding-left: 10px">GameID:</span>
+                                    <input class="form-control" type="text" name="GameID" style="width: 10%;" value="{{ $gameID }}">
+
+                                    <span style="padding-left: 10px">VIP Protect:</span>
+                                    <select class="form-control" name="vip" style="color: black">
+                                        @foreach($vipOptions as $k => $text)
+                                            <option value="{{ $k }}" @if((string)$vip === (string)$k) selected @endif>
+                                                {{ $text }}
+                                            </option>
+                                        @endforeach
+                                    </select>
+
+                                    <span style="padding-left: 10px">Start Date:</span>
+                                    <input type="date" name="start_date" class="form-control" value="{{ $start_date }}"/>
+
+                                    <span style="padding-left: 10px">End Date:</span>
+                                    <input type="date" name="end_date" class="form-control" value="{{ $end_date }}"/>
+
+                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="Search"/>&nbsp;&nbsp;
+                                    <a href="/admin/game_data/protect_logs" class="btn btn-sm btn-gradient-warning btn-icon-text">Reset</a>
+                                </div>
+                            </form>
+
+                            <table class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th>GameID</th>
+                                    <th>Register Time</th>
+                                    <th>Last Login Time</th>
+                                    <th>VIP Protect</th>
+                                    <th>Win Amount</th>
+                                    <th>Multiplier</th>
+                                    <th>Protect Time</th>
+                                    <th>Game</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                @foreach($list as $item)
+                                    <tr>
+                                        <td>
+                                            <a href="/admin/global/id_find?UserID={{ $item->UserID }}">
+                                                {{ $item->GameID }}
+                                            </a>
+                                        </td>
+                                        <td>{{ $item->RegisterDate }}</td>
+                                        <td>{{ $item->LastLogonDate }}</td>
+                                        <td>
+                                            @if($item->VIP)
+                                                <span class="badge badge-danger">VIP</span>
+                                            @else
+                                                <span class="badge badge-secondary">No</span>
+                                            @endif
+                                        </td>
+                                        <td>{{ $item->WinAmount }}</td>
+                                        <td>{{ $item->Multiplier }}</td>
+                                        <td>{{ $item->CreateTime }}</td>
+                                        <td>{{ $item->KindName ?? '' }} @if($item->GameCode) ({{ $item->GameCode }}) @endif</td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+
+                            <div class="box-footer clearfix" id="pages">
+                                Total <b>{{ $list->appends([
+                                        'GameID'     => $gameID,
+                                        'vip'        => $vip,
+                                        'start_date' => $start_date,
+                                        'end_date'   => $end_date,
+                                    ])->total() }}</b> records, <b>{{ $list->lastPage() }}</b> pages
+                                {!! $list->links() !!}
+                            </div>
+
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection
+

+ 3 - 0
resources/views/admin/global/index.blade.php

@@ -116,6 +116,7 @@
                                         <td>{{ __('auto.免费游戏人数') }}</td>
                                         <td style="background-color: #f5f5f5">付费{{ __('auto.流水') }}</td>
                                         <td style="background-color: #f5f5f5">付费{{ __('auto.返奖率') }}</td>
+                                        <td style="background-color: #f5f5f5">付费{{ __('auto.返奖率') }}(历史)</td>
                                         <td style="background-color: #f5f5f5">付费{{ __('auto.游戏人数') }}</td>
                                     </tr>
                                     <tr>
@@ -126,6 +127,7 @@
 
                                         <td  style="background-color: #f5f5f5">{{$games['gameRoomInfo']->pay_flowing_water_new?? 0}}</td>
                                         <td  style="background-color: #f5f5f5">{{number_format((($games['gameRoomInfo']->pay_flowing_water_new?? 0)-($games['gameRoomInfo']->pay_win_lose ?? 0))/max(1,$games['gameRoomInfo']->pay_flowing_water_new?? 0)*100,1)}}%</td>
+                                        <td style="background-color: #f5f5f5">{{$games['gameRoomInfo']->Rtp?? 0}}%</td>
                                         <td style="background-color: #f5f5f5">{{$games['pay_totalGameCount']}}</td>
                                     </tr>
                                     @foreach($games['gameList'] as $k=>$v)
@@ -138,6 +140,7 @@
 
                                             <td style="background-color: #f5f5f5">{{$v->pay_flowing_water_new}}</td>
                                             <td style="background-color: #f5f5f5">{{number_format(($v->pay_flowing_water_new-$v->pay_win_lose)/max(1,$v->pay_flowing_water_new)*100,1)}}%</td>
+                                            <td style="background-color: #f5f5f5">{{$v->Rtp}}%</td>
                                             <td style="background-color: #f5f5f5">{{$v->pay_Cnt}}</td>
                                         </tr>
                                     @endforeach

+ 2 - 0
routes/web.php

@@ -88,6 +88,8 @@ Route::group([
         $route->any('/game_data/NewolyBuyRecord','Admin\GameDataController@NewOlympusBuyRecord');
         $route->any('/game_data/RabbitBuyRecord','Admin\GameDataController@RabbitBuyRecord');
         $route->any('/game_data/fishBuyRecord','Admin\GameDataController@fishBuyRecord');
+        // 用户保护日志
+        $route->any('/game_data/protect_logs','Admin\GameDataController@protectLogs');
         $route->get('callback/make', 'Admin\AccCallbackController@make');
         $route->get('callback/tempsend', 'Admin\AccCallbackController@sendBonusToAll');
         $route->get('dataview', 'Admin\GameDataController@userOnlineView');