Example #1
0
        /// <summary>
        /// 获取标准商品类目属性
        /// </summary>
        /// <param name="itemprop"></param>
        /// <returns></returns>
        internal List <ItemProp> GetItemprops(ItempropsGet itemprop)
        {
            ITopClient          client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
            ItempropsGetRequest req    = new ItempropsGetRequest();

            req.Fields      = "is_input_prop,type,modified_time,modified_type,cid,required,features,is_taosir,taosir_do,pid,parent_pid,parent_vid,name,is_key_prop,is_sale_prop,is_color_prop,is_enum_prop,is_item_prop,must,multi,prop_values,status,sort_order,child_template,is_allow_alias";
            req.Cid         = itemprop.Cid;
            req.Pid         = itemprop.Pid;
            req.ParentPid   = itemprop.ParentPid;
            req.IsKeyProp   = itemprop.IsKeyProp;
            req.IsSaleProp  = itemprop.IsSaleProp;
            req.IsColorProp = itemprop.IsColorProp;
            req.IsEnumProp  = itemprop.IsEnumProp;
            req.IsInputProp = itemprop.IsInputProp;
            req.IsItemProp  = itemprop.IsItemProp;
            req.ChildPath   = itemprop.ChildPath;
            req.Type        = itemprop.Type;
            req.AttrKeys    = itemprop.AttrKeys;
            ItempropsGetResponse response = client.Execute(req);

            TopJsonParser         topjson = new TopJsonParser();
            ItempropsGetResponse1 resp    = topjson.Parse <ItempropsGetResponse1>(response.Body);

            return(resp.ItemProps);
        }
Example #2
0
        //类目API taobao.itemprops.get 获取标准商品类目属性(包括:货号、品牌、衣长等)
        /// <summary>
        /// 类目API taobao.itemprops.get 获取标准商品类目属性(包括:货号、品牌、衣长等)
        /// 注:1,货号,是放在input_str,input_pids 中,如:【(input_pids:input_str)
        /// (1632501:238286)】
        /// 2,品牌,如果淘宝类目中有该品牌如:那么就加到props中,如果没有,需要自定义品牌者加到
        /// input_str,input_pids,如:【(input_pids:input_str)(20000:莱克)】
        /// 3,SUK(销售)属性,sku_properties中有的属性props也必须存在。
        /// sku_properties中以,分开。
        /// </summary>
        /// <param name="cid">淘宝所属类目ID</param>
        /// <param name="isColorProp">是否为颜色属性</param>
        /// <param name="isSaleProp">是否为销售属性</param>
        public List <ItemProp> GetPropsByCid(long cid, bool?isColorProp = null, bool?isSaleProp = null)
        {
            ItempropsGetRequest req = new ItempropsGetRequest();

            req.Fields      = "pid,name,must,multi,prop_values,is_color_prop,is_sale_prop";
            req.Cid         = cid;
            req.IsColorProp = isColorProp;
            req.IsSaleProp  = isSaleProp;

            ItempropsGetResponse response = client.Execute(req);

            return(response.ItemProps);
        }
Example #3
0
        /// <summary>
        /// 获取标准商品类目属性
        /// </summary>
        /// <param name="RemarkId">商品编号</param>
        /// <param name="ProductTypeId">类别编号</param>
        /// <returns></returns>
        public object ItempropsGetRequest(long ProductTypeId)
        {
            ITopClient          client = new DefaultTopClient(Url, Appkey, Appsecret);
            ItempropsGetRequest req    = new ItempropsGetRequest();

            req.Fields = "pid,name,must,multi,prop_values";
            req.Cid    = ProductTypeId;
            req.Pid    = 1627207;
            req.Type   = 2;
            ItempropsGetResponse response = client.Execute(req);

            return(response);
        }
Example #4
0
        public List <ItemProp> Shop(long cid)
        {
            ItempropsGetResponse response = null;

            try
            {
                ITopClient          client = TBManager.GetClient();
                ItempropsGetRequest req    = new ItempropsGetRequest();
                req.Fields = "pid,name,must,multi,prop_values";
                req.Cid    = cid;
                response   = client.Execute(req, Users.SessionKey);
            }
            catch (Exception ex)
            {
                CHENGTUAN.Components.ExceptionReporter.WriteLog(ex, CHENGTUAN.Entity.ExceptionPostion.TBApply_Components);
            }
            return(response.ItemProps);
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public List <BProperty> GetProperities(Product_Class category, Shop shop)
        {
            List <BProperty>    properities = new List <BProperty>();
            ItempropsGetRequest req         = new ItempropsGetRequest();

            req.Fields = "pid,name,must,multi,prop_values";
            if (category != null && !string.IsNullOrEmpty(category.Mall_CID))
            {
                req.Cid = long.Parse(category.Mall_CID);
            }
            else
            {
                req.Cid = 0;
            }
            //req.IsKeyProp = true;
            req.IsSaleProp  = true;
            req.IsColorProp = true;
            req.IsEnumProp  = true;
            req.IsInputProp = true;
            req.IsItemProp  = true;
            //1=>Taobao
            //2=>TMall, need to check Mall Type from Shop object
            req.Type = 1L;

            ItempropsGetResponse response = client.Execute(req);

            if (response.IsError)
            {
                throw new KMJXCException(response.ErrMsg);
            }

            if (response.ItemProps != null)
            {
                foreach (TB.ItemProp prop in response.ItemProps)
                {
                    BProperty pro = new BProperty();
                    pro.Created    = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                    pro.MID        = prop.Pid.ToString();
                    pro.Name       = prop.Name;
                    pro.CategoryId = category.Product_Class_ID;
                    pro.ID         = 0;
                    pro.Shop       = new BShop()
                    {
                        ID = category.Shop_ID
                    };
                    pro.Created_By = new BUser()
                    {
                        ID = category.Create_User_ID
                    };
                    properities.Add(pro);
                    if (prop.PropValues != null)
                    {
                        foreach (TB.PropValue pv in prop.PropValues)
                        {
                            Product_Spec_Value psv = new Product_Spec_Value();
                            psv.Name = pv.Name;
                            pro.Values.Add(psv);
                        }
                    }
                }
            }

            return(properities);
        }