public WechatSogouBasic() { this.weChatCache = new WechatCache(Config.CacheDir, 60 * 60); if (weChatCache.Get <HttpWebRequest>(Config.CacheSessionName) != null) { //if (System.Web.HttpContext.Current.Session[Config.CacheSessionName] == null) //{ //} } }
static public CookieCollection LoadCookieFromCache() { WechatCache cache = new WechatCache(Config.CacheDir, 1); CookieCollection cc = cache.Get <CookieCollection>("cookieCollection"); if (cc == null) { cc = new CookieCollection(); } return(cc); }
EncryptArgs _uinkeybiz(string keyword, string uin, string key, string biz, string pass_ticket, string msgid) { EncryptArgs encrpt = new EncryptArgs(); if (string.IsNullOrEmpty(uin)) { this.weChatCache.Update(keyword + "uin", uin, 36000); this.weChatCache.Update(keyword + "key", key, 36000); this.weChatCache.Update(keyword + "biz", biz, 36000); this.weChatCache.Update(keyword + "pass_ticket", pass_ticket, 36000); this.weChatCache.Update(keyword + "msgid", msgid, 36000); } else { uin = weChatCache.Get <object> (keyword + "uin").ToString(); key = this.weChatCache.Get <object>(keyword + "key").ToString(); biz = this.weChatCache.Get <object>(keyword + "biz").ToString(); pass_ticket = this.weChatCache.Get <object>(keyword + "pass_ticket").ToString(); msgid = this.weChatCache.Get <object>(keyword + "msgid").ToString(); encrpt.uin = uin; encrpt.key = key; encrpt.biz = biz; encrpt.pass_ticket = pass_ticket; encrpt.msgid = msgid; encrpt.uin = uin; } return(encrpt); // def _uinkeybiz(self, keyword, uin= None, key = None, biz = None, pass_ticket = None, msgid = None): //if uin: // self._cache.set(keyword + 'uin', uin, 36000) // self._cache.set(keyword + 'key', key, 36000) // self._cache.set(keyword + 'biz', biz, 36000) // self._cache.set(keyword + 'pass_ticket', pass_ticket, 36000) // self._cache.set(keyword + 'msgid', msgid, 36000) //else: // uin = self._cache.get(keyword + 'uin') // key = self._cache.get(keyword + 'key') // biz = self._cache.get(keyword + 'biz') // pass_ticket = self._cache.get(keyword + 'pass_ticket') // msgid = self._cache.get(keyword + 'msgid') // return uin, key, biz, pass_ticket, msgid }