/// <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); }
/// <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; }
//类目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); }
/// <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); }
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); }
/// <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); }
/// <summary> /// taobao.itemprops.get /// 获取标准商品类目属性 /// </summary> /// <param name="cid">必填 叶子类目ID,如果只传cid,则只返回一级属性</param> /// <param name="fields">需要返回的字段列表,见:ItemProp</param> /// <param name="pid">属性id (取类目属性时,传pid,不用同时传PID和parent_pid) </param> /// <param name="parentpid">父属性ID</param> /// <param name="iskeyprop">是否关键属性。</param> /// <param name="issaleprop">是否销售属性</param> /// <param name="iscolorprop">是否颜色属性</param> /// <param name="isenumprop">是否枚举属性 如果返回true,属性值是下拉框选择输入,如果返回false,属性值是用户自行手工输入。 </param> /// <param name="isinputprop">在is_enum_prop是true的前提下,是否是卖家可以自行输入的属性(注:如果is_enum_prop返回false,该参数统一返回false)。</param> /// <param name="isitemprop">是否商品属性,这个属性只能放于发布商品时使用</param> /// <param name="childpath">类目子属性路径,由该子属性上层的类目属性和类目属性值组成,格式pid:vid;pid:vid.取类目子属性需要传child_path,cid </param> /// <param name="type">获取类目的类型:1代表集市、2代表天猫 </param> /// <param name="attrkeys">属性的Key,支持多条,以“,”分隔 </param> /// <returns></returns> public static List<ItemProp> GetItemprops(long? cid, string fields, long? pid, long? parentpid, bool? iskeyprop, bool? issaleprop, bool? iscolorprop, bool? isenumprop, bool? isinputprop, bool? isitemprop, string childpath, long? type, string attrkeys) { ITopClient client = TopClientService.GetTopClient(); ItempropsGetRequest req = new ItempropsGetRequest(); req.Fields = fields; req.Cid = cid; req.Pid = pid; req.ParentPid = parentpid; req.IsKeyProp = iskeyprop; req.IsSaleProp = issaleprop; req.IsColorProp = iscolorprop; req.IsEnumProp = isenumprop; req.IsInputProp = isinputprop; req.IsItemProp = isitemprop; req.ChildPath = childpath; req.Type = type; req.AttrKeys = attrkeys; ItempropsGetResponse response = client.Execute(req); return response.ItemProps; }
//��Ŀ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; }
//��Ŀ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> public List<ItemProp> GetPropsByCid(long cid) { ItempropsGetRequest req = new ItempropsGetRequest(); req.Fields = "pid,name,must,multi,prop_values"; req.Cid = cid; ItempropsGetResponse response = client.Execute(req); return response.ItemProps; }