public static WechatWebConfig GetWxConfig(string url) { var config = new WechatWebConfig { appid = ConfigurationManager.AppSettings["appid"], oauthid = ConfigurationManager.AppSettings["oauthId"], nonce = GetNonce(), ticket = JSAPITicket.GetTicket(), timestamp = GetTimestamp(), url = url }; config.signature = GetSignature(config.ticket, config.timestamp, config.nonce, url); return(config); }
public static JSAPITicket GetNewTicket() { string strurl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi"; HttpHelper http = new HttpHelper(); string respone = http.Get(string.Format(strurl, Token.GetToken()), Encoding.UTF8); log.Debug("--------------- 向微信请求最新的Ticket ------------------"); var ticket = respone.ToJson <JSAPITicket>(); ticket.ExpiredAt = DateTime.Now.AddSeconds(ticket.expires_in - 60); JSAPITicket._Ticket = ticket; log.Debug(ticket.ToJson()); log.Debug("------------------ Ticket请求完毕 ------------------"); return(ticket); }
public static string GetJSApiTicket() { return(JSAPITicket.GetTicket()); }