コード例 #1
0
        public ActionResult GetProductInfo2()
        {
            int productid            = DoRequest.GetFormInt("productid");
            ShortProductInfo product = new ShortProductInfo();
            var res = GetShortProductsByProductIds.Do(productid.ToString());

            if (res != null && res.Body != null && res.Body.product_list != null)
            {
                product = res.Body.product_list[0];
            }
            return(Json(product, JsonRequestBehavior.AllowGet));
            //return Json(new {productname=product.product_name, seotitle=product.seo_title, seotext=product.seo_text,seokey=product.seo_key }, JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
        public ActionResult GetProductList2()
        {
            string ids = DoRequest.Request("ids");
            List <ShortProductInfo> list = new List <ShortProductInfo>();
            var res = GetShortProductsByProductIds.Do(ids);

            if (res != null && res.Body != null && res.Body.product_list != null)
            {
                list = res.Body.product_list;
            }
            foreach (ShortProductInfo item in list)
            {
                DateTime _sDate = DateTime.Parse(item.promotion_bdate);
                DateTime _eDate = DateTime.Parse(item.promotion_edate);
                if (_sDate <= DateTime.Now && DateTime.Now <= _eDate)
                {
                    item.sale_price = item.promotion_price;//促销价
                }
            }

            List <TypeList> tList = GetTypeListAll.Do(-1).Body.type_list;

            foreach (ShortProductInfo item in list)
            {
                string   path    = item.product_type_path;
                string[] _tem    = path.Split(',');
                int      _xCount = 0;
                for (int x = 0; x < _tem.Length; x++)
                {
                    if (string.IsNullOrEmpty(_tem[x].Trim()))
                    {
                        continue;
                    }
                    int _v = Utils.StrToInt(_tem[x].Trim());
                    foreach (TypeList em in tList)
                    {
                        if (em.product_type_id == _v)
                        {
                            if (_xCount > 0)
                            {
                                item.type_name += (" &gt;&gt; ");
                            }
                            item.type_name += (em.type_name);
                            _xCount++;
                        }
                    }
                }
            }

            return(Json(list, JsonRequestBehavior.AllowGet));
        }