2 Revize 2324a62dfc ... 3dc9b05b07

Autor SHA1 Zpráva Datum
  wanggangzero 3dc9b05b07 添加战斗时长校验 před 1 měsícem
  wanggangzero d67d2b1788 fix: 微信支付推送到tapdb. před 2 měsíci

+ 6 - 1
Gameserver/App/base/ErrCode.php

@@ -80,6 +80,11 @@ class ErrCode {
      */
     const clientPrintMsg_Halt = 1033;
 
+    /**
+     * 操作耗时过短!
+     */
+    const err_opTimeTooShort = 1201;
+
     /**
      * 功能码非法
      */
@@ -601,7 +606,7 @@ class ErrCode {
      * 没有可以领取的产出奖励
      */
     const user_store_CannotReceiveReward = 3332;
-    
+
     /**
      * 至少派遣一只宠物进行探索
      */

+ 5 - 0
Gameserver/App/model/User/Info_Gates.php

@@ -96,6 +96,11 @@ class Info_Gates extends Object_ext {
      */
     public $TowerGate;
 
+    /**
+     * @var int 上次开始战斗的时间戳
+     */
+    public $lastStartFightTs = 0;
+
     public function initialize() {
         $startId = glc()->FirstGateId;                                          # 初始化第一关的关卡id
         $this->CurrentGateId = $startId;

+ 15 - 13
Gameserver/App/process/FightProc.php

@@ -443,6 +443,7 @@ class FightProc {
             my_Assert(ctx()->base(true)->Consume_tili($mo->cost_tili), ErrCode::notenough_tili);
             ctx()->privateData(true)->battlePass_tili += $mo->cost_tili;
         }
+        ctx()->gates()->lastStartFightTs = now();                               # 记录下开始战斗的时间戳(状态变量,用于校验战斗用时,排除作弊)
         UserProc::updateUserInfo();
         return Resp::ok(array("tili" => ctx()->baseInfo->tili, "tili_ts" => ctx()->baseInfo->tili_ts));
     }
@@ -732,6 +733,7 @@ class FightProc {
         //ctx()->base()->Add_Exp($exp);
         $waveMo = GameConfig::waveItem_getItem($gateId, $finalLayer);
         my_Assert(null != $waveMo, ErrCode::err_const_no);
+        my_Assert(now() - ctx()->gates->lastStartFightTs > $waveMo->minTs, ErrCode::err_opTimeTooShort); # todo:校验战斗耗时 2025年4月10日16:29:46
         $oldLevel = ctx()->baseInfo->level;
         StoreProc::AddMultiItemInStore('4,' . $waveMo->rewardExp);
         //ctx()->base()->Add_Exp($waveMo->rewardExp);                             # 指挥官经验
@@ -1928,8 +1930,8 @@ class FightProc {
             }
 
             foreach ($list as $uid => $score) {
-                $index += 1;               
-                self::settleDamageReward_worldBoss($orderId,$uid,$score);
+                $index += 1;
+                self::settleDamageReward_worldBoss($orderId, $uid, $score);
                 EmailProc::SendWorldBossRewardMail(req()->zoneid, $uid, $mo->reward, $index);
             }
         }
@@ -1941,16 +1943,16 @@ class FightProc {
 //        }
     }
 
-    public static function settleDamageReward_worldBoss($orderId,$uid,$demageVal) {            
+    public static function settleDamageReward_worldBoss($orderId, $uid, $demageVal) {
         $demageList = GameConfig::worldboss_demagereward_getItemArray($orderId);
-        
+
         $userInfo = UserProc::getUserGame(req()->zoneid, $uid);
         $worldBoss_received = $userInfo->privateState->worldBoss_received;
         foreach ($demageList as $dMo) {
             if ($demageVal >= $dMo->demageValId && !in_array($dMo->demageValId, $worldBoss_received)) {
                 EmailProc::SendWorldBossDamageRewardMail(req()->zoneid, $uid, $dMo->reward);
             }
-        } 
+        }
     }
 
     /**
@@ -2016,7 +2018,7 @@ class FightProc {
         }
 
         $num = self::GetCurTurnNum();
-        if ($num != ctx()->privateState->worldBoss_turnNum) {          
+        if ($num != ctx()->privateState->worldBoss_turnNum) {
             ctx()->privateState->worldBoss_turnNum = $num;
             ctx()->privateState->worldBoss_received = array();
         }
@@ -2214,7 +2216,7 @@ class FightProc {
         //校验每个轮次最后10分钟, 不能战斗
         my_Assert(FightProc::isFunUnlock(25), ErrCode::active_funUnlock);
         $tag = true;
-        
+
         $curDay = TimeUtil::totalDays();
         $turnNum = self::GetCurTurnNum();
         $turnnumMo = GameConfig::worldboss_turnnum_getItem($turnNum);
@@ -2224,17 +2226,17 @@ class FightProc {
                 $tag = false;
             }
         }
-        
-        if (ctx()->privateState->worldBoss_turnNum != $turnNum){
+
+        if (ctx()->privateState->worldBoss_turnNum != $turnNum) {
             ctx()->privateState->worldBoss_turnNum = $turnNum;
             ctx()->privateState->worldBoss_received = array();
-            $tag = false; 
+            $tag = false;
         }
-            
-        if($tag){
+
+        if ($tag) {
             self::Ranking_DamageVal($damageNum);
         }
-        
+
         UserProc::updateUserInfo();
         return Resp::ok(array());
     }

+ 1 - 1
Gameserver/App/service_call/pay/official/wxpayv2/notify.php

@@ -65,7 +65,7 @@ class PayNotifyCallBack extends WxPayNotify {
         }
         if ($order->status == 1) {                                              # 订单状态是成功 1代表支付成功
             $order->UpdateOrderStatus();                                        # [数据库操作]更新订单状态,->已付款
-//            loyalsoft\TapDBUtil::PushPayEvent($order, 'wxpay');                 # 向tapdb推送充值记录
+            loyalsoft\TapDBUtil::PushPayEvent($order, 'wxpay');                 # 向tapdb推送充值记录
             CLog::pay("[notify.wx] [发货] " . $order->cpOrderId . " >>> " . $order->amount);
             $msg = "success";
             return true;

+ 1 - 1
Gameserver/App/service_call/pay/official/wxpayv2/notify_hykb.php

@@ -65,7 +65,7 @@ class PayNotifyCallBack extends WxPayNotify {
         }
         if ($order->status == 1) {                                              # 订单状态是成功 1代表支付成功
             $order->UpdateOrderStatus();                                        # [数据库操作]更新订单状态,->已付款
-//            loyalsoft\TapDBUtil::PushPayEvent($order, 'wxpay');                 # 向tapdb推送充值记录
+            loyalsoft\TapDBUtil::PushPayEvent($order, 'wxpay');                 # 向tapdb推送充值记录
             CLog::pay("[notify.wx] [发货] " . $order->cpOrderId . " >>> " . $order->amount);
             $msg = "success";
             return true;