dongfeng-pay/jhmicro/order_settle/settle.go
2019-12-19 16:43:20 +08:00

42 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/***************************************************
** @Desc : 将待结算的订单金额,加入账户可用金额中
** @Time : 2019/11/21 23:43
** @Author : yuebin
** @File : settle
** @Last Modified by : yuebin
** @Last Modified time: 2019/11/21 23:43
** @Software: GoLand
****************************************************/
package order_settle
import (
"github.com/astaxie/beego/logs"
"dongfeng-pay/service/controller"
"time"
)
const (
SettleInterval = 5 //隔多少分钟进行结算
OneMinute = 15 //每隔15分钟进行扫码看有没有隔天押款金额
)
func OrderSettleInit() {
//每隔5分钟巡查有没有可以进行结算的订单
go func() {
settleTimer := time.NewTimer(time.Duration(SettleInterval) * time.Minute)
oneMinuteTimer := time.NewTimer(time.Duration(OneMinute) * time.Minute)
for {
select {
case <-settleTimer.C:
settleTimer = time.NewTimer(time.Duration(SettleInterval) * time.Minute)
logs.Info("开始对商户进行支付订单结算>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
controller.OrderSettle()
case <-oneMinuteTimer.C:
oneMinuteTimer = time.NewTimer(time.Duration(OneMinute) * time.Minute)
logs.Info("开始执行商户的解款操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
controller.MerchantLoadSolve()
}
}
}()
}