Tree 3 недель назад
Родитель
Сommit
571f801f68

+ 25 - 0
app/Game/Services/OuroGameService.php

@@ -83,6 +83,31 @@ class OuroGameService
 
         return [$OrgScore,$NowScore];
     }
+
+
+
+    public static function AddFreeScore($UserID,$GiftScore,$reason=null,$notify=true)
+    {
+        $vip = DB::table(TableName::QPAccountsDB() . 'YN_VIPAccount')
+            ->where('UserID', $UserID)
+            ->value('Recharge') ?: 0;
+        if($vip){
+            // 增加用户金币
+            $OrgScore = DB::table('QPTreasureDB.dbo.GameScoreInfo')->where('UserID', $UserID)->value('InsureScore');
+            DB::table('QPTreasureDB.dbo.GameScoreInfo')->where('UserID', $UserID)->increment('InsureScore',$GiftScore);
+            $NowScore=$OrgScore+$GiftScore;
+        }else{
+            // 增加用户金币
+            $OrgScore = DB::table('QPTreasureDB.dbo.GameScoreInfo')->where('UserID', $UserID)->value('Score');
+            DB::table('QPTreasureDB.dbo.GameScoreInfo')->where('UserID', $UserID)->increment('Score',$GiftScore);
+            $NowScore=$OrgScore+$GiftScore;
+        }
+
+
+        return [$OrgScore,$NowScore];
+    }
+
+
     public static function AddDrawBase($UserID, $draw_base, $act_no=2)
     {
         // 增加可提额度

+ 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'=>'免费币']];
         return response()->json($data);
     }
 

+ 2 - 1
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) . ',';
                 }
             }
         }

+ 10 - 3
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,8 +168,10 @@ 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)]);

+ 75 - 0
resources/views/admin/game_data/participation_statistics.blade.php

@@ -0,0 +1,75 @@
+@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-chart-line"></i>
+                    </span>
+                    {{ __('auto.游戏参与情况统计') }}
+                </h3>
+                <nav aria-label="breadcrumb">
+                    <ol class="breadcrumb">
+                        <li class="breadcrumb-item"><a href="#">{{ __('auto.游戏数据') }}</a></li>
+                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.游戏参与情况统计') }}</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">{{ __('auto.游戏参与情况统计') }}</h4>
+                            <form class="well form-inline margin-top-20" method="get" action="">
+                                <span style="padding-left: 10px">{{ __('auto.注册时间:') }}</span>
+                                <input type="date" name="start_date" class="form-control" value="{{ $start_date }}" />
+                                <span style="padding-left: 10px">{{ __('auto.至') }}</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="{{ __('auto.搜索') }}"/>&nbsp;&nbsp;
+                                <a href="/admin/game_data/participation_statistics" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>
+                            </form>
+                            <br>
+                            <table class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th width="10%">{{ __('auto.GameID尾号') }}</th>
+                                    <th width="30%">{{ __('auto.尾号对应的游戏') }}</th>
+                                    <th width="15%">{{ __('auto.注册人数') }}</th>
+                                    <th width="15%">{{ __('auto.参与游戏人数') }}</th>
+                                    <th width="15%">{{ __('auto.参游率') }}</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                @foreach($statistics as $stat)
+                                    <tr>
+                                        <td>{{ $stat['last_digit'] }}</td>
+                                        <td>{{ $stat['game_name'] }}</td>
+                                        <td>{{ $stat['register_count'] }}</td>
+                                        <td>{{ $stat['played_count'] }}</td>
+                                        <td>
+                                            @if($stat['register_count'] > 0)
+                                                <span class="badge badge-{{ $stat['participation_rate'] >= 50 ? 'success' : ($stat['participation_rate'] >= 30 ? 'warning' : 'danger') }}">
+                                                    {{ $stat['participation_rate'] }}%
+                                                </span>
+                                            @else
+                                                <span class="badge badge-secondary">-</span>
+                                            @endif
+                                        </td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                            @if(count($statistics) == 0)
+                                <div class="alert alert-info">
+                                    <p>{{ __('auto.暂无统计数据,请选择其他时间范围。') }}</p>
+                                </div>
+                            @endif
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection