Kaynağa Gözat

add pwa 奖励领取记录
支付陈功率计算

Tree 2 hafta önce
ebeveyn
işleme
8866ac1d02

+ 38 - 0
app/Http/Controllers/Admin/PwaBonusLogController.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Http\Controllers\Controller;
+use App\Models\PwaBonusLog;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+
+class PwaBonusLogController extends Controller
+{
+    public function index(Request $request)
+    {
+        $logDate = $request->input('log_date', '');
+        $gameId = $request->input('game_id', '');
+        $page = $request->input('page', 1);
+
+        $query = DB::table(PwaBonusLog::TABLE);
+
+        if (!empty($logDate)) {
+            $query->where('log_date', $logDate);
+        }
+
+        if ($gameId !== '' && $gameId !== null) {
+            $query->where('GameID', (int) $gameId);
+        }
+
+        $query->orderBy('created_at', 'desc');
+
+        $list = $query->paginate(20, ['*'], 'page', $page);
+
+        return view('admin.pwa_bonus_log.index', [
+            'list' => $list,
+            'log_date' => $logDate,
+            'game_id' => $gameId,
+        ]);
+    }
+}

+ 10 - 0
app/Http/Controllers/Admin/RechargeController.php

@@ -237,6 +237,14 @@ class RechargeController extends Controller
         }
 
         $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
@@ -364,6 +372,8 @@ class RechargeController extends Controller
                 'overMoney' => $overMoney,
                 'payOverMoney' => $payOverMoney ?? 0,
                 'payTotalMoney' => $payTotalMoney,
+                'successUserRate' => $successUserRate,
+                'successOrderRate' => $successOrderRate,
                 'date' => $date,
                 'dates' => $dates,
                 'allChannel' => $allChannel,

+ 11 - 0
app/Http/Controllers/Game/LoginController.php

@@ -19,6 +19,7 @@ use App\Jobs\AfEvent;
 use App\Models\Account\AccountPhone;
 use App\Models\AccountsInfo;
 use App\Models\GamePhoneVerityCode;
+use App\Models\PwaBonusLog;
 use App\Models\SystemStatusInfo;
 use App\Models\Treasure\GameScoreInfo;
 use App\Notification\TelegramBot;
@@ -633,6 +634,16 @@ class LoginController extends Controller
             $data=GlobalUserInfo::toWebData($user);
             $data['Score']=$NowScore;
             Redis::del('pwa_bonus:'.$user->UserID);
