From 35fd7e968e0dad63ac6620195eb556624ec52f3f Mon Sep 17 00:00:00 2001 From: naivekun Date: Fri, 11 Dec 2020 15:08:47 +0800 Subject: [PATCH] chaoxing: improve tasktime --- README.md | 8 +++++--- provider/chaoxing/chaoxing.go | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index de05107..6dfb785 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,9 @@ Push方法在cloudscan收到消息后会被依次调用,模块会处理从clou 超星签到模块,各个参数说明如下 -tasktime模块用于指定轮询签到时间,防止老师在非上课时间钓鱼执法 +tasktime列表用于指定轮询签到时间,防止老师在非上课时间钓鱼执法,如果不需要此功能可以移除tasktime列表,模块将一直轮询签到。 + +若需要全天签到事件,可以填写duration为0 ``` alias: "别名,用于推送消息时区分各个任务", @@ -163,11 +165,11 @@ uid: "超星的uid,从cookie里面扣", courseid: "课程ID", classid: "班级ID", interval: 轮询间隔, -tasktime: [ // 一个列表,成员如下 +tasktime: [ // 一个列表,成员如下,不填可以一直轮询 { weekday: 4, //周四,周日是0 time: "07:45", //任务开始时间,格式为HH:MM - duration: 20 //签到活动持续时间,单位是分钟 + duration: 20 //签到活动持续时间,单位是分钟,填0或不填会默认全天事件 }, { //支持多个时间段签到 diff --git a/provider/chaoxing/chaoxing.go b/provider/chaoxing/chaoxing.go index 16b6a68..d09f9aa 100644 --- a/provider/chaoxing/chaoxing.go +++ b/provider/chaoxing/chaoxing.go @@ -73,6 +73,10 @@ func (c *ChaoxingProvider) Run(pushMessage func(string, string) error) { isAtTaskTime := false for _, activeTime := range c.TaskTime { if int(time.Now().Weekday()) == activeTime.Weekday { + if activeTime.Duration == 0 { + isAtTaskTime = true + break + } t := parseActiveTime(&activeTime) if t.Before(time.Now()) && t.Add(time.Minute*time.Duration(activeTime.Duration)).After(time.Now()) { isAtTaskTime = true