service/app/mix/controller/vas_op.go

108 lines
2.9 KiB
Go

package controller
import (
"github.com/gin-gonic/gin"
"service/api/errcode"
vasproto "service/api/proto/vas/proto"
zoneproto "service/api/proto/zone/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
)
func OpCoinOrderList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*vasproto.OpCoinOrderListReq)
if req.Limit <= 0 {
req.Limit = 1000
}
list, ec := service.DefaultService.OpCoinOrderList(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("OpCoinOrderList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &vasproto.OpCoinOrderListData{
List: list,
}
ReplyOk(ctx, data)
}
func OpOrderList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*vasproto.OpOrderListReq)
if req.Limit <= 0 {
req.Limit = 1000
}
list, ec := service.DefaultService.OpOrderList(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("OpOrderList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &vasproto.OpOrderListData{
List: list,
}
ReplyOk(ctx, data)
}
func OpZoneRefundList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*zoneproto.OpZoneRefundListParam)
if req.Limit <= 0 {
req.Limit = 1000
}
list, ec := service.DefaultService.OpZoneRefundList(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("OpOrderList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &zoneproto.OpZoneRefundListData{
List: list,
}
ReplyOk(ctx, data)
}
func OpManualUnlockWechat(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*zoneproto.OpManualUnlockWechatParam)
ec, err := service.DefaultService.OpManualUnlockWechat(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("RefundOrder fail, req: %v, ec: %v", util.ToJson(req), ec)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func OpRollbackZoneAdmissionExitStatus(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*zoneproto.OpRollbackZoneExitStatusParam)
ec, err := service.DefaultService.OpRollbackZoneAdmissionExitStatus(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("OpRollbackZoneAdmissionExitStatus fail, req: %v, ec: %v", util.ToJson(req), ec)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func OpRollbackZoneRefundStatus(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*zoneproto.OpRollbackZoneRefundStatusParam)
ec, err := service.DefaultService.OpRollbackZoneRefundStatus(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("OpRollbackZoneAdmissionExitStatus fail, req: %v, ec: %v", util.ToJson(req), ec)
if err != nil {
ReplyErrorMsg(ctx, err.Error())
return
}
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}