Пример #1
0
        public void GetTaoBaoGoods()
        {
            NickSessionService nsDal = new NickSessionService();
            IList <Model.TopNickSessionInfo> list = nsDal.GetAllNickSession(new[] { TopTaoBaoService.Temporary, TopTaoBaoService.YingXiaoJueCe });

            GoodsService goodsDal = new GoodsService();

            for (int i = 0; i < list.Count; i++)
            {
                string shopId = TaoBaoAPI.GetShopInfo(list[i].Nick, list[i].Session);
                list[i].ShopId = shopId;
                nsDal.UpdateNickShop(list[i].Nick, shopId);
            }

            foreach (Model.TopNickSessionInfo info in list)
            {
                List <GoodsInfo> goodsList = TaoBaoAPIService.GetGoodsInfoListByNick(info.Nick, info.Session, info.ServiceId);

                List <GoodsInfo> allGoods = goodsDal.GetAllGoods(info.Nick);

                foreach (GoodsInfo ginfo in goodsList)
                {
                    if (allGoods.Contains(ginfo))
                    {
                        goodsDal.UpdateGoodsInfo(ginfo);
                    }
                    else
                    {
                        goodsDal.InsertGoods(ginfo, info.Nick);
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 ///  所有订购用户信息缓存(12小时更新一次)
 /// </summary>
 /// <returns></returns>
 public static IList <TopNickSessionInfo> GetNickSessionList()
 {
     return(new CacheUtility <IList <TopNickSessionInfo> >().Get(KEY_ALLNICKSESSIONINFO, delegate()
     {
         NickSessionService nickDal = new NickSessionService();
         return nickDal.GetAllNickSession();
     }, 60 * 12));
 }