Exemplo n.º 1
0
 public void Save(string user, object[] grid)
 {
     using (DbHelper db = AppUtils.CreateDbHelper())
     {
         StringBuilder sbuilder = new StringBuilder("insert into commissionrate (crid,color,size,sourceTitle,rate,uname) values");
         foreach (HashObject hash in grid)
         {
             sbuilder.AppendFormat("({0},'{1}','{2}','{3}',{4},'{5}'),", Cuid.NewCuid(), hash["color"], hash["size"], hash["sourceTitle"], hash["rate"], hash["uname"]);
         }
         db.BatchExecute(sbuilder.ToString().Substring(0, sbuilder.Length - 1));
         DataCatchSave.ClearUserGoodsCache(user);
         Login login = new Login();
         login.ReBillCatch(user);
     }
 }
Exemplo n.º 2
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));
            });
        }
Exemplo n.º 3
0
        public string 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);
            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, "下载数据保存成功"));

            string mssage = GetMessage(user, comefrom, DataCatchSave.SaveData(user, (text) =>
            {
                IOUtils.Emit("sendMsg", GetMessage(user, comefrom, text));
            }));

            IOUtils.Emit("sendMsg", mssage);
            return(mssage);
        }