merge
This commit is contained in:
commit
3ce8ba6efb
|
@ -283,11 +283,10 @@ func WithdrawApply(ctx *gin.Context) {
|
||||||
ReplyErrorMsg(ctx, "最低提现金额不能小于100元")
|
ReplyErrorMsg(ctx, "最低提现金额不能小于100元")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//if !vasproto.IsWithdrawAnyDiasEnable(req.Mid) && req.Diamonds > 20000 {
|
||||||
if !vasproto.IsWithdrawAnyDiasEnable(req.Mid) && req.Diamonds > 20000 {
|
// ReplyErrorMsg(ctx, "最大提现金额不能大于2000元")
|
||||||
ReplyErrorMsg(ctx, "最大提现金额不能大于2000元")
|
// return
|
||||||
return
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(time.Second * 1)
|
time.Sleep(time.Second * 1)
|
||||||
|
|
||||||
|
|
|
@ -1580,64 +1580,64 @@ func (v *Vas) WithdrawApply(ctx *gin.Context, req *vasproto.WithdrawApplyReq) (t
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2000元以下直接操作
|
// 2000元以下直接操作
|
||||||
if money <= 200000 || vasproto.IsWithdrawAnyDiasEnable(req.Mid) {
|
//if money <= 200000 || vasproto.IsWithdrawAnyDiasEnable(req.Mid) {
|
||||||
alipayCli := alipaycli.GetAlipayClientByAppId(alipaycli.AppIdXinYiDaoLe)
|
alipayCli := alipaycli.GetAlipayClientByAppId(alipaycli.AppIdXinYiDaoLe)
|
||||||
|
|
||||||
// 更改状态
|
// 更改状态
|
||||||
err = v.store.UpdateWithdrawOrderStatus(ctx, tx, orderId, dbstruct.VasWithdrawOrderStatusInit, dbstruct.VasWithdrawOrderStatusAuto)
|
err = v.store.UpdateWithdrawOrderStatus(ctx, tx, orderId, dbstruct.VasWithdrawOrderStatusInit, dbstruct.VasWithdrawOrderStatusAuto)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("UpdateWithdrawOrderStatus fail, order: %v, err: %v", wOrder.ToString(), err)
|
logger.Error("UpdateWithdrawOrderStatus fail, order: %v, err: %v", wOrder.ToString(), err)
|
||||||
return
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加提现记录
|
||||||
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue