Beispiel #1
0
        /// <summary>
        /// 获取分享参数信息
        /// </summary>
        /// <param name="url">分销Url</param>
        /// <param name="config">配置信息</param>
        /// <returns>结果</returns>
        public static TokenInfo GetWeiXinShareConfig(string url, Config config)
        {
            var jtCache = string.Empty; //Redis.GetRedis<string>(Config.JsapiTicket);

            if (string.IsNullOrEmpty(jtCache))
            {
                var jsapiTicketUrl = TenpayUtil.GetJsapiTicketUrl(config, false);
                var jsapiTicket    = JsonConvert.DeserializeObject <JsapiTicket>(HttpHelp.GetUrl(jsapiTicketUrl));
                if (jsapiTicket.Errcode == 0)
                {
                    jtCache = jsapiTicket.Ticket;
                    //Redis.SetRedis(Config.JsapiTicket, jsapiTicket.ticket, DateTime.Now.AddSeconds(jsapiTicket.expires_in - 2));
                }
                else
                {
                    var jsapiTicketUrl1 = TenpayUtil.GetJsapiTicketUrl(config, true);
                    var jsapiTicket1    = JsonConvert.DeserializeObject <JsapiTicket>(HttpHelp.GetUrl(jsapiTicketUrl1));
                    jtCache = jsapiTicket1.Ticket;
                }
            }
            var info = TenpayUtil.GetConfigInfo(jtCache, url, config);

            return(info);
        }