+            PwaBonusLog::addLog([
+                'userID' => $user->UserID,
+                'GameID' => $user->GameID,
+                'Channel' => $user->Channel,
+                'bonus_amount' => $config->BONUS_PWA(),
+                'org_score' => $OrgScore,
+                'now_score' => $NowScore,
+                'ip' => $request->ip(),
+                'log_date' => date('Y-m-d'),
+            ]);
 
             if(date('Ymd',strtotime($user->RegisterDate)) == date('Ymd')){
                 $RecordPlatformDataModel = new \App\Models\RecordPlatformData();

+ 41 - 0
app/Models/PwaBonusLog.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class PwaBonusLog extends Model
+{
+    const TABLE = 'agent.dbo.pwa_bonus_log';
+    protected $table = self::TABLE;
+    public $timestamps = false;
+
+    protected $fillable = [
+        'userID',
+        'GameID',
+        'Channel',
+        'bonus_amount',
+        'org_score',
+        'now_score',
+        'ip',
+        'log_date',
+        'created_at',
+    ];
+
+    public static function addLog(array $data)
+    {
+        $logData = [
+            'userID' => $data['userID'] ?? null,
+            'GameID' => $data['GameID'] ?? 0,
+            'Channel' => $data['Channel'] ?? null,
+            'bonus_amount' => $data['bonus_amount'] ?? 0,
+            'org_score' => $data['org_score'] ?? 0,
+            'now_score' => $data['now_score'] ?? 0,
+            'ip' => $data['ip'] ?? null,
+            'log_date' => $data['log_date'] ?? date('Y-m-d'),
+            'created_at' => date('Y-m-d H:i:s'),
+        ];
+
+        return self::insert($logData);
+    }
+}

+ 78 - 0
resources/views/admin/pwa_bonus_log/index.blade.php

@@ -0,0 +1,78 @@
+@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-gift"></i>
+                    </span>
+                    PWA Bonus Log
+                </h3>
+                <nav aria-label="breadcrumb">
+                    <ol class="breadcrumb">
+                        <li class="breadcrumb-item"><a href="#">Log Management</a></li>
+                        <li class="breadcrumb-item active" aria-current="page">PWA Bonus Log</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">PWA Bonus Receive Records</h4>
+                            <form class="well form-inline margin-top-20" method="get" action='/admin/pwa_bonus_log'>
+                                <div>
+                                    <span style="padding-left: 10px">Date:</span>
+                                    <input type="date" name="log_date" class="form-control" value="{{$log_date}}" />
+                                    <span style="padding-left: 10px">GameID:</span>
+                                    <input class="form-control" type="text" name="game_id" style="width: 12%;" value="{{$game_id}}" placeholder="GameID">
+                                </div>
+                                <div style="margin-top: 10px;">
+                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="Search"/>&nbsp;&nbsp;
+                                    <a href="/admin/pwa_bonus_log" class="btn btn-sm btn-gradient-warning btn-icon-text">Clear</a>
+                                </div>
+                            </form>
+                            <table class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th>ID</th>
+                                    <th>GameID</th>
+                                    <th>UserID</th>
+                                    <th>Channel</th>
+                                    <th>Bonus</th>
+                                    <th>Org Score</th>
+                                    <th>Now Score</th>
+                                    <th>IP</th>
+                                    <th>Log Date</th>
+                                    <th>Created At</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                @foreach($list as $v)
+                                    <tr>
+                                        <td>{{ $v->id }}</td>
+                                        <td>{{ $v->GameID ?? '-' }}</td>
+                                        <td>{{ $v->userID ?? '-' }}</td>
+                                        <td>{{ $v->Channel ?? '-' }}</td>
+                                        <td>{{ $v->bonus_amount ?? 0 }}</td>
+                                        <td>{{ $v->org_score ?? 0 }}</td>
+                                        <td>{{ $v->now_score ?? 0 }}</td>
+                                        <td>{{ $v->ip ?? '-' }}</td>
+                                        <td>{{ $v->log_date }}</td>
+                                        <td>{{ $v->created_at }}</td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                            <div class="box-footer clearfix">
+                                Total <b>{{ $list->appends(['log_date'=>$log_date,'game_id'=>$game_id])->total() }}</b> records, divided into <b>{{ $list->lastPage() }}</b> pages
+                                {!! $list->links() !!}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection

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

@@ -216,6 +216,8 @@
                                         @if(!empty($viewAll))
                                             <h4>{{ __('auto.手续费汇总:') }}{{ $totalPaymentFee ?? 0 }}</h4>
                                         @endif
+                                        <h4>充值成功人数百分比:{{ $successUserRate ?? 0 }}%</h4>
+                                        <h4>充值成功笔数百分比:{{ $successOrderRate ?? 0 }}%</h4>
                                     </div>
                                 @endif
 

+ 1 - 0
routes/web.php

@@ -100,6 +100,7 @@ Route::group([
         // 客户端日志查询
         $route->get('/client_log', 'Admin\ClientLogController@index')->defaults('name', '客户端日志');
         $route->any('/client_log/query', 'Admin\ClientLogController@query');
+        $route->get('/pwa_bonus_log', 'Admin\PwaBonusLogController@index')->defaults('name', 'PWA奖励日志');
 //        $route->any('/game_data/GateBuyRecord','Admin\GameDataController@GateBuyRecord');
 //        $route->any('/game_data/GateBuyRecord','Admin\GameDataController@GateBuyRecord');