Browse Source

no message

Tree 1 week ago
parent
commit
ba9f264b01

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

@@ -600,13 +600,15 @@ class GlobalController extends Controller
         $adminChannels = session('admin_channels');
         $channel = $request->channel;
         $channels = $adminChannels;
+        $sortRegister = $request->sortRegister ?: '';
+        $sortLogin = $request->sortLogin ?: '';
 
-        $list = (new GlobalUser())->rechargeRankList($channel);
+        $list = (new GlobalUser())->rechargeRankList($channel, $sortRegister, $sortLogin);
 
         $page = \Illuminate\Pagination\Paginator::resolveCurrentPage('page');
 
         return view('admin.global.recharge_rank', compact(
-            'list', 'channel', 'channels', 'page'
+            'list', 'channel', 'channels', 'page', 'sortRegister', 'sortLogin'
         ));
     }
 

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

@@ -1303,6 +1303,9 @@ class LoginController extends Controller
         $ReferrType = 0;
         if ($ActCode) {
             //使用邀请的Code来保持邀请被邀请的用户注册渠道一致性
+            if (strlen($ActCode) > 6) {
+                $ActCode = substr($ActCode, 0, 6);
+            }
             $link = AgentLinks::getByCode($ActCode);
             if ($link) {
                 $inviter = AccountsInfo::where('UserID', $link->UserID)->first();

+ 4 - 6
app/Models/Order.php

@@ -101,26 +101,24 @@ class Order extends Model
     //d0新增付费人数
     public static function d0_day_pay()
     {
-        $pay = DB::connection('read')->table('agent.dbo.order as a')
+        $pay = DB::connection('read')->table(DB::raw('agent.dbo.order as a WITH (NOLOCK)'))
             ->selectRaw('
             cast(sum(a.amount)/100 as int) as d0_pay_num ,
             count(DISTINCT a.user_id) as day_pay_count,
             a.Channel')
-            ->leftJoin("QPAccountsDB.dbo.AccountsInfo as ai","ai.UserID","=","a.user_id")
+            ->leftJoin(DB::raw('QPAccountsDB.dbo.AccountsInfo as ai WITH (NOLOCK)'), 'ai.UserID', '=', 'a.user_id')
             ->whereRaw('RegisterDate>=CONVERT(varchar(10),GETDATE(),120) and a.pay_at>CONVERT(varchar(10),GETDATE(),120)')
-            ->lock('with(nolock)')
             ->groupBy('a.Channel')->get()->toArray();
 
-        $withdraw = DB::connection('read')->table('QPAccountsDB.dbo.OrderWithDraw as ow')
+        $withdraw = DB::connection('read')->table(DB::raw('QPAccountsDB.dbo.OrderWithDraw as ow WITH (NOLOCK)'))
             ->selectRaw('
              sum(cast(ow.WithDraw as int))/100  payout,
              sum(cast(ow.ServiceFee as int))/100 fee,
              count(ow.RecordID)               payout_count,
              count(distinct (ow.UserID))    payout_user_count,
              ai.Channel')
-            ->leftJoin("QPAccountsDB.dbo.AccountsInfo as ai","ai.UserID","=","ow.UserID")
+            ->leftJoin(DB::raw('QPAccountsDB.dbo.AccountsInfo as ai WITH (NOLOCK)'), 'ai.UserID', '=', 'ow.UserID')
             ->whereRaw('RegisterDate>=CONVERT(varchar(10),GETDATE(),120) ')
-            ->lock('with(nolock)')
             ->groupBy('ai.Channel')->get()->toArray();
         $result=[];
         foreach ($pay as $value){

+ 21 - 15
app/Services/GlobalUser.php

@@ -66,11 +66,12 @@ class GlobalUser extends BaseApiLogic
         $StatusValue = DB::connection('read')->table('QPAccountsDB.dbo.SystemStatusInfo')
             ->where('StatusName', 'WithDrawPoint')
             ->select('StatusValue')
+            ->lock('with(nolock)')
             ->first()->StatusValue ?? 0;
         $adminChannels=session('admin_channels');
         $field = ['ai.GameID', 'ai.UserID', 'ai.SpreaderID', 'ai.NickName', 'ai.MemberOrder', 'ai.Nullity', 'ai.WebLogonTimes', 'ai.LastLogonIP', 'ai.LastLogonDate', 'ai.LastLogonMobile', 'ai.RegisterIP', 'ai.RegisterDate', 'ai.Channel', 'gi.Score', 'gi.InsureScore', 'gi.MaxScore', 'gi.MaxWinScore'];
-        $Sql = DB::connection('read')->table(TableName::QPAccountsDB() . 'AccountsInfo as ai')
-            ->leftJoin(TableName::QPTreasureDB() . 'GameScoreInfo as gi', 'ai.UserID', 'gi.UserID')
+        $Sql = DB::connection('read')->table(DB::raw(TableName::QPAccountsDB() . 'AccountsInfo as ai WITH (NOLOCK)'))
+            ->leftJoin(DB::raw(TableName::QPTreasureDB() . 'GameScoreInfo as gi WITH (NOLOCK)'), 'ai.UserID', 'gi.UserID')
             ->where('ai.IsAndroid', 0)
             ->select($field);
         if(count($adminChannels)<5)$Sql=$Sql->whereIn('ai.Channel', $adminChannels);
@@ -352,12 +353,13 @@ class GlobalUser extends BaseApiLogic
         $StatusValue = DB::connection('read')->table('QPAccountsDB.dbo.SystemStatusInfo')
             ->where('StatusName', 'WithDrawPoint')
             ->select('StatusValue')
+            ->lock('with(nolock)')
             ->first()->StatusValue ?? 0;
         $where = [];
         $field = ['ai.GameID', 'ai.UserID', 'ai.SpreaderID', 'ai.NickName', 'ai.MemberOrder', 'ai.Nullity', 'ai.WebLogonTimes', 'ai.LastLogonIP', 'ai.LastLogonDate', 'ai.RegisterIP', 'ai.RegisterDate', 'ai.Channel', 'gi.Score'];
-        $Sql = DB::connection('read')->table(TableName::QPAccountsDB() . 'AccountsInfo as ai')
+        $Sql = DB::connection('read')->table(DB::raw(TableName::QPAccountsDB() . 'AccountsInfo as ai WITH (NOLOCK)'))
             ->where('ai.IsAndroid', 0)
-            ->leftJoin(TableName::QPTreasureDB() . 'GameScoreInfo as gi', 'ai.UserID', 'gi.UserID')
+            ->leftJoin(DB::raw(TableName::QPTreasureDB() . 'GameScoreInfo as gi WITH (NOLOCK)'), 'ai.UserID', 'gi.UserID')
             ->select($field);
 
         if (!empty($GameID))
@@ -575,24 +577,20 @@ class GlobalUser extends BaseApiLogic
     /**
      * 充值排行榜:总充值>100 且 提现/充值<35%
      */
-    public function rechargeRankList($channel)
+    public function rechargeRankList($channel, $sortRegister = '', $sortLogin = '')
     {
         $AccountsInfoM = new AccountsInfo();
         $minRecharge = 100;
 
-        $field = [
-            'ai.GameID', 'ai.UserID', 'ai.NickName', 'ai.Channel',
-            'ai.RegisterDate', 'ai.LastLogonDate',
-            'gi.Score',
-            'rut.Recharge', 'rut.Withdraw',
-        ];
+        $numVal = NumConfig::NUM_VALUE;
+        $giTable = TableName::QPTreasureDB() . 'GameScoreInfo';
         $Sql = DB::connection('read')->table(TableName::QPAccountsDB() . 'AccountsInfo as ai')
             ->join(TableName::QPRecordDB() . 'RecordUserTotalStatistics as rut', 'ai.UserID', 'rut.UserID')
-            ->leftJoin(TableName::QPTreasureDB() . 'GameScoreInfo as gi', 'ai.UserID', 'gi.UserID')
             ->where('ai.IsAndroid', 0)
             ->where('rut.Recharge', '>', $minRecharge)
-            ->whereRaw('rut.Withdraw * 1.0 / (rut.Recharge * ' . NumConfig::NUM_VALUE . ') < 0.35')
-            ->select($field);
+            ->whereRaw("rut.Withdraw * 1.0 / (rut.Recharge * {$numVal}) < 0.35")
+            ->distinct()
+            ->selectRaw("ai.GameID, ai.UserID, ai.NickName, ai.Channel, ai.RegisterDate, ai.LastLogonDate, (select top 1 Score from {$giTable} where UserID = ai.UserID) as Score, rut.Recharge, rut.Withdraw");
 
         if (!empty($channel) || $channel === '0') {
             $Sql->where('ai.Channel', $channel);
@@ -603,7 +601,15 @@ class GlobalUser extends BaseApiLogic
             $Sql->whereIn('ai.Channel', $adminChannels);
         }
 
-        $list = $Sql->orderByRaw('rut.Recharge desc')->paginate(15);
+        if (!empty($sortRegister) && in_array($sortRegister, ['asc', 'desc'])) {
+            $Sql->orderBy('ai.RegisterDate', $sortRegister);
+        } elseif (!empty($sortLogin) && in_array($sortLogin, ['asc', 'desc'])) {
+            $Sql->orderBy('ai.LastLogonDate', $sortLogin);
+        } else {
+            $Sql->orderByRaw('rut.Recharge desc');
+        }
+
+        $list = $Sql->paginate(15);
 
         $UserIDs = [];
         foreach ($list as $value) {

+ 56 - 2
resources/views/admin/global/recharge_rank.blade.php

@@ -48,8 +48,40 @@
                                     <th width="8%">总充值</th>
                                     <th width="8%">总提现</th>
                                     <th width="6%">提/充比</th>
-                                    <th width="10%">{{ __('auto.注册时间') }}</th>
-                                    <th width="10%">最后登录时间</th>
+                                    <th width="10%">
+                                        <div class="sort_register">
+                                            {{ __('auto.注册时间') }}
+                                            <svg t="1611284352657" class="icon2" onclick="sortFunc('sortRegister','asc')"
+                                                 viewBox="0 0 1024 1024" version="1.1"
+                                                 xmlns="http://www.w3.org/2000/svg" p-id="4118" width="14">
+                                                <path d="M541.866667 285.866667l345.6 345.6c17.066667 17.066667 17.066667 42.666667 0 59.733333-8.533333 8.533333-19.2 12.8-29.866667 12.8H168.533333c-23.466667 0-42.666667-19.2-42.666666-42.666667 0-10.666667 4.266667-21.333333 12.8-29.866666l343.466666-345.6c17.066667-17.066667 42.666667-17.066667 59.733334 0z"
+                                                      p-id="4119" fill="{{ ($sortRegister ?? '') === 'asc' ? 'red' : '#707072' }}"></path>
+                                            </svg>
+                                            <svg t="1611283709864" class="icon1" onclick="sortFunc('sortRegister','desc')"
+                                                 viewBox="0 0 1024 1024" version="1.1"
+                                                 xmlns="http://www.w3.org/2000/svg" p-id="3148" width="14">
+                                                <path d="M482.133333 738.133333L136.533333 392.533333c-17.066667-17.066667-17.066667-42.666667 0-59.733333 8.533333-8.533333 19.2-12.8 29.866667-12.8h689.066667c23.466667 0 42.666667 19.2 42.666666 42.666667 0 10.666667-4.266667 21.333333-12.8 29.866666L541.866667 738.133333c-17.066667 17.066667-42.666667 17.066667-59.733334 0z"
+                                                      p-id="3149" fill="{{ ($sortRegister ?? '') === 'desc' ? 'red' : '#707071' }}"></path>
+                                            </svg>
+                                        </div>
+                                    </th>
+                                    <th width="10%">
+                                        <div class="sort_login">
+                                            最后登录时间
+                                            <svg t="1611284352657" class="icon2" onclick="sortFunc('sortLogin','asc')"
+                                                 viewBox="0 0 1024 1024" version="1.1"
+                                                 xmlns="http://www.w3.org/2000/svg" p-id="4118" width="14">
+                                                <path d="M541.866667 285.866667l345.6 345.6c17.066667 17.066667 17.066667 42.666667 0 59.733333-8.533333 8.533333-19.2 12.8-29.866667 12.8H168.533333c-23.466667 0-42.666667-19.2-42.666666-42.666667 0-10.666667 4.266667-21.333333 12.8-29.866666l343.466666-345.6c17.066667-17.066667 42.666667-17.066667 59.733334 0z"
+                                                      p-id="4119" fill="{{ ($sortLogin ?? '') === 'asc' ? 'red' : '#707072' }}"></path>
+                                            </svg>
+                                            <svg t="1611283709864" class="icon1" onclick="sortFunc('sortLogin','desc')"
+                                                 viewBox="0 0 1024 1024" version="1.1"
+                                                 xmlns="http://www.w3.org/2000/svg" p-id="3148" width="14">
+                                                <path d="M482.133333 738.133333L136.533333 392.533333c-17.066667-17.066667-17.066667-42.666667 0-59.733333 8.533333-8.533333 19.2-12.8 29.866667-12.8h689.066667c23.466667 0 42.666667 19.2 42.666666 42.666667 0 10.666667-4.266667 21.333333-12.8 29.866666L541.866667 738.133333c-17.066667 17.066667-42.666667 17.066667-59.733334 0z"
+                                                      p-id="3149" fill="{{ ($sortLogin ?? '') === 'desc' ? 'red' : '#707071' }}"></path>
+                                            </svg>
+                                        </div>
+                                    </th>
                                     <th width="10%">{{ __('auto.控制状态') }}</th>
                                     <th width="8%">{{ __('auto.用户控制') }}</th>
                                 </tr>
@@ -101,6 +133,8 @@
                         <div class="box-footer clearfix" id="pages">
                             {{ __('auto.总共') }} <b>{{ $list->appends([
                                     'channel' => $channel,
+                                    'sortRegister' => $sortRegister ?? '',
+                                    'sortLogin' => $sortLogin ?? '',
                                 ])->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                             {!! $list->links() !!}
                         </div>
@@ -110,6 +144,26 @@
         </div>
     </div>
     <script>
+        var currentSort = {
+            sortRegister: '{{ $sortRegister ?? '' }}',
+            sortLogin: '{{ $sortLogin ?? '' }}'
+        };
+
+        function sortFunc(field, dir) {
+            var params = new URLSearchParams(window.location.search);
+            params.delete('sortRegister');
+            params.delete('sortLogin');
+            params.delete('page');
+
+            if (currentSort[field] === dir) {
+                // already active => cancel sort
+            } else {
+                params.set(field, dir);
+            }
+
+            window.location.href = '/admin/global/recharge_rank?' + params.toString();
+        }
+
         function update(id) {
             var page = layer.open({
                 type: 2,

+ 1 - 0
resources/views/admin/web_channel_config/edit.blade.php

@@ -94,6 +94,7 @@
                                     <label>PlatformName --- {{__('auto.平台名称')}}</label>
                                     <select class="form-control" name="PlatformName">
                                         <option value="" @if($info->PlatformName == '') selected @endif>None</option>
+                                        <option value="bigo" @if($info->PlatformName == 'bigo') selected @endif>BIGO</option>
                                         <option value="ios" @if($info->PlatformName == 'ios') selected @endif>iOS线上包</option>
                                         <option value="iosjump" @if($info->PlatformName == 'iosjump') selected @endif>iOS落地页+线上包</option>
                                         <option value="fb" @if($info->PlatformName == 'fb') selected @endif>Facebook (fb)</option>