Browse Source

经验金币钻石统计

cyzhao 3 years ago
parent
commit
be38d897b3

+ 16 - 6
Gameserver/Amfphp/model/User/Info_UserBase.php

@@ -159,10 +159,15 @@ class Info_UserBase extends Object_ext {
      * 用户获得金币 
      * @param int $amt
      */
-    function Add_Gold($amt) {
+    function Add_Gold($amt,$mask = 0) {
         my_Assert($amt >= 0, "参数为负");
         
-        UserProc::CollectUserBaseParam(req()->cmd,2, $this->gold, $amt, $this->gold+$amt, "获得金币");
+        if($mask == 1){
+            UserProc::CollectUserBaseParam(req()->cmd,2, $this->gold, $amt, $this->gold+$amt, "关卡战斗掉落金币");
+        } else {
+            UserProc::CollectUserBaseParam(req()->cmd,2, $this->gold, $amt, $this->gold+$amt, "获得金币");
+        }
+        
         $this->gold += $amt;              
     }
 
@@ -171,7 +176,7 @@ class Info_UserBase extends Object_ext {
      * @param int $amt
      * @return boolean true:成功, false:金币不足
      */
-    function Consume_Gold($amt) {
+    function Consume_Gold($amt,$mask = 0) {
         if ($amt > 0) {                       
             if ($this->gold - $amt >= 0) {
                 UserProc::CollectUserBaseParam(req()->cmd,2, $this->gold, $amt, $this->gold-$amt, "消耗金币");
@@ -186,10 +191,15 @@ class Info_UserBase extends Object_ext {
      * 增加用户钻石 
      * @param type $amt
      */
-    function Add_Cash($amt) {
+    function Add_Cash($amt,$mask = 0) {
         my_Assert($amt >= 0, "amt值为负");
         
-        UserProc::CollectUserBaseParam(req()->cmd, 3, $this->cash, $amt, $this->cash+$amt,"获得钻石");
+        if($mask == 1){
+            UserProc::CollectUserBaseParam(req()->cmd, 3, $this->cash, $amt, $this->cash+$amt,"关卡战斗掉落钻石");
+        } else {
+            UserProc::CollectUserBaseParam(req()->cmd, 3, $this->cash, $amt, $this->cash+$amt,"获得钻石");
+        }
+        
         $this->cash += $amt;
     }
 
@@ -198,7 +208,7 @@ class Info_UserBase extends Object_ext {
      * @param int $amt
      * @return bool 成功与否
      */
-    function Consume_Cash($amt) {
+    function Consume_Cash($amt,$mask = 0) {
         if ($amt >= 0) {
             if ($this->cash - $amt >= 0) {
                 UserProc::CollectUserBaseParam(req()->cmd, 3, $this->cash, $amt, $this->cash-$amt,"消耗钻石");

+ 10 - 4
Gameserver/Amfphp/process/StoreProc.php

@@ -456,7 +456,7 @@ class StoreProc {
      * @deprecated since version 0
      * @return type
      */
-    public static function AddMultiItemInStore($goodsStr, $src = 1) {
+    public static function AddMultiItemInStore($goodsStr, $src = 1,$mask = 0) {
         $user = req()->userInfo->game;
         $ary = explode(";", $goodsStr);
         foreach ($ary as $value) {
@@ -472,11 +472,11 @@ class StoreProc {
                     break;
                 case META_GOLD_ITEMID:                                          # 金币
 //                    Data_UserGame::Add_Gold($user->baseInfo, $num);
-                    $user->base()->Add_Gold($num);                              # 增加金币                                    
+                    $user->base()->Add_Gold($num,$mask);                              # 增加金币                                    
                     break;
                 case META_CASH_ITEMID:                                          # 钻石
 //                    Data_UserGame::Add_Cash($user->baseInfo, $num);
-                    $user->base()->Add_Cash($num);                              # 增加钻石
+                    $user->base()->Add_Cash($num,$mask);                              # 增加钻石
                     break;
                 case META_tili_ITEMID:                                          # 体力
 //                    Data_UserGame::Add_tili($num);
@@ -585,7 +585,13 @@ class StoreProc {
     public static function AddItemInStore() {
         list($rwdStr,$mask) = req()->paras;//mask = 1:表示战斗中掉落
         $user = req()->userInfo->game;
-        $err = self::AddMultiItemInStore($rwdStr);
+        
+        if($mask == 1){
+            $err = self::AddMultiItemInStore($rwdStr,1,1);
+        } else {
+            $err = self::AddMultiItemInStore($rwdStr);
+        }
+        
         my_Assert(ErrCode::ok == $err, $err);
         UserProc::updateUserInfo();
         return Resp::ok(array(

+ 26 - 0
Gameserver/Public/gamesys/app/providers/userBaseParams.php

@@ -0,0 +1,26 @@
+<?php
+include_once dirname(__FILE__) . '/../main.php';
+
+$params = query_paras();
+
+$uid = $params['date']['uid'];
+$zoneid = $params['date']['zoneid'];
+$type = $params['date']['type'];
+$date = $params['date']['ts'];
+
+$key = "userbaseParams-".$uid."-".$zoneid;
+
+$num = gMem()->llen($key);
+$arr = gMem()->lrange($key, 0, $num);
+$resultArr = array();
+foreach ($arr as $item) {
+    if($item->type == $type){
+        $resultArr[] = $item;
+    }
+}
+
+$result = new stdClass();
+$result->data = $resultArr;
+$result->err = 0;
+
+echo json_encode($result);

+ 25 - 1
Gameserver/Public/gamesys/home/js/index.js

@@ -444,7 +444,31 @@
                         "F_ModifyDate": "2021-09-13 11:21:20",
                         "F_ModifyUserId": "System",
                         "F_ModifyUserName": "超级管理员"
-                    },                    
+                    },
+                    {
+                        "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
+                        "F_ParentId": "1",
+                        "F_EnCode": "AreaManage",
+                        "F_FullName": "经验金币钻石增减变化统计",
+                        "F_Icon": "fa fa-leaf",
+                        "F_UrlAddress": "pages/userBaseParams/userBaseParams.html",
+                        "F_Target": "iframe",
+                        "F_IsMenu": 1,
+                        "F_AllowExpand": 1,
+                        "F_IsPublic": 0,
+                        "F_AllowEdit": null,
+                        "F_AllowDelete": null,
+                        "F_SortCode": 1,
+                        "F_DeleteMark": 0,
+                        "F_EnabledMark": 1,
+                        "F_Description": "经验金币钻石增减变化统计",
+                        "F_CreateDate": "2021-09-13 11:21:20",
+                        "F_CreateUserId": "System",
+                        "F_CreateUserName": "超级管理员",
+                        "F_ModifyDate": "2021-09-13 11:21:20",
+                        "F_ModifyUserId": "System",
+                        "F_ModifyUserName": "超级管理员"
+                    }, 
                     {
                         "F_ModuleId": "99",
                         "F_ParentId": "0",

+ 21 - 0
Gameserver/Public/gamesys/home/pages/userBaseParams/userBaseParams.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<!--
+To change this license header, choose License Headers in Project Properties.
+To change this template file, choose Tools | Templates
+and open the template in the editor.
+-->
+<html>
+    <head>
+        <title>TODO supply a title</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        
+        <script src="../../js/jquery/jQuery-2.2.0.min.js"></script>
+        <script src="../api.js"></script>
+        <script src="userBaseParams.js"></script>
+    </head>
+    <body>
+        <div>TODO write content</div>
+        <button class="btn" style="display:block;margin:auto;background-color: #3c8dbc;color: #FFFFFF;" onclick="sendMail()">获取数据</button>
+    </body>
+</html>

+ 29 - 0
Gameserver/Public/gamesys/home/pages/userBaseParams/userBaseParams.js

@@ -0,0 +1,29 @@
+function sendMail() {
+    console.log("发送请求");
+
+    var zoneid = 1;
+    var uid = "EA74E58DCEB076ACC2D824684499CDA2";
+    var type = 2;
+    var ts = "20201119";
+   
+//    var titleTxt = $("#title-text").val();
+//    var fromTxt = $("#from-text").val();
+
+    var data = {
+        zoneid: zoneid,
+        uid: uid,
+        type:type,
+        ts: ts,     
+    };
+
+    post(
+            getProviderUrl("userBaseParams"),
+            {date: data},
+            function (data) {
+                console.log(data);
+//                Canvas(data.data1, data.data2);
+                window.alert("成功okokokokok");
+            }
+    , 'json');
+}
+