refactor(item): 统一物品操作接口并优化金币处理逻辑

This commit is contained in:
1
2025-12-16 06:54:27 +00:00
parent 39dc79f706
commit 49b4c8cf2a
10 changed files with 47 additions and 28 deletions

View File

@@ -6,6 +6,8 @@ import (
"blazing/logic/service/fight"
"blazing/logic/service/item"
"blazing/logic/service/player"
"github.com/gogf/gf/v2/util/gconv"
)
func (h Controller) ITEM_SALE(data *item.C2S_ITEM_SALE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
@@ -17,6 +19,6 @@ func (h Controller) ITEM_SALE(data *item.C2S_ITEM_SALE, c *player.Player) (resul
c.Info.Coins += uint32(int64(data.Amount) * int64(xmlres.ItemsMAP[int(data.ItemId)].SellPrice))
}
c.Service.Item.SubItem(data.ItemId, data.Amount)
c.Service.Item.UPDATE(data.ItemId, -gconv.Int(data.Amount))
return result, 0
}