|
@ -15,7 +15,7 @@ import ( |
|
|
|
|
|
|
|
|
func init() { |
|
|
func init() { |
|
|
//go loopOrder()
|
|
|
//go loopOrder()
|
|
|
go utils.HandleTicker(1*time.Hour, HandleReward) // 打赏24小时退款
|
|
|
|
|
|
|
|
|
go utils.HandleTicker(1*time.Second, HandleReward) // 打赏24小时退款
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var orderDelayQueue = make(chan *models.UserOrder, math.MaxInt8) |
|
|
var orderDelayQueue = make(chan *models.UserOrder, math.MaxInt8) |
|
@ -247,7 +247,7 @@ func HandleTimeout(order *models.UserOrder) error { |
|
|
func HandleReward() error { |
|
|
func HandleReward() error { |
|
|
result, err := models.GetExpireRewardHistory() |
|
|
result, err := models.GetExpireRewardHistory() |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
logger.Error("获取过期打赏错误原因", err) |
|
|
|
|
|
|
|
|
err = fmt.Errorf("获取过期打赏错误原因: %v", err) |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
for _, v := range result { |
|
|
for _, v := range result { |
|
@ -256,13 +256,14 @@ func HandleReward() error { |
|
|
} |
|
|
} |
|
|
_, err := Refund("欧轩互动-打赏过期退款", v.OutTradeNo) |
|
|
_, err := Refund("欧轩互动-打赏过期退款", v.OutTradeNo) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
logger.Error("欧轩互动打赏过期退款", v.OutTradeNo) |
|
|
|
|
|
|
|
|
err = fmt.Errorf("欧轩互动打赏过期退款错误: %v, out_trade_no: %v", err, v.OutTradeNo) |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
v.Status = 4 |
|
|
v.Status = 4 |
|
|
_, err = models.Update(v.Id, v, "status") |
|
|
_, err = models.Update(v.Id, v, "status") |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
logger.Error("欧轩互动打赏过期状态改变错误") |
|
|
|
|
|
|
|
|
err = fmt.Errorf("欧轩互动打赏过期状态改变错误: %v, out_trade_no: %v", err, v.OutTradeNo) |
|
|
|
|
|
return err |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return nil |
|
|
return nil |
|
|