Sfoglia il codice sorgente

1、充值筛选
2、增加邮件freebonus支持
3、异常cookie支持

Tree 2 settimane fa
parent
commit
fdaa5391cf

+ 1 - 1
app/Http/Controllers/Admin/ExchangeController.php

@@ -622,7 +622,7 @@ class ExchangeController extends Controller
 //        $prop = DB::connection('write')->table('QPAccountsDB.dbo.YN_MatchProp')->select('PropID','PropName')->get()->toArray();
 //        $data = array_merge($prize,$prop);
         //$data = $prize;
-        $data = [['PropID'=>30000,'PropName'=>'金币']];
+        $data = [['PropID'=>30000,'PropName'=>'金币'],['PropID'=>31000,'PropName'=>'免费币']];
 
 //        $data = [['PropID'=>31000,'PropName'=>'免费币']];
         return response()->json($data);

+ 2 - 4
app/Http/Controllers/Admin/MailController.php

@@ -80,6 +80,7 @@ class MailController extends Controller
                 ->orderBy('MailID', 'desc')
                 ->paginate(10);
         }
+        $gift = [30000 => '金币',31000 => '免费币'];
         foreach ($list as $key => &$value) {
             if (!empty($value->BonusString)) {
                 $bonus = $value->BonusString;
@@ -87,7 +88,7 @@ class MailController extends Controller
                 $value->BonusString = '';
                 foreach ($bonus as $k => &$v) {
                     $v = explode(',', $v);
-                    $value->BonusString .=  '金币x' . ($v[1] / 100) . ',';
+                    $value->BonusString .=  $gift[$v[0]] . ($v[1] / 100) . ',';
                 }
             }
         }
@@ -150,9 +151,6 @@ class MailController extends Controller
                     return $this->json(500, '彩金额度不足');
                 }
                 $change_score = $value['number'];
-                if (!preg_match('/^\d+$/', $change_score)) {
-                    return $this->json(500, '金额必须是整数');
-                }
 
                 $value['number'] = $value['number'] * 100;
                 $bonus .= implode(',', $value) . ';';

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

@@ -45,6 +45,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,32 +172,68 @@ 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;
@@ -297,8 +335,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,

+ 13 - 6
app/Http/Controllers/Game/MailController.php

@@ -129,6 +129,7 @@ class MailController extends Controller
                 return apiReturnFail(['web.mail.mail_gift_taken','The attachment of the email has been received']);
             }
             $GiftScore=0;
+            $FreeScore=0;
             if (!empty($mail->BonusString)) {
                 $bonus = $mail->BonusString;
                 $bonus = explode(';', $bonus);
@@ -139,10 +140,14 @@ class MailController extends Controller
                         $GiftScore+=$v[1] ;
                         $mail->BonusString .=  '$' . ($v[1] / 100) . ',';
                     }
+                    if($v[0]=='31000'){
+                        $FreeScore+=$v[1] ;
+                        $mail->BonusString .=  '$' . ($v[1] / 100) . ',';
+                    }
                 }
             }
 //            dd($GiftScore);
-            if(!$GiftScore){
+            if(!$GiftScore && !$FreeScore){
                 return ApiReturnFail(['web.mail.mail_has_nomoney','The mail does not have money!']);
             }
 
@@ -163,15 +168,17 @@ class MailController extends Controller
             $UserID=$user->UserID;
 
 
-
-           [$OrgScore,$NowScore]=OuroGameService::AddScore($user->UserID,$GiftScore,$Reason);
+            if($GiftScore)
+                [$OrgScore,$NowScore]=OuroGameService::AddScore($user->UserID,$GiftScore,$Reason);
+            if($FreeScore)
+                [$OrgScore,$NowScore]=OuroGameService::AddFreeScore($user->UserID,$FreeScore,$Reason);
 
             if($FromType==2&&$Amount>0){
                 AccountWithDrawInfo::where('UserID', $user->UserID)->update(['Win'=>DB::raw('Win+'.$Amount),'HistoryWithDraw'=>DB::raw('HistoryWithDraw-'.$Amount)]);
             }
-           if($DrawBase){
-               OuroGameService::AddDrawBase($UserID,$DrawBase,0);
-           }
+            if($DrawBase){
+                OuroGameService::AddDrawBase($UserID,$DrawBase,0);
+            }
             // 增加用户金币
 //            DB::connection('sqlsrv')->select("SET NOCOUNT ON use QPAccountsDB exec GSP_GR_PrivateMail_Update $MailID,$UserID,2");
             //0其它 1充值 2提现 3彩金

+ 1 - 0
app/Http/Controllers/Game/WebRouteController.php

@@ -484,6 +484,7 @@ class WebRouteController extends Controller
                         ->first();
                 }
             }catch (\Exception $e) {
+                Util::WriteLog('invalid_cookie',$fbclid);
                 $obj = null;
             }
 

+ 13 - 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>
@@ -299,7 +308,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 +340,7 @@
             'source' : '{{$source}}',
             'chargeMoney' : '{{$chargeMoney}}',
             'payMethod' : '{{$payMethod}}',
+            'operator_admin_id' : '{{ $operator_admin_id ?? '' }}',
         }
 
         function start_times(id) {