feat(shop): 添加商品限购功能并优化购买逻辑 - 修改购买黄金商品接口,添加商品配额检查功能 - 新增月、周、日三种限购类型检查逻辑 - 当商品超出库存或达到购买限制时返回相应错误码 - 移除gold_log表中PlayerID字段的唯一索引约束 - 修复GoldService中的Cheak方法实现,支持多种时间维度限购检查 ```
This commit is contained in:
@@ -95,8 +95,14 @@ func (h Controller) BuyGoldItem(data *item.C2S_GOLD_BUY_PRODUCT, player *player.
|
||||
//product, exists := xmlres.GoldProductMap[int(data.ProductID)]
|
||||
pro := service.NewShopService().Get(data.ProductID)
|
||||
if pro == nil {
|
||||
return nil, errorcode.ErrorCodes.ErrSystemError
|
||||
return nil, errorcode.ErrorCodes.ErrTooManyProducts
|
||||
}
|
||||
if pro.QuotaType != 0 {
|
||||
if player.Service.GoldLog.Cheak(data.ProductID, pro.QuotaType-1)+int(data.Count) > int(pro.QuotaLimit) {
|
||||
return nil, errorcode.ErrorCodes.ErrExceedStock
|
||||
}
|
||||
}
|
||||
|
||||
var usegold uint64
|
||||
var addSuccess bool
|
||||
switch data.Type {
|
||||
|
||||
Reference in New Issue
Block a user