public void GetTicket_AppCode_NotNull() { IWeChatAppService appService = container.Resolve <IWeChatAppService>(); var app = appService.GetApp(Constants.MOBILE_APPROVAL); var ticket = JsApiTicketManager.TryGetTicket("wx2e8cc6975a5fa1ce", app.SecretValue); Assert.IsNotNull(ticket); Console.WriteLine(ticket); }
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); }); }
public void AutoFac_Test() { var connstr = "server=.;database=dev;uid=sa;pwd=123456"; ContainerBuilder builder = new ContainerBuilder(); builder.RegisterType <WeChatAppService>().As <IWeChatAppService>(); builder.RegisterType <WeChatAppRepository>().As <IWeChatAppRepository>(); builder.RegisterInstance(EFContext.CreateForEFDesignTools(connstr)); //builder.RegisterModule(new ConfigurationSettingsReader("autofac")); //using (IContainer container = builder.Build()) //{ // AutoFacManager manager = container.Resolve<AutoFacManager>(); // manager.Say(); //} using (IContainer container = builder.Build()) { IWeChatAppService service = container.Resolve <IWeChatAppService>(); var app = service.GetApp(Constants.MOBILE_APPROVAL); Console.WriteLine(app.WeChatAppID); } }
public WeChatController(IWeChatAppService currentService , IAccountService accountService) { _currentService = currentService; _accountService = accountService; }
public MessageController(IWeChatAppService currentService, IMessageService msgService) { _currentService = currentService; _msgService = msgService; }
public WeChatController(IWeChatAppService wechatAppService) { _wechatAppService = wechatAppService; }
public MemberService(IWeChatAppService appService) : base(appService) { }
public AccessTokenService(IWeChatAppService appService) { _appService = appService; }