|
|
|
// Code generated by go-mir. DO NOT EDIT.
|
|
|
|
// versions:
|
|
|
|
// - mir v3.2.0
|
|
|
|
|
|
|
|
package v1
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/alimy/mir/v3"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/rocboss/paopao-ce/internal/model/web"
|
|
|
|
)
|
|
|
|
|
|
|
|
type AlipayPriv interface {
|
|
|
|
// Chain provide handlers chain for gin
|
|
|
|
Chain() gin.HandlersChain
|
|
|
|
|
|
|
|
UserWalletBills(*web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error)
|
|
|
|
UserRechargeResult(*web.UserRechargeResultReq) (*web.UserRechargeResultResp, mir.Error)
|
|
|
|
UserRechargeLink(*web.UserRechargeLinkReq) (*web.UserRechargeLinkResp, mir.Error)
|
|
|
|
|
|
|
|
mustEmbedUnimplementedAlipayPrivServant()
|
|
|
|
}
|
|
|
|
|
|
|
|
type AlipayPrivBinding interface {
|
|
|
|
BindUserWalletBills(*gin.Context) (*web.UserWalletBillsReq, mir.Error)
|
|
|
|
BindUserRechargeResult(*gin.Context) (*web.UserRechargeResultReq, mir.Error)
|
|
|
|
BindUserRechargeLink(*gin.Context) (*web.UserRechargeLinkReq, mir.Error)
|
|
|
|
|
|
|
|
mustEmbedUnimplementedAlipayPrivBinding()
|
|
|
|
}
|
|
|
|
|
|
|
|
type AlipayPrivRender interface {
|
|
|
|
RenderUserWalletBills(*gin.Context, *web.UserWalletBillsResp, mir.Error)
|
|
|
|
RenderUserRechargeResult(*gin.Context, *web.UserRechargeResultResp, mir.Error)
|
|
|
|
RenderUserRechargeLink(*gin.Context, *web.UserRechargeLinkResp, mir.Error)
|
|
|
|
|
|
|
|
mustEmbedUnimplementedAlipayPrivRender()
|
|
|
|
}
|
|
|
|
|
|
|
|
// RegisterAlipayPrivServant register AlipayPriv servant to gin
|
|
|
|
func RegisterAlipayPrivServant(e *gin.Engine, s AlipayPriv, b AlipayPrivBinding, r AlipayPrivRender) {
|
|
|
|
router := e.Group("v1")
|
|
|
|
// use chain for router
|
|
|
|
middlewares := s.Chain()
|
|
|
|
router.Use(middlewares...)
|
|
|
|
|
|
|
|
// register routes info to router
|
|
|
|
router.Handle("GET", "/user/wallet/bills", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
|
|
req, err := b.BindUserWalletBills(c)
|
|
|
|
if err != nil {
|
|
|
|
r.RenderUserWalletBills(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.UserWalletBills(req)
|
|
|
|
r.RenderUserWalletBills(c, resp, err)
|
|
|
|
})
|
|
|
|
|
|
|
|
router.Handle("GET", "/user/recharge", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
|
|
req, err := b.BindUserRechargeResult(c)
|
|
|
|
if err != nil {
|
|
|
|
r.RenderUserRechargeResult(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.UserRechargeResult(req)
|
|
|
|
r.RenderUserRechargeResult(c, resp, err)
|
|
|
|
})
|
|
|
|
|
|
|
|
router.Handle("POST", "/user/recharge", func(c *gin.Context) {
|
|
|
|
select {
|
|
|
|
case <-c.Request.Context().Done():
|
|
|
|
return
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
|
|
req, err := b.BindUserRechargeLink(c)
|
|
|
|
if err != nil {
|
|
|
|
r.RenderUserRechargeLink(c, nil, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
resp, err := s.UserRechargeLink(req)
|
|
|
|
r.RenderUserRechargeLink(c, resp, err)
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnimplementedAlipayPrivServant can be embedded to have forward compatible implementations.
|
|
|
|
type UnimplementedAlipayPrivServant struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedAlipayPrivServant) Chain() gin.HandlersChain {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedAlipayPrivServant) UserWalletBills(req *web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedAlipayPrivServant) UserRechargeResult(req *web.UserRechargeResultReq) (*web.UserRechargeResultResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedAlipayPrivServant) UserRechargeLink(req *web.UserRechargeLinkReq) (*web.UserRechargeLinkResp, mir.Error) {
|
|
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (UnimplementedAlipayPrivServant) mustEmbedUnimplementedAlipayPrivServant() {}
|
|
|
|
|
|
|
|
// UnimplementedAlipayPrivRender can be embedded to have forward compatible implementations.
|
|
|
|
type UnimplementedAlipayPrivRender struct {
|
|
|
|
RenderAny func(*gin.Context, any, mir.Error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *UnimplementedAlipayPrivRender) RenderUserWalletBills(c *gin.Context, data *web.UserWalletBillsResp, err mir.Error) {
|
|
|
|
r.RenderAny(c, data, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *UnimplementedAlipayPrivRender) RenderUserRechargeResult(c *gin.Context, data *web.UserRechargeResultResp, err mir.Error) {
|
|
|
|
r.RenderAny(c, data, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *UnimplementedAlipayPrivRender) RenderUserRechargeLink(c *gin.Context, data *web.UserRechargeLinkResp, err mir.Error) {
|
|
|
|
r.RenderAny(c, data, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *UnimplementedAlipayPrivRender) mustEmbedUnimplementedAlipayPrivRender() {}
|
|
|
|
|
|
|
|
// UnimplementedAlipayPrivBinding can be embedded to have forward compatible implementations.
|
|
|
|
type UnimplementedAlipayPrivBinding struct {
|
|
|
|
BindAny func(*gin.Context, any) mir.Error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *UnimplementedAlipayPrivBinding) BindUserWalletBills(c *gin.Context) (*web.UserWalletBillsReq, mir.Error) {
|
|
|
|
obj := new(web.UserWalletBillsReq)
|
|
|
|
err := b.BindAny(c, obj)
|
|
|
|
return obj, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *UnimplementedAlipayPrivBinding) BindUserRechargeResult(c *gin.Context) (*web.UserRechargeResultReq, mir.Error) {
|
|
|
|
obj := new(web.UserRechargeResultReq)
|
|
|
|
err := b.BindAny(c, obj)
|
|
|
|
return obj, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *UnimplementedAlipayPrivBinding) BindUserRechargeLink(c *gin.Context) (*web.UserRechargeLinkReq, mir.Error) {
|
|
|
|
obj := new(web.UserRechargeLinkReq)
|
|
|
|
err := b.BindAny(c, obj)
|
|
|
|
return obj, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *UnimplementedAlipayPrivBinding) mustEmbedUnimplementedAlipayPrivBinding() {}
|