go-common/app/interface/main/activity/http/kfc.go

42 lines
790 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package http
import (
bm "go-common/library/net/http/blademaster"
)
func kfcInfo(c *bm.Context) {
p := new(struct {
ID int64 `form:"id" validate:"min=1"`
})
if err := c.Bind(p); err != nil {
return
}
midStr, _ := c.Get("mid")
mid := midStr.(int64)
c.JSON(kfcSvc.KfcInfo(c, p.ID, mid))
}
func kfcUse(c *bm.Context) {
p := new(struct {
CouponCode string `form:"coupon_code" validate:"min=1"`
})
if err := c.Bind(p); err != nil {
return
}
if len([]rune(p.CouponCode)) == 12 {
kfcSvc.KfcUse(c, p.CouponCode)
}
c.JSON(200, nil)
}
func deliverKfc(c *bm.Context) {
p := new(struct {
ID int64 `form:"id" validate:"min=1"`
Mid int64 `form:"mid" validate:"min=1"`
})
if err := c.Bind(p); err != nil {
return
}
c.JSON(nil, kfcSvc.DeliverKfc(c, p.ID, p.Mid))
}