예제 #1
0
        /// <summary>
        /// 获取应用标识下的token
        /// </summary>
        /// <param name="appid"></param>
        /// <returns></returns>
        private string GetAppIdToken(string appid)
        {
            if (string.IsNullOrEmpty(appid))
            {
                return("");
            }

            var key = appid.AddCachePrefix("ServiceToken");

            var token = CacheManager.Get(key, 60);

            if (token.IsNullOrEmpty())
            {
                var response = ServiceLocater.GetService <IAppIdAuthService>().QueryByAppId(new QueryByAppIdRequest
                {
                    ServiceAppId = appid
                });

                if (response.IsSuccess && response.Entity != null)
                {
                    token = response.Entity.AuthToken;

                    if (token.IsNotNullOrEmpty())
                    {
                        CacheManager.RedisDefault.Set(key, token, PublicConst.Time.Hour2);
                    }
                }
            }

            return(token);
        }
예제 #2
0
        public static void Show(string Patch, string taskName)
        {
            Console.WriteLine("Patch:{0};TaskName:{1}", Patch, taskName);

            Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            IUserInfoService _userinfoService = ServiceLocater.GetService <IUserInfoService>();
        }
예제 #3
0
파일: Startup.cs 프로젝트: Xamlab/Schedulee
        public static IDependencyContainer SetupContainer()
        {
            var graceContainer = new DependencyInjectionContainer();
            var container      = new DependencyContainer(graceContainer);

            graceContainer.Add(block => block.ExportInstance(container).As <IDependencyContainer>());
            container.RegisterCoreDependencies()
            .RegisterUIDependencies()
            .RegisterDroidDependencies();
            ServiceLocater.Create(container);
            return(container);
        }
예제 #4
0
        /// <summary>
        /// 获取解密参数
        /// </summary>
        /// <param name="appid">应用标识</param>
        /// <param name="authtoken">授权Token</param>
        /// <param name="encryptionType">加密类型(0:不加密;1:对称加密(DES);2:对称加密(AES);3:非对称加密</param>
        /// <param name="secretKey">解密秘钥</param>
        private static void QueryDecryptParameter(string appid, ref string authtoken, ref int encryptionType, ref string secretKey)
        {
            if (!string.IsNullOrEmpty(appid))
            {
                var key = appid.AddCachePrefix("AppIdAuth");

                var entity = CacheManager.Get <AppIdAuthDto>(key, 60);

                if (entity == null)
                {
                    lock (Queryappidauth)
                    {
                        entity = CacheManager.Get <AppIdAuthDto>(key, 60);

                        if (entity == null)
                        {
                            var response = ServiceLocater.GetService <IAppIdAuthService>().QueryByAppId(new QueryByAppIdRequest {
                                ServiceAppId = appid
                            });

                            if (response.IsSuccess && response.Entity != null)
                            {
                                entity = response.Entity;

                                CacheManager.RedisDefault.Set(key, entity, PublicConst.Time.Hour2);
                            }
                        }
                    }
                }

                if (entity != null)
                {
                    authtoken      = entity.AuthToken;
                    encryptionType = entity.EncryptionType;

                    switch (entity.EncryptionType)
                    {
                    case 1:
                    case 2:
                        secretKey = entity.SecretKey;
                        break;

                    case 3:
                        secretKey = entity.PrivateKey;
                        break;
                    }
                }
            }
        }
예제 #5
0
 public OperLogAttribute(string logcontent)
 {
     LogContent = logcontent;
     SystemOperationLogService = ServiceLocater.GetService <ISystemOperationLogService>();
 }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 public BaseApiController()
 {
     _userGroupService = ServiceLocater.GetService <IUserGroupService>();
 }
예제 #7
0
 public BaseController()
 {
     _iuserinfoservice         = ServiceLocater.GetService <IUserInfoService>();
     _systemNavbarService      = ServiceLocater.GetService <ISystemNavbarService>();
     _systemAppSettingsService = ServiceLocater.GetService <ISystemAppSettingsService>();
 }