예제 #1
0
        public virtual AppResult GetToken(string appcode)
        {
            var app         = _appService.GetApp(appcode);
            var accessToken = AccessTokenManager.GetToken(CorpID, app.SecretValue);

            return(new AppResult
            {
                AccessToken = accessToken,
                AgentId = app.WeChatAppID
            });
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        // GET: WeChat
        public ActionResult Index()
        {
            var app = _currentService.GetApp(Constants.MOBILE_APPROVAL_TEST);

            return(View(app));
        }