public void InitialTestContext() { if (CoreAppContext.Identity == null) { var appIdentity = new AppIdentity() { tenant_id = "1", app_id = AppInfoHelper.AppId, UDID = "TestDevice", }; //AppInfoHelper.FormatAppIdInfo(appIdentity); CoreAppContext.SetIdentity(appIdentity); } if (CoreUserContext.Identity == null) { var userIdentity = new UserIdentity() { id = userId, auth_type = PortalAuthorizeType.Admin }; CoreUserContext.SetIdentity(userIdentity); } }
/// <summary> /// 初始化当前请求上下文的应用全局信息 /// </summary> /// <param name="context"></param> /// <returns></returns> public static AppIdentity InitialCoreAppIdentity(this HttpContext context) { var sysInfo = CoreAppContext.Identity; if (sysInfo != null) { return(sysInfo); } sysInfo = new AppIdentity(); CoreAppContext.SetIdentity(sysInfo); return(sysInfo); }