From 31c3b0fa637fd59fa53ebde8cd185e49cf66f78d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 15 Sep 2022 14:37:09 +0800 Subject: [PATCH] 1 --- doc/Bag.py | 14 ++++++++++++ doc/Battle.py | 1 + webapp/controller/BagController.class.php | 27 +++++++++++++++++++++++ webapp/services/PropertyChgService.php | 2 +- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/doc/Bag.py b/doc/Bag.py index 2b4c24bf..1d334e6c 100644 --- a/doc/Bag.py +++ b/doc/Bag.py @@ -53,4 +53,18 @@ class Bag(object): ['property_chg', _common.PropertyChg(), '属性变更'], ] }, + { + 'name': 'buyItem', + 'desc': '购买道具(目前只一次购买改名卡)', + 'group': 'Bag', + 'url': 'webapp/index.php?c=Bag&a=buyItem', + 'params': [ + _common.ReqHead(), + ['item_id', '', '道具id'], + ], + 'response': [ + _common.RspHead(), + ['property_chg', _common.PropertyChg(), '属性变更'], + ] + }, ] diff --git a/doc/Battle.py b/doc/Battle.py index 0d61cdd1..892fd43f 100644 --- a/doc/Battle.py +++ b/doc/Battle.py @@ -29,6 +29,7 @@ class Battle(object): 'params': [ _common.ReqHead(), ['battle_uniid', '', 'battle_uuid'], + ['match_mode', 0, '0: 匹配赛模式 1: 排位赛 3: pve'], ['is_valid_battle', 0, 'is_valid_battle'], ['payload', '', 'payload'], ['map_id', 0, '地图id'], diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index afcd576a..7e8cb632 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -138,6 +138,7 @@ class BagController extends BaseAuthedController { )); $this->propertyChgService->addBagChg(); } + $this->propertyChgService->addUserChg(); $this->_rspData(array( 'property_chg' => $this->propertyChgService->toDto(), )); @@ -236,6 +237,32 @@ class BagController extends BaseAuthedController { )); } + public function buyItem() + { + $itemId = getReqVal('item_id', 0); + $itemMeta = mt\Item::get($itemId); + if (!$itemMeta) { + $this->_rspErr(1, "item_id error"); + return; + } + if (!( + $itemMeta['type'] == mt\Item::FUNC_TYPE && + $itemMeta['sub_type'] == mt\Item::FUNC_RENAME_CARD_SUBTYPE)) { + $this->_rspErr(1, "only supported rename card"); + return; + } + $items = array( + 'item_id' => itemId, + 'item_num' => 1 + ); + $this->_addItems($items, $this->awardService, $this->propertyService); + $this->propertyChgService->addBagChg(); + $this->_rspData(array( + 'award' => $this->awardService->toDto(), + 'property_chg' => $this->propertyChgService->toDto(), + )); + } + private function useTiliDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3) { $errCode = 0; diff --git a/webapp/services/PropertyChgService.php b/webapp/services/PropertyChgService.php index e345270e..1df6173b 100644 --- a/webapp/services/PropertyChgService.php +++ b/webapp/services/PropertyChgService.php @@ -49,7 +49,7 @@ class PropertyChgService extends BaseService { public function toDto() { return array( - 'user_info' => $this->userChg ? User::info(myself()->_getOrmUserInfo()) : array(), + 'user_info' => $this->userChg ? User::info(myself()->_getOrmUserInfo()) : null, 'container_chg' => $this->chgList ); }