1234567891011121314151617181920212223242526272829303132 |
- package controllers
- import (
- "git.baozhida.cn/ERP_libs/lib"
- beego "github.com/beego/beego/v2/server/web"
- )
- // 定义错误控制器
- type ErrorController struct {
- beego.Controller
- }
- // 定义404错误, 调用例子: this.Abort("404")
- func (c *ErrorController) Error404() {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "页面未找到!"}
- c.ServeJSON()
- return
- }
- // 定义500错误, 调用例子: this.Abort("500")
- func (c *ErrorController) Error500() {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "服务器异常,请稍后重试!"}
- c.ServeJSON()
- return
- }
- // 定义db错误, 调用例子: this.Abort("Db")
- func (c *ErrorController) ErrorDb() {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "服务器异常,请稍后重试!"}
- c.ServeJSON()
- return
- }
|