This commit is contained in:
aozhiwei 2022-09-15 14:37:09 +08:00
parent 607625da33
commit 31c3b0fa63
4 changed files with 43 additions and 1 deletions

View File

@ -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(), '属性变更'],
]
},
]

View File

@ -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'],

View File

@ -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;

View File

@ -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
);
}