public void AddItme(BaseItemInfo item, string fileName, bool isShop = true)
        {
            string key = item.Created + item.Format + item.Name;

            if (!ShopAllItems.ContainsKey(key))
            {
                ShopAllItems.Add(key, item);
                WriteItem(item, fileName);
            }
            else
            {
                if (isShop)
                {
                    if (shopAllItems[key].PlatformPrice > item.PlatformPrice)
                    {
                        ShopAllItems[key] = item;
                        WriteItem(item, fileName);
                    }
                }
                else
                {
                    if (shopAllItems[key].ShopPrice > item.ShopPrice)
                    {
                        ShopAllItems[key] = item;
                        WriteItem(item, fileName);
                    }
                }
            }
        }
Example #2
0
        public static void WriteCSV(string filePathName, BaseItemInfo itemInfo)
        {
            try
            {
                string filePath = filePathName;

                CheckAndCreateFolder(filePath);

                if (!File.Exists(filePath))
                {
                    using (StreamWriter fileWriter = new StreamWriter(filePath, true, Encoding.Default))
                    {
                        fileWriter.WriteLine(itemInfo.GetLogHeadLine());
                        fileWriter.Flush();
                        fileWriter.Close();
                    }
                }

                WriteCSV(filePath, true, itemInfo.GetLogStrArr());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #3
0
        private List <BaseItemInfo> GetSomeItem(string content)
        {
            List <BaseItemInfo> items = new List <BaseItemInfo>();

            if (!string.IsNullOrEmpty(content))
            {
                MatchCollection ms = CommonFun.GetValues(content, "<row>", "</row>");

                foreach (Match m in ms)
                {
                    try
                    {
                        BaseItemInfo item = new BaseItemInfo();
                        item.ViewCount = CommonFun.GetValue(m.Value, "<ARTID>", "</ARTID>");
                        item.Name      = CommonFun.GetValue(m.Value, "<NAME>", "</NAME>");
                        item.Format    = CommonFun.GetValue(m.Value, "<SPEC>", "</SPEC>");
                        item.Created   = CommonFun.GetValue(m.Value, "<FACTORY>", "</FACTORY>");
                        item.ID        = CommonFun.GetValue(m.Value, "<FILENO>", "</FILENO>");
                        string priceStr = CommonFun.GetValue(m.Value, "<PRICE>", "</PRICE>");
                        item.PlatformPrice = string.IsNullOrEmpty(priceStr) ? 0 : Convert.ToDecimal(priceStr);
                        item.Type          = CommonFun.GetValue(m.Value, "<MEDIATYPENAME>", "</MEDIATYPENAME>");
                        items.Add(item);

                        AddItme(item, "HA/HA" + ticks + ".csv");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
            }
            return(items);
        }
Example #4
0
        /// <summary>
        /// Converts a BaseItem to a BaseItemInfo
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>BaseItemInfo.</returns>
        /// <exception cref="System.ArgumentNullException">item</exception>
        public static BaseItemInfo GetBaseItemInfo(BaseItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            var info = new BaseItemInfo
            {
                Id           = GetClientItemId(item),
                Name         = item.Name,
                MediaType    = item.MediaType,
                Type         = item.GetType().Name,
                IsFolder     = item.IsFolder,
                RunTimeTicks = item.RunTimeTicks
            };

            var imagePath = item.PrimaryImagePath;

            if (!string.IsNullOrEmpty(imagePath))
            {
                try
                {
                    info.PrimaryImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(item, ImageType.Primary, imagePath);
                }
                catch (IOException)
                {
                }
            }

            return(info);
        }
Example #5
0
        /// <summary>
        /// Converts a BaseItem to a BaseItemInfo
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>BaseItemInfo.</returns>
        /// <exception cref="System.ArgumentNullException">item</exception>
        public BaseItemInfo GetBaseItemInfo(BaseItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            var info = new BaseItemInfo
            {
                Id           = GetDtoId(item),
                Name         = item.Name,
                MediaType    = item.MediaType,
                Type         = item.GetType().Name,
                RunTimeTicks = item.RunTimeTicks
            };

            var imagePath = item.PrimaryImagePath;

            if (!string.IsNullOrEmpty(imagePath))
            {
                try
                {
                    info.PrimaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary, imagePath);
                }
                catch (IOException)
                {
                }
            }

            return(info);
        }
Example #6
0
        /// <summary>
        /// 上架新物品
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpNewItem(BaseItemInfo item, Http.HttpRequest http)
        {
            if (item.ShopPrice < 5)
            {
                return(false);
            }
            //find
            string findUrl      = "https://admin.tkyfw.com/Goods/findExp";
            string findPostData = "store_id=34";

            http.HttpPost(findUrl, findPostData);

            //findApp
            string findAppUrl      = "https://admin.tkyfw.com/Goods/findAppNum";
            string findAppPostData = string.Format("appNum:{0}", item.ID);

            http.HttpPost(findAppUrl, findAppPostData);

            string url = string.Format("https://admin.tkyfw.com/Goods/complateInfo?cat_first=&cat_second=&cat_third=&approval_number={0}", item.ID);

            string upNewItemUrl = "https://admin.tkyfw.com/Goods/findRepeatCheck";

            string checkUrl = "https://admin.tkyfw.com/Goods/checkGoods";

            string content = http.HttpGet(url);


            MatchCollection ms = CommonFun.GetValues(content, "gxtj_ul", "</li>");

            foreach (Match m in ms)
            {
                string fromat = CommonFun.GetValue(m.Value, "<span>", "<span>");

                fromat = CommonFun.FormatStr(fromat, item.Name);

                if (fromat == item.Format)
                {
                    string boxStr = CommonFun.GetValue(m.Value, "\"checkbox\"", "/>");

                    string value = CommonFun.GetValue(boxStr, "value=\"", "\"");

                    string result = http.HttpPost(upNewItemUrl, string.Format("value_arr={0}{1}", value, HttpUtility.UrlEncode(",")));

                    result = CommonFun.GetValue(result, ":", "}");

                    if (result == "2")
                    {
                        CommonFun.WriteCSV("TKAdmin/UpNew" + fileName + ".csv", item);
                        http.HttpPost(checkUrl, "", url, "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", null);
                        Console.WriteLine("UpNewItem,name:{0}, id:{1}, fromat:{2}", item.Name, item.ID, item.Format);
                    }
                    Thread.Sleep(random.Next(3, 6) * 1000);


                    // UpdatePrice(item, http);
                }
            }

            return(true);
        }
Example #7
0
        /// <summary>
        /// 是否可以接
        /// </summary>
        /// <returns></returns>
        public bool CanTake(string content, Http.HttpRequest http)
        {
            string infoStr = CommonFun.GetValue(content, "<tr>", "</tr>");

            MatchCollection tdMs = CommonFun.GetValues(infoStr, "<td>", "</td>");

            string orderNO = CommonFun.GetValue(infoStr, "<td class=\"tablenow\">", "</td>");

            bool result = false;

            MatchCollection ms = CommonFun.GetValues(content, "<div class=\"tkzds\">", "</div>");

            string format = ms[0].Value;
            string id     = ms[1].Value;
            string key    = id + format;

            //是否TK平台的单
            if (orderNO.StartsWith("TK") && !IsSelfOrder(content))
            {
                string drs = tdMs[5].Value;
                //不是同城
                if (!drs.Contains("长沙"))
                {
                    BaseItemInfo item = items.ContainsKey(key) ? items[key] : null;

                    //在线支付
                    if (infoStr.Contains("在线支付") || (infoStr.Contains("货到付款") && item != null && item.Type == "201"))
                    {
                        string msg    = CommonFun.GetValue(content, "<li>买家留言:<span>", "</span></li>");
                        string remark = CommonFun.GetValue(content, "<li>平台备注:<span>", "</span></li>");
                        //无需发票
                        if (!msg.Contains("发票") && !remark.Contains("发票"))
                        {
                            //MatchCollection ms = CommonFun.GetValues(content, "<div class=\"tkzds\">", "</div>");
                            //单品
                            if (ms.Count == 5)
                            {
                                //ms = CommonFun.GetValues(content, "span1 xiatiaomar\">", "</div>");
                                decimal price = Convert.ToDecimal(ms[2].Value);

                                //价格合理
                                if (items.ContainsKey(key))
                                {
                                    if (true || items[key].PlatformPrice <= price)
                                    {
                                        result = true;
                                    }
                                    else
                                    {
                                        Console.WriteLine("Price info orderPrice:{0}, sellPrice:{1}", price, items[key].PlatformPrice);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(result);
        }
Example #8
0
        public void ReportNowViewingItem(string sessionId, BaseItemInfo item, string context)
        {
            var session = GetSession(sessionId);

            session.NowViewingItem    = item;
            session.NowViewingContext = context;
        }
Example #9
0
        public override bool ComparePrice(BaseItemInfo platformItem, BaseItemInfo info)
        {
            //15块钱以下的百分之40个点    15到30的百分之30  30到50百分之25    50以上百分之20
            decimal compacePrice = platformItem.ShopSelaPrice;
            decimal infoPrice    = info.ShopPrice;
            bool    result       = false;

            if (compacePrice > 50)
            {
                if (compacePrice * (decimal)0.8 >= infoPrice)
                {
                    info.PlatformPrice = platformItem.ShopSelaPrice;
                    info.Type          = platformItem.Type;
                    info.ViewCount     = platformItem.ViewCount;

                    CommonFun.WriteCSV("QLK/50以上" + ticks + ".csv", info);
                    result = true;
                }
            }
            else if (compacePrice > 30)
            {
                if (compacePrice * (decimal)0.75 >= infoPrice)
                {
                    info.PlatformPrice = platformItem.ShopSelaPrice;
                    info.Type          = platformItem.Type;
                    info.ViewCount     = platformItem.ViewCount;

                    CommonFun.WriteCSV("QLK/30-50" + ticks + ".csv", info);
                    result = true;
                }
            }
            else if (compacePrice > 15)
            {
                if (compacePrice * (decimal)0.7 >= infoPrice)
                {
                    info.PlatformPrice = platformItem.ShopSelaPrice;
                    info.Type          = platformItem.Type;
                    info.ViewCount     = platformItem.ViewCount;

                    CommonFun.WriteCSV("QLK/15-30" + ticks + ".csv", info);
                    result = true;
                }
            }
            else if (compacePrice > 5)
            {
                if (compacePrice * (decimal)0.6 >= infoPrice)
                {
                    info.PlatformPrice = platformItem.ShopSelaPrice;
                    info.Type          = platformItem.Type;
                    info.ViewCount     = platformItem.ViewCount;

                    CommonFun.WriteCSV("QLK/15以下" + ticks + ".csv", info);
                    result = true;
                }
            }

            return(result);
        }
Example #10
0
    public void Init(IShopExecute item)
    {
        Clear();
        ShopSellElement ShopSellElement = DataBaseController.GetItem(DataBaseController.Instance.DataStructs.PrefabsStruct.ShopSellElement);
        ShopSellElement.Init(item);
        CurItemInfo = ShopSellElement;
        Link();
//        if (OnInitCallback != null)
//            OnInitCallback(null, ItemOwner.Shop);
    }
Example #11
0
        private static void CompareTKPrice(BaseItemInfo platformItem, BaseItemInfo info, string fileName)
        {
            if (info.ShopPrice > 0 && info.ShopPrice * (decimal)0.8 >= platformItem.ShopSelaPrice)
            {
                info.PlatformPrice = platformItem.ShopSelaPrice;
                info.Type          = platformItem.Type;

                WriteCSV(fileName + "/低于20以上" + ticks + ".csv", info);
            }
        }
Example #12
0
        public override void ReadAllItem()
        {
            try
            {
                foreach (string id in AllItemUrl)
                {
                    try
                    {
                        string itemPriceUrl = "http://ad.dabai.7lk.com/custom/price/info";

                        string itemInfoUrl = "https://ad.dabai.7lk.com/medication/detail";

                        string itemInfoPostData = "pid={0}&doctorId=321967&token=9d571f1dc32cadf0ea38";

                        string itemPricePostData = "doctorId=321967&userId=321967&skuId={0}&token=9d571f1dc32cadf0ea38";

                        string content = request.HttpPost(itemInfoUrl, string.Format(itemInfoPostData, id));

                        BaseItemInfo item = GetItem(content);

                        string skuId = CommonFun.GetValue(content, "\"skuId\":", ",");

                        content = request.HttpPost(itemPriceUrl, string.Format(itemPricePostData, skuId));

                        string priceStr = CommonFun.GetValue(content, "\"priceMin\":", ",");

                        item.ShopPrice = string.IsNullOrEmpty(priceStr) ? 0 : Convert.ToDecimal(priceStr) / 100;

                        string key = item.ID + "{" + item.Format + "}";

                        if (ShopAllItems.ContainsKey(key))
                        {
                            if (item.ShopPrice != 0 && ShopAllItems[key].ShopPrice > item.ShopPrice)
                            {
                                ShopAllItems[key] = item;
                            }
                        }
                        else
                        {
                            ShopAllItems.Add(key, item);
                        }

                        CommonFun.WriteCSV("QLK/QL" + ticks + ".csv", item);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #13
0
 /// <summary>
 /// 更新平台库存
 /// </summary>
 /// <param name="item"></param>
 /// <param name="stock"></param>
 /// <param name="platform"></param>
 /// <returns></returns>
 private bool UpdatePlatformStock(BaseItemInfo item, int stock, string platform)
 {
     try
     {
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     return(true);
 }
Example #14
0
		private void UpdateButtons()
		{
			BaseItemInfo item = null;

			if (_listBoxRecipes.SelectedIndex != null)
			{
				item = (BaseItemInfo)_listBoxRecipes.SelectedItem.Tag;
			}

			_buttonCreate.Enabled = item != null && TJ.Player.Inventory.Contains(item.Crafting);
		}
Example #15
0
        public void NavigateTo(BaseItemInfo item)
        {
            var dto = new BaseItemDto
            {
                Id   = item.Id,
                Type = item.Type,
                Name = item.Name
            };

            NavigateTo(dto);
        }
Example #16
0
 private void Child_Fetch(SafeDataReader dr)
 {
     LoadProperty(_Id, dr.GetInt32("billitemmooring"));
     LoadProperty(_Bill, dr.GetInt32("bill"));
     LoadProperty(_Quantity, dr.GetInt32("Quantity"));
     LoadProperty(_Uom, dr.GetInt32("uom"));
     LoadProperty(_Cargo, BaseItemInfo.Get(dr, _Cargo.Name));
     LoadProperty(_Rate, dr.GetDecimal("rate"));
     LoadProperty(_IsTaxable, dr.GetBoolean("istaxable"));
     LoadProperty(_Total, this.Quantity * this.Rate);
 }
Example #17
0
        private bool ComparePrice(BaseItemInfo platformItem, BaseItemInfo info)
        {
            if (info.PlatformPrice > 0 && info.PlatformPrice * (decimal)0.8 >= platformItem.ShopSelaPrice)
            {
                info.ShopPrice = platformItem.ShopSelaPrice;
                info.Type      = platformItem.Type;

                CommonFun.WriteCSV("TYaoFang/20以上" + 636493584245833259 + ".csv", info);
                return(true);
            }
            return(false);
        }
Example #18
0
        /// <summary>
        /// 从下架列表中重新上架
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool ReUpItem(BaseItemInfo item, Http.HttpRequest http)
        {
            if (item.ShopPrice > 5)
            {
                string url = "https://admin.tkyfw.com/Goods/edit_upGoods";

                string postStr = string.Format("storeid[]={0}", item.ViewCount);

                string result = http.HttpPost(url, postStr);
            }

            return(true);
        }
        private void GetOnePageBaseItemInfo(string content)
        {
            MatchCollection ms = CommonFun.GetValues(content, "<div class=\"desc\">", "<div class=\"other\">");

            foreach (Match m in ms)
            {
                if (m.Value.Contains("noprice"))
                {
                    return;
                }

                string priceStr = CommonFun.GetValue(m.Value, "</small>", "</span>");

                if (string.IsNullOrEmpty(priceStr))
                {
                    Console.WriteLine("Login failed!!!!");
                    request.Cookie = "__jsluid=00722fe4a2305a1f7e6e44e846a302ce; ASP.NET_SessionId=nmfxaoaonht2wzmiafye2w4v; Hm_lvt_3f534012f862ad7faa732b5b0655ce2f=1514443356; historysearch=; Hm_lpvt_3f534012f862ad7faa732b5b0655ce2f=1514508794; YaoTuWang_Passport_Identity=9937796DFDBDE9A6A8AED4D5CF64EA4C22E6DA8F1256977C5DDB6BE83BA2792836A2A6441BE475E64955CB954B8A3C9BB962787AB25BA4E7E92EB98327D6A27934100ADE884D0F28E4D4DC2D60157EFCEA7568AFE2B3E7F059A623B3EE22F4024587087B0E98014BFD4E6AFEBA9D49A55B8B8335492218875C700F2DCBEC637CED603E8A15396800BC68A7A867559AEB744195D1";
                    return;
                }

                string name = CommonFun.GetValue(m.Value, "\">", "</a>");

                if (name.Contains("注射"))
                {
                    return;
                }
                else
                {
                    BaseItemInfo info = new BaseItemInfo();

                    string[] nameArray = name.Split(' ');

                    if (nameArray.Length > 1)
                    {
                        info.Name = nameArray[1];
                    }
                    else
                    {
                        info.Name = nameArray[0];
                    }

                    MatchCollection msFormatAndCreated = CommonFun.GetValues(m.Value, "<div class=\"h1\">", "</div>");

                    info.Format        = msFormatAndCreated[1].Value;
                    info.Created       = msFormatAndCreated[2].Value;
                    info.PlatformPrice = Convert.ToDecimal(priceStr);

                    AddItme(info, "YaoTu/YaoTu" + ticks + ".csv");
                }
            }
        }
Example #20
0
        private static void ComparePrice(BaseItemInfo platformItem, BaseItemInfo info, string fileName)
        {
            if (info.ShopPrice * (decimal)1.25 <= platformItem.ShopPrice)
            {
                info.ID            = platformItem.ID;
                info.PlatformPrice = platformItem.ShopPrice;
                info.ViewCount     = platformItem.ViewCount;
                info.Type          = platformItem.Type;

                CommonFun.WriteCSV(fileName + "/25以上.csv", info);
            }
            else if (info.ShopPrice * (decimal)1.15 <= platformItem.ShopPrice &&
                     platformItem.ShopPrice * (decimal)1.25 > platformItem.ShopPrice)
            {
                info.ID            = platformItem.ID;
                info.PlatformPrice = platformItem.ShopPrice;
                info.ViewCount     = platformItem.ViewCount;
                info.Type          = platformItem.Type;

                CommonFun.WriteCSV(fileName + "/15-25.csv", info);
            }
            else if (info.ShopPrice * (decimal)1.05 <= platformItem.ShopPrice &&
                     platformItem.ShopPrice * (decimal)1.15 > platformItem.ShopPrice)
            {
                info.ID            = platformItem.ID;
                info.PlatformPrice = platformItem.ShopPrice;
                info.ViewCount     = platformItem.ViewCount;
                info.Type          = platformItem.Type;

                CommonFun.WriteCSV(fileName + "/5-15.csv", info);
            }
            else if (info.ShopPrice == platformItem.ShopPrice &&
                     info.ShopPrice * (decimal)1.05 > platformItem.ShopPrice)
            {
                info.ID            = platformItem.ID;
                info.PlatformPrice = platformItem.ShopPrice;
                info.ViewCount     = platformItem.ViewCount;
                info.Type          = platformItem.Type;

                CommonFun.WriteCSV(fileName + "/0-5.csv", info);
            }
            else
            {
                info.ID            = platformItem.ID;
                info.PlatformPrice = platformItem.ShopPrice;
                info.ViewCount     = platformItem.ViewCount;
                info.Type          = platformItem.Type;

                CommonFun.WriteCSV(fileName + "/0以下.csv", info);
            }
        }
Example #21
0
        public override bool ComparePrice(BaseItemInfo platformItem, BaseItemInfo info)
        {
            if (info.PlatformPrice > 0 && info.PlatformPrice * (decimal)0.8 >= platformItem.ShopSelaPrice)
            {
                info.ShopPrice = platformItem.ShopSelaPrice;
                info.Type      = platformItem.Type;
                info.ViewCount = platformItem.ViewCount;

                CommonFun.WriteCSV("HA/20以上" + ticks + ".csv", info);

                return(true);
            }
            return(false);
        }
Example #22
0
        public static bool WriteXLS(string fileName, BaseItemInfo item)
        {
            string filePath = fileName;

            CheckAndCreateFolder(filePath);

            if (!File.Exists(filePath))
            {
                CreateXLS(filePath);
                InsertToXLS(fileName, "info", item.GetLogHeadLine().Split(','));
            }

            InsertToXLS(fileName, "info", item.GetLogStrArr());

            return(true);
        }
Example #23
0
        /// <summary>
        /// 获取物品价格
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public decimal GetItemPrice(BaseItemInfo item)
        {
            if (TKItems.ShopAllItems.Count == 0)
            {
                TKItems.ReadBaseItemInfo("TK/TK.csv", true);
            }

            string key = item.ItemName + item.Format + item.Created;

            if (TKItems.ShopAllItems.ContainsKey(key))
            {
                return(TKItems.ShopAllItems[key].ShopPrice);
            }

            return(item.ShopPrice);
        }
Example #24
0
        public static string GetItemName(BaseItemInfo item)
        {
            var name = item.Name;

            if (!string.IsNullOrWhiteSpace(item.SeriesName))
            {
                name = item.SeriesName + " - " + name;
            }

            if (item.Artists != null && item.Artists.Count > 0)
            {
                name = item.Artists[0] + " - " + name;
            }

            return(name);
        }
Example #25
0
 private void Child_Fetch(SafeDataReader dr)
 {
     LoadProperty(_Id, dr.GetInt32("billitem"));
     LoadProperty(_Bill, dr.GetInt32("bill"));
     LoadProperty(_Cargo, BaseItemInfo.Get(dr, _Cargo.Name));
     LoadProperty(_UnitCount, dr.GetInt32("unitcount"));
     LoadProperty(_Uom, dr.GetInt32("uom"));
     LoadProperty(_QtyConversion, dr.GetDecimal("qtyconversion"));
     LoadProperty(_WeightUsed, dr.GetInt32("weightused"));
     LoadProperty(_StevedoringRate, dr.GetDecimal("stevedoringrate"));
     LoadProperty(_StevedoringConst, dr.GetDecimal("stevedoringconst"));
     LoadProperty(_ArrastreRate, dr.GetDecimal("arrastrerate"));
     LoadProperty(_ArrastreConst, dr.GetDecimal("arrastreconst"));
     LoadProperty(_PremiumRate, dr.GetDecimal("premiumrate"));
     LoadProperty(_IsTaxable, dr.GetBoolean("istaxable"));
 }
        protected Dictionary <string, BaseItemInfo> ReadXlsItems(string fileName)
        {
            Dictionary <string, BaseItemInfo> items = new Dictionary <string, BaseItemInfo>();

            try
            {
                DataTable data = CommonFun.ReadXLS(fileName);

                for (int row = 0; row < data.Rows.Count; row++)
                {
                    try
                    {
                        BaseItemInfo item = new BaseItemInfo();
                        item.ID       = data.Rows[row]["批准文号"].ToString();
                        item.Name     = (string)data.Rows[row]["通用名称"].ToString();
                        item.ItemName = data.Columns.Contains("商品名称") ? data.Rows[row]["商品名称"].ToString() : "";
                        item.Created  = (string)data.Rows[row]["生产厂家"].ToString();
                        item.Format   = (string)data.Rows[row]["包装规格"].ToString();
                        string priceStr = (string)data.Rows[row]["平台售价(最低价格)"].ToString();
                        item.ShopPrice     = string.IsNullOrEmpty(priceStr) ? 9999 : Convert.ToDecimal(priceStr);
                        item.PlatformPrice = item.ShopPrice;
                        item.Type          = data.Columns.Contains("剂型") ? (string)data.Rows[row]["剂型"].ToString() : "";
                        item.Inventory     = (string)data.Rows[row]["库存"].ToString();
                        item.SellType      = (string)data.Rows[row]["出售方式(零或整)"].ToString();

                        string key = item.Name + item.Format + item.Created;
                        if (!items.ContainsKey(key))
                        {
                            items.Add(key, item);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(items);
        }
Example #27
0
 private BaseItemInfo GetItem(string content)
 {
     try
     {
         BaseItemInfo item = new BaseItemInfo();
         item.ID        = CommonFun.GetValue(content, "\"approvalNum\":\"", "\"");
         item.Created   = CommonFun.GetValue(content, "\"manufacturer\":\"", "\"");
         item.Format    = CommonFun.GetValue(content, "\"packaging\":\"", "\"");
         item.Name      = CommonFun.GetValue(content, "\"commonName\":\"", "\"");
         item.ItemName  = CommonFun.GetValue(content, "\"name\":\"", "\"");
         item.ViewCount = CommonFun.GetValue(content, "\"skuId\":", ",");
         return(item);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     return(null);
 }
Example #28
0
        /// <summary>
        /// 获取平台库存
        /// </summary>
        /// <param name="item"></param>
        /// <param name="platform"></param>
        /// <returns></returns>
        private Dictionary <string, int> GetPlatformStock(BaseItemInfo item)
        {
            Dictionary <string, int> stocks = new Dictionary <string, int>();

            try
            {
                //1、获取tk的库存
                tk.GetSellingItem(item.ID);
                //2、获取1号网的库存
                string yyUrl = "";
                //3、获取315的库存
                string tofUrl = "https://www.315jiage.cn/memberViewPrices.aspx?act=ajax&cmd=get&p=1&w=certification&k=%E5%9B%BD%E8%8D%AF%E5%87%86%E5%AD%97Z15021169&minStock=&maxStock=&hot=0&rnd=334376";
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(stocks);
        }
Example #29
0
        private int GetItemCount(BaseItemInfo item, Dictionary <string, BaseItemInfo> items, bool isTK)
        {
            try
            {
                int count = 0;
                do
                {
                    foreach (BaseItemInfo sItem in items.Values)
                    {
                        if (isTK)
                        {
                            if (CommonFun.IsSameFormat(item.Format, sItem.Format, item.Name, sItem.Name))
                            {
                                return(Convert.ToInt32(sItem.Inventory));
                            }
                        }
                        else
                        {
                            bool isSame = false;
                            if (count > 0)
                            {
                                isSame = CommonFun.IsSameFormat(item.Format, sItem.Format, item.Name, sItem.Name);
                            }
                            else
                            {
                                isSame = item.Type.Trim() == sItem.Type.Trim();
                            }
                            if (isSame)
                            {
                                return(Convert.ToInt32(sItem.Inventory));
                            }
                        }
                    }
                } while (++count < 2 && !isTK);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }


            return(int.MaxValue);
        }
Example #30
0
        /// <summary>
        /// Converts a BaseItem to a BaseItemInfo
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>BaseItemInfo.</returns>
        /// <exception cref="System.ArgumentNullException">item</exception>
        public BaseItemInfo GetBaseItemInfo(BaseItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            var info = new BaseItemInfo
            {
                Id           = GetDtoId(item),
                Name         = item.Name,
                MediaType    = item.MediaType,
                Type         = item.GetClientTypeName(),
                RunTimeTicks = item.RunTimeTicks
            };

            info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);

            return(info);
        }
Example #31
0
        /// <summary>
        /// 获取固定表
        /// </summary>

        private void GetFixedItem()
        {
            try
            {
                DataTable data = CommonFun.ReadXLS("KTUnUpdate.xlsx");

                for (int row = 0; row < data.Rows.Count; row++)
                {
                    try
                    {
                        BaseItemInfo item = new BaseItemInfo();
                        item.ID      = data.Rows[row]["批准文号"].ToString();
                        item.Name    = (string)data.Rows[row]["通用名称"].ToString();
                        item.Created = (string)data.Rows[row]["生产厂家"].ToString();
                        item.Format  = (string)data.Rows[row]["包装规格"].ToString();
                        string priceStr = (string)data.Rows[row]["平台售价(最低价格)"].ToString();
                        item.ShopPrice     = string.IsNullOrEmpty(priceStr) ? 9999 : Convert.ToDecimal(priceStr);
                        item.PlatformPrice = item.ShopPrice;
                        item.Type          = (string)data.Rows[row]["剂型"].ToString();
                        item.Inventory     = (string)data.Rows[row]["库存"].ToString();
                        item.SellType      = (string)data.Rows[row]["出售方式(零或整)"].ToString();

                        //item.Name = (string)data.Rows[row]["通用名称"].ToString();

                        string key = item.Name + item.Format + item.Created;
                        if (!unUpdate.ContainsKey(key))
                        {
                            unUpdate.Add(key, item);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #32
0
    public void Init(BaseItem item)
    {
        Clear();
        switch (item.FirstChar())
        {
            case PlayerItem.FIRSTCHAR:
                PlayerItemInfo PlayerItemInfo = DataBaseController.GetItem(DataBaseController.Instance.DataStructs.PrefabsStruct.PlayerItemInfo);
                PlayerItemInfo.Init(item as PlayerItem, WithButtons);
                CurItemInfo = PlayerItemInfo;
                break;
            case BonusItem.FIRSTCHAR:
                BonusItemInfo BonusItemInfo = DataBaseController.GetItem(DataBaseController.Instance.DataStructs.PrefabsStruct.BonusItemInfo);
                BonusItemInfo.Init(item as BonusItem, WithButtons);
                CurItemInfo = BonusItemInfo;
                break;
            case ExecutableItem.FIRSTCHAR:
                ExecutableItemInfo ExecutableItemInfo = DataBaseController.GetItem(DataBaseController.Instance.DataStructs.PrefabsStruct.ExecutableItemInfo);
                ExecutableItemInfo.Init(item as ExecutableItem, WithButtons);
                CurItemInfo = ExecutableItemInfo;
                break;
            case TalismanItem.FIRSTCHAR:
                TalismanItemInfo TalismanItemInfo = DataBaseController.GetItem(DataBaseController.Instance.DataStructs.PrefabsStruct.TalismanItemInfo);
                TalismanItemInfo.Init(item as TalismanItem, WithButtons);
                CurItemInfo = TalismanItemInfo;
                break;
            case RecipeItem.FIRSTCHAR:
                RecepiItemInfo RecepiItemInfo = DataBaseController.GetItem(DataBaseController.Instance.DataStructs.PrefabsStruct.RecepiItemInfo);
                RecepiItemInfo.Init(item as RecipeItem, WithButtons);
                CurItemInfo = RecepiItemInfo;
                break;

        }
        Link();
//        if (OnInitCallback != null)
//            OnInitCallback(item,ItemOwner.Player);
    }