Browse Source

宝箱商城bug修复

cyzhao 10 months ago
parent
commit
e8fd19e02d
1 changed files with 16 additions and 16 deletions
  1. 16 16
      Gameserver/App/process/ShopProc.php

+ 16 - 16
Gameserver/App/process/ShopProc.php

@@ -62,7 +62,7 @@ class ShopProc {
         return Resp::ok(array(
                     "privateState" => ctx()->privateState,
                     "baseInfo" => ctx()->baseInfo,
-                    "tili" => $addTili,
+                    "tili" => $addTili,           
                     "task" => ctx()->task,
         ));
     }
@@ -168,20 +168,6 @@ class ShopProc {
                 $mo = GameConfig::shop_box_getItem($typeId);
                 my_Assert($mo != null, ErrCode::err_const_no);
                 
-                if ($mo->type == 1) {
-                    if ($buyNum == 0) {
-                        $buyNum = 1;
-                        my_Assert(now() - $user->privateState->lastFreeGetTs_ShopBoxCommon >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
-                        $user->privateState->lastFreeGetTs_ShopBoxCommon = now();
-                    }
-                } else if ($mo->type == 2) {
-                    if ($buyNum == 0) {
-                        $buyNum = 1;
-                        my_Assert(now() - $user->privateState->lastFreeGetTs_ShopBoxBright >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
-                        $user->privateState->lastFreeGetTs_ShopBoxBright = now();
-                    }
-                }
-                
                 if ($buyNum == 1) {
                     $cost = $mo->cost_one;
                     $yaoshiArr = explode(',', $mo->cost_one_yaoshi);
@@ -197,7 +183,21 @@ class ShopProc {
                     my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
                     $user->baseInfo->Consume_Cash($cost);
                 }
-
+                
+                if ($mo->type == 1) {
+                    if ($buyNum == 0) {
+                        $buyNum = 1;
+                        my_Assert(now() - $user->privateState->lastFreeGetTs_ShopBoxCommon >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
+                        $user->privateState->lastFreeGetTs_ShopBoxCommon = now();
+                    }
+                } else if ($mo->type == 2) {
+                    if ($buyNum == 0) {
+                        $buyNum = 1;
+                        my_Assert(now() - $user->privateState->lastFreeGetTs_ShopBoxBright >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
+                        $user->privateState->lastFreeGetTs_ShopBoxBright = now();
+                    }
+                }
+                                
                 $arr = array();
                 $arr[] = 1;
                 $arr[] = 10;