Ver código fonte

统计新数据

Tree 1 semana atrás
pai
commit
366b9344b6

+ 31 - 14
app/Console/Commands/RecordPlatformData.php

@@ -65,14 +65,14 @@ class RecordPlatformData extends Command
             switch ($dateDay) {
                 case 2:
                     $service->Retain($value->DateID, Carbon::parse($value->DateID)->addDay(1), 'RetainOne');
-                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(1), 'ActiveRetainOne');
+//                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(1), 'ActiveRetainOne');
                     $service->payRetain($value->DateID, Carbon::parse($value->DateID)->addDay(1), 'PayRetainOne');
                     break;
                 case 3:
                     // 注册三日留存
                     $service->Retain($value->DateID, Carbon::parse($value->DateID)->addDay(2), 'RetainThree');
                     // 活跃三日留存
-                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(2), 'ActiveRetainThree');
+//                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(2), 'ActiveRetainThree');
                     // 付费三日留存
                     $service->payRetain($value->DateID, Carbon::parse($value->DateID)->addDay(2), 'PayRetainThree');
                     break;
@@ -80,15 +80,23 @@ class RecordPlatformData extends Command
                     // 注册七日留存
                     $service->Retain($value->DateID, Carbon::parse($value->DateID)->addDay(6), 'RetainSeven');
                     // 活跃七日留存
-                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(6), 'ActiveRetainSeven');
+//                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(6), 'ActiveRetainSeven');
                     // 付费七日留存
                     $service->payRetain($value->DateID, Carbon::parse($value->DateID)->addDay(6), 'PayRetainSeven');
                     break;
+                case 15:
+                    // 注册七日留存
+                    $service->Retain($value->DateID, Carbon::parse($value->DateID)->addDay(14), 'RetainFifteen');
+                    // 活跃七日留存
+//                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(14), 'ActiveRetainSeven');
+                    // 付费七日留存
+                    $service->payRetain($value->DateID, Carbon::parse($value->DateID)->addDay(14), 'RetainFifteen');
+                    break;
                 case 30:
                     // 注册三十日留存
                     $service->Retain($value->DateID, Carbon::parse($value->DateID)->addDay(29), 'RetainThirty');
                     // 活跃三十日留存
-                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(29), 'ActiveRetainThirty');
+//                    $service->activeRetain($value->DateID, Carbon::parse($value->DateID)->addDay(29), 'ActiveRetainThirty');
                     // 付费三十日留存
                     $service->payRetain($value->DateID, Carbon::parse($value->DateID)->addDay(29), 'PayRetainThirty');
                     break;
@@ -115,6 +123,10 @@ class RecordPlatformData extends Command
         $GameUserCounts = $dao->GameUserCount($dateID);
         // 新增参游人数
         $NewGameUserCounts = $dao->NewGameUserCount($date);
+
+
+        $NewGameWinTopCounts = $dao->NewGameWinTopCount($dateID);
+
         // 赠送金币 =====  增加赠送金币
         //$GiveGolds = RecordScoreInfo::todayLottery($date->format('Y-m-d'));
         // 充值彩金
@@ -165,15 +177,15 @@ class RecordPlatformData extends Command
             }
 
 
-//            if ($GiveGolds->isNotEmpty()) {
-//                // 赠送金币
-//                foreach ($GiveGolds as $item) {
-//                    $data = ['DateID' => $dateID, 'GiveGold' => $item->ChangeScore];
-//
-//                    $dao->Update($data, $value->Channel, $item->Channel, $dateID);
-//
-//                }
-//            }
+            if ($NewGameWinTopCounts->isNotEmpty()) {
+                //
+                foreach ($NewGameWinTopCounts as $item) {
+                    $data = ['DateID' => $dateID, 'NewWinTop' => $item->UserCount];
+
+                    $dao->Update($data, $value->Channel, $item->Channel, $dateID);
+
+                }
+            }
 
             if ($NewGameUserCounts->isNotEmpty()) {
                 // 新增游戏人数
@@ -185,6 +197,9 @@ class RecordPlatformData extends Command
                 }
             }
 
