fix
This commit is contained in:
parent
7d666e8021
commit
c38248cfc5
|
@ -378,6 +378,7 @@ func (m *ordersModel) GetRechargeTimeoutOrder(
|
||||||
sql := "1=1"
|
sql := "1=1"
|
||||||
var args []interface{}
|
var args []interface{}
|
||||||
sql += " and transfer_status = 2"
|
sql += " and transfer_status = 2"
|
||||||
|
sql += " and (fail_reason = '' or fail_reason IS NULL)"
|
||||||
// sql += " and created_at <= DATE_SUB(NOW(), INTERVAL 3 MINUTE)"
|
// sql += " and created_at <= DATE_SUB(NOW(), INTERVAL 3 MINUTE)"
|
||||||
sql += " and created_at <= DATE_SUB(DATE_ADD(NOW(),INTERVAL 8 HOUR), INTERVAL 7 MINUTE)"
|
sql += " and created_at <= DATE_SUB(DATE_ADD(NOW(),INTERVAL 8 HOUR), INTERVAL 7 MINUTE)"
|
||||||
err = m.GetDb().Where(sql, args...).OrderBy("created_at").Limit(limit).Find(&orders)
|
err = m.GetDb().Where(sql, args...).OrderBy("created_at").Limit(limit).Find(&orders)
|
||||||
|
|
|
@ -14,8 +14,8 @@ import (
|
||||||
func DoRechargeTimeout() {
|
func DoRechargeTimeout() {
|
||||||
fmt.Println("开始执行周期任务:DoTimeout")
|
fmt.Println("开始执行周期任务:DoTimeout")
|
||||||
|
|
||||||
// 创建一个新的Ticker,每3秒钟触发一次
|
// 创建一个新的Ticker,每分钟触发一次
|
||||||
ticker := time.NewTicker(3 * time.Second)
|
ticker := time.NewTicker(60 * time.Second)
|
||||||
defer ticker.Stop() // 在函数结束时停止Ticker
|
defer ticker.Stop() // 在函数结束时停止Ticker
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
res, err := models.GetInstance().GetRechargeTimeoutOrder(10)
|
res, err := models.GetInstance().GetRechargeTimeoutOrder(10)
|
||||||
|
@ -24,6 +24,10 @@ func DoRechargeTimeout() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for i := 0; i < len(res); i++ {
|
for i := 0; i < len(res); i++ {
|
||||||
|
models.GetInstance().Update(&models.Orders{
|
||||||
|
Id: res[i].Id,
|
||||||
|
FailReason: "超时",
|
||||||
|
})
|
||||||
dingStr := fmt.Sprintf(
|
dingStr := fmt.Sprintf(
|
||||||
`
|
`
|
||||||
系统出现了超时7分钟的订单啦,快去后台查看!
|
系统出现了超时7分钟的订单啦,快去后台查看!
|
||||||
|
|
Loading…
Reference in New Issue