对接
This commit is contained in:
@@ -9,6 +9,14 @@ import (
|
||||
type Recharge struct{ s *service.Service }
|
||||
|
||||
func NewRecharge(s *service.Service) *Recharge { return &Recharge{s: s} }
|
||||
func (h *Recharge) Providers(c *gin.Context) {
|
||||
v, e := h.s.Providers(c.Request.Context())
|
||||
if e != nil {
|
||||
businessFail(c, e)
|
||||
return
|
||||
}
|
||||
OKWithData(c, gin.H{"list": v})
|
||||
}
|
||||
func (h *Recharge) Plans(c *gin.Context) {
|
||||
v, e := h.s.Plans(c.Request.Context())
|
||||
if e != nil {
|
||||
@@ -48,6 +56,34 @@ func (h *Recharge) Get(c *gin.Context) {
|
||||
}
|
||||
OKWithData(c, v)
|
||||
}
|
||||
|
||||
func (h *Recharge) GetMine(c *gin.Context) {
|
||||
claims := Claims(c)
|
||||
if claims == nil {
|
||||
NoAuth(c, "请登录")
|
||||
return
|
||||
}
|
||||
v, e := h.s.GetForUser(c.Request.Context(), claims.ID, c.Param("orderNo"))
|
||||
if e != nil {
|
||||
businessFail(c, e)
|
||||
return
|
||||
}
|
||||
OKWithData(c, v)
|
||||
}
|
||||
|
||||
func (h *Recharge) PaymentStatus(c *gin.Context) {
|
||||
claims := Claims(c)
|
||||
if claims == nil {
|
||||
NoAuth(c, "请登录")
|
||||
return
|
||||
}
|
||||
v, e := h.s.PaymentStatus(c.Request.Context(), claims.ID, c.Param("orderNo"))
|
||||
if e != nil {
|
||||
businessFail(c, e)
|
||||
return
|
||||
}
|
||||
OKWithData(c, v)
|
||||
}
|
||||
func (h *Recharge) Create(c *gin.Context) {
|
||||
in, ok := bindJSON[dto.RechargeOrderRequest](c)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user