feat(pet): 添加宠物是否可售状态字段 新增is_sale字段用于控制宠物是否可售, 同时修改价格更新接口以支持设置销售状态 ```
This commit is contained in:
@@ -88,6 +88,7 @@ type PriseReq struct {
|
||||
g.Meta `path:"/modpirse" method:"POST"`
|
||||
Ctime uint32 `json:"catch_time"`
|
||||
Price float32 `json:"sale_price"`
|
||||
IsSale uint32 `json:"is_sale"`
|
||||
}
|
||||
|
||||
func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *cool.BaseRes, err error) {
|
||||
@@ -97,7 +98,7 @@ func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *co
|
||||
if req.Price < 5 {
|
||||
req.Price = 5
|
||||
}
|
||||
service.NewPetService(uint32(admin.UserId)).UPdatePrice(req.Ctime, req.Price)
|
||||
service.NewPetService(uint32(admin.UserId)).UPdatePrice(req.Ctime, req.Price, req.IsSale)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -46,9 +46,8 @@ func (s *PetService) UPdateFree(ctime uint32, free uint32) {
|
||||
).Update()
|
||||
|
||||
}
|
||||
func (s *PetService) UPdatePrice(ctime uint32, Price float32) {
|
||||
|
||||
s.dbm(s.Model).Where("catch_time", ctime).Data("sale_price", Price).Update()
|
||||
func (s *PetService) UPdatePrice(ctime uint32, Price float32, is_sale uint32) {
|
||||
s.dbm(s.Model).Where("catch_time", ctime).Data("sale_price", Price, "is_sale", is_sale).Update()
|
||||
|
||||
}
|
||||
func (s *PetService) BuyPet(pid uint32) error {
|
||||
|
||||
Reference in New Issue
Block a user