You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dongfeng-pay/jhmicro/order_settle/settle.go

42 lines
1.3 KiB
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/***************************************************
** @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()
}
}
}()
}