From 9ece7b21a1a04123bc27bc8d4f34be5b9e46a329 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 1 Dec 2021 14:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=BA=97=E5=8A=9F=E8=83=BDok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/controller/ShopController.class.php | 33 +++++++++++++--------- webapp/controller/UserController.class.php | 1 + webapp/models/Bag.php | 2 +- webapp/services/PropertyChgService.php | 4 +-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index bd452f40..e9e19a35 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -9,6 +9,7 @@ require_once('mt/Drop.php'); require_once('models/User.php'); require_once('models/Hero.php'); +require_once('models/Bag.php'); require_once('models/HeroSkin.php'); require_once('models/GunSkin.php'); require_once('models/ShopBuyRecord.php'); @@ -18,6 +19,7 @@ require_once('services/PropertyChgService.php'); use phpcommon\SqlHelper; use models\User; +use models\Bag; use models\Hero; use models\HeroSkin; use models\GunSkin; @@ -221,7 +223,7 @@ class ShopController extends BaseAuthedController { } } $propertyChgService->addUserChg(); - $this->rspData(array( + $this->_rspData(array( 'award' => $awardService->toDto(), 'property_chg' => $propertyChgService->toDto(), 'goods_chg' => $goodsDto @@ -251,19 +253,21 @@ class ShopController extends BaseAuthedController { ); $priceInfo = mt\Item::getPriceInfo($val); if (!empty($priceInfo)) { - foreach ($priceInfo['price_info']['cost_list'] as $cost) { - if ($cost['discount'] > 0) { - switch ($cost['item_id']) { - case V_ITEM_GOLD: - { - $goodsDto['gold_discount'] = $cost['discount']; - } - break; - case V_ITEM_DIAMOND: - { - $goodsDto['diamond_discount'] = $cost['discount']; - } - break; + foreach ($priceInfo['price_info']['cost_list'] as $costGroup) { + foreach ($costGroup as $cost) { + if ($cost['discount'] > 0) { + switch ($cost['item_id']) { + case V_ITEM_GOLD: + { + $goodsDto['gold_discount'] = $cost['discount']; + } + break; + case V_ITEM_DIAMOND: + { + $goodsDto['diamond_discount'] = $cost['discount']; + } + break; + } } } } @@ -456,6 +460,7 @@ class ShopController extends BaseAuthedController { break; default: { + Bag::addItem($itemMeta['id'], 1); $propertyChgService->addBagChg(); } break; diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index ec07bf8b..93b2969a 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -61,6 +61,7 @@ class UserController extends BaseAuthedController { 'name' => $userName, #'avatar_url' => $avatar_url, 'gold' => 10000 * 10000, + 'diamond' => 10000 * 10000, #'season_status' => 1, #'newInfo' => '', #'new_second_equip' => 2, diff --git a/webapp/models/Bag.php b/webapp/models/Bag.php index 290d9b8d..863dfd5b 100644 --- a/webapp/models/Bag.php +++ b/webapp/models/Bag.php @@ -58,7 +58,7 @@ class Bag extends BaseModel { 'item_id' => $itemId ), array( - 'item_num' => function () use($item) { return "item_num + {$itemNum}";}, + 'item_num' => function () use($itemNum) { return "item_num + {$itemNum}";}, 'modifytime' => myself()->_getNowTime(), 'item_state' => self::GETED_STATE, ), diff --git a/webapp/services/PropertyChgService.php b/webapp/services/PropertyChgService.php index aaa0e037..bb14c1e3 100644 --- a/webapp/services/PropertyChgService.php +++ b/webapp/services/PropertyChgService.php @@ -46,12 +46,12 @@ class PropertyChgService extends BaseService { private function internalAddChg($name) { - foreach ($this->chgLlist as $item) { + foreach ($this->chgList as $item) { if ($item == $name) { return; } } - array_push($chgList, $name); + array_push($this->chgList, $name); } }