public ResultObj <JsApiModel> GetJsApi(DtoKey inObj) { var reObj = new ResultObj <JsApiModel>(); var token = Utility.ReadAccessToken(appConfig.WeiXin.Appid, appConfig.WeiXin.Secret); var jsapiTicket = RedisReadHelper.StringGet("WECHA_JSAPI_TICKET");; if (string.IsNullOrEmpty(jsapiTicket)) { jsapiTicket = Helper.WeiChat.Utility.GetJsapiTicket(token); RedisWriteHelper.SetString("WECHA_JSAPI_TICKET", jsapiTicket, new TimeSpan(2, 0, 0)); } reObj.data = new JsApiModel(); reObj.data.noncestr = Guid.NewGuid().ToString("n").Substring(10); reObj.data.timestamp = TypeChange.DateToInt64().ToString().Substring(0, 10); reObj.data.url = inObj.Key; reObj.data.appid = appConfig.WeiXin.Appid; reObj.data.signature = CheckSignature.GetSignature(new List <string> { "noncestr=" + reObj.data.noncestr, "timestamp=" + reObj.data.timestamp, "url=" + reObj.data.url, "jsapi_ticket=" + jsapiTicket }, "&"); return(reObj); }