Beispiel #1
0
        public static void FillPromoInfo(BannerModel uiBannerInfo)
        {
            if (string.IsNullOrWhiteSpace(uiBannerInfo.BannerLink))
            {
                return;
            }

            if (uiBannerInfo.BannerLink.IndexOf("http://127.0.0.1/") >= 0)
            {
                //提取促销模板系统编号
                uiBannerInfo.PromotionSysNo = ExtractPromotionSysNo(uiBannerInfo.BannerLink);
                uiBannerInfo.BannerLink     = "";
            }
            else if (uiBannerInfo.BannerLink.IndexOf("/product/detail") >= 0)
            {
                //提取商品系统编号
                uiBannerInfo.ProductSysNo = ExtractProductSysNo(uiBannerInfo.BannerLink);
                uiBannerInfo.BannerLink   = "";
            }
            else if (uiBannerInfo.BannerLink.IndexOf("/groupbuying") >= 0)
            {
                //提取团购系统编号
                uiBannerInfo.GroupBuySysNo = ExtractGroupBuySysNo(uiBannerInfo.BannerLink);
                uiBannerInfo.BannerLink    = "";
            }

            else if (uiBannerInfo.BannerLink.IndexOf("/product/searchresult") >= 0)
            {
                //提取搜索关键字
                uiBannerInfo.Keywords   = ExtractKeywords(uiBannerInfo.BannerLink);
                uiBannerInfo.BannerLink = "";
            }
            else if (uiBannerInfo.BannerLink.IndexOf("/substore") >= 0)
            {
                //提取三级分类系统编号
                uiBannerInfo.CatSysNo   = ExtractC3SysNo(uiBannerInfo.BannerLink);
                uiBannerInfo.BannerLink = "";
            }
            else if (uiBannerInfo.BannerLink.IndexOf("/BrandZone") >= 0)
            {
                //提取品牌系统编号
                uiBannerInfo.BrandID    = ExtractBrandSysNo(uiBannerInfo.BannerLink);
                uiBannerInfo.BannerLink = "";
            }
        }
Beispiel #2
0
        private List <BannerModel> Transform(IEnumerable <BannerInfo> bannerList)
        {
            List <BannerModel> result = new List <BannerModel>();

            foreach (var bannerEntity in bannerList)
            {
                var bannerModel = new BannerModel();
                bannerModel.SysNo             = bannerEntity.SysNo;
                bannerModel.BannerLink        = (bannerEntity.BannerLink ?? "").Trim();
                bannerModel.BannerTitle       = (bannerEntity.BannerTitle ?? "").Trim();
                bannerModel.BannerResourceUrl = (bannerEntity.BannerResourceUrl ?? "").Trim();
                //从BannerLink中提取相关信息(比如ProductSysNo等)
                BannerHelper.FillPromoInfo(bannerModel);

                result.Add(bannerModel);
            }

            return(result);
        }