diff --git a/business/api/goods.go b/business/api/goods.go index 5c48213..b1a3bdd 100644 --- a/business/api/goods.go +++ b/business/api/goods.go @@ -49,6 +49,9 @@ func (p DefParty) goodsList() web_iris.Party { PetNotExistError.Fail(ctx, goodsListRequest) return } + if userInfo.Role == 1 { + userPetInfo = GetPet(goodsListRequest.Pid) + } //先取默认的商品 key := "0" + strconv.Itoa(userPetInfo.PetBaseInfo.PetType) + "0" + "0" goodsList := getPetGoodsList(key) diff --git a/business/api/pet.go b/business/api/pet.go index eea4e7b..96fc364 100644 --- a/business/api/pet.go +++ b/business/api/pet.go @@ -50,6 +50,12 @@ func GetUserPet(uId int64, pId int64) UserPetInfo { return UserPetInfo{userPet, PetBaseInfoMap[userPet.PetId]} } +func GetPet(pId int64) UserPetInfo { + var userPet models.Pet + database.Instance().Model(&models.Pet{}).Where("id = ? and status = 1", pId).Find(&userPet) + return UserPetInfo{userPet, PetBaseInfoMap[userPet.PetId]} +} + type PetListResponse struct { UserPets []UserPetInfo `json:"userPets"` }