|
@@ -61,6 +61,12 @@ func EggFinWithdrawApplyDataConsume(queue md.MqQueue) { |
|
|
"body": res.Body, |
|
|
"body": res.Body, |
|
|
"err": err.Error(), |
|
|
"err": err.Error(), |
|
|
})) |
|
|
})) |
|
|
|
|
|
//// 如果需要重试 推回队尾 |
|
|
|
|
|
//if err.Error() == "Lock wait timeout exceeded; try restarting transaction" { |
|
|
|
|
|
// var msg *md.CommUserId |
|
|
|
|
|
// json.Unmarshal(res.Body, &msg) |
|
|
|
|
|
// ch.Publish(queue.ExchangeName, msg, queue.RoutKey) |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
var data md2.EggFinWithdrawApplyErrorData |
|
|
var data md2.EggFinWithdrawApplyErrorData |
|
|
data.ErrorInfo = err.Error() |
|
|
data.ErrorInfo = err.Error() |
|
@@ -108,17 +114,9 @@ func handleEggFinWithdrawApplyDataConsume(msgData []byte, client *alipay.Client, |
|
|
return errors.New("提现记录无需处理~") |
|
|
return errors.New("提现记录无需处理~") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
session := db.Db.NewSession() |
|
|
|
|
|
defer func() { |
|
|
|
|
|
session.Close() |
|
|
|
|
|
if err := recover(); err != nil { |
|
|
|
|
|
_ = logx.Error(err) |
|
|
|
|
|
} |
|
|
|
|
|
}() |
|
|
|
|
|
session.Begin() |
|
|
|
|
|
// 2.3 更新 apply 信息 |
|
|
// 2.3 更新 apply 信息 |
|
|
apply.State = 2 |
|
|
apply.State = 2 |
|
|
affected, err2 := applyDb.UpdateFinWithdrawApplyBySession(session, apply, "state") |
|
|
|
|
|
|
|
|
affected, err2 := applyDb.UpdateFinWithdrawApply(apply, "state") |
|
|
if err2 != nil { |
|
|
if err2 != nil { |
|
|
return err2 |
|
|
return err2 |
|
|
} |
|
|
} |
|
@@ -144,24 +142,18 @@ func handleEggFinWithdrawApplyDataConsume(msgData []byte, client *alipay.Client, |
|
|
}) |
|
|
}) |
|
|
_, err = client.FundTransUniTransfer(context.Background(), bm) |
|
|
_, err = client.FundTransUniTransfer(context.Background(), bm) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
// 如果需要重试 推回队尾 |
|
|
|
|
|
if err.Error() == "Lock wait timeout exceeded; try restarting transaction" { |
|
|
|
|
|
ch.Publish(md2.EggAppExchange, msg, md2.EggFinWithdrawApply) |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
//TODO::处理提现失败 |
|
|
//TODO::处理提现失败 |
|
|
err = dealFinWithdrawApplyStateForBad(apply) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
|
|
|
err11 := dealFinWithdrawApplyStateForBad(apply) |
|
|
|
|
|
if err11 != nil { |
|
|
|
|
|
return errors.New("处理提现失败:" + err11.Error()) |
|
|
} |
|
|
} |
|
|
session.Rollback() |
|
|
|
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
} else if msg.WithdrawKind == 2 { |
|
|
} else if msg.WithdrawKind == 2 { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return session.Commit() |
|
|
|
|
|
|
|
|
return nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func dealFinWithdrawApplyStateForBad(finWithdrawApply *model.FinWithdrawApply) error { |
|
|
func dealFinWithdrawApplyStateForBad(finWithdrawApply *model.FinWithdrawApply) error { |
|
@@ -179,7 +171,7 @@ func dealFinWithdrawApplyStateForBad(finWithdrawApply *model.FinWithdrawApply) e |
|
|
return errors.New("更新提现单状态失败") |
|
|
return errors.New("更新提现单状态失败") |
|
|
} |
|
|
} |
|
|
dealUserWalletReq := md3.DealUserWalletReq{ |
|
|
dealUserWalletReq := md3.DealUserWalletReq{ |
|
|
Direction: "sub", |
|
|
|
|
|
|
|
|
Direction: "add", |
|
|
Kind: int(enum.UserWithdrawBad), |
|
|
Kind: int(enum.UserWithdrawBad), |
|
|
Title: enum.UserWithdrawBad.String(), |
|
|
Title: enum.UserWithdrawBad.String(), |
|
|
Uid: finWithdrawApply.Uid, |
|
|
Uid: finWithdrawApply.Uid, |
|
|