mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
3.9 KiB
137 lines
3.9 KiB
// Code generated by go-mir. DO NOT EDIT.
|
|
|
|
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/alimy/mir/v3"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/rocboss/paopao-ce/internal/model/web"
|
|
)
|
|
|
|
type WebAlipayPriv interface {
|
|
// Chain provide handlers chain for gin
|
|
Chain() gin.HandlersChain
|
|
|
|
UserWalletBills(*web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error)
|
|
UserRechargeResult() mir.Error
|
|
UserRechargeLink() mir.Error
|
|
|
|
mustEmbedUnimplementedWebAlipayPrivServant()
|
|
}
|
|
|
|
type WebAlipayPrivBinding interface {
|
|
BindUserWalletBills(*gin.Context) (*web.UserWalletBillsReq, mir.Error)
|
|
|
|
mustEmbedUnimplementedWebAlipayPrivBinding()
|
|
}
|
|
|
|
type WebAlipayPrivRender interface {
|
|
RenderUserWalletBills(*gin.Context, *web.UserWalletBillsResp, mir.Error)
|
|
RenderUserRechargeResult(*gin.Context, mir.Error)
|
|
RenderUserRechargeLink(*gin.Context, mir.Error)
|
|
|
|
mustEmbedUnimplementedWebAlipayPrivRender()
|
|
}
|
|
|
|
// RegisterWebAlipayPrivServant register WebAlipayPriv servant to gin
|
|
func RegisterWebAlipayPrivServant(e *gin.Engine, s WebAlipayPriv, b WebAlipayPrivBinding, r WebAlipayPrivRender) {
|
|
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:
|
|
}
|
|
|
|
r.RenderUserRechargeResult(c, s.UserRechargeResult())
|
|
})
|
|
|
|
router.Handle("POST", "/user/recharge", func(c *gin.Context) {
|
|
select {
|
|
case <-c.Request.Context().Done():
|
|
return
|
|
default:
|
|
}
|
|
|
|
r.RenderUserRechargeLink(c, s.UserRechargeLink())
|
|
})
|
|
|
|
}
|
|
|
|
// UnimplementedWebAlipayPrivServant can be embedded to have forward compatible implementations.
|
|
type UnimplementedWebAlipayPrivServant struct {
|
|
}
|
|
|
|
func (UnimplementedWebAlipayPrivServant) Chain() gin.HandlersChain {
|
|
return nil
|
|
}
|
|
|
|
func (UnimplementedWebAlipayPrivServant) UserWalletBills(req *web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error) {
|
|
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
}
|
|
|
|
func (UnimplementedWebAlipayPrivServant) UserRechargeResult() mir.Error {
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
}
|
|
|
|
func (UnimplementedWebAlipayPrivServant) UserRechargeLink() mir.Error {
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
}
|
|
|
|
func (UnimplementedWebAlipayPrivServant) mustEmbedUnimplementedWebAlipayPrivServant() {}
|
|
|
|
// UnimplementedWebAlipayPrivRender can be embedded to have forward compatible implementations.
|
|
type UnimplementedWebAlipayPrivRender struct {
|
|
RenderAny func(*gin.Context, any, mir.Error)
|
|
}
|
|
|
|
func (r *UnimplementedWebAlipayPrivRender) RenderUserWalletBills(c *gin.Context, data *web.UserWalletBillsResp, err mir.Error) {
|
|
r.RenderAny(c, data, err)
|
|
}
|
|
|
|
func (r *UnimplementedWebAlipayPrivRender) RenderUserRechargeResult(c *gin.Context, err mir.Error) {
|
|
r.RenderAny(c, nil, err)
|
|
}
|
|
|
|
func (r *UnimplementedWebAlipayPrivRender) RenderUserRechargeLink(c *gin.Context, err mir.Error) {
|
|
r.RenderAny(c, nil, err)
|
|
}
|
|
|
|
func (r *UnimplementedWebAlipayPrivRender) mustEmbedUnimplementedWebAlipayPrivRender() {}
|
|
|
|
// UnimplementedWebAlipayPrivBinding can be embedded to have forward compatible implementations.
|
|
type UnimplementedWebAlipayPrivBinding struct {
|
|
BindAny func(*gin.Context, any) mir.Error
|
|
}
|
|
|
|
func (b *UnimplementedWebAlipayPrivBinding) BindUserWalletBills(c *gin.Context) (*web.UserWalletBillsReq, mir.Error) {
|
|
obj := new(web.UserWalletBillsReq)
|
|
err := b.BindAny(c, obj)
|
|
return obj, err
|
|
}
|
|
|
|
func (b *UnimplementedWebAlipayPrivBinding) mustEmbedUnimplementedWebAlipayPrivBinding() {}
|