1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-04-22 00:39:41 +08:00
parent b59beed45f
commit a6386daad8
11 changed files with 90 additions and 67 deletions

View File

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