public static void Register()
        {
            IWeChatAppService         appService    = AutofacManager.Resolve <IWeChatAppService>();
            IApplicationConfigService configService = AutofacManager.Resolve <IApplicationConfigService>();
            var config = configService.ListApplicationConfig()
                         .FirstOrDefault(m => m.ConfigType.ToLower() == Constants.WECHAT.ToLower() && m.ConfigKey.ToLower() == Constants.CORP_ID.ToLower());

            LocalCacheManager.Add(Constants.CORP_ID, config.ConfigValue);

            List <WeChatAppConfig> apps = appService.ListApps();

            apps.ForEach(app =>
            {
                WeChatManager.RegisterWorkApp(config.ConfigValue, app.SecretValue, app.AppName);
            });
        }
Example #2
0
        public void Configuration(IAppBuilder app)
        {
            // 有关如何配置应用程序的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkID=316888
            var connstr = WebConfigurationManager.ConnectionStrings["devConnstr"].ToString();

            AreaRegistration.RegisterAllAreas();

            GlobalConfiguration.Configure(WebApiConfig.Register);

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            AutofacConfig.RegisterAutofac();
            AutofacManager.RegisterAutofac();
            //企业微信应用信息注册
            AccessTokenConfig.Register();

            ConfigureOAuth(app);
        }