|
|
|
@ -396,11 +396,17 @@ func ReturnBackWithdraw(or *common.WithdrawOrder, originStatus, status uint8, pa |
|
|
|
order := &common.WithdrawOrder{} |
|
|
|
order := &common.WithdrawOrder{} |
|
|
|
order.ID = or.ID |
|
|
|
order.ID = or.ID |
|
|
|
tx := db.Mysql().Begin() |
|
|
|
tx := db.Mysql().Begin() |
|
|
|
|
|
|
|
// 打款失败的单,重新挂起到后台进入人工审核,不再返还金币给玩家
|
|
|
|
u := map[string]interface{}{ |
|
|
|
u := map[string]interface{}{ |
|
|
|
"status": status, |
|
|
|
"status": status, |
|
|
|
"fail_reason": or.FailReason, |
|
|
|
"fail_reason": or.FailReason, |
|
|
|
"callback_time": time.Now().Unix(), |
|
|
|
"callback_time": time.Now().Unix(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if len(or.Operator) == 0 { |
|
|
|
|
|
|
|
status = common.StatusROrderCreate |
|
|
|
|
|
|
|
delete(u, "callback_time") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if len(payChannel) > 0 { |
|
|
|
if len(payChannel) > 0 { |
|
|
|
u["pay_channel"] = payChannel[0] |
|
|
|
u["pay_channel"] = payChannel[0] |
|
|
|
} |
|
|
|
} |
|
|
|
@ -423,10 +429,13 @@ func ReturnBackWithdraw(or *common.WithdrawOrder, originStatus, status uint8, pa |
|
|
|
uid := or.UID |
|
|
|
uid := or.UID |
|
|
|
re := new(common.RechargeInfo) |
|
|
|
re := new(common.RechargeInfo) |
|
|
|
re.UID = uid |
|
|
|
re.UID = uid |
|
|
|
updateRe := map[string]interface{}{ |
|
|
|
updateRe := map[string]interface{}{} |
|
|
|
"withdrawing_cash": gorm.Expr("withdrawing_cash - ?", or.WithdrawCash), |
|
|
|
if status != common.StatusROrderCreate { |
|
|
|
"total_withdrawing": gorm.Expr("total_withdrawing - ?", or.Amount), |
|
|
|
updateRe = map[string]interface{}{ |
|
|
|
"day_withdraw": gorm.Expr("day_withdraw - ?", or.Amount), |
|
|
|
"withdrawing_cash": gorm.Expr("withdrawing_cash - ?", or.WithdrawCash), |
|
|
|
|
|
|
|
"total_withdrawing": gorm.Expr("total_withdrawing - ?", or.Amount), |
|
|
|
|
|
|
|
"day_withdraw": gorm.Expr("day_withdraw - ?", or.Amount), |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if status == common.StatusROrderFail || status == common.StatusROrderRefuse { |
|
|
|
if status == common.StatusROrderFail || status == common.StatusROrderRefuse { |
|
|
|
updateRe["withdraw_count"] = gorm.Expr("withdraw_count + ?", -1) |
|
|
|
updateRe["withdraw_count"] = gorm.Expr("withdraw_count + ?", -1) |
|
|
|
@ -438,18 +447,20 @@ func ReturnBackWithdraw(or *common.WithdrawOrder, originStatus, status uint8, pa |
|
|
|
tx.Rollback() |
|
|
|
tx.Rollback() |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
if err := UpdateCurrency(&common.UpdateCurrency{ |
|
|
|
if status != common.StatusROrderCreate { |
|
|
|
CurrencyBalance: &common.CurrencyBalance{ |
|
|
|
if err := UpdateCurrency(&common.UpdateCurrency{ |
|
|
|
UID: or.UID, |
|
|
|
CurrencyBalance: &common.CurrencyBalance{ |
|
|
|
Type: or.CurrencyType, |
|
|
|
UID: or.UID, |
|
|
|
Value: or.WithdrawCash, |
|
|
|
Type: or.CurrencyType, |
|
|
|
Event: common.CurrencyEventWithDrawBack, |
|
|
|
Value: or.WithdrawCash, |
|
|
|
Exs1: or.OrderID, |
|
|
|
Event: common.CurrencyEventWithDrawBack, |
|
|
|
}, |
|
|
|
Exs1: or.OrderID, |
|
|
|
}, tx); err != nil { |
|
|
|
}, |
|
|
|
log.Error("Withdraw callback err:%v", err) |
|
|
|
}, tx); err != nil { |
|
|
|
tx.Rollback() |
|
|
|
log.Error("Withdraw callback err:%v", err) |
|
|
|
return err |
|
|
|
tx.Rollback() |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 退还代付券
|
|
|
|
// 退还代付券
|
|
|
|
// if or.Extra == "useFreeWithdraw" {
|
|
|
|
// if or.Extra == "useFreeWithdraw" {
|
|
|
|
|