From 6d1e62324e6ca5892907d2803d0ddb5e3e29889f Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Wed, 29 May 2024 15:26:24 +0800 Subject: [PATCH] manual unlock wechat --- api/proto/zone/proto/zone_op.go | 7 +++++++ app/mix/controller/init.go | 1 + app/mix/controller/vas_op.go | 15 +++++++++++++++ app/mix/service/logic/vas.go | 11 +++++++---- app/mix/service/logic/vas_zone.go | 2 +- app/mix/service/vasservice.go | 18 ++++++++++++++++++ 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/api/proto/zone/proto/zone_op.go b/api/proto/zone/proto/zone_op.go index 2f437c8c..4b4be13a 100644 --- a/api/proto/zone/proto/zone_op.go +++ b/api/proto/zone/proto/zone_op.go @@ -134,3 +134,10 @@ type OpZoneRefundVO struct { type OpZoneRefundListData struct { List []*OpZoneRefundVO `json:"list"` } + +type OpManualUnlockWechatParam struct { + Mid int64 `json:"mid"` // 用户mid + StreamerMid int64 `json:"streamer_mid"` // 主播id + ProductId string `json:"product_id"` // 商品id + Oid2 string `json:"oid2"` // oid2 +} diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index 78cf5aef..fa60bf87 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -302,6 +302,7 @@ func Init(r *gin.Engine) { opVasPayGroup.POST("refund_coin_order", middleware.JSONParamValidator(vasproto.RefundCoinOrderReq{}), RefundCoinOrder) opVasPayGroup.POST("wxpay_callback_manual", middleware.JSONParamValidator(vasproto.WxpayCallbackManualParam{}), WxpayCallbackManual) opVasPayGroup.POST("zone_refund_list", middleware.JSONParamValidator(zoneproto.OpZoneRefundListParam{}), OpZoneRefundList) + opVasPayGroup.POST("manual_unlock_wechat", middleware.JSONParamValidator(zoneproto.OpManualUnlockWechatParam{}), OpManualUnlockWechat) // 验证码 opVeriCodeGroup := r.Group("/op/veri_code", PrepareOp()) diff --git a/app/mix/controller/vas_op.go b/app/mix/controller/vas_op.go index 86810680..3ee5ffa5 100644 --- a/app/mix/controller/vas_op.go +++ b/app/mix/controller/vas_op.go @@ -60,3 +60,18 @@ func OpZoneRefundList(ctx *gin.Context) { } 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) +} diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index be1b7d49..4aacae31 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -684,6 +684,7 @@ func (v *Vas) OneStepUnlockContact(ctx *gin.Context, req *vasproto.OneStepUnlock retContact = uVasInfo.WechatContact } } + logger.Info("OneStepUnlockContact success, req: %v, coinOrderId: %v", util.ToJson(req), orderId) }() // 锁钱包 余额检查 @@ -820,10 +821,12 @@ func (v *Vas) OneStepUnlockContact(ctx *gin.Context, req *vasproto.OneStepUnlock } // 是否达到铁粉解锁条件 - _err := v.UnlockZoneIronfanshipReachConsume(ctx, tx, coinOrder.GetMid(), 0, coinOrder.GetUid()) - if _err != nil { - logger.Error("UnlockZoneIronfanshipReachConsume fail, coinOrder: %v, err: %v", util.ToJson(coinOrder), _err) - return + if coinPrice > 0 { + _err := v.UnlockZoneIronfanshipReachConsume(ctx, tx, coinOrder.GetMid(), 0, coinOrder.GetUid()) + if _err != nil { + logger.Error("UnlockZoneIronfanshipReachConsume fail, coinOrder: %v, err: %v", util.ToJson(coinOrder), _err) + return + } } return } diff --git a/app/mix/service/logic/vas_zone.go b/app/mix/service/logic/vas_zone.go index 1cc584c5..a785cadd 100644 --- a/app/mix/service/logic/vas_zone.go +++ b/app/mix/service/logic/vas_zone.go @@ -505,7 +505,7 @@ func (v *Vas) UnlockZoneIronfanshipReachConsume(ctx *gin.Context, tx *sqlx.Tx, m // 解锁铁粉 err := v.MustUnlockIronfanship(ctx, tx, mid, zid, -1, "ironfan", dbstruct.ZoneUnlockTypeReachConsume) if err != nil { - logger.Error("UnlockZoneAdmission fail, mid: %v, zid: %v, err: %v", mid, zid, err) + logger.Error("MustUnlockIronfanship fail, mid: %v, zid: %v, err: %v", mid, zid, err) return err } diff --git a/app/mix/service/vasservice.go b/app/mix/service/vasservice.go index 32c9c4bf..5fa84510 100644 --- a/app/mix/service/vasservice.go +++ b/app/mix/service/vasservice.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "fmt" goproto "google.golang.org/protobuf/proto" + "service/api/base" "service/api/errcode" "service/api/errs" accountproto "service/api/proto/account/proto" @@ -1070,3 +1071,20 @@ func (s *Service) ZoneMomentOrderList(ctx *gin.Context, req *vasproto.ZoneMoment } return } + +func (s *Service) OpManualUnlockWechat(ctx *gin.Context, req *zoneproto.OpManualUnlockWechatParam) (ec errcode.ErrCode, err error) { + _, _, _, err = _DefaultVas.OneStepUnlockContact(ctx, &vasproto.OneStepUnlockContactReq{ + BaseRequest: base.BaseRequest{ + Mid: req.Mid, + }, + ContactProductId: req.ProductId, + Uid: req.StreamerMid, + Oid2: req.Oid2, + }) + ec, err = errs.DealVasErr(err) + if err != nil { + logger.Error("OneStepUnlockContact fail, req: %v, err: %v", util.ToJson(req), err) + return + } + return +}