-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathcron.go
86 lines (67 loc) · 2.01 KB
/
cron.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// +----------------------------------------------------------------------
// | GoCMS 0.1
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2014 http://www.6574.com.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: zzdboy <[email protected]>
// +----------------------------------------------------------------------
package models
//定时执行任务
import "time"
import "github.com/revel/revel"
//每分钟执行一次
type EveryMinute struct {
}
func (c EveryMinute) Run() {
//task := new(Task)
//抓取cnBeta
//task.GrabCnbeta()
}
//每五分钟执行一次
type FiveMinutes struct {
}
func (c FiveMinutes) Run() {
revel.WARN.Println("Cron Time:" + time.Now().Format("2006-01-02 15:04:05"))
}
//每三十分钟执行
type ThirtyMinutes struct {
}
func (c ThirtyMinutes) Run() {
revel.WARN.Println("Cron Time:" + time.Now().Format("2006-01-02 15:04:05"))
}
//每小时执行
type HourlyMinutes struct {
}
func (c HourlyMinutes) Run() {
revel.WARN.Println("Cron Time:" + time.Now().Format("2006-01-02 15:04:05"))
}
//每天执行
//每天运行一次,午夜
type DailyMinutes struct {
}
func (c DailyMinutes) Run() {
revel.WARN.Println("Cron Time:" + time.Now().Format("2006-01-02 15:04:05"))
}
//每周执行
//每周运行一次,周日午夜
type WeeklyMinutes struct {
}
func (c WeeklyMinutes) Run() {
revel.WARN.Println("Cron Time:" + time.Now().Format("2006-01-02 15:04:05"))
}
//每月执行
//一个月运行一次,半夜,第一个月
type MonthlyMinutes struct {
}
func (c MonthlyMinutes) Run() {
revel.WARN.Println("Cron Time:" + time.Now().Format("2006-01-02 15:04:05"))
}
//每年执行
//运行一年一次,1月1日午夜
type YearlyMinutes struct {
}
func (c YearlyMinutes) Run() {
revel.WARN.Println("Cron Time:" + time.Now().Format("2006-01-02 15:04:05"))
}