This commit is contained in:
aozhiwei 2024-11-22 11:33:13 +08:00
parent e60bcd317a
commit f70201abb1

View File

@ -43,7 +43,7 @@ func (this *BagApi) UseItem(c *gin.Context) {
}
reqJson := struct {
ItemUniId string `json:"item_uniid"`
ItemNum string `json:"item_num"`
ItemNum int32 `json:"item_num"`
}{}
if err := c.ShouldBindJSON(&reqJson); err != nil {
f5.RspErr(c, 401, "params parse error")
@ -57,7 +57,11 @@ func (this *BagApi) UseItem(c *gin.Context) {
f5.RspErr(c, 500, "server internal error")
return
} else if !found {
f5.RspErr(c, 1, "server internal error")
f5.RspErr(c, 1, "item not found")
return
}
if bagItem.ItemNum < reqJson.ItemNum {
f5.RspErr(c, 1, "item not enough")
return
}
c.JSON(200, rspObj)