cyzhao 8 сар өмнө
parent
commit
483b8a88e5

+ 29 - 20
Gameserver/App/process/ActiveProc.php

@@ -42,9 +42,9 @@ class ActiveProc {
                 Err(ErrCode::cmd_err);
         }
     }
-        
-    static function ResetActive() {
 
+    static function ResetActive() {
+        
     }
 
     /**
@@ -325,7 +325,7 @@ class ActiveProc {
         ctx()->privateState->LoginDays[] = $index;
         ctx()->privateState->day7_accumulate += 1;
     }
-           
+
     /**
      * 6101 签到
      * @return type
@@ -405,42 +405,49 @@ class ActiveProc {
                     'reward_Gem' => StoreProc::$reward_Gem,
         ));
     }
-    
+
     /**
      * 限时贩卖 2天一刷
      */
     public static function ResetLimitTsBuy() {
-        $mo = GameConfig::subfun_unlock_getItem(Enum_SubFunType::LimitTsSale);       
+        ctx()->privateState->limitTsBuy_RewardRecord = array();
+        
+        $mo = GameConfig::subfun_unlock_getItem(Enum_SubFunType::LimitTsSale);
         $startDay = TimeUtil::totalDays($mo->startTs);
         $nextDay = TimeUtil::totalDays();
-        
+     
         $num = $nextDay - $startDay;
-        $val = intval($num / 2);               
-        $yushu = $val % 5;  
-        $type = $yushu +1;
-        
+        $refershType = $num % 2; //余数只会是0 或 1; 0:两天后在刷新,1就是已经过了一天了,在过一天就刷新,当前时间减一天
+        ctx()->privateState->nextDayLogin = now();
+        if ($refershType == 1) {
+            ctx()->privateState->nextDayLogin = now() - 86400;
+        }
+      
+        $val = intval($num / 2);
+        $yushu = $val % 5;
+        $type = $yushu + 1;
+
         $arr = GameConfig::activity_promopackinfo_type_getItemArray($type);
         $count = count($arr);
-        
+
         $ret = array();
-        if($count == 6){
+        if ($count == 6) {
             $ret = $arr;
         } else {
             for ($i = 0; $i < 6; $i++) {
                 $count = count($arr);
-                $rand = rand(0,$count-1);
+                $rand = rand(0, $count - 1);
                 $ret[] = $arr[$rand];
                 StlUtil::arrayRemoveAt($arr, $rand);
-                if(count($arr) == 0){
+                if (count($arr) == 0) {
                     break;
                 }
-            }           
+            }
         }
         ctx()->privateState->limitTsBuy_RandIds = array();
         foreach ($ret as $mo) {
             ctx()->privateState->limitTsBuy_RandIds[] = $mo->typeId;
         }
-        
     }
 
     /**
@@ -448,25 +455,27 @@ class ActiveProc {
      */
     public static function LimitTsBuy_Drawreward() {
         list($typeId) = req()->paras;                                           # 参数: 领取第x天的奖励
-        
+
         my_Assert(in_array($typeId, ctx()->privateState->limitTsBuy_RewardRecord), ErrCode::active_const_no_err);
         $mo = GameConfig::activity_promopackinfo_getItem($typeId);              # 查询奖励数据
         my_Assert(null != $mo, ErrCode::err_const_no);                          # 防御找不到配置
-        
+
         $rewardArr = ctx()->privateState->limitTsBuy_RewardRecord;
         $count = array_count_values(array_keys($rewardArr, $typeId))[$typeId];
         my_Assert($count < $mo->limitNum, ErrCode::user_shop_LimitNum);
-            
+
         StoreProc::AddMultiItemInStore($mo->reward);                            # 发放奖励
         ctx()->privateState->limitTsBuy_RewardRecord[] = $typeId;
-        
+
         UserProc::updateUserInfo();                                             # 回存
         return Resp::ok(array('gold' => ctx()->baseInfo->gold,
                     'cash' => ctx()->baseInfo->cash,
                     'store' => ctx()->store,
+                    'heros' => ctx()->heros,
                     'privateState' => ctx()->privateState,
                     'reward' => StoreProc::$reward,
                     'reward_Gem' => StoreProc::$reward_Gem,
         ));
     }
+
 }

+ 1 - 10
Gameserver/App/process/FightProc.php

@@ -1011,16 +1011,7 @@ class FightProc {
     static function SubFunDateInit_Config() {
         $dic = GameConfig::subfun_unlock();
         foreach ($dic as $id => $mo) {
-            if ($mo->type == 3 && $mo->id == Enum_SubFunType::LimitTsSale && ctx()->privateState->nextDayLogin == 0 && now()>= $mo->startTs) {
-                $startDay = TimeUtil::totalDays($mo->startTs);
-                $nextDay = TimeUtil::totalDays();
-                
-                $num = $nextDay - $startDay;
-                $yushu = $num % 2;//余数只会是0 或 1; 0:两天后在刷新,1就是已经过了一天了,在过一天就刷新,当前时间减一天
-                if($yushu == 1){
-                    ctx()->privateState->nextDayLogin = now() - 86400;
-                }
-                                              
+            if ($mo->type == 3 && $mo->id == Enum_SubFunType::LimitTsSale && ctx()->privateState->nextDayLogin == 0 && now()>= $mo->startTs) {                                                          
                 ActiveProc::ResetLimitTsBuy();
             }
         }

+ 2 - 3
Gameserver/App/process/UserProc.php

@@ -493,10 +493,9 @@ class UserProc {
         //2天一刷 
         $curDay = TimeUtil::totalDays(); 
         $nextDay = TimeUtil::totalDays(ctx()->privateState->nextDayLogin);
-        if($curDay - $nextDay>= 2){
-            ctx()->privateState->nextDayLogin = now();
+        if($curDay - $nextDay>= 2){            
             ActiveProc::ResetLimitTsBuy();     
-            ctx()->privateState->limitTsBuy_RewardRecord = array();
+            
         }
     }