temu客户端上传功能 2.拼多多商品提取问题修复(25%)

This commit is contained in:
wule committed 2025-12-12 19:34:16 +08:00
1 parent 2bb124e2d7
commit 62465769fe
13 files changed
+402 -210

No files matched your search

@@ -34,7 +34,14 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
public partial class DbProductSelectListManageForm : LRBaseForm
{
public bool IsClientJit { get; set; } = false;
public enum EnumClientMode
{
Admin,
Client,
ClientJit,
}
public EnumClientMode ClientMode { get; set; } = EnumClientMode.Admin;
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
List<string> skuRandomLetterArr = new List<string> { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" };
@@ -154,7 +161,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//ucSplitPage1.cmbPageSize.Items.Remove("1000");
}
if (BaseClass.SaLevel == 1 && !IsClientJit)
if (BaseClass.SaLevel == 1 && ClientMode == EnumClientMode.Admin)
{
dgvSelectProduct.Columns["colSubSaNick"].Visible = true;
chkShowDel.Visible = true;
@@ -168,7 +175,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
//chkSkuRandomPrice.Checked = true;
}
if (IsClientJit)
if (ClientMode != EnumClientMode.Admin)
{
chkShowDel.Visible = true;
btnReFission.Visible = true;
@@ -210,7 +217,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
}
else
{
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
{
foreach (DataGridViewRow row in dgvSelectProduct.Rows)
{
@@ -330,7 +337,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
dgvSelectProduct.Rows[rowIndex].Height = 60;
displayLoginStatusColor(dgvSelectProduct.Rows[rowIndex].Cells["colLogin"], dgvSelectProduct.Rows[rowIndex].Cells["colLogin"].Value.ParseToString());
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
{
var clientShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == prodSelect.shop_id);
if (clientShop == null || clientShop.jit_expire_time.IsNullOrEmpty() || clientShop.jit_expire_time < DateTime.Now.Date)
@@ -358,6 +365,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
pageCount = 1;
var url = BaseClass.BuildObjString("product/admin_get_user_select_product_list");
if (ClientMode != EnumClientMode.Admin)
url = BaseClass.BuildObjString("product/get_user_select_product_list");
var data = "";
Invoke(new Action(() =>
{
@@ -378,8 +388,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms
data += "&operate_sub_sa_name=" + BaseClass.UserName;
if (chkNoSubSa.Checked)
data += "&no_sub_sa=true";
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
data += "&is_client_jit=true";
if (ClientMode != EnumClientMode.Admin)
{
string shopIds = string.Join(",", GlobalConfig.ShopLoginList.Where(s => !s.ShopId.IsNullOrEmpty()).Select(s => s.ShopId).Distinct()) ?? "default";
data += "&shop_ids=" + shopIds;
}
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -440,7 +455,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var shopId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
var draftId = dgvSelectProduct.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString();
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
{
var clientShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (clientShop == null || clientShop.jit_expire_time.IsNullOrEmpty() || clientShop.jit_expire_time < DateTime.Now.Date)
@@ -463,7 +478,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
break;
case "编辑备注":
DbProductSelectEditNotesForm editForm = new DbProductSelectEditNotesForm(dbSelectProduct);
editForm.IsClientJit = this.IsClientJit;
editForm.IsClientJit = (ClientMode == EnumClientMode.ClientJit);
editForm.ShowDialog();
dgvSelectProduct.Rows[e.RowIndex].Cells["colNotes"].Value = dbSelectProduct.notes;
dgvSelectProduct.Rows[e.RowIndex].Cells["colUserNotes"].Value = dbSelectProduct.user_notes;
@@ -483,7 +498,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
// 查看map映射列表
var url = BaseClass.BuildObjString("product/get_select_prod_db_id_map_draft_id_list");
var data = UserLogin.GetSignaturex() + "&select_db_id=" + dbId;
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
@@ -522,7 +537,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (flag)
{
if (!IsClientJit)
if (ClientMode == EnumClientMode.Admin)
{
var shop = GetShop(shopId);
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
@@ -550,7 +565,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
case "进店":
{
var shop = GetShop(shopId);
if (!IsClientJit)
if (ClientMode == EnumClientMode.Admin)
{
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
@@ -574,7 +589,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
{
var shop = GetShop(shopId);
// 登录店铺
if (!IsClientJit)
if (ClientMode == EnumClientMode.Admin)
{
AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop);
shopLoginForm.openType = EnumOpenType.login;
@@ -673,7 +688,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var url = BaseClass.BuildObjString("product/del_select_product");
var data = UserLogin.GetSignaturex() +
"&db_id=" + dbId;
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -696,11 +711,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
ShopLoginInfo GetShop(string shopId)
{
ShopLoginInfo shop;
if (IsClientJit)
{
shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
}
else
if (ClientMode == EnumClientMode.Admin)
{
shop = shopLst.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
@@ -708,6 +719,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
shop = AdminGetServerShop(shopId);
}
}
else
{
shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
}
if (shop == null)
{
shop = new ShopLoginInfo() { ShopId = shopId };
@@ -867,7 +882,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
var empty_data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id +
"&status=已清除";
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
empty_data += "&is_client_jit=true";
GetHtml.PostUtf8(empty_url, empty_data);
}
@@ -890,7 +905,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (result.Contains("登录过期") || result.Contains("Invalid Login State"))
{
if (!IsClientJit)
if (ClientMode == EnumClientMode.Admin)
AdminShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false);
else
ShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false);
@@ -929,7 +944,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
"&up_spu_id=" + prod.spu_id +
"&shop_id=" + prod.shop_id +
"&status=" + prod.status;
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
@@ -3375,7 +3390,7 @@ Content-Disposition: form-data; name=""sign""
var empty_data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id +
"&status=已清除";
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
empty_data += "&is_client_jit=true";
GetHtml.PostUtf8(empty_url, empty_data);
}
@@ -3397,7 +3412,7 @@ Content-Disposition: form-data; name=""sign""
var data = UserLogin.GetSignaturex() +
"&db_id=" + prod.id;
data += "&fission_product_name=" + GetHtml.UrlEncodeUtf8(fissionProductName.Trim());
if (IsClientJit)
if (ClientMode == EnumClientMode.ClientJit)
data += "&is_client_jit=true";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -3641,7 +3656,7 @@ Content-Disposition: form-data; name=""sign""
case "已上传商品ID":
{
var shop = GetShop(shopId);
if (!IsClientJit)
if (ClientMode == EnumClientMode.Admin)
{
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +