This commit is contained in:
@@ -133,6 +133,34 @@ func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *co
|
||||
return
|
||||
}
|
||||
|
||||
type PetShowReq struct {
|
||||
g.Meta `path:"/show" method:"POST"`
|
||||
CatchTime uint32 `json:"catch_time"`
|
||||
IsShow int `json:"is_show"` // 1=展示 0=取消展示
|
||||
}
|
||||
|
||||
func (c *PetBagController) Show(ctx context.Context, req *PetShowReq) (res *cool.BaseRes, err error) {
|
||||
admin := cool.GetAdmin(ctx)
|
||||
res = &cool.BaseRes{}
|
||||
if req.CatchTime == 0 {
|
||||
err = fmt.Errorf("invalid catch_time")
|
||||
return
|
||||
}
|
||||
if req.IsShow != 0 && req.IsShow != 1 {
|
||||
req.IsShow = 0
|
||||
}
|
||||
petSvc := service.NewPetService(uint32(admin.UserId))
|
||||
pet := petSvc.PetInfoOneByCatchTime(req.CatchTime)
|
||||
if pet == nil {
|
||||
err = fmt.Errorf("pet not found")
|
||||
return
|
||||
}
|
||||
if !petSvc.UpdateIsShow(req.CatchTime, req.IsShow) {
|
||||
err = fmt.Errorf("update failed")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type BuyPetReq struct {
|
||||
g.Meta `path:"/buy" method:"POST"`
|
||||
Cid uint32 `json:"id"`
|
||||
|
||||
Reference in New Issue
Block a user