```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(item_buy): 优化购买逻辑并添加库存限制功能

- 将变量名 is 改为 ok,提高代码可读性
- 移除未使用的变量 addSuccess
- 重构购买成功逻辑,确保物品添加成功后才扣减金币
- 在 talk.go 中修改判断条件,使用 Limit 字段而非 Type 字段
- 在 user_talk.go 中添加 Limit 字段用于限制数量配置
```
This commit is contained in:
昔念
2026-03-28 01:46:52 +08:00
parent ce0474258a
commit 06091ff42c
3 changed files with 25 additions and 21 deletions

View File

@@ -15,6 +15,8 @@ type MineralCollectionConfig struct {
// MapID 矿产所在地图ID
MapID uint32 `gorm:"column:map_id;not null;index:idx_mineral_collection_config_map_id;comment:矿产所在地图ID" json:"map_id"`
//uint32 `gorm:"not null;default:0;comment:'限购类型( 0-每日限购 1-每周限购 2-每月限购)'" json:"quota_type" description:"限购类型"`
Limit uint32 `gorm:"column:limit;default:0;comment:限制数量" json:"limit"`
Type uint32 `gorm:"column:type;not null;index:idx_mineral_collection_config_type;comment:类型" json:"type"`
// DailyCollectCount 每日可采集次数