This commit is contained in:
yan.y 2024-05-15 00:08:04 +08:00
parent 2f90ee9e17
commit 1a9bca31ba
2 changed files with 9 additions and 0 deletions

View File

@ -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)

View File

@ -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"`
}