Merge branch 'master' of github.com:jtt-fan/KJD

This commit is contained in:
chfei committed 2026-09-07 13:50:02 +08:00
commit d370a58554
16 files changed
+893 -387

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -366,14 +366,21 @@ namespace TemuKJD.WXForms.ProductForms
{
lblHot.Visible = true;
cmbHot.Visible = true;
chkFilterViewUv.Visible = true;
numFilterViewUv.Visible = true;
if (!string.IsNullOrWhiteSpace(cmbSourceType.Text))
chkFilterViewUv.Visible = true;
//numFilterViewUv.Visible = true;
pnlFilterViewUv.Visible = true;
chkFilterSaleCountNum.Visible = true;
pnlFilterSaleCountNum.Visible = true;
if (!string.IsNullOrWhiteSpace(cmbSourceType.Text))
{
//lblGroupFilter.Visible = true;
//cmbGroupFilter.Visible = true;
}
}
cmbUpdateInDays.Visible = true;
chkUpdateInDays.Visible = true;
txtUpdateInDays.Visible = true;
lblUpdateInDays.Visible = true;
}
if (BaseClass.UserAuthority.Contains("商品采集") || BaseClass.ParentAuthority.Contains("商品采集"))
{
if (BaseClass.UserAuthority.Contains("学员数据") || BaseClass.ParentAuthority.Contains("学员数据"))
@@ -429,7 +436,8 @@ namespace TemuKJD.WXForms.ProductForms
List<Control> ctrlLst = new List<Control>()
{
lblSourceType, cmbSourceType, lblGroupFilter, cmbGroupFilter, lblHot, cmbHot, lblIdFilter, txtIdFilter,
chkFilterViewUv, numFilterViewUv /*chkRandomFissionProduct, txtRandomFissionProductCount, lblNotes, cmbNotes*//*, lblJstInitSet, cmbJstInitSet*/
chkFilterViewUv, pnlFilterViewUv, chkFilterSaleCountNum, pnlFilterSaleCountNum,
/*chkRandomFissionProduct, txtRandomFissionProductCount, lblNotes, cmbNotes*//*, lblJstInitSet, cmbJstInitSet*/
};
for (int i = 0; i < ctrlLst.Count - 2; i += 2)
{
@@ -453,8 +461,8 @@ namespace TemuKJD.WXForms.ProductForms
}
if (chkWXComplateProd.Visible == false)
{
chkRandomFissionProduct.Location = new Point(chkRandomFissionProduct.Location.X + 54, chkRandomFissionProduct.Location.Y);
txtRandomFissionProductCount.Location = new Point(txtRandomFissionProductCount.Location.X + 54, txtRandomFissionProductCount.Location.Y);
//chkRandomFissionProduct.Location = new Point(chkRandomFissionProduct.Location.X + 54, chkRandomFissionProduct.Location.Y);
//txtRandomFissionProductCount.Location = new Point(txtRandomFissionProductCount.Location.X + 54, txtRandomFissionProductCount.Location.Y);
}
IsFormLoad = true;
@@ -1300,7 +1308,7 @@ namespace TemuKJD.WXForms.ProductForms
result.Contains("提审次数已达上限") || result.Contains("拥金上货失败:需要开通优选联盟") || result.Contains("本店铺近期提审失败比例较高,已被限"))
{
shop.upLimitRetryCount++;
if (shop.upLimitRetryCount >= 3)
if (shop.upLimitRetryCount >= globalShopUploadCntLimitRetryTimes)
{
shop.upLimitRetryCount = 0;
@@ -1309,7 +1317,7 @@ namespace TemuKJD.WXForms.ProductForms
Invoke(new Action(() => { shopRow.Cells["colSelect"].Value = false; }));
}
}
else
else if (result.Contains("\"success\":true"))
{
shop.upLimitRetryCount = Math.Max(0, shop.upLimitRetryCount - 1);
}
@@ -2407,7 +2415,7 @@ namespace TemuKJD.WXForms.ProductForms
else
{
// 使用接口链接传主图
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + gallery_item.url.Replace("https://", "http://") + "\"}");
@@ -2458,7 +2466,7 @@ namespace TemuKJD.WXForms.ProductForms
return errMsg;
}
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
//upDate += "&is_file=true";
@@ -2643,8 +2651,14 @@ namespace TemuKJD.WXForms.ProductForms
var aiGalleries = prodInfo.detail.galleries.Where(g => g.type == 1).Take(3).ToList();
foreach (var gallery_item in aiGalleries) // 9张主图
{
string getImgError;
var image = GetHtml.GetUrlImg(gallery_item.url.Replace("https://", "http://"), out getImgError);
imgId++;
string getImgError;
var imgUrl = gallery_item.url;
{
if (!imgUrl.Contains("wxapp") && imgUrl.Contains("mmecimage.cn"))
imgUrl = imgUrl.Replace("https://", "http://");
}
var image = GetHtml.GetUrlImg(imgUrl, out getImgError);
var imageBg = new Bitmap(800, 800);
if (!string.IsNullOrEmpty(getImgError) || image == null)
{
@@ -2663,7 +2677,24 @@ namespace TemuKJD.WXForms.ProductForms
string imgFullPath = tempImgPath + "\\图片" + imgId + ".jpg";
tempImgFullPathLst.Add(imgFullPath);
if (imgId == 1)
image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg);
{
try
{
image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch
{
// 真实图像失败传假图也能识别
int fileSize = Randomx.GetId(1024, 10240);
using (BinaryWriter writer = new BinaryWriter(File.Create(imgFullPath)))
{
for (int i = 0; i < fileSize; i++)
{
writer.Write((byte)Randomx.GetId(256)); // 生成0到255之间的随机字节
}
}
}
}
else
{
// 只需要传一张真实图像即可
@@ -3325,7 +3356,7 @@ namespace TemuKJD.WXForms.ProductForms
else
{
// 使用接口链接传详情图
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + gallery_item.url.Replace("https://", "http://") + "\"}");
@@ -3375,7 +3406,7 @@ namespace TemuKJD.WXForms.ProductForms
return errMsg;
}
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
//upDate += "&is_file=true";
@@ -4387,7 +4418,7 @@ namespace TemuKJD.WXForms.ProductForms
// 使用接口链接传sku图
if (1 == 1 && !sku.thumb_url.Contains("wst.wxapp.tc.qq.com"))
{
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + sku.thumb_url.Replace("https://", "http://") + "\"}");
@@ -4433,7 +4464,7 @@ namespace TemuKJD.WXForms.ProductForms
return errMsg;
}
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
//upDate += "&is_file=true";
@@ -5091,7 +5122,7 @@ namespace TemuKJD.WXForms.ProductForms
byte[] imageBytes = memoryStream.ToArray();
var imgBase64 = Convert.ToBase64String(imageBytes);
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
//upDate += "&is_file=true";
@@ -5152,7 +5183,8 @@ namespace TemuKJD.WXForms.ProductForms
foreach (var propParam in upProdParam.product.info.param)
{
if (propParam.categorys[0].name.Contains("食品名称") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装"))
if (propParam.categorys[0].name.Contains("食品名称") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装") &&
!propParam.categorys[1].name.Contains("1") && propParam.categorys[1].name.Length > 5)
foodName = "食品名称:" + propParam.categorys[1].name;
else if (propParam.categorys[0].name.Contains("生产企业名称") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装"))
companyName = "生产商名称:" + propParam.categorys[1].name;
@@ -5380,7 +5412,7 @@ namespace TemuKJD.WXForms.ProductForms
//return errMsg;
}
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
//upDate += "&is_file=true";
@@ -5472,7 +5504,7 @@ namespace TemuKJD.WXForms.ProductForms
return errMsg;
}
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
//upDate += "&is_file=true";
@@ -5532,7 +5564,7 @@ namespace TemuKJD.WXForms.ProductForms
return errMsg;
}
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
//upDate += "&is_file=true";
@@ -6301,7 +6333,10 @@ namespace TemuKJD.WXForms.ProductForms
//if (chkSevenDays.Checked)
// data += "&add_days_less=21";
if (chkUpdateInDays.Checked)
{
data += "&add_days_less=" + txtUpdateInDays.Text.Trim();
data += "&add_days_less_type=" + (cmbUpdateInDays.Text == "更新" ? "mdy" : "add");
}
// 回采数据
if (chkWXComplateProd.Checked)
@@ -6313,6 +6348,9 @@ namespace TemuKJD.WXForms.ProductForms
if (chkFilterViewUv.Checked)
data += "&min_view_uv=" + numFilterViewUv.Value;
if (chkFilterSaleCountNum.Checked)
data += "&sale_count_num_more=" + numFilterSaleCountNum.Value;
}));
var html = GetHtml.PostUtf8(url, data);
//if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -6572,8 +6610,13 @@ namespace TemuKJD.WXForms.ProductForms
cmbHot_TextChanged(null, null);
chkFilterViewUv.Checked = false;
numFilterViewUv.Value = 200;
if (chkWXComplateProd.Visible == true) chkWXComplateProd.Checked = false;
if (chkRandomFissionProduct.Visible == true) chkRandomFissionProduct.Checked = false;
if (txtRandomFissionProductCount.Visible == true) txtRandomFissionProductCount.Text = "";
int prodCount;
int prodCount;
pbSelectProd.Visible = true;
Task.Run(() =>
{
@@ -7189,9 +7232,15 @@ namespace TemuKJD.WXForms.ProductForms
wxUploadRule.IsUseShanghaiReturnOrderAddress = chkUseShanghaiReturnOrderAddress.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
}
public class WXUpload
int globalShopUploadCntLimitRetryTimes = 5;
private void numJumpCnt_ValueChanged(object sender, EventArgs e)
{
globalShopUploadCntLimitRetryTimes = numJumpCnt.Value.ParseToInt();
}
}
public class WXUpload
{
public static string searchProduct(ShopLoginInfo shop, string extCode, string extCode2 = "")
{