2023-12-21 22:17:40 +08:00
|
|
|
package controller
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"service/api/errcode"
|
|
|
|
vasproto "service/api/proto/vas/proto"
|
|
|
|
"service/app/mix/service"
|
|
|
|
"service/bizcommon/util"
|
|
|
|
"service/library/logger"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 获取充值商品
|
|
|
|
func GetCoinsProductList(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.GetCoinsProductListReq)
|
|
|
|
data, ec := service.DefaultService.GetCoinsProductList(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("GetCoinsProductList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 充值 创建订单
|
|
|
|
func CreateOrder(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.CreateOrderReq)
|
|
|
|
data, ec := service.DefaultService.CreateOrder(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("CreateOrder fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// op充值
|
|
|
|
func OpCreateOrder(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.OpCreateOrderReq)
|
2023-12-25 01:14:14 +08:00
|
|
|
if req.Operator != "yezian" {
|
|
|
|
logger.Warn("invalid operator, req: %v", util.ToJson(req))
|
|
|
|
ReplyErrCodeMsg(ctx, errcode.ErrCodeVasInvalidParam)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-12-21 22:17:40 +08:00
|
|
|
ec := service.DefaultService.OpCreateOrder(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("OpCreateOrder fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 一键解锁
|
|
|
|
func OneStepUnlock(ctx *gin.Context) {
|
|
|
|
defer logger.Recover()
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.OneStepUnlockContactReq)
|
|
|
|
data, ec := service.DefaultService.OneStepUnlockContact(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("GetAddWechatList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 填写地址
|
|
|
|
func ConsumerFillContact(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.ConsumerFillContactReq)
|
|
|
|
ec := service.DefaultService.ConsumerFillContact(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("ConsumerFillContact fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 待添加微信列表
|
|
|
|
func GetAddWechatList(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.GetAddWechatListReq)
|
|
|
|
data, ec := service.DefaultService.GetAddWechatList(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("GetAddWechatList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 完成添加微信
|
|
|
|
func ConfirmAddWechat(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.ConfirmAddWechatReq)
|
|
|
|
data, ec := service.DefaultService.ConfirmAddWechat(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("ConfirmAddWechat fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 已解锁微信列表
|
|
|
|
func GetUnlockWechatList(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.GetUnlockWechatListReq)
|
|
|
|
data, ec := service.DefaultService.GetUnlockWechatList(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("GetUnlockWechatList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 明细
|
|
|
|
func GetCHList(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.GetCHListReq)
|
|
|
|
data, ec := service.DefaultService.GetCHList(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("GetCHList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 网红设置微信
|
|
|
|
func UpdateWechat(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.UpdateWechatReq)
|
|
|
|
ec := service.DefaultService.UpdateWechat(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("UpdateWechat fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查看微信
|
|
|
|
func QueryWechat(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.QueryWechatReq)
|
|
|
|
isUnlock, lockType, wechat, ec := service.DefaultService.QueryWechat(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("QueryWechat fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
data := &vasproto.QueryWechatData{
|
|
|
|
IsUnlock: isUnlock,
|
|
|
|
LockType: lockType,
|
|
|
|
WechatContact: wechat,
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// h5直接解锁
|
|
|
|
func H5DirectUnlockWechat(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*vasproto.H5DirectUnlockWechatReq)
|
|
|
|
data, ec := service.DefaultService.H5DirectUnlockWechat(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeVasSrvOk {
|
|
|
|
logger.Error("H5DirectUnlockWechat fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|