public override void ProcessRequest(HttpContext context) { try { base.ProcessRequest(context); var requestUriPath = _httpProxy.GetURIAbsolutePath().ToLower(); requestUriPath = ManagePageUrl(requestUriPath); if (ApplicationMode.Maintenance == ApplicationConfig.GetApplicationMode) { try { CreateInstallInstance(); if (_appInstaller.Status != Enums.AppInstallStatus.Finish) { _appInstaller.Install(_httpProxy); } else { HandleRequest(requestUriPath); } } catch (Exception) { throw; } } else { HandleRequest(requestUriPath); } } catch (Exception ex) { // TODO need to handle it better _logger.Error(ex.Message, ex); JObject data = CreateResponse(CommonConst._500_SERVER_ERROR); data["Error"] = ex.Message; data["StackTrace"] = ex.StackTrace; _httpProxy.ContentType = CommonConst.CONTENT_TYPE_APPLICATION_JSON; _httpProxy.SetResponse(CommonConst._500_SERVER_ERROR, data); } finally { WriteResponse(); } }
public virtual void Create() { int appInfoId = cvt.ToInt(ctx.Post("appInfoId")); AppInstaller info = getAppInfo(appInfoId); if (info.IsClose(ctx.owner.obj.GetType())) { echo("app closed"); return; } if (!checkInstall(info)) { return; } String name = ctx.Post("Name"); AccessStatus accs = AccessStatus.Public; if (strUtil.IsNullOrEmpty(name)) { echoError("请填写名称"); return; } // 自定义安装 Type appType = ObjectContext.Instance.TypeList[info.TypeFullName]; if (rft.IsInterface(appType, typeof(IAppInstaller))) { // 主题ID String themeId = ctx.Post("themeId"); IAppInstaller customInstaller = ObjectContext.Create(appType) as IAppInstaller; IMemberApp capp = customInstaller.Install(ctx, ctx.owner.obj, name, accs, themeId, ""); intiAppPermission(capp); echoToParentPart(lang("opok"), to(Index), 1); return; } // 主题安装 if (strUtil.HasText(info.InstallerType)) { // 主题ID String themeId = ctx.Post("themeId"); Type installerType = ObjectContext.GetType(info.InstallerType); IAppInstaller customInstaller = ObjectContext.Create(installerType) as IAppInstaller; IMemberApp capp = customInstaller.Install(ctx, ctx.owner.obj, name, accs, themeId, ""); intiAppPermission(capp); echoToParentPart(lang("opok"), to(Index), 1); return; } // 默认安装 IMember owner = ctx.owner.obj; User creator = (User)ctx.viewer.obj; // 1、添加一条 IMemberApp IMemberApp app = userAppService.Add(creator, owner, name, info.Id, accs); if (app != null) { // 2、添加菜单 String appUrl = UrlConverter.clearUrl(app, ctx); menuService.AddMenuByApp(app, name, "", appUrl); // 3、初始化权限 intiAppPermission(app); log(SiteLogString.InsertApp(), app); echoToParentPart(lang("opok"), to(Index), 1); } else { errors.Add(lang("exop")); run(NewApp, info.Id); } }
public ActionResult PostLogin() { _appInstaller.Install(); return(Content("Yes")); }