diff --git a/logic/controller/user_action.go b/logic/controller/user_action.go index 88ca8f167..183898f47 100644 --- a/logic/controller/user_action.go +++ b/logic/controller/user_action.go @@ -153,7 +153,11 @@ func (h Controller) ChangePlayerCloth(data *item.ChangePlayerClothInboundInfo, p } for _, clothID := range data.ClothList { - result.ClothList = append(result.ClothList, model.PeopleItemInfo{ID: clothID, Level: 1}) + + if player.Service.Item.Exist(clothID) { + result.ClothList = append(result.ClothList, model.PeopleItemInfo{ID: clothID, Level: 1}) + } + } player.Info.Clothes = result.ClothList diff --git a/modules/player/service/item.go b/modules/player/service/item.go index cdd4dd032..f369c7862 100644 --- a/modules/player/service/item.go +++ b/modules/player/service/item.go @@ -8,6 +8,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) +func (s *ItemService) Exist(itemid uint32) bool { + + var ttt *model.Item + s.TestModel(s.Model).Where("item_id", itemid).Scan(&ttt) + + return ttt != nil + +} func (s *ItemService) Get(min, max uint32) []model.Item { var ttt []model.Item