微信商品上传货号extcode优化 产品数据库查询逻辑优化

This commit is contained in:
wule committed 2026-09-08 16:59:22 +08:00
1 parent 4fdcc94a91
commit 5ade769d7d
5 files changed
+131 -11

No files matched your search

@@ -1545,7 +1545,24 @@ namespace TemuKJD.WXForms.ProductForms
}
}
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
public static string GetEC1ExtCode(string spu_id)
{
if (spu_id.IsNullOrEmpty())
throw new Exception("货号指定失败,值不能为空!");
if (!spu_id.StartsWith("EC1") && !spu_id.EndsWith("A"))
return "EC1" + spu_id + "A";
return spu_id;
}
public static string GetNewExtCode(string spu_id)
{
if (spu_id.IsNullOrEmpty())
throw new Exception("货号指定失败,值不能为空!");
if (!spu_id.StartsWith("P1-"))
return "P1-" + spu_id;
return spu_id;
}
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
{
#region 初始化上传商品对象
// 生成初始化上传商品对象
@@ -1627,7 +1644,7 @@ namespace TemuKJD.WXForms.ProductForms
{
var searchExtCode = dbProd.ext_code;
if (searchExtCode.ParseToString().Length < 10)
searchExtCode = "EC1" + dbProd.spu_id + "A";
searchExtCode = GetEC1ExtCode(dbProd.spu_id);
if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId"))
{
var sku_secret_json = dbProd.sku_secret_json;
@@ -2371,7 +2388,7 @@ namespace TemuKJD.WXForms.ProductForms
if (extCode.IsNullOrEmpty() || extCode.Length <= 10)
{
//extCode = "EC" + Randomx.GetId(1000).ToString().PadLeft(3, '0') + dbProd.spu_id + "C";
extCode = "EC1" + dbProd.spu_id + "A";
extCode = GetEC1ExtCode(dbProd.spu_id);
}
upProdParam.product.info.spuCode = extCode;
upProdParam.product.info.outProductId = extCode;