|
@@ -79,29 +79,39 @@ class ShopProc {
|
|
|
case EnumShopGift::Daily_Shop://每日商店
|
|
|
$mo = GameConfig::shop_daily_getItem($typeId);
|
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
-
|
|
|
- if($mo->freeNum > 0){
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ my_Assert(in_array($typeId, $user->privateState->dailyShopRandItems), ErrCode::err_const_no);
|
|
|
+ if($typeId == 1001){
|
|
|
+ $getNum = 0;
|
|
|
+ foreach ($user->privateState->dailyShopReceived as $id) {
|
|
|
+ if($id == $typeId){
|
|
|
+ $getNum+=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ if($getNum >= $mo->num){
|
|
|
+ my_Assert($user->privateState->dailyShop_GuangGaoNum < $mo->num, ErrCode::user_shop_FreeNumLimit);
|
|
|
+ my_Assert(now() - $user->privateState->dailyShop_GuangGaoTs >= $mo->downTs, ErrCode::user_shop_FreeNumLimit);
|
|
|
+ $user->privateState->dailyShop_GuangGaoNum += 1;
|
|
|
+ $user->privateState->dailyShop_GuangGaoTs = now();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ my_Assert(!in_array($typeId, $user->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);
|
|
|
+
|
|
|
+ switch ($mo->costType) {
|
|
|
+ case EnumShopCost::Gold:
|
|
|
+ my_Assert($user->baseInfo->gold>= $mo->costNum, ErrCode::notenough_gold_msg);
|
|
|
+ ctx()->baseInfo->Consume_Gold($mo->costNum);
|
|
|
+ break;
|
|
|
+ case EnumShopCost::Cash:
|
|
|
+ my_Assert($user->baseInfo->cash>= $mo->costNum, ErrCode::notenough_cash_msg);
|
|
|
+ ctx()->baseInfo->Consume_Cash($mo->costNum);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- my_Assert(in_array($typeId, $user->privateState->dailyShopRandItems), ErrCode::err_const_no);
|
|
|
- my_Assert(!in_array($typeId, $user->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);
|
|
|
-
|
|
|
- switch ($mo->costType) {
|
|
|
- case EnumShopCost::Gold:
|
|
|
- my_Assert($user->baseInfo->gold>= $mo->costNum, ErrCode::notenough_gold_msg);
|
|
|
- ctx()->baseInfo->Consume_Gold($mo->costNum);
|
|
|
- break;
|
|
|
- case EnumShopCost::Cash:
|
|
|
- my_Assert($user->baseInfo->cash>= $mo->costNum, ErrCode::notenough_cash_msg);
|
|
|
- ctx()->baseInfo->Consume_Cash($mo->costNum);
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
StoreProc::AddMultiItemInStore($mo->reward);
|
|
|
ctx()->privateState->dailyShopReceived[] = $typeId;
|
|
|
|