聚水潭食品类目上传
This commit is contained in:
1 parent
7b06707a40
commit
1b2b6bb553
12 files changed
+430
-16
No files matched your search
@@ -824,6 +824,7 @@ namespace TemuKJD.ToolForms
|
||||
jstPddShopId = BaseRegex.GetStringJson(ref getShopIdRst, "shopId");
|
||||
}
|
||||
|
||||
// 获取属性
|
||||
var getPropRst = GetPddProp(shop, prod, prod.dbProduct.cat_id, jstPddShopId);
|
||||
if (!getPropRst.Contains("\"success\":true"))
|
||||
{
|
||||
@@ -849,11 +850,45 @@ namespace TemuKJD.ToolForms
|
||||
name_alias = pObj["name_alias"].IsJTokenNullOrEmpty() ? null : pObj["name_alias"].ParseToString(),
|
||||
});
|
||||
}
|
||||
if (pddPropMap.Count == 0 && 1==2)
|
||||
{
|
||||
// 取商品属性 作废
|
||||
getPropRst = GetPddPropForUpdate(shop, prod, prod.dbProduct.cat_id, jstPddShopId);
|
||||
if (!getPropRst.Contains("\"success\":true"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref getPropRst, "message");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = getPropRst;
|
||||
prod.getProductMsg = "采集失败 " + errMsg;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
pddPropMap = new List<PDDPropRefPidNameMap>();
|
||||
pddPropObj = JsonHelper.JObjectParse(getPropRst)["data"];
|
||||
foreach (JObject pObj in pddPropObj["cateAttrList"])
|
||||
{
|
||||
pddPropMap.Add(new PDDPropRefPidNameMap()
|
||||
{
|
||||
id = pObj["id"].IsJTokenNullOrEmpty() ? new long?() : pObj["id"].ParseToLong(),
|
||||
ref_pid = pObj["ref_pid"].IsJTokenNullOrEmpty() ? new long?() : pObj["ref_pid"].ParseToLong(),
|
||||
name = pObj["name"].IsJTokenNullOrEmpty() ? null : pObj["name"].ParseToString(),
|
||||
name_alias = pObj["name_alias"].IsJTokenNullOrEmpty() ? null : pObj["name_alias"].ParseToString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
// 没有属性的预测属性
|
||||
// 不进行类目属性预测
|
||||
//var getPropRstV2 = GetPddPropForecastV2(shop, prod, prod.dbProduct.cat_id);
|
||||
|
||||
prod.dbProduct.main_cat_id = jObj["categoryData"].FirstOrDefault().ParseToString();
|
||||
var prodDataJson = JsonHelper.SerializeObject(jObj);
|
||||
//if (jObj["pddPropMap"].IsJTokenNullOrEmpty() && !jObj["pddData"]["categoryPropStr"].IsJTokenNullOrEmpty())
|
||||
//{
|
||||
|
||||
//}
|
||||
var propMapJson = JsonHelper.SerializeObject(pddPropMap);
|
||||
prod.dbProduct.product_json = "{\"pddData\":" + prodDataJson + ",\"pddPropMap\":" + propMapJson + ",\"jstProd\":" + prod.jstProductJson + "}";
|
||||
var priceMin = jObj["skuInfo"]["goodsSkuDetail"].Min(s => s["supplyPrice"].ParseToDecimal());
|
||||
@@ -1039,6 +1074,21 @@ namespace TemuKJD.ToolForms
|
||||
return response;
|
||||
}
|
||||
|
||||
public string GetPddPropForUpdate(ShopLoginInfo shop, JSTListProductInfo jstLstProd, string catId, string shopId = "20115638")
|
||||
{
|
||||
string url = "https://sc.scm121.com/api/goods/supplier/shopManage/querySupplierShopSpuForUpdate";
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstLstProd.supplierId + "?showErpList=1";
|
||||
string body = @"{""itemSpuId"":""" + jstLstProd.itemSpuId + @""",""shopType"":""Pinduoduo"",""itemCoId"":""" + jstLstProd.itemCoId +
|
||||
@""",""companyType"":""SUPPLIER""}";
|
||||
var propRst = "";
|
||||
for (int i = 0; i < 3 && !propRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
propRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, body, referer, appVersion);
|
||||
}
|
||||
return propRst;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 没有商品属性的,类目属性预测
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user