Ejemplo n.º 1
0
        public static string GetJsapi_ticket(string access_token, string userAgent)
        {
            string ticket = "";

            WechatJsConfig JsConfig = WechatJsServices.GetWechatJsConfig();

            if (DateTime.Now < DateTime.Parse(JsConfig.WechatJsTicketExpiredTime))
            {
                ticket = JsConfig.WechatJsTicket;
            }
            else
            {
                ticket = WechatJsServices.RefrenshJsapi_ticket(access_token, userAgent).ticket;
            }
            return(ticket);
        }
Ejemplo n.º 2
0
        public static WechatJsConfig GetWechatJsConfig()
        {
            Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");


            AppSettingsSection appsection = config.GetSection("appSettings") as AppSettingsSection;


            WechatJsConfig JsConfig = new WechatJsConfig();

            JsConfig.WechatJsUrl               = appsection.Settings["WechatJsUrl"].Value;
            JsConfig.WechatJsToken             = appsection.Settings["WechatJsToken"].Value;
            JsConfig.WechatJsDomain            = appsection.Settings["WechatJsDomain"].Value;
            JsConfig.WechatJsReturnDomain      = appsection.Settings["WechatJsReturnDomain"].Value;
            JsConfig.WechatJsTicket            = appsection.Settings["WechatJsTicket"].Value;
            JsConfig.WechatJsTicketExpiredTime = appsection.Settings["WechatJsTicketExpiredTime"].Value;



            return(JsConfig);
        }