|
@@ -25,20 +25,23 @@ func InitSupplement() {
|
|
|
flag.StringVar(&Supplement_Cycle, "c", "day", "day:每天定点执行;week:每周定点执行")
|
|
|
flag.IntVar(&Supplement_Day, "d", 1, "补采几天的数据")
|
|
|
flag.IntVar(&Supplement_MaxErrorTimes, "e", 5, "连续几页异常采集中断")
|
|
|
+ flag.Parse()
|
|
|
if Supplement {
|
|
|
Supplement_Publishtime = GetTime(-Supplement_Day)
|
|
|
if Supplement_Cycle == "day" {
|
|
|
- Supplement_StartCron = "0 16 9 ? * *"
|
|
|
- //InitSpider()
|
|
|
+ Supplement_StartCron = "0 0 22 ? * *"
|
|
|
Supplement_EndCron = "0 0 9 ? * *"
|
|
|
+ //InitSpider()
|
|
|
} else if Supplement_Cycle == "week" {
|
|
|
Supplement_StartCron = "0 0 0 ? * SAT"
|
|
|
Supplement_EndCron = "0 0 0 ? * MON"
|
|
|
}
|
|
|
c := cron.New()
|
|
|
c.Start()
|
|
|
- c.AddFunc(Supplement_StartCron, SupplementStart)
|
|
|
- c.AddFunc(Supplement_EndCron, SupplementEnd)
|
|
|
+ if Supplement_StartCron != "" && Supplement_EndCron != "" {
|
|
|
+ c.AddFunc(Supplement_StartCron, SupplementStart)
|
|
|
+ c.AddFunc(Supplement_EndCron, SupplementEnd)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|