package global import ( base_ctl "SCRM/controllers" "SCRM/enums" "fmt" "github.com/astaxie/beego" ) func ErrorCtlRegistRouters() { beego.Router("/error", &ErrorViewController{}, "get:HandleError") } type ErrorViewController struct { base_ctl.BaseViewController } // /handle_error [get] // @param code:int func (this *ErrorViewController) HandleError() { code, _ := this.GetInt("code") if code == enums.ErrorCodeNeverCreateTypeApp { ssoDomain := beego.AppConfig.String("sso_domain") createAppURL := fmt.Sprintf("%v/org/app/create", ssoDomain) this.Redirect302(createAppURL) } else if code == enums.ErrorCodeContactSuperAdminCreateTypeApp { ssoDomain := beego.AppConfig.String("sso_domain") hitURL := fmt.Sprintf("%v/create_app_hint", ssoDomain) this.Redirect302(hitURL) } else { this.Abort404() } }