From a05451e99a3c75a2363ec101600ff57b77284315 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Thu, 16 May 2024 16:49:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=8F=90=E7=8E=B0=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/mix/controller/vas.go | 8 +-- app/mix/service/logic/vas.go | 112 +++++++++++++++++------------------ 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/app/mix/controller/vas.go b/app/mix/controller/vas.go index becfcec0..ee9e1e5f 100644 --- a/app/mix/controller/vas.go +++ b/app/mix/controller/vas.go @@ -270,10 +270,10 @@ func WithdrawApply(ctx *gin.Context) { ReplyErrorMsg(ctx, "最低提现金额不能小于100元") return } - if !vasproto.IsWithdrawAnyDiasEnable(req.Mid) && req.Diamonds > 20000 { - ReplyErrorMsg(ctx, "最大提现金额不能大于2000元") - return - } + //if !vasproto.IsWithdrawAnyDiasEnable(req.Mid) && req.Diamonds > 20000 { + // ReplyErrorMsg(ctx, "最大提现金额不能大于2000元") + // return + //} time.Sleep(time.Second * 1) diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index b161e623..2d381b9e 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -1564,64 +1564,64 @@ func (v *Vas) WithdrawApply(ctx *gin.Context, req *vasproto.WithdrawApplyReq) (t } // 2000元以下直接操作 - if money <= 200000 || vasproto.IsWithdrawAnyDiasEnable(req.Mid) { - alipayCli := alipaycli.GetAlipayClientByAppId(alipaycli.AppIdXinYiDaoLe) + //if money <= 200000 || vasproto.IsWithdrawAnyDiasEnable(req.Mid) { + alipayCli := alipaycli.GetAlipayClientByAppId(alipaycli.AppIdXinYiDaoLe) - // 更改状态 - err = v.store.UpdateWithdrawOrderStatus(ctx, tx, orderId, dbstruct.VasWithdrawOrderStatusInit, dbstruct.VasWithdrawOrderStatusAuto) - if err != nil { - logger.Error("UpdateWithdrawOrderStatus fail, order: %v, err: %v", wOrder.ToString(), err) - return - } - - // 添加提现记录 - chWithdraw := &dbstruct.ConsumeHistory{ - Mid: goproto.Int64(mid), - Did: goproto.String(req.Did), - Type: goproto.Int32(dbstruct.CHTypeWithdraw), - SType: goproto.Int32(dbstruct.CHSTypeWithdrawDiamondAuto), - TypeId: goproto.String("auto_withdraw_diamonds"), - OrderId: goproto.String(orderId), - Change: goproto.Int64(-diamonds), - Before: goproto.Int64(walletLock.GetWithdrawDiamonds()), - After: goproto.Int64(walletLock.GetWithdrawDiamonds() - diamonds), - Ct: goproto.Int64(time.Now().Unix()), - } - err = v.store.CreateConsumeHistory(ctx, tx, chWithdraw) - if err != nil { - logger.Error("CreateConsumeHistory fail, ch: %v, err: %v", util.ToJson(chWithdraw), err) - return - } - - // 支付宝转账 - transferParam := &alipaycli.UniTransferParam{ - OutBizNo: orderId, - Amount: money, - Title: fmt.Sprintf("%d钻石提现", diamonds), - AlipayLoginId: alipayId, - AlipayName: alipayName, - } - transferResp, err = alipayCli.UniTransfer(ctx, transferParam) - if err != nil { - logger.Error("UniTransfer fail, param: %v, err: %v", util.ToJson(transferParam), err) - return - } - if transferResp == nil { - err = errors.New("invalid transfer resp") - logger.Error("Invalid transfer resp, param: %v, err: %v", util.ToJson(transferParam), err) - return - } - if transferResp.Response == nil { - err = errors.New("invalid transfer resp") - logger.Error("Invalid transfer resp response, param: %v, resp: %v, err: %v", util.ToJson(transferParam), util.ToJson(transferResp), err) - return - } - if transferResp.Response.Status != "SUCCESS" { - err = errs.ErrVasAlipayUniTransferFail - logger.Error("UniTransfer fail, param: %v, resp: %v, err: %v", util.ToJson(transferParam), util.ToJson(transferResp), err) - return - } + // 更改状态 + err = v.store.UpdateWithdrawOrderStatus(ctx, tx, orderId, dbstruct.VasWithdrawOrderStatusInit, dbstruct.VasWithdrawOrderStatusAuto) + if err != nil { + logger.Error("UpdateWithdrawOrderStatus fail, order: %v, err: %v", wOrder.ToString(), err) + return } + + // 添加提现记录 + chWithdraw := &dbstruct.ConsumeHistory{ + Mid: goproto.Int64(mid), + Did: goproto.String(req.Did), + Type: goproto.Int32(dbstruct.CHTypeWithdraw), + SType: goproto.Int32(dbstruct.CHSTypeWithdrawDiamondAuto), + TypeId: goproto.String("auto_withdraw_diamonds"), + OrderId: goproto.String(orderId), + Change: goproto.Int64(-diamonds), + Before: goproto.Int64(walletLock.GetWithdrawDiamonds()), + After: goproto.Int64(walletLock.GetWithdrawDiamonds() - diamonds), + Ct: goproto.Int64(time.Now().Unix()), + } + err = v.store.CreateConsumeHistory(ctx, tx, chWithdraw) + if err != nil { + logger.Error("CreateConsumeHistory fail, ch: %v, err: %v", util.ToJson(chWithdraw), err) + return + } + + // 支付宝转账 + transferParam := &alipaycli.UniTransferParam{ + OutBizNo: orderId, + Amount: money, + Title: fmt.Sprintf("%d钻石提现", diamonds), + AlipayLoginId: alipayId, + AlipayName: alipayName, + } + transferResp, err = alipayCli.UniTransfer(ctx, transferParam) + if err != nil { + logger.Error("UniTransfer fail, param: %v, err: %v", util.ToJson(transferParam), err) + return + } + if transferResp == nil { + err = errors.New("invalid transfer resp") + logger.Error("Invalid transfer resp, param: %v, err: %v", util.ToJson(transferParam), err) + return + } + if transferResp.Response == nil { + err = errors.New("invalid transfer resp") + logger.Error("Invalid transfer resp response, param: %v, resp: %v, err: %v", util.ToJson(transferParam), util.ToJson(transferResp), err) + return + } + if transferResp.Response.Status != "SUCCESS" { + err = errs.ErrVasAlipayUniTransferFail + logger.Error("UniTransfer fail, param: %v, resp: %v, err: %v", util.ToJson(transferParam), util.ToJson(transferResp), err) + return + } + //} return }