+
+
+
 //            if ($RechargeWinnings->isNotEmpty()) {
 //                // 充值彩金
 //                foreach ($RechargeWinnings as $item) {
@@ -247,6 +262,8 @@ class RecordPlatformData extends Command
             $GameUserCount = $GameUserCounts->sum('UserCount');
             $NewGameUserCount = $NewGameUserCounts->sum('UserCount');
 
+            $NewWinTop = $NewGameWinTopCounts->sum('UserCount');
+
 
 //            $GiveGold = $GiveGolds->sum('ChangeScore');
 //            $RechargeWinningsScore = $RechargeWinnings->sum('Score');
@@ -269,7 +286,7 @@ class RecordPlatformData extends Command
             $SignInCount = 0;
 
             $data = compact('ARPPU', 'ARPU', 'ApplyWithdraw', 'WithdrawFree', 'GameUserCount', 'NewGameUserCount', 'GiveGold', 'ApplyWithdrawBi',
-                'ApplyWithdrawCount','TotalDibaoCount','SignInSum','SignInCount');
+                'ApplyWithdrawCount','TotalDibaoCount','SignInSum','SignInCount','NewWinTop');
             $data['RechargeWinnings'] = $RechargeWinningsScore;
             $data['ShareWinnings'] = $ShareWinningsScore;
             $data['Dibao'] = $DibaoScore;

+ 12 - 15
app/Http/logic/api/OrderLogic.php

@@ -5,6 +5,7 @@ namespace App\Http\logic\api;
 
 
 use App\Facade\TableName;
+use App\Game\GlobalUserInfo;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Redis;
 
@@ -71,22 +72,16 @@ class OrderLogic extends BaseApiLogic
     public function orderCreate($order_sn, $amount, $payment_code, $userID, $order_title = '',$GiftsID = 0,$AdId = '',$eventType = 2)
     {
         if (empty($AdId) || $AdId == 'undefined') {
-//            $AdId = DB::connection('write')->table(TableName::QPAccountsDB() . 'AccountsInfo')
-//                ->where('UserID', $userID)
-//                ->value('LastLogonMachine');
-//            if(!$AdId){
-                $redis = Redis::connection();
-                $AdId = $redis->get('user_ad_'.$userID);
-//            }
-//            $AdId = 'efa7d051-2f29-429b-b26e-d73b64604673';
+            $redis = Redis::connection();
+            $AdId = $redis->get('user_ad_'.$userID);
         }
 
-        $Channel = DB::connection('write')->table(TableName::QPAccountsDB() . 'AccountsInfo')
-            ->where('UserID', $userID)->select('Channel')->first()->Channel;
+//        $Channel = DB::connection('write')->table(TableName::QPAccountsDB() . 'AccountsInfo')
+//            ->where('UserID', $userID)->select('Channel')->first()->Channel;
 
-        if($userID == 4293017 ){
-//            $Channel = 101;
-        }
+        $userInfo = GlobalUserInfo::getGameUserInfo('UserID',$userID);
+        $Channel = $userInfo?$userInfo->Channel:100;
+        $RegisterDate = $userInfo?$userInfo->RegisterDate:date('Y-m-d');
 
         $body = [
             'app_id' => 1,
@@ -108,12 +103,14 @@ class OrderLogic extends BaseApiLogic
         ];
 
         $order = DB::connection('write')->table('agent.dbo.order')->insert($body);
-
-
         if (!$order) {
             $this->error = 'Payment error_2';
             return false;
         }
+
+        $RecordPlatformDataModel = new \App\Models\RecordPlatformData();
+        $RecordPlatformDataModel->PayRequestToday($Channel,$RegisterDate);
+
         return true;
     }
 }

+ 31 - 0
app/Models/RecordPlatformData.php

@@ -281,4 +281,35 @@ class RecordPlatformData extends Model
 
 
     }
