1鞋子上传加绒不加绒处理 2核价功能继续优化

This commit is contained in:
wule committed 2025-08-26 19:31:52 +08:00
1 parent 12ea9bebe5
commit c70b78aff3
28 files changed
+1718 -362

No files matched your search

@@ -185,7 +185,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (!string.IsNullOrWhiteSpace(imgUrl))
image = GetHtml.GetUrlImg(imgUrl, out getImgError);
if (!string.IsNullOrEmpty(getImgError))
BaseMsgForm.ShowError(getImgError);
//BaseMsgForm.ShowError("图片加载失败 " + getImgError);
image = TemuKJD.Properties.Resources.errpic;
try
{
@@ -34,6 +34,75 @@ namespace TemuKJD.KJDForms.ProductSelectForms
List<TemuDBExtCodePriceInfo> lstDbPrice = new List<TemuDBExtCodePriceInfo>();
List<string> lstCustomImg = new List<string>();
Dictionary<string, string> dicCustomImg = new Dictionary<string, string>();
List<string> lstExtCodeFleeceInShoes = new List<string>() {
"DZ-GM-857",
"DZ-GM-971",
"DZ-GM-TY02",
"DZ-BM-TY07",
"058-2039",
"161-8",
"166-8",
"607-8",
"307-8",
"707",
"GM-909",
"DZ-808",
"DZ-YD607",
"DZ-YD608",
"DZ--D-3",
"DZ-GM-988",
"DZ-GM-966",
"DZ-GM-B002",
"DZ-GM-U001",
"DZ-GM-X004",
"BM-DF01",
"DZ-BM-W620",
"DZ-GM-BSX05",
"DZ-BM-HT700",
"BM-D-5",
"DZ-GM-CF001",
"DZ-GM-CF20",
"GM-D-6",
"BM-D-8",
"DZ-GM-602",
"DZ-GM-610",
"DZ-GM-990",
"DZ-GM-HT710",
"DZ-GM-J004",
"DZ-BM-N006",
"GM-QXR01",
"GM-S85",
"DZ-GM-S616",
"DZ-GM-SX08",
"DZ-GM-XR06",
"DZ-GM-XR08",
"GM-YD609",
"BM-YH05",
"BM-YH07",
"GM-ZH001",
"GM-ZH002",
"5922",
"5928",
"5169",
"5268",
"5921",
"5627",
"5777",
"5829",
"5866",
"5888",
"5621",
"5925",
"5926",
"5927",
"5929",
"5931",
"5932",
"5963",
"5965",
"5966",
"5968",
};
public DbProductSelectListManageForm()
{
@@ -206,7 +275,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (!string.IsNullOrWhiteSpace(imgUrl))
image = GetHtml.GetUrlImg(imgUrl, out getImgError);
if (!string.IsNullOrEmpty(getImgError))
BaseMsgForm.ShowError(getImgError);
//BaseMsgForm.ShowError("图片加载失败 " + getImgError);
image = TemuKJD.Properties.Resources.errpic;
try
{
@@ -812,6 +882,22 @@ namespace TemuKJD.KJDForms.ProductSelectForms
return "上传失败 " + html;
}
List<TemuCategoryTemplateInfo> categoryTemplateList = new List<TemuCategoryTemplateInfo>();
var propTemplateRst = QueryCategoryTemplate(shop, prodParam.productDraftId.ParseToString(), catId.ParseToString());
if (propTemplateRst.Contains("\"success\":true"))
{
try
{
JObject jObj = JObject.Parse(propTemplateRst);
var PropLstStr = JsonHelper.SerializeObject(jObj["result"]["properties"]);
categoryTemplateList.AddRange(JsonHelper.DeserializeJsonToList<TemuCategoryTemplateInfo>(PropLstStr));
}
catch (Exception ex)
{
}
}
prodParam.carouselImageI18nReqs = prodInfo.carouselImageI18nVOList;
prodParam.carouselImageUrls = prodInfo.carouselImageUrls;
@@ -819,7 +905,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
List<string> realCarouselImageUrls = new List<string>();
realCarouselImageUrls.AddRange(prodInfo.carouselImageUrls);
if (chkCustomPic.Checked)
if (chkCustomPic.Checked) // 上传自定义图片
{
for (int i = 0; i < prodParam.carouselImageUrls.Count; i++)
{
@@ -1019,6 +1105,41 @@ namespace TemuKJD.KJDForms.ProductSelectForms
valueExtendInfo = ""
});
}
var prop = categoryTemplateList.FirstOrDefault(p => p.name.Contains("内里是否加绒"));
if (prop != null && prop.required == true && !prodParam.productPropertyReqs.Any(p => p.propName == prop.name))
{
if (lstExtCodeFleeceInShoes.Contains(dbProd.ext_code) ||
lstExtCodeFleeceInShoes.Any(c => (dbProd.ext_code.Contains("-" + c))))
{
prodParam.productPropertyReqs.Add(new ProductPropertyReqsItem
{
valueUnit = "",
propValue = "是",
propName = "内里是否加绒",
refPid = prop.refPid.ParseToLong(),
vid = 404104,
controlType = 1,
pid = prop.pid.ParseToLong(),
templatePid = prop.templatePid,
valueExtendInfo = ""
});
}
else
{
prodParam.productPropertyReqs.Add(new ProductPropertyReqsItem
{
valueUnit = "",
propValue = "否",
propName = "内里是否加绒",
refPid = prop.refPid.ParseToLong(),
vid = 404105,
controlType = 1,
pid = prop.pid.ParseToLong(),
templatePid = prop.templatePid,
valueExtendInfo = ""
});
}
}
prodParam.productSaleExtAttrReq = new ProductSaleExtAttrReq
{
bodyShape = prodInfo.productSaleExtAttr.bodyShape,
@@ -1034,7 +1155,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
BaseMsgForm.ShowError("商品属性转换失败 " + ex.Message);
}
}
prodParam.productWhExtAttrReq = new ProductWhExtAttrReq()
@@ -1591,6 +1712,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
private string QueryCategoryTemplate(ShopLoginInfo shop, string draftId, string catId)
{
string url = "https://agentseller.temu.com/anniston-agent-seller/category/template/query";
string body = @"{""catId"":" + catId + @",""langList"":[""en""]}";
string refere = "https://agentseller.temu.com/goods/edit?productDraftId=" + draftId + "&from=productDraftList";
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
private string CheckImgMd5(ShopLoginInfo shop, string draftId, string parentSpecId, string fileMd5)
{
string url = "https://agentseller.temu.com/phoenix-mms/material/queryByMd5";
@@ -1979,7 +2109,7 @@ Content-Disposition: form-data; name=""upload_sign""
catch (Exception ex)
{
//Console.WriteLine("An error occurred: " + ex.Message);
BaseMsgForm.ShowError(ex.Message);
BaseMsgForm.ShowError("打开自定义图片失败 " + ex.Message);
return;
}
}
@@ -506,7 +506,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (!string.IsNullOrWhiteSpace(imgUrl))
image = GetHtml.GetUrlImg(imgUrl, out getImgError);
if (!string.IsNullOrEmpty(getImgError))
BaseMsgForm.ShowError(getImgError);
//BaseMsgForm.ShowError("图片加载失败 " + getImgError);
image = TemuKJD.Properties.Resources.errpic;
try
{