Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb

This commit is contained in:
hujiabin 2024-10-16 17:31:13 +08:00
commit 55fcceb9ee
2 changed files with 23 additions and 4 deletions

View File

@ -1019,6 +1019,11 @@ class BattleController extends BaseAuthedController {
public function useBattleItem()
{
$itemId = getReqVal('item_id', 0);
$itemMeta = mt\Item::get($itemId);
if (!$itemMeta) {
$this->_rspErr(2, 'config error');
return;
}
$itemCount = Bag::getItemCount($itemId);
if ($itemCount > 0) {
Bag::decItem($itemId, 1);
@ -1417,9 +1422,9 @@ class BattleController extends BaseAuthedController {
'return_time' => myself()->_getNowTime(),
)
);
services\BattleBoxService::incAlreadyAllocBoxNum($row['phase'],
$row['createtime'],
-max(0, $allocBoxNum - $usedNum));
services\BattleBoxService::incAlreadyAllocNum($row['phase'],
$row['createtime'],
-max(0, $allocBoxNum - $usedNum));
myself()->_rspOk();
}

View File

@ -498,11 +498,25 @@ class UserController extends BaseAuthedController {
)
)) {
$itemNum = myself()->_callModelStatic('Bag', 'getItemCount', $itemId);
$hasLuckySymbol = myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol');
if ($itemMeta['type'] == mt\Item::FUNC_TYPE &&
$itemMeta['sub_type'] == mt\Item::LUCKY_SYMBOL_SUBTYPE &&
!$hasLuckySymbol) {
$this->_decItems(array(
array(
'item_id' => $itemMeta['id'],
'item_num' => 1
)
));
myself()->_callModelStatic('LuckySymbol', 'add');
$hasLuckySymbol = 1;
}
myself()->_rspData(array(
'item_id' => $itemId,
'item_num' => $itemNum,
'item_type' => $itemMeta['type'],
'item_sub_type' => $itemMeta['sub_type']
'item_sub_type' => $itemMeta['sub_type'],
'has_lucky_symbol' => $hasLuckySymbol,
));
} else {
myself()->_rspErr(1, 'item_id not found');