Переглянути джерело

添加统计事件上报接口.

王刚 3 роки тому
батько
коміт
1f7227b69b

+ 11 - 0
Gameserver/Amfphp/base/MemKey_GameRun.php

@@ -258,6 +258,15 @@ class MemKey_GameRun {
     public static function stat_monthly_secretshopSales_zset($zoneid, $tsMonth) {
         return "stat-monthly-secretshopsales-zone$zoneid-$tsMonth";
     }
+    /**
+    * 
+    * 客户端上报日志 
+    * @param type $eventID
+    * @return type
+    */
+    public static function stat_clientReportLog($eventID){
+        return "stat-reported-log-$eventID";
+    }
 
 // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="   日志 ">
@@ -281,5 +290,7 @@ class MemKey_GameRun {
         return "log-" . $typename;
     }
 
+    
+    
 // </editor-fold>
 }

+ 0 - 18
Gameserver/Amfphp/base/MemKey_Stat.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace loyalsoft;
-
-//
-///**
-// * 游戏统计数据
-// * @version
-// *          1.0.0 Created at 2017-4-6. by --gwang
-// * @author gwang (mail@wanggangzero.cn)
-// * @copyright ? 2017-4-6, SJZ LoyalSoft Corporation & gwang. All rights reserved.
-// */
-//
-//class MemKey_Stat{
-//
-//
-//
-//}

+ 10 - 9
Gameserver/Amfphp/process/SystemProc.php

@@ -116,19 +116,20 @@ class SystemProc {
      * [6902] 客户端日志上报 
      */
     static function logReport() {
-        $max = 300;
-        $once = 30;
-        $key = "report-log";
-        $log = req()->paras[0];                                                 # 客户端参数解析: 本地日志
+        list($eventID,$EArgKey,$EArgValue)=req()->paras;                        # 客户端参数解析: 
+        $key = MemKey_GameRun::stat_clientReportLog($eventID);
         $logItem = array(#                                                      # 组装对象
             'uid' => req()->uid,
-            'log' => $log,
+            'EArgKey' => $EArgKey,
+            'EArgValue'=>$EArgValue,
             'ts' => TimeUtil::dtCurrent()
         );
-        gMem()->lpush($key, array($logItem));                                   # 推送日志
-        if (gMem()->llen($key) > $max + $once) {                                # 达到清理条件
-            gMem()->ltrim($key, 0, -$once);                                     # 缩减记录
-        }
+        gMem()->lpush($key, array($logItem));                                   # 压入日志
+//        $max = 300;
+//        $once = 30;
+//        if (gMem()->llen($key) > $max + $once) {                                # 达到清理条件
+//            gMem()->ltrim($key, 0, -$once);                                     # 缩减记录
+//        }
         return Resp::ok("copy!");
     }
 

+ 37 - 0
Gameserver/Amfphp/service_call/InquireApi/ReportStatLog.php

@@ -0,0 +1,37 @@
+<?php
+
+/*
+ * 上报统计日志
+ * 2022.1.24
+ */
+
+namespace loyalsoft;
+
+include_once __DIR__ . '/../../main.php';
+
+HttpUtil::PostOnly();
+
+/**
+ * 客户端统计日志上报处理类
+ */
+class CliendStatLogReportHandler {
+
+    /**
+     *  客户端日志上报 
+     */
+    static function logReport() {
+        extract(query_paras());                                                 # 客户端参数解析: 
+
+        $key = MemKey_GameRun::stat_clientReportLog($EventID);
+        $logItem = array(#                                                      # 组装对象
+            'EArgKey' => $EArgKey,
+            'EArgValue' => $EArgValue,
+            'ts' => TimeUtil::dtCurrent()
+        );
+        gMem()->lpush($key, array($logItem));                                   # 压入日志 
+    }
+
+}
+
+CliendStatLogReportHandler::logReport();
+echoLine("copy!");

+ 10 - 5
Gameserver/Amfphp/test.php

@@ -3,7 +3,8 @@
 namespace loyalsoft;
 
 include __DIR__ . '/main.php';
-var_dump(__DIR__);
+//var_dump(__DIR__);
+
 echoLine("phpver: " . PHP_VERSION . PHP_EOL);
 echoLine("tsDay:" . totalDays());
 //SelfChecker::CheckAll();
@@ -11,9 +12,13 @@ echoLine("tsDay:" . totalDays());
 //set_time_limit(15);                                                           # 设置执行超时时间
 //
 //
+SelfChecker::checkModules();
+
+$m = new \MongoDB\Driver\Client("mongodb://localhost:27017");
+$db = $m->selectDb("wanggangzero"); //选择数据库
+$db->php->insert(array('name' => '李元霸', 'age' => 12));
 
-$arr = [12];
-$i = 12;
+$db->php->insert(array('name' => '李元霸', 'age' => 18));
 
-StlUtil::arrayRemove($arr, $i);
-var_dump($arr);
+$data = $db->php->find();
+var_dump($data);