+
+
+    public function BindToday($Channel, $RegisterDate)
+    {
+        $dateID = Carbon::now()->format('Ymd');
+        $newCont = 0;
+//        if ($dateID == date('Ymd', strtotime($RegisterDate)) && $Extra == 1) {
+        if ($dateID == date('Ymd', strtotime($RegisterDate))) {
+            $newCont = 1;
+        }
+        DB::table(TableName::QPRecordDB() . 'RecordPlatformData')
+            ->updateOrInsert(['Channel' => -1, 'DateID' => $dateID], ['BindPhoneCount' => DB::raw("BindPhoneCount+1"),'NewPhoneCount' => DB::raw("NewPhoneCount+$newCont")]);
+
+
+        DB::table(TableName::QPRecordDB() . 'RecordPlatformData')
+            ->updateOrInsert(['Channel' => $Channel, 'DateID' => $dateID], ['BindPhoneCount' => DB::raw("BindPhoneCount+1"),'NewPhoneCount' => DB::raw("NewPhoneCount+$newCont")]);
+
+    }
+
+    public function PayRequestToday($Channel, $RegisterDate)
+    {
+        $dateID = Carbon::now()->format('Ymd');
+        if ($dateID == date('Ymd', strtotime($RegisterDate))) {
+            DB::table(TableName::QPRecordDB() . 'RecordPlatformData')
+                ->updateOrInsert(['Channel' => -1, 'DateID' => $dateID], ['NewPayRequest' => DB::raw("NewPayRequest+1")]);
+            DB::table(TableName::QPRecordDB() . 'RecordPlatformData')
+                ->updateOrInsert(['Channel' => $Channel, 'DateID' => $dateID], ['NewPayRequest' => DB::raw("NewPayRequest+1")]);
+
+        }
+
+    }
 }

+ 2 - 2
app/Services/RecordPlatformData.php

@@ -19,7 +19,7 @@ class RecordPlatformData
         $RecordPlatformDataModel = new \App\Models\RecordPlatformData();
         $count = DB::connection('read')->table(TableName::QPAccountsDB().'AccountsInfo as ai')
             ->whereExists(function ($query) use ($time2) {
-                $query->from(TableName::QPRecordDB() . 'RecordUserLogin as rl')
+                $query->from(TableName::QPRecordDB() . 'RecordUserGamePlay as rl')
                     ->select('rl.UserID')
 //                    ->whereRaw("rl.UserID=ai.UserID and DateID=CONVERT(VARCHAR(100),DATEADD(dd,$dateNum,'$date'),112)");
                     ->whereRaw("rl.UserID=ai.UserID and DateID=$time2");
@@ -118,7 +118,7 @@ class RecordPlatformData
         $count = DB::connection('read')->table(TableName::QPRecordDB().'RecordUserDataStatisticsNew as record')
             ->join(TableName::QPAccountsDB().'AccountsInfo as ai','record.UserID','ai.UserID')
             ->whereExists(function ($query) use ($time2) {
-                $query->from(TableName::QPRecordDB() . 'RecordUserLogin as rl')
+                $query->from(TableName::QPRecordDB() . 'RecordUserGamePlay as rl')
                     ->select('rl.UserID')
                     ->whereRaw("rl.UserID=record.UserID and DateID=$time2");
             })

+ 13 - 0
app/dao/RecordPlatformData/RecordPlatformData.php

@@ -65,6 +65,19 @@ class RecordPlatformData
             ->get();
     }
 
+
+    // 新增游戏人数打到了提现额度【分渠道】
+    public function NewGameWinTopCount($date)
+    {
+        return DB::connection('sqlsrv')->table(TableName::QPAccountsDB() . 'AccountsInfo as ai')
+            ->whereDate('RegisterDate', $date->format('Y-m-d'))
+            ->join(TableName::QPTreasureDB() . 'GameScoreInfo as rd', 'ai.UserID', '=', 'rd.UserID')
+            ->whereRaw('(ISNULL(rd.Score,0) + ISNULL(rd.InsureScore,0)) > ?', [4000])
+            ->selectRaw('COUNT(ai.UserID) AS UserCount, ai.Channel')
+            ->groupBy('ai.Channel')
+            ->get();
+    }
+
     // 数据修改
 
     /**