1688上传类目转换等优化 充值用户服务充值和用户续费店铺功能

This commit is contained in:
wule committed 2026-05-27 22:01:04 +08:00
1 parent ecb291e3d7
commit aab73b978f
56 files changed
+4532 -1748

No files matched your search

+408 -147
View File
@@ -16,6 +16,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -48,7 +49,7 @@ namespace TemuKJD.ToolForms
private string currentGet1688ListProductData = "";
private string appVersion = "";
private string currentSupplierId = "";
int getDetailWait = 1;
int getDetailWait = 5;
int pageStart = 1;
int pageEnd = 9999;
ConcurrentList<_1688OneProductListInfo> lst1688OneProductListInfo = new ConcurrentList<_1688OneProductListInfo>();
@@ -63,6 +64,7 @@ namespace TemuKJD.ToolForms
this.splitContainer1.SplitterDistance = 472;
this.dgvProduct.AddSelectorColumn("colCheck");
this.dgvProduct.AddImgColumn("colImg", "colImgUrl");
this.dgvOut1688Prod.AddImgColumn("colOutImg", "colOutImgUrl");
lst1688cookie = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<Cookie>>("1688_cookies");
if (lst1688cookie == null)
@@ -227,9 +229,15 @@ namespace TemuKJD.ToolForms
Task.Run(() => { GetCurrent1688SearchData(postData, responseData, request); });
}
//if (url.Contains("https://detail.1688.com/offer/"))
//{
// Task.Run(() => { currentDetailData = responseData; });
//}
if (url.Contains("https://detail.1688.com/offer/"))
{
Task.Run(() => { currentDetailData = responseData; });
var dataTmp = responseData;
if (dataTmp.Contains("specId"))
Task.Run(() => { currentDetailData = dataTmp; });
}
if (responseData.Contains("赛龙宠物"))
@@ -621,24 +629,34 @@ namespace TemuKJD.ToolForms
currentDetailData = "";
//var get1688DetailRst = Get1688DetailData(shop, prod);
string url = "https://detail.1688.com/offer/" + prod.offerId + ".html?fxcv=2&sk=consign";
//string url = "https://detail.1688.com/offer/" + prod.offerId + ".html";
this.cefWebBrowser.Load(url);
// 额外休眠
Thread.Sleep(Math.Max(3, getDetailWait) * 1000);
for (int i = 0; i < 20; i++)
{
if (string.IsNullOrEmpty(currentDetailData))
{
Thread.Sleep(500);
}
}
string get1688DetailRst = currentDetailData;
//Invoke(new Action(() => { this.ucTabControlMetro1.SelectedIndex = 0; }));
if (!get1688DetailRst.Contains("\"success\":true"))
if (!get1688DetailRst.Contains("\"success\":true") && !get1688DetailRst.Contains("\"specId\":\""))
{
if (get1688DetailRst.Contains("___tmd___") || get1688DetailRst.Contains("___TMD___"))
{
Invoke(new Action(() => { this.ucTabControlMetro1.SelectedIndex = 0; }));
//Invoke(new Action(() => { this.ucTabControlMetro1.SelectedIndex = 0; }));
Thread.Sleep(5000);
}
var errMsg = BaseRegex.GetStringJson(ref get1688DetailRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = get1688DetailRst;
if (errMsg.Length > 500)
errMsg = errMsg.Substring(0, 500);
prod.getProductMsg = "采集失败 " + errMsg;
Invoke(new Action(() =>
{
@@ -784,169 +802,176 @@ namespace TemuKJD.ToolForms
private void btnSaveDb_Click(object sender, EventArgs e)
{
//"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
List<DataGridViewRow> rowLst = new List<DataGridViewRow>();
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true));
if (cancellationTokenSource != null && cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
this.pbLoading.Visible = true;
var t = Task.Run(() =>
if (btnSaveDb.Text == "商品入库")
{
int success = 0;
int total = rowLst.Count;
foreach (var row in rowLst)
//"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
List<DataGridViewRow> rowLst = new List<DataGridViewRow>();
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true));
if (cancellationTokenSource != null && cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
this.pbLoading.Visible = true;
var t = Task.Run(() =>
{
if (cancellationTokenSource.IsCancellationRequested)
break;
Invoke(new Action(() =>
int success = 0;
int total = rowLst.Count;
foreach (var row in rowLst)
{
row.Cells["colMsg"].Value = "";
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在入库表格第 " + (row.Index + 1) + " 行数据 成功 " + success + " 条";
}));
var prodId = row.Cells["colProductId"].Value.ParseToString();
var prod = lst1688OneProductListInfo.FirstOrDefault(c => c.offerId.ParseToString() == prodId);
if (prod == null || prod.dbProduct == null || prod.dbProduct.product_json.Length < 10)
continue;
var dbProd = prod.dbProduct;
if (!chkOverride.Checked && !prod.getProductMsg.IsNullOrEmpty())
{
if (prod.getProductMsg.Contains("已存在相同Id商品") || prod.getProductMsg.Contains("商品覆盖成功") || prod.getProductMsg.Contains("商品入库成功"))
{
//已存在相同Id商品,跳过
//商品覆盖成功!
//商品入库成功!
prod.getProductMsg = "已存在相同Id商品,跳过";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prod.getProductMsg;
}));
success++;
continue;
}
}
Thread.Sleep(25);
if (row.Index % 20 == 0)
NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
bool isExist = false;
var existUrl = BaseClass.BuildPDDObjString("product/get_product_spu_id_list");
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.offerId;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "入库失败,产品数据库连接失败";
row.Cells["colMsg"].Value = "";
}));
continue;
}
else
{
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
//var SetPartnerSpuRst = "";
var url = BaseClass.BuildPDDObjString("product/add_product");
if (isExist)
{
if (chkOverride.Checked)
Invoke(new Action(() =>
{
url = BaseClass.BuildPDDObjString("product/mdy_product");
this.statusBar.lblTaskStatus.Text = "正在入库表格第 " + (row.Index + 1) + " 行数据 成功 " + success + " 条";
}));
var prodId = row.Cells["colProductId"].Value.ParseToString();
var prod = lst1688OneProductListInfo.FirstOrDefault(c => c.offerId.ParseToString() == prodId);
if (prod == null || prod.dbProduct == null || prod.dbProduct.product_json.Length < 10)
continue;
var dbProd = prod.dbProduct;
if (!chkOverride.Checked && !prod.getProductMsg.IsNullOrEmpty())
{
if (prod.getProductMsg.Contains("已存在相同Id商品") || prod.getProductMsg.Contains("商品覆盖成功") || prod.getProductMsg.Contains("商品入库成功"))
{
//已存在相同Id商品,跳过
//商品覆盖成功!
//商品入库成功!
prod.getProductMsg = "已存在相同Id商品,跳过";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prod.getProductMsg;
}));
success++;
continue;
}
}
Thread.Sleep(25);
if (row.Index % 20 == 0)
NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
bool isExist = false;
var existUrl = BaseClass.BuildPDDObjString("product/get_product_spu_id_list");
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.offerId;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "入库失败,产品数据库连接失败";
}));
continue;
}
else
{
//入库成功 已存在相同id商品
prod.getProductMsg = "已存在相同SkuId,跳过";
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
//var SetPartnerSpuRst = "";
var url = BaseClass.BuildPDDObjString("product/add_product");
if (isExist)
{
if (chkOverride.Checked)
{
url = BaseClass.BuildPDDObjString("product/mdy_product");
}
else
{
//入库成功 已存在相同id商品
prod.getProductMsg = "已存在相同id商品,跳过";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prod.getProductMsg;
}));
success++;
continue;
}
}
var data = Work.UserLogin.GetSignaturex() +
"&from_shop_id=" + prod.dbProduct.from_shop_id +
"&from_shop_name=" + prod.dbProduct.from_shop_name +
//"&offline_supplier_id=" + prod.dbProduct.offline_supplier_id +
//"&offline_supplier_name=" + prod.dbProduct.offline_supplier_name +
"&spu_id=" + prod.dbProduct.spu_id.ParseToString() +
"&skc_id=" + prod.dbProduct.skc_id.ParseToString() +
"&price_text=" + prod.dbProduct.price_text +
"&ext_code=" + HttpUtility.UrlEncode(prod.dbProduct.ext_code, Encoding.UTF8) +
"&product_name=" + HttpUtility.UrlEncode(prod.dbProduct.product_name, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8) +
"&sale_count=" + dbProd.sale_count +
"&sale_count_text=" + HttpUtility.UrlEncode(dbProd.sale_count_text, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) +
"&wx_safe_status=" + HttpUtility.UrlEncode("未校验", Encoding.UTF8) +
"&product_get_type=" + HttpUtility.UrlEncode("1688厂家", Encoding.UTF8);
if (!isExist)
{
data += "&main_cat_id=" + prod.dbProduct.main_cat_id +
"&main_cat_name=" + HttpUtility.UrlEncode(prod.dbProduct.main_cat_name.ParseToString(), Encoding.UTF8) +
"&cat_id=" + prod.dbProduct.cat_id +
"&cat_name=" + HttpUtility.UrlEncode((prod.dbProduct.cat_name ?? prod.dbProduct.cat_name).ParseToString(), Encoding.UTF8);
}
if (1 == 1)
{
//1688没有分销,但是聚水潭上货条件要判断1是否类目识别 2是否服务端加密 3是否分销
//作为1688和聚水潭一致的上货必备条件,此处1688分销直接设置为1
prod.dbProduct.distribution_set = 1;
data += "&distribution_set=1";
}
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"))
{
string msg = "商品入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = msg;
}));
}
else
{
success++;
prod.getProductMsg = "商品入库成功!";
if (url == BaseClass.BuildPDDObjString("product/mdy_product"))
prod.getProductMsg = "商品覆盖成功!";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prod.getProductMsg;
}));
success++;
continue;
}
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
var data = Work.UserLogin.GetSignaturex() +
"&from_shop_id=" + prod.dbProduct.from_shop_id +
"&from_shop_name=" + prod.dbProduct.from_shop_name +
//"&offline_supplier_id=" + prod.dbProduct.offline_supplier_id +
//"&offline_supplier_name=" + prod.dbProduct.offline_supplier_name +
"&spu_id=" + prod.dbProduct.spu_id.ParseToString() +
"&skc_id=" + prod.dbProduct.skc_id.ParseToString() +
"&price_text=" + prod.dbProduct.price_text +
"&ext_code=" + HttpUtility.UrlEncode(prod.dbProduct.ext_code, Encoding.UTF8) +
"&product_name=" + HttpUtility.UrlEncode(prod.dbProduct.product_name, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8) +
"&sale_count=" + dbProd.sale_count +
"&sale_count_text=" + HttpUtility.UrlEncode(dbProd.sale_count_text, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) +
"&wx_safe_status=" + HttpUtility.UrlEncode("未校验", Encoding.UTF8) +
"&product_get_type=" + HttpUtility.UrlEncode("1688厂家", Encoding.UTF8);
if (!isExist)
Invoke(new Action(() =>
{
data += "&main_cat_id=" + prod.dbProduct.main_cat_id +
"&main_cat_name=" + HttpUtility.UrlEncode(prod.dbProduct.main_cat_name.ParseToString(), Encoding.UTF8) +
"&cat_id=" + prod.dbProduct.cat_id +
"&cat_name=" + HttpUtility.UrlEncode((prod.dbProduct.cat_name ?? prod.dbProduct.cat_name).ParseToString(), Encoding.UTF8);
}
if (1 == 1)
{
//1688没有分销,但是聚水潭上货条件要判断1是否类目识别 2是否服务端加密 3是否分销
//作为1688和聚水潭一致的上货必备条件,此处1688分销直接设置为1
prod.dbProduct.distribution_set = 1;
data += "&distribution_set=1";
}
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"))
{
string msg = "商品入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = msg;
}));
}
else
{
success++;
prod.getProductMsg = "商品入库成功!";
if (url == BaseClass.BuildPDDObjString("product/mdy_product"))
prod.getProductMsg = "商品覆盖成功!";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prod.getProductMsg;
}));
}
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
BaseMsgForm.ShowInfo("商品入库完毕!");
}));
}, cancellationTokenSource.Token);
this.pbLoading.Visible = false;
BaseMsgForm.ShowInfo("商品入库完毕!");
}));
}, cancellationTokenSource.Token);
}
else if (btnSaveDb.Text == "外部商品入库")
{
Out1688ProductImport();
}
}
@@ -1102,5 +1127,241 @@ namespace TemuKJD.ToolForms
if (CancelReturn != null)
CancelReturn.Cancel();
}
private void ucTabControlMetro1_SelectedIndexChanged(object sender, EventArgs e)
{
if (ucTabControlMetro1.SelectedTab.Text == "1688外部数据")
{
btnSaveDb.Text = "外部商品入库";
btnGetDetail.Visible = false;
btnGetGoods.Visible = false;
}
else
{
btnSaveDb.Text = "商品入库";
btnGetDetail.Visible = true;
btnGetGoods.Visible = true;
}
}
void Out1688ProductImport()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = true;
// 设置过滤条件,只显示文本文件
openFileDialog.Filter = "文本文件 (*.txt)|*.txt|All files (*.*)|*.*";
// 显示对话框并获取结果
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
var filePathLst = openFileDialog.FileNames.ToList();
dgvOut1688Prod.Rows.Clear();
pbLoading.Visible = true;
this.statusBar.pgbTaskProgress.Maximum = filePathLst.Count;
this.statusBar.UpdateProgressBar(0);
Task.Run(() =>
{
int successNum = 0;
int failedNum = 0;
foreach (var path in filePathLst)
{
string content = "";
string rst = "";
try
{
using (StreamReader sr = new StreamReader(path))
{
content = sr.ReadToEnd();
}
rst = Out1688ProdImportOne(path, content);
Thread.Sleep(100);
}
catch (Exception ex)
{
rst = ex.Message;
}
if (string.IsNullOrEmpty(rst))
successNum++;
else
failedNum++;
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
this.statusBar.lblTaskStatus.Text = "正在导入";
}));
}
Invoke(new Action(() =>
{
pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "导入完成";
BaseMsgForm.ShowInfo("导入完成!");
}));
});
}
}
string Out1688ProdImportOne(string filePath, string content)
{
DataGridViewRow row = null;
Invoke(new Action(() =>
{
var index = dgvOut1688Prod.Rows.Add(false, filePath);
row = dgvOut1688Prod.Rows[index];
row.Height = 60;
}));
try
{
if (string.IsNullOrEmpty(content) || content.Length < 10)
return "商品数据为空";
KJDDBProduct dbProd = new KJDDBProduct();
dbProd.product_get_type_text = "1688外部数据";
dbProd.product_json = content;
dbProd.size_json = "{}";
_1688OutProductInfo outProd = JsonHelper.DeserializeJsonToObject<_1688OutProductInfo>(content);
string convertRst = "";
var prodInfo = new PDDProdFormConverter()._1688OutToPddConvert(out convertRst, dbProd);
if (!string.IsNullOrEmpty(convertRst))
return convertRst;
Thread.Sleep(25);
//if (row.Index % 20 == 0)
// NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
bool isExist = false;
var existUrl = BaseClass.BuildPDDObjString("product/get_product_spu_id_list");
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + outProd.productId;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = "入库失败,产品数据库连接失败";
}));
return "入库失败,产品数据库连接失败";
}
else
{
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
var priceMin = (prodInfo.detail.sku?.Min(x => x.multi_price)).ParseToInt() * 0.01m;
var priceMax = (prodInfo.detail.sku?.Max(x => x.multi_price)).ParseToInt() * 0.01m;
Invoke(new Action(() =>
{
row.Cells["colOutSupplierId"].Value = (string.IsNullOrEmpty(outProd.shopId) ? outProd.shopName : outProd.shopId);
row.Cells["colOutSupplierName"].Value = outProd.shopName;
row.Cells["colOutGoodsId"].Value = prodInfo.detail.goods_id.ParseToString();
row.Cells["colOutGoodsName"].Value = prodInfo.detail.goods_name;
row.Cells["colOutCat"].Value = outProd.categoryName;
row.Cells["colOutImgUrl"].Value = prodInfo.detail.image_url;
row.Cells["colOutPrice"].Value = priceMin + "-" + priceMax;
}));
//var SetPartnerSpuRst = "";
var url = BaseClass.BuildPDDObjString("product/add_product");
if (isExist)
{
if (chkOverride.Checked)
{
url = BaseClass.BuildPDDObjString("product/mdy_product");
}
else
{
//入库成功 已存在相同id商品
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = "已存在相同商品Id,跳过";
}));
return "";
}
}
if (outProd.minOrderQuaitity.ParseToInt() > 1)
{
//Invoke(new Action(() =>
//{
// row.Cells["colOutMsg"].Value = "起批数量超过1,跳过";
//}));
//return "起批数量超过1,跳过";
}
var data = Work.UserLogin.GetSignaturex() +
"&from_shop_id=" + (string.IsNullOrEmpty(outProd.shopId) ? outProd.shopName : outProd.shopId) +
"&from_shop_name=" + outProd.shopName +
//"&offline_supplier_id=" + prod.dbProduct.offline_supplier_id +
//"&offline_supplier_name=" + prod.dbProduct.offline_supplier_name +
"&spu_id=" + prodInfo.detail.goods_id.ParseToString() +
"&skc_id=" + prodInfo.detail.goods_id.ParseToString() +
"&price_text=" + priceMin + "-" + priceMax +
"&ext_code=" + HttpUtility.UrlEncode(prodInfo.detail.out_goods_sn, Encoding.UTF8) +
"&product_name=" + HttpUtility.UrlEncode(prodInfo.detail.goods_name, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(content, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8) +
"&sale_count=" + dbProd.sale_count +
"&sale_count_text=" + HttpUtility.UrlEncode(dbProd.sale_count_text, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(prodInfo.detail.image_url, Encoding.UTF8) +
"&wx_safe_status=" + HttpUtility.UrlEncode("未校验", Encoding.UTF8) +
"&product_get_type=" + HttpUtility.UrlEncode("1688外部数据", Encoding.UTF8);
if (!isExist)
{
data += "&main_cat_id=" + "" +
"&main_cat_name=" + "" +
"&cat_id=" + outProd.categoryId +
"&cat_name=" + HttpUtility.UrlEncode(outProd.categoryName, Encoding.UTF8);
}
if (1 == 1)
{
//1688没有分销,但是聚水潭上货条件要判断1是否类目识别 2是否服务端加密 3是否分销
//作为1688和聚水潭一致的上货必备条件,此处1688分销直接设置为1
//dbProd.distribution_set = 1;
//data += "&distribution_set=1";
}
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"))
{
string msg = "商品入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = msg;
}));
return msg;
}
else
{
var getProductMsg = "商品入库成功!";
if (url == BaseClass.BuildPDDObjString("product/mdy_product"))
getProductMsg = "商品覆盖成功!";
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = getProductMsg;
}));
}
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("1688_product_list_" + MainForm.ProcessCount, lst1688OneProductListInfo);
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
row.Cells["colOutMsg"].Value = "商品入库失败" + ex.Message;
}));
return "商品入库失败" + ex.Message;
}
return "";
}
}
}