增加AtTime参数 支持自定义更新时间

This commit is contained in:
ZJY 2021-09-13 10:28:02 +08:00
parent e8fef0dde2
commit fdce2df544
5 changed files with 10 additions and 3 deletions

View File

@ -8,6 +8,7 @@ containers:
weigth:
mode: parallel
limit: 9999
AtTime: #填写1-12之间的数 填错自负默认为10 10点容易出现高峰超时。
theme:
static: ./static
master:

View File

@ -181,7 +181,7 @@ func updateCookie() {
}
}
} else {
(&JdCookie{}).Push(fmt.Sprintf("转换失败,请重新转换,%s", ck.PtPin))
(&JdCookie{}).Push(fmt.Sprintf("转换超时,请重新转换,%s", ck.PtPin))
}
go func() {
Save <- &JdCookie{}

View File

@ -47,7 +47,7 @@ func cmd(str string, sender *Sender) string {
}
msg += line
nt := time.Now()
if (nt.Unix() - st.Unix()) > 10 {
if (nt.Unix() - st.Unix()) > 15 {
sender.Reply(msg)
st = nt
msg = ""

View File

@ -31,6 +31,7 @@ type Yaml struct {
QbotPublicMode bool `yaml:"qbot_public_mode"`
DailyAssetPushCron string `yaml:"daily_asset_push_cron"`
Version string `yaml:"version"`
CTime string `yaml:"AtTime"`
Node string
Npm string
Python string
@ -81,6 +82,9 @@ func initConfig() {
if Config.Master == "" {
Config.Master = "xxxx"
}
if Config.CTime == "" {
Config.Master = "10"
}
if Config.Mode != Parallel {
Config.Mode = Balance
}

View File

@ -2,6 +2,7 @@ package models
import (
"fmt"
"github.com/beego/beego/v2/core/logs"
"github.com/robfig/cron/v3"
)
@ -9,7 +10,8 @@ func intiSky() {
c := cron.New(cron.WithSeconds()) //精确到秒
//定时任务
spec := "0 0 10/12 * * ?" //cron表达式每秒一次
spec := "0 0 " + Config.CTime + "/12 * * ?" //cron表达式每秒一次
logs.Info(spec)
c.AddFunc(spec, func() {
fmt.Println("开始wskey转换")
updateCookie()