cyzhao 9 mesi fa
parent
commit
efe5848ebc

+ 2 - 0
Gameserver/App/base/CmdCode.php

@@ -17,6 +17,8 @@ class CmdCode {
     const cmd_pay_getfirstpaygift = 8802;
     
     const cmd_pay_resetFirstRechargeUI_OpenTip = 8803;
+    
+    const cmd_pay_accumulateRechargeRewardReceived = 8804;
 
 // <editor-fold defaultstate="collapsed" desc="移动支付">
 //---------- 移动端 支付API 操作码 ----

+ 5 - 0
Gameserver/App/base/ErrCode.php

@@ -249,6 +249,11 @@ class ErrCode {
      */
     const pay_rewardReceive_ts_limit = 8821;
     
+    /**
+     * 累计元宝数量不足无法领取奖励
+     */
+    const pay_accumulateYuanBaoNotEnough = 8822;
+    
 // </editor-fold>
 //
 // <editor-fold defaultstate="collapsed" desc="    not enough 系列    ">

+ 7 - 0
Gameserver/App/model/User/Info_PrivateState.php

@@ -303,6 +303,13 @@ class Info_PrivateState extends Object_ext {
      * @var type
      */
     public $firstRechargeUI_OpenTip = 1;
+    
+    /**
+     * 累计奖励领取记录
+     * @var type
+     */
+    #[ArrayType]
+    public $accumulateRechargeRewardRecord = array();
 
     public function initialize() {
         $this->junbeiShopNumRecord = new \stdClass();

+ 6 - 0
Gameserver/App/model/User/Info_UserBase.php

@@ -88,6 +88,12 @@ class Info_UserBase extends Object_ext {
      * @var int 历史充值总金额(单位:分)
      */
     public $charge_amt = 0;
+    
+    /**
+     * 累计元宝
+     * @var type
+     */
+    public $accumulateYuanBao = 0;
 
     /**
      * 新解锁的头像框

+ 49 - 2
Gameserver/App/process/PayProc.php

@@ -31,8 +31,10 @@ class PayProc {
             // 支付相关的活动
             case CmdCode::cmd_pay_getfirstpaygift:                              # 8802 领取首充礼包
                 return PayProc::m_GetFirstPayGift();
-            case CmdCode::cmd_pay_resetFirstRechargeUI_OpenTip:                 # 8803 弹框 
+            case CmdCode::cmd_pay_resetFirstRechargeUI_OpenTip:                 # 8803 重置弹框 
                 return PayProc::resetFirstRechargeUI_OpenTip();
+            case CmdCode::cmd_pay_accumulateRechargeRewardReceived:             # 8804 累计充值领取奖励
+                return PayProc::accumulateRechargeRewardReceived();
 // 游戏内二级货币消费
             case CmdCode::cmd_mpay_pay:                                         # 8807 消费..
                 return self::m_pay();                                           # ::==> 购买普通商城物品
@@ -61,7 +63,52 @@ class PayProc {
     }
     
     /**
-     * 
+     * 8804 累计充值
+     */
+    static function accumulateRechargeRewardReceived(){
+        list($id) = req()->paras;
+        $mo = GameConfig::accumulaterecharge_getItem($id);        
+        my_Assert($mo != null, ErrCode::err_const_no);
+        
+        my_Assert(ctx()->baseInfo->accumulateYuanBao >= $id , ErrCode::pay_accumulateYuanBaoNotEnough);
+        my_Assert(in_array($id, ctx()->privateState->accumulateRechargeRewardRecord) , ErrCode::pay_repeatReceive);
+        
+        ctx()->privateState->accumulateRechargeRewardRecord[] = $id;
+        StoreProc::AddMultiItemInStore($mo->reward);
+        
+        $reset = true;
+        $dic = GameConfig::accumulaterecharge();
+        $max_yuanbao = 0;
+        foreach ($dic as $aMo) {
+            if(!in_array($aMo->yuanbao, ctx()->privateState->accumulateRechargeRewardRecord)){
+                $reset = false;
+            }          
+            
+            if($aMo->yuanbao > $max_yuanbao){
+                $max_yuanbao = $aMo->yuanbao;
+            }
+        }
+        
+        if($reset){
+            ctx()->privateState->accumulateRechargeRewardRecord = array();
+            ctx()->baseInfo->accumulateYuanBao -= $max_yuanbao;
+            if(ctx()->baseInfo->accumulateYuanBao <= 0){
+                ctx()->baseInfo->accumulateYuanBao = 0;
+            }
+        }
+        
+        UserProc::updateUserInfo();
+        return Resp::ok(array('gold' => ctx()->baseInfo->gold,
+                    'cash' => ctx()->baseInfo->cash,
+                    'store' => ctx()->store,
+                    'privateState' => ctx()->privateState,
+                    'reward'=> StoreProc::$reward,
+                    'reward_Gem'=> StoreProc::$reward_Gem,
+            ));   
+    }
+    
+    /**
+     * 8803 重置弹框 
      */
     static function resetFirstRechargeUI_OpenTip(){
         ctx()->privateState->firstRechargeUI_OpenTip = 0;

+ 4 - 0
Gameserver/App/process/ShopProc.php

@@ -417,11 +417,15 @@ class ShopProc {
         }
 
         $reward = $mo->reward;
+        $pList = explode(',', $reward);
+        $addYuanbao = $pList[1];
         if (!$tag) {
             $reward = $mo->reward . ';' . $mo->reward;
+            $addYuanbao *= 2;
         }
 
         StoreProc::AddMultiItemInStore($reward);
+        ctx()->baseInfo->accumulateYuanBao += $addYuanbao;        
         ctx()->baseInfo->charge_amt += $mo->price;        
         ctx()->privateState->cashShopReceived[] = $typeId;