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.8 KiB
137 lines
3.8 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 AlipayPriv interface {
|
|
// Chain provide handlers chain for gin
|
|
Chain() gin.HandlersChain
|
|
|
|
UserWalletBills(*web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error)
|
|
UserRechargeResult() mir.Error
|
|
UserRechargeLink() mir.Error
|
|
|
|
mustEmbedUnimplementedAlipayPrivServant()
|
|
}
|
|
|
|
type AlipayPrivBinding interface {
|
|
BindUserWalletBills(*gin.Context) (*web.UserWalletBillsReq, mir.Error)
|
|
|
|
mustEmbedUnimplementedAlipayPrivBinding()
|
|
}
|
|
|
|
type AlipayPrivRender interface {
|
|
RenderUserWalletBills(*gin.Context, *web.UserWalletBillsResp, mir.Error)
|
|
RenderUserRechargeResult(*gin.Context, mir.Error)
|
|
RenderUserRechargeLink(*gin.Context, 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:
|
|
}
|
|
|
|
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())
|
|
})
|
|
|
|
}
|
|
|
|
// 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() mir.Error {
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
}
|
|
|
|
func (UnimplementedAlipayPrivServant) UserRechargeLink() mir.Error {
|
|
return 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, err mir.Error) {
|
|
r.RenderAny(c, nil, err)
|
|
}
|
|
|
|
func (r *UnimplementedAlipayPrivRender) RenderUserRechargeLink(c *gin.Context, err mir.Error) {
|
|
r.RenderAny(c, nil, 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) mustEmbedUnimplementedAlipayPrivBinding() {}
|