error.go 981 Bytes
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"] = "服务器目前无法使用(由于超载或停机维护)"
}