1成人用品上传到草稿箱 2随机商品跳过资质商品 3ai短标题 4记住类目保证金筛选功能

This commit is contained in:
wule committed 2026-03-03 14:03:31 +08:00
1 parent cce4c9da2d
commit ce42448b29
15 files changed
+851 -389

No files matched your search

+194 -9
View File
@@ -1234,12 +1234,12 @@ namespace TemuKJD.ToolForms
// 采集商品详情
var getDetailRst = GetPddBaseData(shop, prod);
if (!getDetailRst.Contains("\"success\":true"))
var getPddDetailRst = GetPddBaseData(shop, prod);
if (!getPddDetailRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref getDetailRst, "message");
var errMsg = BaseRegex.GetStringJson(ref getPddDetailRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = getDetailRst;
errMsg = getPddDetailRst;
prod.getProductMsg = "采集失败 " + errMsg;
Invoke(new Action(() =>
{
@@ -1250,7 +1250,16 @@ namespace TemuKJD.ToolForms
try
{
var jObj = JsonHelper.JObjectParse(getDetailRst)["data"];
var jObj = JsonHelper.JObjectParse(getPddDetailRst)["data"];
// 未维护拼多多平台数据的,采集聚水潭基础数据转化为拼多多数据,给客户上传草稿箱使用
if (jObj.IsJTokenNullOrEmpty())
{
jObj = GetJstDetail(shop, prod, row);
if (jObj == null)
continue;
}
prod.dbProduct.cat_id = jObj["catId"].ParseToString();
if (string.IsNullOrEmpty(jstPddShopId))
@@ -1261,6 +1270,8 @@ namespace TemuKJD.ToolForms
}
// 获取属性
if (prod.dbProduct.cat_id.IsNullOrEmpty())
prod.dbProduct.cat_id = "1";
var getPropRst = GetPddProp(shop, prod, prod.dbProduct.cat_id, jstPddShopId);
if (!getPropRst.Contains("\"success\":true"))
{
@@ -1276,6 +1287,14 @@ namespace TemuKJD.ToolForms
}
List<PDDPropRefPidNameMap> pddPropMap = new List<PDDPropRefPidNameMap>();
var pddPropObj = JsonHelper.JObjectParse(getPropRst)["data"];
if (pddPropObj.IsJTokenNullOrEmpty())
{
pddPropObj = new JObject();
}
if (pddPropObj["properties"].IsJTokenNullOrEmpty())
{
pddPropObj["properties"] = new JArray();
}
foreach (JObject pObj in pddPropObj["properties"])
{
pddPropMap.Add(new PDDPropRefPidNameMap()
@@ -1288,7 +1307,7 @@ namespace TemuKJD.ToolForms
}
if (pddPropMap.Count == 0 && 1==2)
{
// 取商品属性 作废
// 取商品属性
getPropRst = GetPddPropForUpdate(shop, prod, prod.dbProduct.cat_id, jstPddShopId);
if (!getPropRst.Contains("\"success\":true"))
{
@@ -1357,6 +1376,115 @@ namespace TemuKJD.ToolForms
}, cancellationTokenSource.Token);
}
/// <summary>
/// 获取聚水潭商品详情并转换为聚水潭拼多多商品详情
/// </summary>
/// <param name="shop"></param>
/// <param name="prod"></param>
/// <param name="row"></param>
/// <returns></returns>
private JObject GetJstDetail(ShopLoginInfo shop, JSTListProductInfo prod, DataGridViewRow row)
{
var detailRst = GetGoodsDetail(shop, prod);
if (!detailRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref detailRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = detailRst;
prod.getProductMsg = "采集失败 " + errMsg;
Invoke(new Action(() =>
{
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
}));
return null;
}
var JstData = JsonHelper.JObjectParse(detailRst)["data"];
var PddData = new JObject();
PddData["id"] = JstData["supplierId"].ParseToString();
PddData["coId"] = JstData["coId"].ParseToString();
PddData["carouselGallery"] = JstData["itemMainImage"];
PddData["categoryData"] = new JArray() { 1 };
PddData["catId"] = 1;
//PddData["detailGallery"] = JstData["itemDetailImages"];
if (JstData["itemDetailImages"].IsJTokenNullOrEmpty() || JstData["itemDetailImages"].Count() == 0)
{
PddData["detailGallery"] = new JArray();
foreach(var jItem in PddData["carouselGallery"])
{
(PddData["detailGallery"] as JArray).Add(jItem);
}
}
else
{
PddData["detailGallery"] = new JArray();
foreach (var jItem in JstData["itemDetailImages"])
{
(PddData["detailGallery"] as JArray).Add(jItem["imageUrl"]);
}
}
PddData["goodsDesc"] = JstData["itemName"].ParseToString();
PddData["goodsName"] = JstData["itemName"].ParseToString();
PddData["goodsProperties"] = new JArray();
PddData["marketPrice"] = JstData["maxSupplyPrice"].ParseToDecimal() * 2 + 10;
PddData["styleCode"] = JstData["styleCode"];
PddData["itemSpuId"] = JstData["itemSpuId"];
PddData["skuInfo"] = new JObject();
(PddData["skuInfo"] as JObject).Add("goodsSkuDetail", new JArray());
foreach (var jstSkuObj in JstData["itemSkuList"])
{
JObject skuObj = new JObject();
(PddData["skuInfo"]["goodsSkuDetail"] as JArray).Add(skuObj);
skuObj["quantity"] = jstSkuObj["stock"];
skuObj["skus"] = new JArray();
if (!jstSkuObj["colour"].IsJTokenNullOrEmpty())
{
JObject jSpecColor = new JObject();
(skuObj["skus"] as JArray).Add(jSpecColor);
jSpecColor["v"] = jstSkuObj["colour"].ParseToString();
jSpecColor["k"] = "颜色";
}
if (!jstSkuObj["spec"].IsJTokenNullOrEmpty())
{
JObject jSpecColor = new JObject();
(skuObj["skus"] as JArray).Add(jSpecColor);
jSpecColor["v"] = jstSkuObj["spec"].ParseToString();
jSpecColor["k"] = "尺码";
}
skuObj["supplyPrice"] = jstSkuObj["supplyPrice"];
skuObj["erpSkuStatus"] = jstSkuObj["erpSkuStatus"];
skuObj["baseSkuId"] = jstSkuObj["id"];
skuObj["coId"] = jstSkuObj["coId"];
skuObj["isOnsale"] = 1;
skuObj["itemNo"] = jstSkuObj["itemCode"].IsJTokenNullOrEmpty() ? jstSkuObj["erpStyleCode"] : jstSkuObj["itemCode"];
skuObj["pic"] = jstSkuObj["pic"];
skuObj["jdSkuStatus"] = 1;
skuObj["limitQuantity"] = 999;
skuObj["sales"] = 0;
skuObj["aliSkuStatus"] = 1;
skuObj["preSaleTime"] = "";
skuObj["price"] = jstSkuObj["supplyPrice"].ParseToDecimal() + 1;
skuObj["multiPrice"] = jstSkuObj["supplyPrice"];
skuObj["id"] = jstSkuObj["id"];
}
PddData["whiteImage"] = JstData["whiteImage"];
PddData["colourRelation"] = JstData["colourSet"];
PddData["specRelation"] = JstData["specSet"];
PddData["itemCoId"] = JstData["itemCoId"];
PddData["shopTypeEnum"] = "Pinduoduo";
PddData["forecastMainImage"] = PddData["carouselGallery"].FirstOrDefault();
PddData["forecastItemName"] = PddData["goodsName"];
PddData["mainImage"] = PddData["carouselGallery"];
PddData["leafCategoryId"] = "1";
PddData["itemName"] = PddData["goodsName"];
PddData["groupPreSaleDay"] = 0;
PddData["categoryPropStr"] = "[]";
return PddData;
}
private void GetDyProd()
{
this.pbLoading.Visible = true;
@@ -1506,6 +1634,22 @@ namespace TemuKJD.ToolForms
return getDetailRst;
}
public string GetGoodsDetail(ShopLoginInfo shop, JSTListProductInfo jstLstProd)
{
string url = "https://sc.scm121.com/api/goods/goods/queryGoodsDetail";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + jstLstProd.itemSpuId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true";
//data = @"{""itemSpuId"":""0A3A5CC4F524430A9F3D7640BD0D3029"",""itemCoId"":""11596521""}";
string data = @"{""itemSpuId"":""" + jstLstProd.itemSpuId + @""",""itemCoId"":""" + jstLstProd.itemCoId + @"""}";
var detailRst = "";
for (int i = 0; i < 3 && !detailRst.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
detailRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
}
return detailRst;
}
public string GetPddShopId(ShopLoginInfo shop, JSTListProductInfo jstLstProd)
{
string url = "https://sc.scm121.com/api/goods/shelves/mxStoresInformation/selectStoresInfo?shopTypeKey=%E6%8B%BC%E5%A4%9A%E5%A4%9A&spuId=" +
@@ -1551,6 +1695,10 @@ namespace TemuKJD.ToolForms
return response;
}
/// <summary>
/// 获取真实coid
/// </summary>
/// <returns></returns>
public string QueryRealCoid(ShopLoginInfo shop, JSTListProductInfo jstProd)
{
string url = "https://sc.scm121.com/api/goods/goodsQuery/queryGoodsDistributionHierarchyV2";
@@ -1561,6 +1709,10 @@ namespace TemuKJD.ToolForms
return response;
}
/// <summary>
/// 批量获取真实coid
/// </summary>
/// <returns></returns>
public string BatchQueryRealCoid(ShopLoginInfo shop, string spuIds, string coid0 = "12840800")
{
string url = "https://sc.scm121.com/api/goods/goodsQuery/queryGoodsDistributionHierarchyV2";
@@ -1570,6 +1722,15 @@ namespace TemuKJD.ToolForms
return response;
}
/// <summary>
/// 查询供应商售后地址
/// </summary>
/// <param name="shop"></param>
/// <param name="realSpuId">真实spuid</param>
/// <param name="spuId">爆款spuid</param>
/// <param name="supCoId1">真实coid</param>
/// <param name="supCoId0">爆款coid</param>
/// <returns></returns>
public string GetAfterSaleAddress(ShopLoginInfo shop, string realSpuId, string spuId, string supCoId1, string supCoId0 = "12840800")
{
string url = "https://innerapi.scm121.com/api/aftersale/addresses/queryMultiLevelSupplierReturnAddressWithSwitch";
@@ -1588,6 +1749,11 @@ namespace TemuKJD.ToolForms
var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
return response;
}
/// <summary>
/// 获取供应商退货地址中的手机号
/// </summary>
/// <returns></returns>
public string GetAfterSaleAddressMobileById(ShopLoginInfo shop, string Id, string realSpuId, string spuId, string realCoid, string supCoId = "12840800")
{
string url = "https://innerapi.scm121.com/api/aftersale/middleman/addresses/queryPhone?id=" + Id;
@@ -1598,6 +1764,12 @@ namespace TemuKJD.ToolForms
return response;
}
/// <summary>
/// 设置分销
/// </summary>
/// <param name="shop"></param>
/// <param name="jstProd"></param>
/// <returns></returns>
public string SetPartnerSpu(ShopLoginInfo shop, JSTListProductInfo jstProd)
{
string url = "https://sc.scm121.com/api/goods/buyer/partnerSpu/add";
@@ -1607,8 +1779,13 @@ namespace TemuKJD.ToolForms
return response;
}
/// <summary>
/// 获取手机号查询授权
/// </summary>
/// <param name="shop"></param>
/// <param name="jstProd"></param>
/// <param name="authStr"></param>
/// <returns></returns>
public string AuthV2(ShopLoginInfo shop, JSTListProductInfo jstProd, string authStr)
{
string url = "https://sc.scm121.com/api/company/open/auth/grantAuthV2";
@@ -1619,7 +1796,15 @@ namespace TemuKJD.ToolForms
return response;
}
/// <summary>
/// 获取下架sku列表信息
/// </summary>
/// <param name="shop"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="pageNum"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public string GetDownSkuLst(ShopLoginInfo shop, DateTime startTime, DateTime endTime, int pageNum, int pageSize)
{
string url = "https://sc.scm121.com/api/goods/goChannelPartnerSku/queryChannelPartnerSkuList";
+47 -47
View File
@@ -30,17 +30,17 @@ namespace TemuKJD.ToolForms
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtSize = new System.Windows.Forms.TextBox();
this.txtY = new System.Windows.Forms.TextBox();
this.txtX = new System.Windows.Forms.TextBox();
this.btnSelectImg = new DevComponents.DotNetBar.PanelEx();
this.btnSave = new DevComponents.DotNetBar.PanelEx();
this.btnMake = new DevComponents.DotNetBar.PanelEx();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.pbImage = new System.Windows.Forms.PictureBox();
this.txtX = new System.Windows.Forms.TextBox();
this.txtY = new System.Windows.Forms.TextBox();
this.txtSize = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -76,6 +76,48 @@ namespace TemuKJD.ToolForms
this.splitContainer1.SplitterDistance = 266;
this.splitContainer1.TabIndex = 0;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(23, 99);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 17);
this.label3.TabIndex = 744;
this.label3.Text = "文字尺寸";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(23, 65);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 17);
this.label2.TabIndex = 743;
this.label2.Text = "文字坐标";
//
// txtSize
//
this.txtSize.Location = new System.Drawing.Point(83, 96);
this.txtSize.Name = "txtSize";
this.txtSize.Size = new System.Drawing.Size(127, 23);
this.txtSize.TabIndex = 742;
this.txtSize.Text = "44";
//
// txtY
//
this.txtY.Location = new System.Drawing.Point(149, 62);
this.txtY.Name = "txtY";
this.txtY.Size = new System.Drawing.Size(61, 23);
this.txtY.TabIndex = 741;
this.txtY.Text = "1024";
//
// txtX
//
this.txtX.Location = new System.Drawing.Point(83, 62);
this.txtX.Name = "txtX";
this.txtX.Size = new System.Drawing.Size(61, 23);
this.txtX.TabIndex = 740;
this.txtX.Text = "860";
//
// btnSelectImg
//
this.btnSelectImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -178,48 +220,6 @@ namespace TemuKJD.ToolForms
this.pbImage.TabIndex = 707;
this.pbImage.TabStop = false;
//
// txtX
//
this.txtX.Location = new System.Drawing.Point(83, 62);
this.txtX.Name = "txtX";
this.txtX.Size = new System.Drawing.Size(61, 23);
this.txtX.TabIndex = 740;
this.txtX.Text = "860";
//
// txtY
//
this.txtY.Location = new System.Drawing.Point(149, 62);
this.txtY.Name = "txtY";
this.txtY.Size = new System.Drawing.Size(61, 23);
this.txtY.TabIndex = 741;
this.txtY.Text = "1020";
//
// txtSize
//
this.txtSize.Location = new System.Drawing.Point(83, 96);
this.txtSize.Name = "txtSize";
this.txtSize.Size = new System.Drawing.Size(127, 23);
this.txtSize.TabIndex = 742;
this.txtSize.Text = "44";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(23, 65);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 17);
this.label2.TabIndex = 743;
this.label2.Text = "文字坐标";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(23, 99);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 17);
this.label3.TabIndex = 744;
this.label3.Text = "文字尺寸";
//
// ImgToolForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;