优化了微店商品上传 优化pdd买手读单

This commit is contained in:
wule committed 2026-04-15 21:04:37 +08:00
1 parent 6c4f16b897
commit f360688c43
62 files changed
+5620 -1432

No files matched your search

@@ -83,6 +83,10 @@ namespace KJD_Web.Upload.Prod
{
string prodStr = Encoding.UTF8.GetString(this.FileUpload1.FileBytes);
prodStr = TextBox2.Text.Trim();
var reducePer = 0m;
var realPricePer = 1m - reducePer * 0.01m;
if (realPricePer < 0.1m)
realPricePer = 0.1m;
WXClientProductInfoLite wxClientProd = new WXClientProductInfoLite();
@@ -92,11 +96,11 @@ namespace KJD_Web.Upload.Prod
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
wxClientProd.product_key = JsonUtils.DeserializeJsonToObject<wx_client_prod_key>(regex_str);
if (wxClientProd.product_key == null)
return "解析失败";
return "解析失败product_key";
}
catch
{
return "解析失败";
return "解析失败product_key";
}
//商品详情格式
@@ -105,7 +109,7 @@ namespace KJD_Web.Upload.Prod
//主标题
wxClientProd.info.title = RegexUtils.GetStringJson(ref prodStr, "title");
if (wxClientProd.info.title.IsNullOrEmpty())
return "解析失败";
return "解析失败title";
//副标题
wxClientProd.info.sub_title = RegexUtils.GetStringJson(ref prodStr, "sub_title");
@@ -116,11 +120,11 @@ namespace KJD_Web.Upload.Prod
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
wxClientProd.info.head_img = JsonUtils.DeserializeJsonToListNullable<string>(regex_str);
if (wxClientProd.info.head_img == null)
return "解析失败";
return "解析失败head_img";
}
catch
{
return "解析失败";
return "解析失败head_img";
}
var nodeCatId = RegexUtils.GetStringJson(ref prodStr, "nodeCatId");
@@ -139,7 +143,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败category";
}
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "detail");
@@ -158,7 +162,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败detail";
}
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "param");
@@ -173,7 +177,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败param";
}
//品牌id
@@ -191,7 +195,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "";
return "解析失败sku_id_list";
}
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "sku_list");
@@ -204,7 +208,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败sku_list";
}
if (wxClientProd.info.sku_list == null)
@@ -222,7 +226,16 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败sku_info";
}
}
// 佣金商品 根据折扣价格和佣金比例减去佣金
if (wxClientProd.info.sku_list != null)
{
foreach (var sku in wxClientProd.info.sku_list.sku_info)
{
sku.price = (sku.price - (sku.price - sku.discounted_price) * (1m - realPricePer)).ParseToInt();
}
}
@@ -236,7 +249,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败product_sale_attrs";
}
@@ -255,7 +268,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败service_desc";
}
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "express_info");
@@ -268,7 +281,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败express_info";
}
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "headVideoInfo");
@@ -281,7 +294,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败headVideoInfo";
}
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "afterSaleInfo");
@@ -294,7 +307,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败afterSaleInfo";
}
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "deliveryExpressFee");
@@ -307,7 +320,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败deliveryExpressFee";
}
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "templateInfo");
@@ -320,7 +333,7 @@ namespace KJD_Web.Upload.Prod
}
catch
{
return "解析失败";
return "解析失败templateInfo";
}
wxClientProd.info.spuCode = RegexUtils.GetStringJson(ref prodStr, "spuCode");
@@ -331,11 +344,26 @@ namespace KJD_Web.Upload.Prod
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
wxClientProd.productSkus = JsonUtils.DeserializeJsonToList<WXProductSkuInfoLite>(regex_str);
if (wxClientProd.productSkus == null)
return "解析失败";
return "解析失败productSkus";
}
catch
{
return "解析失败";
return "解析失败productSkus";
}
// 佣金商品 根据价格给售卖价格赋值,如果价格丢失,直接在售卖价上计算
foreach (var sku in wxClientProd.productSkus)
{
var wxDisSku = wxClientProd.info.sku_list?.sku_info?.FirstOrDefault(s => s.sku_id == sku.skuKey.skuId);
if (wxDisSku != null)
sku.productSkuInfo.salePrice = wxDisSku.price;
else
sku.productSkuInfo.salePrice = (sku.productSkuInfo.salePrice - sku.productSkuInfo.salePrice * realPricePer).ParseToInt();
}
if (wxClientProd.productSkus.Min(s => s.productSkuInfo.salePrice * 0.01m) == 0)
{
return "解析失败Sku价格为0";
}
return SaveWxProd(wxClientProd.product_key.product_id, wxClientProd, prodStr);