diff --git a/consume/egg_fin_withdraw_apply_consume.go b/consume/egg_fin_withdraw_apply_consume.go index 94a386a..71dacb8 100644 --- a/consume/egg_fin_withdraw_apply_consume.go +++ b/consume/egg_fin_withdraw_apply_consume.go @@ -55,7 +55,7 @@ func EggFinWithdrawApplyDataConsume(queue md.MqQueue) { for { res, ok = <-delivery if ok == true { - err = handleEggFinWithdrawApplyDataConsume(res.Body, client) + err = handleEggFinWithdrawApplyDataConsume(res.Body, client, ch) if err != nil { fmt.Println("EggFinWithdrawApplyDataConsume:::::", err.Error()) utils2.FilePutContents("EggFinWithdrawApplyDataConsume", utils2.SerializeStr(map[string]interface{}{ @@ -89,7 +89,7 @@ func EggFinWithdrawApplyDataConsume(queue md.MqQueue) { } } -func handleEggFinWithdrawApplyDataConsume(msgData []byte, client *alipay.Client) error { +func handleEggFinWithdrawApplyDataConsume(msgData []byte, client *alipay.Client, ch *rabbit.Channel) error { time.Sleep(time.Duration(100) * time.Millisecond) //休眠100毫秒 // 1.解析mq中queue的数据结构体 var msg *md2.EggFinWithdrawApplyData @@ -148,6 +148,11 @@ func handleEggFinWithdrawApplyDataConsume(msgData []byte, client *alipay.Client) }) _, err = client.FundTransUniTransfer(context.Background(), bm) if err != nil { + // 如果需要重试 推回队尾 + if err.Error() == "Lock wait timeout exceeded; try restarting transaction" { + ch.Publish(md2.EggAppExchange, msg, md2.EggFinWithdrawApply) + return nil + } //TODO::处理提现失败 err = dealFinWithdrawApplyStateForBad(apply) if err != nil {