temu推单相关功能

This commit is contained in:
wule committed 2025-12-04 20:45:18 +08:00
1 parent 165df61234
commit b05de6797e
27 files changed
+4561 -315

No files matched your search

@@ -28,6 +28,7 @@ using TemuKJD.BLL;
using TemuKJD.ToolForms;
using AllBase.Model.Result.TemuResult.TemuSizeConfigResult;
using AllBase.Model.Result.TemuResult;
using NaiBa.Util;
namespace TemuKJD.KJDForms.ProductSelectForms
{
@@ -39,8 +40,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
List<string> skuRandomLetterArr = new List<string> { "~", "#", "¥", "%", "&", "*", "(", ")", "(", ")", "+", "-", "_", "=", "【", "】", "·", "|", "《", "》" };
NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstAdminTemuDBProductSelect = new NaiBa.Util.ConcurrentList<TemuDBProductSelect>();
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
List<TemuDBExtCodePriceInfo> lstDbPrice = new List<TemuDBExtCodePriceInfo>();
public ConcurrentList<CateSizeWeightConfig> lstCateSizeWeightConfig = new ConcurrentList<CateSizeWeightConfig>();
ConcurrentList<ShopLoginInfo> shopLst = new ConcurrentList<ShopLoginInfo>();
ConcurrentList<TemuDBExtCodePriceInfo> lstDbPrice = new ConcurrentList<TemuDBExtCodePriceInfo>();
List<string> lstCustomImg = new List<string>();
Dictionary<string, string> dicCustomImg = new Dictionary<string, string>();
List<string> lstExtCodeFleeceInShoes = new List<string>() {
@@ -148,8 +150,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
else
{
ucSplitPage1.cmbPageSize.Items.Remove("5000");
ucSplitPage1.cmbPageSize.Items.Remove("2000");
ucSplitPage1.cmbPageSize.Items.Remove("1000");
//ucSplitPage1.cmbPageSize.Items.Remove("2000");
//ucSplitPage1.cmbPageSize.Items.Remove("1000");
}
if (BaseClass.SaLevel == 1 && !IsClientJit)
@@ -282,7 +284,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.ucSplitPage1.TotalPage = pageCount;
var shopIdLst = list.Select(p => p.shop_id).Distinct().ToList();
shopLst = ShopBLL.AdminGetServerShopLstByIds(shopIdLst);
shopLst.Clear();
shopLst.AddRange(ShopBLL.AdminGetServerShopLstByIds(shopIdLst));
//if (defaultBitmap == null)
// defaultBitmap = new Bitmap(80, 80);
@@ -509,9 +512,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
break;
case "进店":
{
var shop = GetShop(shopId);
if (!IsClientJit)
{
var shop = GetShop(shopId);
AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft";
@@ -519,25 +522,41 @@ namespace TemuKJD.KJDForms.ProductSelectForms
adminLoginForm.WindowState = FormWindowState.Maximized;
adminLoginForm.ShowDialog();
}
else
{
ShopLoginForm adminLoginForm = new ShopLoginForm(shop);
//adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product/draft";
adminLoginForm.InitUrl = "https://agentseller.temu.com/goods/draft";
adminLoginForm.openType = EnumOpenType.manage;
adminLoginForm.WindowState = FormWindowState.Maximized;
adminLoginForm.ShowDialog();
}
}
break;
case "登录":
{
var shop = GetShop(shopId);
// 登录店铺
if (!IsClientJit)
{
var shop = GetShop(shopId);
// 登录店铺
AdminShopLoginForm shopLoginForm = new AdminShopLoginForm(shop);
shopLoginForm.openType = EnumOpenType.login;
shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
}
else
{
ShopLoginForm shopLoginForm = new ShopLoginForm(shop);
shopLoginForm.openType = EnumOpenType.login;
shopLoginForm.SaveComplete += ShopLoginForm_SaveComplete;
shopLoginForm.ShowDialog();
}
foreach (DataGridViewRow row in this.dgvSelectProduct.Rows)
{
if (row.Cells["colSupplierId"].Value.ParseToString() == shop.ShopId)
{
if (row.Cells["colSupplierId"].Value.ParseToString() == shop.ShopId)
{
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
}
row.Cells["colLogin"].Value = shop.LoginStatus2 == "国际版在线" ? "在线" : "登录";
displayLoginStatusColor(row.Cells["colLogin"], row.Cells["colLogin"].Value.ParseToString());
}
}
}
@@ -639,17 +658,25 @@ namespace TemuKJD.KJDForms.ProductSelectForms
ShopLoginInfo GetShop(string shopId)
{
var shop = shopLst.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
ShopLoginInfo shop;
if (IsClientJit)
{
shop = AdminGetServerShop(shopId);
shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
}
else
{
shop = shopLst.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
{
shop = new ShopLoginInfo() { ShopId = shopId };
shop.LoginStatus = "不存在";
shop = AdminGetServerShop(shopId);
}
shopLst.Add(shop);
}
if (shop == null)
{
shop = new ShopLoginInfo() { ShopId = shopId };
shop.LoginStatus = "不存在";
}
shopLst.Add(shop);
return shop;
}
@@ -762,18 +789,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
continue;
}
var shop = shopLst.FirstOrDefault(s => s.ShopId == prod.shop_id);
if (shop == null)
{
shop = AdminGetServerShop(prod.shop_id);
if (shop == null)
{
shop = new ShopLoginInfo() { ShopId = prod.shop_id };
shop.LoginStatus = "不存在";
}
shopLst.Add(shop);
}
var shop = GetShop(prod.shop_id);
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
@@ -837,7 +853,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (result.Contains("登录过期") || result.Contains("Invalid Login State"))
{
AdminShopListForm.Instance.CheckShopLogin(shopLst.Where(s => s.LoginName == shop.LoginName).ToArray(), false);
if (!IsClientJit)
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);
}
}
catch (Exception ex)
@@ -1627,13 +1646,132 @@ namespace TemuKJD.KJDForms.ProductSelectForms
int numberOfPieces = 1; // 单品数量
if (chkChangeSizeAndNumber.Checked) // 修改包装尺寸和单品数量
{
len = Randomx.GetId(numLen1.Value.ParseToInt(), numLen2.Value.ParseToInt()+1);
len = Randomx.GetId(numLen1.Value.ParseToInt(), numLen2.Value.ParseToInt() + 1);
width = Randomx.GetId(numWidth1.Value.ParseToInt(), Math.Min(len, numWidth2.Value.ParseToInt() + 1));
height = Randomx.GetId(numHeight1.Value.ParseToInt(), Math.Min(width, numHeight2.Value.ParseToInt() + 1));
weight = Randomx.GetId(numWeight1.Value.ParseToInt(), numWeight2.Value.ParseToInt() + 1);
len *= 10;
width *= 10;
height *= 10;
weight *= 1000;
numberOfPieces = Randomx.GetId(numUnitNum1.Value.ParseToInt(), numUnitNum2.Value.ParseToInt());
var cateSizeWeightConfig = lstCateSizeWeightConfig.FirstOrDefault(c => c.catId == catId.ToString());
if (cateSizeWeightConfig == null)
{
var url = BaseClass.BuildObjString("product/get_cate_size_weight_config_v2");
var data = UserLogin.GetSignaturex() +
"&cat_id=" + catId;
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"))
{
try
{
var jArr = JObject.Parse(html)["data"];
cateSizeWeightConfig = JsonHelper.DeserializeJsonToObject<CateSizeWeightConfig>(jArr.ToString());
if (cateSizeWeightConfig != null)
lstCateSizeWeightConfig.Add(cateSizeWeightConfig);
}
catch { }
}
}
if (cateSizeWeightConfig == null)
{
//查询接口尺寸重量限制
html = "";
html = queryProductSizeAndWeightConfig(shop, prodParam.productDraftId.ParseToString(), catId.ParseToString());
var html1 = queryCatSizeAndWeightConfig(shop, prodParam.productDraftId.ParseToString(), catId.ParseToString());
if (!string.IsNullOrEmpty(html1) && html1.Contains("length"))
html = html1;
//{"success":true,"errorCode":1000000,"errorMsg":null,"result":{"common":{"operatorId":null,"operatorName":null,"operatorType":null,"checkSideRelation":false,"noticeSideEquation":false,"length":{"min":10,"max":2999},"width":{"min":5,"max":2999},"height":{"min":2,"max":2999},"weight":{"min":2000,"max":99999000}}}}
Thread.Sleep(Randomx.GetId(50, 100));
if (html.Contains("\"success\":true"))
{
try
{
JObject jObj = JObject.Parse(html);
cateSizeWeightConfig = new CateSizeWeightConfig() { catId = catId.ToString() };
if (html.Contains("common"))
{
cateSizeWeightConfig.minLen = jObj["result"]["common"]["length"]["min"].ParseToInt();
cateSizeWeightConfig.maxLen = jObj["result"]["common"]["length"]["max"].ParseToInt();
cateSizeWeightConfig.minWidth = jObj["result"]["common"]["width"]["min"].ParseToInt();
cateSizeWeightConfig.maxWidth = jObj["result"]["common"]["width"]["max"].ParseToInt();
cateSizeWeightConfig.minHeight = jObj["result"]["common"]["height"]["min"].ParseToInt();
cateSizeWeightConfig.maxHeight = jObj["result"]["common"]["height"]["max"].ParseToInt();
cateSizeWeightConfig.minWeight = jObj["result"]["common"]["weight"]["min"].ParseToInt();
cateSizeWeightConfig.maxWeight = jObj["result"]["common"]["weight"]["max"].ParseToInt();
}
else
{
cateSizeWeightConfig.minLen = jObj["result"]["length"]["min"].ParseToInt();
cateSizeWeightConfig.maxLen = jObj["result"]["length"]["max"].ParseToInt();
cateSizeWeightConfig.minWidth = jObj["result"]["width"]["min"].ParseToInt();
cateSizeWeightConfig.maxWidth = jObj["result"]["width"]["max"].ParseToInt();
cateSizeWeightConfig.minHeight = jObj["result"]["height"]["min"].ParseToInt();
cateSizeWeightConfig.maxHeight = jObj["result"]["height"]["max"].ParseToInt();
cateSizeWeightConfig.minWeight = jObj["result"]["weight"]["min"].ParseToInt();
cateSizeWeightConfig.maxWeight = jObj["result"]["weight"]["max"].ParseToInt();
}
lstCateSizeWeightConfig.Add(cateSizeWeightConfig);
var url = BaseClass.BuildObjString("product/add_cate_size_weight_config_v2");
var data = UserLogin.GetSignaturex();
data += "&cat_id=" + catId;
data += "&minLen=" + cateSizeWeightConfig.minLen;
data += "&maxLen=" + cateSizeWeightConfig.maxLen;
data += "&minWidth=" + cateSizeWeightConfig.minWidth;
data += "&maxWidth=" + cateSizeWeightConfig.maxWidth;
data += "&minHeight=" + cateSizeWeightConfig.minHeight;
data += "&maxHeight=" + cateSizeWeightConfig.maxHeight;
data += "&minWeight=" + cateSizeWeightConfig.minWeight;
data += "&maxWeight=" + cateSizeWeightConfig.maxWeight;
html = GetHtml.PostUtf8(url, data);
}
catch { }
}
else
{
//if (html.Contains("登录过期") || html.Contains("Invalid Login State"))
//{
// this.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
// //Invoke(new Action(() =>
// //{
// // displayShopStatus(shop);
// //}));
//}
//string sErrMsg = BaseRegex.GetStringJson(ref html, "errorMsg").ParseToString();
//if (string.IsNullOrEmpty(sErrMsg))
// sErrMsg = BaseRegex.GetStringJson(ref html, "error_msg").ParseToString();
//if (string.IsNullOrEmpty(sErrMsg))
// sErrMsg = html;
//Invoke(new Action(() =>
//{
// foreach (var row in rows)
// row.Cells["colMsg"].Value = "修改请求失败 " + sErrMsg;
//}));
//return; //continue;
}
}
if (cateSizeWeightConfig != null)
{
// 设置长宽高
if (len < cateSizeWeightConfig.minLen) len = cateSizeWeightConfig.minLen;
if (len > cateSizeWeightConfig.maxLen) len = cateSizeWeightConfig.maxLen;
if (width < cateSizeWeightConfig.minWidth) width = cateSizeWeightConfig.minWidth;
if (width > cateSizeWeightConfig.maxWidth) width = cateSizeWeightConfig.maxWidth;
if (height < cateSizeWeightConfig.minHeight) height = cateSizeWeightConfig.minHeight;
if (height > cateSizeWeightConfig.maxHeight) height = cateSizeWeightConfig.maxHeight;
if (weight < cateSizeWeightConfig.minWeight) weight = cateSizeWeightConfig.minWeight;
if (weight > cateSizeWeightConfig.maxWeight) weight = cateSizeWeightConfig.maxWeight;
}
}
int skuCount = 0;
//foreach (var skuInfo in skcInfo.productSkuList)
NaiBa.Util.ConcurrentList<TemuProductSku> skuListTmp = new NaiBa.Util.ConcurrentList<TemuProductSku>();
@@ -1829,10 +1967,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms
if (chkChangeSizeAndNumber.Checked) // 修改包装尺寸和单品数量
{
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.len = len * 10;
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.width = width * 10;
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.height = height * 10;
skuItem.productSkuWhExtAttrReq.productSkuWeightReq.value = weight * 1000;
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.len = len;
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.width = width;
skuItem.productSkuWhExtAttrReq.productSkuVolumeReq.height = height;
skuItem.productSkuWhExtAttrReq.productSkuWeightReq.value = weight;
}
skuItem.supplierPrice = skuInfo.supplierPrice;
// 按照批号原价取商品原价和加价规则并修改商品上传价格
@@ -2831,6 +2969,22 @@ namespace TemuKJD.KJDForms.ProductSelectForms
return HttpResponseBLL.PostResponse2(shop, url, body, refere);
}
private string queryProductSizeAndWeightConfig(ShopLoginInfo shop, string productId, string catId)
{
string url = "https://agentseller.temu.com/anniston-agent-seller/product/check/common/queryConfig";
string body = "{}";
string referer = "https://agentseller.temu.com/goods/edit?productDraftId=" + productId + "&from=productDraftList";
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string queryCatSizeAndWeightConfig(ShopLoginInfo shop, string productId, string catId)
{
string url = "https://agentseller.temu.com/anniston-agent-seller/product/check/common/queryConfig";
url = "https://agentseller.temu.com/anniston-agent-seller/product/check/cat/queryConfig";
string body = @"{""catId"":" + catId + "}";
string referer = "https://agentseller.temu.com/goods/edit?productDraftId=" + productId + "&from=productDraftList";
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
}
private string GetCatPathList(ShopLoginInfo shop, string draftId, string catId)
{
string url = "https://agentseller.temu.com/anniston-agent-seller/category/path/list";