49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Work.Api
|
|
{
|
|
public class PinduoduoApiPropId
|
|
{
|
|
public ShopChatBase Shop;
|
|
public PinduoduoApiPropId(ShopChatBase shop)
|
|
{
|
|
Shop = shop;
|
|
}
|
|
/// <summary>
|
|
/// 初始化大类
|
|
/// </summary>
|
|
/// <param name="mainCatId"></param>
|
|
/// <returns></returns>
|
|
public string Get(int mainCatId)
|
|
{
|
|
PinduoduoApiGetProduct api = new PinduoduoApiGetProduct(Shop);
|
|
api.Type = "pdd.goods.spec.get";
|
|
var cid = FromTitleToCat.MainCat.Find(c => c!=null && c.Key == mainCatId.ToString());
|
|
if (cid == null)
|
|
return "";
|
|
string id = cid.Value1.Substring(1);
|
|
id = id.Substring(0, id.IndexOf(","));
|
|
api.Data.Add("cat_id", id);
|
|
return api.GetData();
|
|
}
|
|
/// <summary>
|
|
/// 获取
|
|
/// </summary>
|
|
/// <param name="parentId"></param>
|
|
/// <param name="name"></param>
|
|
/// <returns></returns>
|
|
public string GetPropId(string parentId, string name)
|
|
{
|
|
PinduoduoApiGetProduct api = new PinduoduoApiGetProduct(Shop);
|
|
api.Type = "pdd.goods.spec.id.get";
|
|
api.Data.Add("parent_spec_id", parentId);
|
|
api.Data.Add("spec_name", name);
|
|
return api.GetData();
|
|
}
|
|
}
|
|
}
|