Commit d33d84ba authored by jingbo.wang's avatar jingbo.wang

添加月表

parent e5ae32e9
......@@ -11,7 +11,6 @@ import (
"io/ioutil"
)
func init() {
//显示报表
api_server.HandlerFunc(api_server.GET, "/show/:long/:y/:m/:d/:name", show)
......@@ -65,7 +64,7 @@ func sendEmail(ctx *fasthttp.RequestCtx) {
d := ctx.UserValue("d").(string)
name := ctx.UserValue("name").(string)
if long != "day" && long != "week" {
if long != "day" && long != "week" && long != "month" {
ctx.Response.SetStatusCode(fasthttp.StatusNotFound)
ctx.Response.SetBodyString("page not found")
return
......
......@@ -44,6 +44,7 @@ func run(now time.Time, dir string) {
dir = dir + "/" + fileNamePrefix
dirDay := dir + "/" + "day"
dirWeek := dir + "/" + "week"
dirMonth := dir + "/" + "month"
if util.Exists(dir) {
return
} else {
......@@ -53,6 +54,14 @@ func run(now time.Time, dir string) {
}
}
//月表
if err := os.Mkdir(dirMonth, os.ModePerm); err != nil {
glog.Error("创建dir失败:", dirMonth, ":", err)
return
} else {
reportForm(now, dirWeek, 30)
}
//周表
if err := os.Mkdir(dirWeek, os.ModePerm); err != nil {
glog.Error("创建dir失败:", dirWeek, ":", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment