Exemple #1
0
 public static string HoldOnUrl = "https://login.wx.qq.com/cgi-bin/mmwebwx-bin/login?loginicon=true&uuid=";// + Tickets + "&tip=0&r=1499867820&_=1497443441656";
 /// <summary>
 /// 获取登录地址
 /// </summary>
 /// <param name="uuid"></param>
 /// <returns></returns>
 public static string WaitingUrl(string uuid)
 {
     return(HoldOnUrl + uuid + "&tip=0&r=" + DateTimeToosHelper.GetUnixTimeSpan().ToString() + "& _=" + DateTimeToosHelper.GetUnixTimeSpan().ToString() + MethodsHelper.GetThreeNumber());
 }
Exemple #2
0
        /// <summary>
        /// 获取心跳
        /// </summary>
        /// <param name="SyncKey"></param>
        public static void KeepHeart(string SyncKey)
        {
            Random ran      = new Random();
            string HeartUrl = UrlDefine.HeartUrl + "r=" + DateTimeToosHelper.GetUnixTimeSpan().ToString() + MethodsHelper.GetThreeNumber() +
                              "&skey=" + CommonDefine.LoginResult.skey
                              + "&sid=" + CommonDefine.LoginResult.wxsid
                              + "&uin=" + CommonDefine.LoginResult.wxuin
                              + "&deviceid=e9128931905052" + ((int)ran.Next(0, 9)).ToString() + ((int)(ran.Next(0, 8) + 1)).ToString() + "&synckey=" + SyncKey + "&_=" + DateTimeToosHelper.GetUnixTimeSpan().ToString() + MethodsHelper.GetThreeNumber();

            LogWriter.Write(SyncKey, @"SyncKey.log");
            string HeartList = string.Empty;

            try
            {
                HeartList = HttpMethods.Get(HeartUrl, CommonDefine.Cookies, Encoding.UTF8).ContentData.ToString();
            }
            catch (Exception ex)
            {
                // HeartList = HttpMethods.Get(HeartUrl, CommonDefine.Cookies, Encoding.UTF8).ContentData.ToString();
            }
            if (!string.IsNullOrWhiteSpace(HeartList))
            {
                LogWriter.Write(HeartList.ToString());
                if (HeartList.ToString() != "window.synccheck={retcode:\"0\",selector:\"0\"}")
                {
                    //   Thread.CurrentThread.Abort();
                    Console.WriteLine(HeartList.ToString());
                    GetMsg(CommonDefine.SyncKey);
                    CommonDefine.GetMsgSyncKey = GetSyncKey();// 理论上此处不需要赋值,如果收发消息出现问题,放开次注释
                }
                else if (HeartList.ToString() != "window.synccheck={retcode:\"0\",selector:\"7\"}")
                {
                    // GetMsgSyncKey = GetSyncKey();
                }
                Console.WriteLine(HeartList.ToString());
                Console.WriteLine("thK's while is breaked!" + DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"));
            }
            else
            {
                // GetMsgSyncKey = GetSyncKey();
            }
            return;
        }