go-common/app/interface/live/app-room/api/http/v1/gift.bm.go

107 lines
3.3 KiB
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: gift.proto
/*
Package v1 is a generated blademaster stub package.
This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
It is generated from these files:
gift.proto
*/
package v1
import (
"context"
bm "go-common/library/net/http/blademaster"
"go-common/library/net/http/blademaster/binding"
)
// to suppressed 'imported but not used warning'
var _ *bm.Context
var _ context.Context
var _ binding.StructValidator
var PathGiftDailyBag = "/live.approom.v1.Gift/daily_bag"
var PathGiftNeedTipRecharge = "/live.approom.v1.Gift/NeedTipRecharge"
var PathGiftTipRechargeAction = "/live.approom.v1.Gift/TipRechargeAction"
var PathGiftGiftConfig = "/live.approom.v1.Gift/gift_config"
// ==============
// Gift Interface
// ==============
type GiftBMServer interface {
// 每日礼包接口
// `midware:"guest"`
DailyBag(ctx context.Context, req *DailyBagReq) (resp *DailyBagResp, err error)
// `midware:"auth"`
NeedTipRecharge(ctx context.Context, req *NeedTipRechargeReq) (resp *NeedTipRechargeResp, err error)
// `midware:"auth" method:"post"`
TipRechargeAction(ctx context.Context, req *TipRechargeActionReq) (resp *TipRechargeActionResp, err error)
// 礼物全量配置
GiftConfig(ctx context.Context, req *GiftConfigReq) (resp *GiftConfigResp, err error)
}
var v1GiftSvc GiftBMServer
func giftDailyBag(c *bm.Context) {
p := new(DailyBagReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.DailyBag(c, p)
c.JSON(resp, err)
}
func giftNeedTipRecharge(c *bm.Context) {
p := new(NeedTipRechargeReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.NeedTipRecharge(c, p)
c.JSON(resp, err)
}
func giftTipRechargeAction(c *bm.Context) {
p := new(TipRechargeActionReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.TipRechargeAction(c, p)
c.JSON(resp, err)
}
func giftGiftConfig(c *bm.Context) {
p := new(GiftConfigReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.GiftConfig(c, p)
c.JSON(resp, err)
}
// RegisterV1GiftService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1GiftService(e *bm.Engine, svc GiftBMServer, midMap map[string]bm.HandlerFunc) {
auth := midMap["auth"]
guest := midMap["guest"]
v1GiftSvc = svc
e.GET("/xlive/app-room/v1/gift/daily_bag", guest, giftDailyBag)
e.GET("/xlive/app-room/v1/gift/NeedTipRecharge", auth, giftNeedTipRecharge)
e.POST("/xlive/app-room/v1/gift/TipRechargeAction", auth, giftTipRechargeAction)
e.GET("/xlive/app-room/v1/gift/gift_config", giftGiftConfig)
}
// RegisterGiftBMServer Register the blademaster route
func RegisterGiftBMServer(e *bm.Engine, server GiftBMServer) {
v1GiftSvc = server
e.GET("/live.approom.v1.Gift/daily_bag", giftDailyBag)
e.GET("/live.approom.v1.Gift/NeedTipRecharge", giftNeedTipRecharge)
e.POST("/live.approom.v1.Gift/TipRechargeAction", giftTipRechargeAction)
e.GET("/live.approom.v1.Gift/gift_config", giftGiftConfig)
}