/// <summary> /// 异常响应处理 /// </summary> /// <param name="context"></param> /// <param name="appInfo"></param> /// <param name="res"></param> /// <returns></returns> private static Task ExceptionResponse(HttpContext context, AppIdentity appInfo, IResp res) { var url = InterReqHelper.GetErrorPage(context, appInfo, res); if (string.IsNullOrEmpty(url)) { return(ResponseJsonError(context.Response, res)); } context.Response.Redirect(url); return(Task.CompletedTask); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="appInfo"></param> /// <param name="res"></param> protected void ResponseExceptionEnd(AuthorizationFilterContext context, AppIdentity appInfo, Resp res) { string rUrl = res.IsRespType(RespTypes.UserUnLogin) ? InterReqHelper.GetUnloginPage(context.HttpContext, appInfo) : InterReqHelper.GetErrorPage(context.HttpContext, appInfo, res); if (string.IsNullOrEmpty(rUrl)) { context.Result = new ContentResult() { ContentType = "application/json; charset=utf-8", Content = $"{{\"ret\":{res.ret},\"msg\":\"{res.msg}\"}}" }; return; } context.Result = new RedirectResult(rUrl); return; }