test set def

This commit is contained in:
shoopea 2019-12-13 17:37:20 +08:00
parent 0fb27e8309
commit 8bde59743e
2 changed files with 11 additions and 3 deletions

View File

@ -12,6 +12,7 @@ func startCron() *cron.Cron {
c := cron.New(cron.WithLocation(time.UTC))
c.AddFunc("15 7,15,23 * * *", cronSendWarReport)
c.AddFunc("58 6,14,22 * * *", cronSetDef)
c.AddFunc("@every 1m", cronSetDef)
c.Start()
return c
}

13
job.go
View File

@ -1158,10 +1158,10 @@ func jobFwdMsg(j Job) {
err = json.Unmarshal(j.Payload, &p)
logOnError(err, "jobFwdMsg : Unmarshal payload")
cwm, err := getObjMsg(j.Trigger)
msg, err := getObjMsg(j.Trigger)
logOnError(err, "jobFwdMsg : getObjMsg msg")
clientFwdCWMsg(j.UserID64, cwm.ID64, cwm.ChatID64, p.ChatID64)
clientFwdCWMsg(j.UserID64, msg.ID64, msg.ChatID64, p.ChatID64)
err = setJobDone(j.ID64)
logOnError(err, "jobFwdMsg : setJobDone")
@ -1177,8 +1177,15 @@ func jobSetDef(j Job) {
err = json.Unmarshal(j.Payload, &p)
logOnError(err, "jobSetDef : Unmarshal payload")
cwm, err := getObjMsg(j.Trigger)
msg, err := getObjMsg(j.Trigger)
logOnError(err, "jobSetDef : getObjMsg msg")
rule, err := getMsgParsingRule(msg)
logOnError(err, "jobSetDef : getMsgParsingRule")
cwm, err := parseSubTypeMessageMeAck(msg, rule.re)
if cwm.State == `🛌Rest` {
clientSendCWMsg(j.UserID64, `🛡Defend`)
}
err = setJobDone(j.ID64)
logOnError(err, "jobSetDef : setJobDone")