error.go
981 Bytes
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
package controllers
type ErrorController struct {
BaseController
}
func (c *ErrorController) Error401() {
resp := make(map[string]interface{})
defer c.RetData(resp)
resp["code"] = "401"
resp["msg"] = "未经授权,请求要求验证身份"
c.RetData(resp)
}
func (c *ErrorController) Error403() {
resp := make(map[string]interface{})
defer c.RetData(resp)
resp["code"] = "403"
resp["msg"] = "服务器拒绝请求"
}
func (c *ErrorController) Error404() {
resp := make(map[string]interface{})
defer c.RetData(resp)
resp["code"] = "404"
resp["msg"] = "很抱歉您访问的地址或者方法不存在"
}
func (c *ErrorController) Error500() {
resp := make(map[string]interface{})
defer c.RetData(resp)
resp["code"] = "500"
resp["msg"] = "server error"
}
func (c *ErrorController) Error503() {
resp := make(map[string]interface{})
defer c.RetData(resp)
resp["code"] = "503"
resp["msg"] = "服务器目前无法使用(由于超载或停机维护)"
}