-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patherror.go
67 lines (61 loc) · 2.43 KB
/
error.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
package controllers
import (
"blog/common"
"blog/models"
"github.com/astaxie/beego"
"html/template"
)
type ErrorController struct {
beego.Controller
}
func (this *ErrorController) Error404() {
//获取博客标题,声明,寄语
config := models.GetConfig("blog_title", "blog_avatar", "favicon_icon", "notice", "word", "keywords", "description", "website_title")
if value, ok := config.(map[string]string); ok {
this.Data["title"] = value["blog_title"]
this.Data["avatar"] = common.Asset(value["blog_avatar"])
this.Data["favicon_icon"] = common.Asset(value["favicon_icon"])
this.Data["notice"] = value["notice"]
this.Data["word"] = template.HTML(value["word"])
this.Data["keywords"] = value["keywords"]
this.Data["description"] = value["description"]
this.Data["website_title"] = "404"
}
this.Data["categorys"] = models.CategoryList(0)
this.TplName = "system/404.tpl"
this.Layout = "base/layout.tpl"
}
func (this *ErrorController) Error501() {
//获取博客标题,声明,寄语
config := models.GetConfig("blog_title", "blog_avatar", "favicon_icon", "notice", "word", "keywords", "description", "website_title")
if value, ok := config.(map[string]string); ok {
this.Data["title"] = value["blog_title"]
this.Data["avatar"] = common.Asset(value["blog_avatar"])
this.Data["favicon_icon"] = common.Asset(value["favicon_icon"])
this.Data["notice"] = value["notice"]
this.Data["word"] = template.HTML(value["word"])
this.Data["keywords"] = value["keywords"]
this.Data["description"] = value["description"]
this.Data["website_title"] = "404"
}
this.Data["categorys"] = models.CategoryList(0)
this.TplName = "system/404.tpl"
this.Layout = "base/layout.tpl"
}
func (this *ErrorController) ErrorDb() {
//获取博客标题,声明,寄语
config := models.GetConfig("blog_title", "blog_avatar", "favicon_icon", "notice", "word", "keywords", "description", "website_title")
if value, ok := config.(map[string]string); ok {
this.Data["title"] = value["blog_title"]
this.Data["avatar"] = common.Asset(value["blog_avatar"])
this.Data["favicon_icon"] = common.Asset(value["favicon_icon"])
this.Data["notice"] = value["notice"]
this.Data["word"] = template.HTML(value["word"])
this.Data["keywords"] = value["keywords"]
this.Data["description"] = value["description"]
this.Data["website_title"] = "404"
}
this.Data["categorys"] = models.CategoryList(0)
this.TplName = "system/404.tpl"
this.Layout = "base/layout.tpl"
}