refactor(item): 统一物品操作接口并优化金币处理逻辑
This commit is contained in:
@@ -20,7 +20,7 @@ func (s *ItemService) Get(min, max uint32) []model.Item {
|
||||
return ttt
|
||||
|
||||
}
|
||||
func (s *ItemService) AddItem(id, count uint32) {
|
||||
func (s *ItemService) UPDATE(id uint32, count int) {
|
||||
if t, _ := s.GModel(s.Model).Where("item_id", id).Count(); t != 0 {
|
||||
_, err := s.GModel(s.Model).Where("item_id", id).Increment("item_cnt", count)
|
||||
if err != nil {
|
||||
@@ -35,11 +35,7 @@ func (s *ItemService) AddItem(id, count uint32) {
|
||||
}
|
||||
|
||||
}
|
||||
func (s *ItemService) SubItem(id, count uint32) {
|
||||
|
||||
s.GModel(s.Model).Where("item_id", id).Decrement("item_cnt", count)
|
||||
|
||||
}
|
||||
func (s *ItemService) CheakItem(id uint32) uint32 {
|
||||
var ttt model.Item
|
||||
s.GModel(s.Model).Where("item_id", id).Scan(&ttt)
|
||||
|
||||
Reference in New Issue
Block a user