Beispiel #1
0
        internal void ReBillCatch(string user)
        {
            int id = 0;

            if (!wsUserDictionary.TryGetValue(user, out id))
            {
                id = DateTime.Now.GetHashCode();
            }
            string comefrom = string.Format("数据分析_{0}", id);

            IOUtils.Emit("sendMsg", GetMessage(user, comefrom, "成功保存商品配置信息,系统将继续分析下载数据"));
            DataCatchSave.SaveData(user, (text) =>
            {
                IOUtils.Emit("sendMsg", GetMessage(user, comefrom, text));
            });
        }
Beispiel #2
0
        public void BillCatch(string user, ulong key, IList dataList)
        {
            if (!IOUtils.IsPostDataRequest(key, (ulong)dataList.Count))
            {
                throw new Exception("抓取数据未被验证,非法请求");
            }
            IList list = GetAllList(key, dataList);

            if (IOUtils.HasKey(key))
            {
                dataList.Clear();
                return;//还有未传完的数据
            }
            if (wsUserDictionary.ContainsKey(user))
            {
                wsUserDictionary.Remove(user);
            }
            int id = DateTime.Now.GetHashCode();

            wsUserDictionary.Add(user, id);
            DataCatchSave.ClearUserGoodsCache(user);
            backDataList.Remove(key);//清除备份,做一次性数据处理
            string comefrom = string.Format("数据分析_{0}", id);

            try
            {
                Data data = new Data(user);
                data.comefrom = comefrom;

                IOUtils.Emit("login", JavaScriptSerializer.CreateInstance().Serialize(data));

                IOUtils.Emit("sendMsg", GetMessage(user, comefrom, "准备保存下载数据"));
                TaobaoDataHelper.SaveDataToTBill(user, AppUtils.ConnectionString, list);
                IOUtils.Emit("sendMsg", GetMessage(user, comefrom, "下载数据保存成功"));

                IOUtils.Emit("sendMsg", GetMessage(user, comefrom, DataCatchSave.SaveData(user, (text) =>
                {
                    IOUtils.Emit("sendMsg", GetMessage(user, comefrom, text));
                })));
            }
            catch (Exception e)
            {
                IOUtils.Emit("sendMsg", GetMessage(user, comefrom, e.Message));
            }
        }
Beispiel #3
0
        public void BillCatchDemo(string user, ulong key, IList dataList)
        {
            if (!IOUtils.IsPostDataRequest(key, (ulong)dataList.Count))
            {
                throw new Exception("抓取数据未被验证,非法请求");
            }
            IList list = GetAllList(key, dataList);

            if (IOUtils.HasKey(key))
            {
                dataList.Clear();
                return;//还有未传完的数据
            }

            backDemoDataList.Remove(key);//清除备份,做一次性数据处理
            string comefrom = string.Format("数据分析_{0}", DateTime.Now.GetHashCode());
            Data   data     = new Data(user);

            data.comefrom = comefrom;

            IOUtils.Emit("login", JavaScriptSerializer.CreateInstance().Serialize(data));

            HashObject hash = DataCatchSave.AnalysisData(user, list, (text) =>
            {
                IOUtils.Emit("sendMsg", GetMessage(user, comefrom, text));
            });

            if (hash == null)
            {
                return;
            }
            string id = Cuid.NewCuid().ToString();

            DataCatchFromTBExample.SetTempData(id, hash);
            IOUtils.Emit("sendMsg", GetMessage(user, comefrom, string.Format("OK:url:{0}", id)));
        }