Exemple #1
0
        public string CreateSycnRequestData(SyncKey syncKey)
        {
            var data = new { BaseRequest = new { Uin, Sid, Skey, DeviceID }, SyncKey = syncKey, rr = Common.ConvertDateTimeToInt(DateTime.Now.ToUniversalTime()) };
            var val  = JsonConvert.SerializeObject(data);

            return(val);
        }
Exemple #2
0
        private async Task <SyncResponse> Sync()
        {
            var url  = $"{_baseUri}/webwxsync?sid={_loginXml.Sid}&lang=zh_CN&skey={_loginXml.Skey}&pass_ticket={_loginXml.PassTicket}";
            var data = _loginXml.CreateSycnRequestData(_syncKey);

            var result = await WechatHttp.Post(url, data);

            var response = JsonConvert.DeserializeObject <SyncResponse>(result);

            if (response.SyncKey.Count > 0)
            {
                _syncKey = response.SyncKey;
            }

            return(response);
        }
Exemple #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns></returns>
        private async Task <bool> Init()
        {
            var url  = $"{_baseUri}/webwxinit?r={Common.ConvertDateTimeToInt(DateTime.Now)}&lang=en_US&pass_ticket={_loginXml.PassTicket}";
            var data = _loginXml.CreateBaseRequestData();

            var returnValue = await WechatHttp.Post(url, data);

            var result = JsonConvert.DeserializeObject <InitResponse>(returnValue);

            _syncKey = result.SyncKey;
            _me      = result.User;
            if (result.Count > 0)
            {
                _contactList = result.ContactList;
            }

            return(result?.BaseResponse?.Ret == 0);
        }