This commit is contained in:
chfei committed 2026-10-19 14:00:53 +08:00
commit ac61ef5300
2 files changed
+94 -19

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ namespace AllBase
/// <summary> /// <summary>
/// 版本ID /// 版本ID
/// </summary> /// </summary>
public static int VersionCount = 1349; public static int VersionCount = 1351;
public static string MainPath = "29wx"; public static string MainPath = "29wx";
//public static string MainPath = "29wx"; //public static string MainPath = "29wx";
//public static string MainPath = "29pdd"; //public static string MainPath = "29pdd";
@@ -2346,21 +2346,20 @@ namespace TemuKJD.WXForms.ProductForms
bool isChangeImgDic = false; bool isChangeImgDic = false;
wxImgMapDic = GetImageCaches(prodInfo); wxImgMapDic = GetImageCaches(prodInfo);
// 旧盗链
Dictionary<string, string> wxImgMapOldDic = new Dictionary<string, string>();
//Dictionary<string, string> wxImgMapDic = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(dbProd.wx_img_map_json))
//if (!string.IsNullOrEmpty(dbProd.wx_img_map_json)) {
//{ try
// try {
// { wxImgMapOldDic = JsonHelper.DeserializeJsonToObject<Dictionary<string, string>>(dbProd.wx_img_map_json);
// wxImgMapDic = JsonHelper.DeserializeJsonToObject<Dictionary<string, string>>(dbProd.wx_img_map_json); }
// } catch
// catch {
// { isChangeImgDic = true;
// isChangeImgDic = true; wxImgMapOldDic = new Dictionary<string, string>();
// wxImgMapDic = new Dictionary<string, string>(); }
// } }
//}
#endregion #endregion
#region 提取源商品详情,根据需要生成sku货号 #region 提取源商品详情,根据需要生成sku货号
@@ -2611,6 +2610,12 @@ namespace TemuKJD.WXForms.ProductForms
upProdParam.product.info.headImg.Add(image.PlatformUrl); upProdParam.product.info.headImg.Add(image.PlatformUrl);
continue; continue;
} }
if (wxImgMapOldDic.ContainsKey(BaseClass.GetMd5(gallery_item.url)))
{
upProdInitParam.product.info.headImg.Add(wxImgMapOldDic[BaseClass.GetMd5(gallery_item.url)]);
upProdParam.product.info.headImg.Add(wxImgMapOldDic[BaseClass.GetMd5(gallery_item.url)]);
continue;
}
if (needAddRandomBlock || wantAddRandomBlock || gallery_item.url.Contains("wst.wxapp.tc.qq.com")) if (needAddRandomBlock || wantAddRandomBlock || gallery_item.url.Contains("wst.wxapp.tc.qq.com"))
{ {
@@ -2651,6 +2656,9 @@ namespace TemuKJD.WXForms.ProductForms
Md5 = BaseClass.GetMd5(gallery_item.url), Md5 = BaseClass.GetMd5(gallery_item.url),
PlatformUrl = upImgUrl, PlatformUrl = upImgUrl,
}; };
wxImgMapOldDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
isChangeImgDic = true; isChangeImgDic = true;
continue; continue;
} }
@@ -2711,6 +2719,8 @@ namespace TemuKJD.WXForms.ProductForms
PlatformUrl = upImgUrl, PlatformUrl = upImgUrl,
}; };
wxImgMapOldDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
isChangeImgDic = true; isChangeImgDic = true;
continue; continue;
} }
@@ -2804,8 +2814,11 @@ namespace TemuKJD.WXForms.ProductForms
#region 保存缓存盗链图片 #region 保存缓存盗链图片
if (isChangeImgDic)
{ {
SaveImageCaches(Platform, wxImgMapDic.Values); SaveImageCaches(Platform, wxImgMapDic.Values);
SaveImageCacheOld(dbProd.spu_id, wxImgMapOldDic);
isChangeImgDic = false; isChangeImgDic = false;
} }
@@ -3599,6 +3612,12 @@ namespace TemuKJD.WXForms.ProductForms
continue; continue;
} }
if (wxImgMapOldDic.ContainsKey(BaseClass.GetMd5(gallery_item.url)))
{
upProdParam.product.info.detail.detailImg.Add(wxImgMapOldDic[BaseClass.GetMd5(gallery_item.url)]);
continue;
}
if (needAddRandomBlock || wantAddRandomBlock || gallery_item.url.Contains("wst.wxapp.tc.qq.com")) if (needAddRandomBlock || wantAddRandomBlock || gallery_item.url.Contains("wst.wxapp.tc.qq.com"))
{ {
// 如果想打码或者需要打码,就走差异化详情图,不走api直传 // 如果想打码或者需要打码,就走差异化详情图,不走api直传
@@ -3637,6 +3656,9 @@ namespace TemuKJD.WXForms.ProductForms
Md5 = BaseClass.GetMd5(gallery_item.url), Md5 = BaseClass.GetMd5(gallery_item.url),
PlatformUrl = upImgUrl, PlatformUrl = upImgUrl,
}; };
wxImgMapOldDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
isChangeImgDic = true; isChangeImgDic = true;
continue; continue;
} }
@@ -3695,6 +3717,9 @@ namespace TemuKJD.WXForms.ProductForms
Md5 = BaseClass.GetMd5(gallery_item.url), Md5 = BaseClass.GetMd5(gallery_item.url),
PlatformUrl = upImgUrl, PlatformUrl = upImgUrl,
}; };
wxImgMapOldDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
isChangeImgDic = true; isChangeImgDic = true;
continue; continue;
} }
@@ -3724,8 +3749,12 @@ namespace TemuKJD.WXForms.ProductForms
#endregion #endregion
#region 保存缓存盗链图片 #region 保存缓存盗链图片
if (isChangeImgDic)
{ {
SaveImageCaches(Platform, wxImgMapDic.Values); SaveImageCaches(Platform, wxImgMapDic.Values);
SaveImageCacheOld(dbProd.spu_id, wxImgMapOldDic);
isChangeImgDic = false; isChangeImgDic = false;
} }
#endregion #endregion
@@ -4663,6 +4692,14 @@ namespace TemuKJD.WXForms.ProductForms
attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = image.PlatformUrl, }); attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = image.PlatformUrl, });
continue; continue;
} }
if (wxImgMapOldDic.ContainsKey(BaseClass.GetMd5(sku.thumb_url)))
{
attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = wxImgMapOldDic[BaseClass.GetMd5(sku.thumb_url)], });
continue;
}
// 使用接口链接传sku图 // 使用接口链接传sku图
if (1 == 1 && !sku.thumb_url.Contains("wst.wxapp.tc.qq.com")) if (1 == 1 && !sku.thumb_url.Contains("wst.wxapp.tc.qq.com"))
{ {
@@ -4697,6 +4734,9 @@ namespace TemuKJD.WXForms.ProductForms
Md5 = BaseClass.GetMd5(sku.thumb_url), Md5 = BaseClass.GetMd5(sku.thumb_url),
PlatformUrl = upImgUrl, PlatformUrl = upImgUrl,
}; };
wxImgMapOldDic[BaseClass.GetMd5(sku.thumb_url)] = upImgUrl;
isChangeImgDic = true; isChangeImgDic = true;
continue; // 传图成功跳过模拟上传 continue; // 传图成功跳过模拟上传
} }
@@ -4751,6 +4791,9 @@ namespace TemuKJD.WXForms.ProductForms
Md5 = BaseClass.GetMd5(sku.thumb_url), Md5 = BaseClass.GetMd5(sku.thumb_url),
PlatformUrl = upImgUrl, PlatformUrl = upImgUrl,
}; };
wxImgMapOldDic[BaseClass.GetMd5(sku.thumb_url)] = upImgUrl;
isChangeImgDic = true; isChangeImgDic = true;
continue; continue;
} }
@@ -4796,8 +4839,12 @@ namespace TemuKJD.WXForms.ProductForms
#endregion #endregion
#region 保存缓存盗链图片 #region 保存缓存盗链图片
if (isChangeImgDic)
{ {
SaveImageCaches(Platform, wxImgMapDic.Values); SaveImageCaches(Platform, wxImgMapDic.Values);
SaveImageCacheOld(dbProd.spu_id, wxImgMapOldDic);
isChangeImgDic = false; isChangeImgDic = false;
} }
#endregion #endregion
@@ -5923,8 +5970,12 @@ namespace TemuKJD.WXForms.ProductForms
} }
#region 保存缓存盗链图片 #region 保存缓存盗链图片
if (isChangeImgDic)
{ {
SaveImageCaches(Platform, wxImgMapDic.Values); SaveImageCaches(Platform, wxImgMapDic.Values);
SaveImageCacheOld(dbProd.spu_id, wxImgMapOldDic);
isChangeImgDic = false; isChangeImgDic = false;
} }
#endregion #endregion
@@ -6174,8 +6225,9 @@ namespace TemuKJD.WXForms.ProductForms
//------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------
//生成主图base64字符串 //生成主图base64字符串
string getImgError; string getImgError;
if (!img_url.Contains("wst.wxapp.tc.qq.com") && !img_url.Contains("mmecimage.cn")) //if (!img_url.Contains("wst.wxapp.tc.qq.com") && !img_url.Contains("mmecimage.cn"))
img_url = img_url.Replace("https://", "http://"); if (!img_url.Contains("wxapp") && !img_url.Contains("mmecimage.cn"))
img_url = img_url.Replace("https://", "http://");
var image = GetHtml.GetUrlImg(img_url, out getImgError); var image = GetHtml.GetUrlImg(img_url, out getImgError);
if (image == null) if (image == null)
image = new Bitmap(800, 800); image = new Bitmap(800, 800);
@@ -6187,7 +6239,7 @@ namespace TemuKJD.WXForms.ProductForms
var imageBg = new Bitmap(imgWidth, imgHeight); var imageBg = new Bitmap(imgWidth, imgHeight);
if (image == null || !string.IsNullOrEmpty(getImgError)) if (image == null || !string.IsNullOrEmpty(getImgError))
{ {
errorMsg = "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"初始化图片上传失败 " + getImgError + "\"}"; errorMsg = "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"初始化图片上传失败 " + getImgError + " " + img_url + "\"}";
return ""; return "";
} }
try try
@@ -7572,6 +7624,29 @@ namespace TemuKJD.WXForms.ProductForms
} }
void SaveImageCacheOld(string spuId, Dictionary<string, string> wxImgMapOldDic)
{
if (EnvironmentHelper.IsProduction)
{
return;
}
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex();
//data += "&spu_id=" + dbProd.spu_id;
data += "&spu_id=" + spuId;
data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapOldDic);
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
}
private void chkNotUploadShopProdMoreThan_CheckedChanged(object sender, EventArgs e) private void chkNotUploadShopProdMoreThan_CheckedChanged(object sender, EventArgs e)
{ {
if (IsFormLoad) if (IsFormLoad)