聚水潭上传微信小店相关逻辑
This commit is contained in:
1 parent
625f4d9420
commit
b4fa5cacb1
26 files changed
+2570
-487
No files matched your search
@@ -1,11 +1,13 @@
|
||||
using AllBase;
|
||||
using AllBase.Model.Result;
|
||||
using AllBase.Model.Result.PDDResult;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using NaiBa.CefHelper;
|
||||
using NaiBa.CefHelper.Handler;
|
||||
using NaiBa.Util;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -39,6 +41,7 @@ namespace TemuKJD.ToolForms
|
||||
int filterSaleCountDays = 7;
|
||||
int filterSaleCount = 100;
|
||||
string platformType = "Pinduoduo";
|
||||
string jstPddShopId = "";
|
||||
ConcurrentList<JSTListProductInfo> lstJSTListProductInfo = new ConcurrentList<JSTListProductInfo>();
|
||||
|
||||
public GetJuShuitanProdForm()
|
||||
@@ -199,11 +202,16 @@ namespace TemuKJD.ToolForms
|
||||
private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e)
|
||||
{
|
||||
if (this.Created && !this.Disposing && !this.IsDisposed)
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
currentUrl = e.Address;
|
||||
txtAddress.Text = e.Address;
|
||||
}));
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
currentUrl = e.Address;
|
||||
txtAddress.Text = e.Address;
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
|
||||
{
|
||||
@@ -308,12 +316,19 @@ namespace TemuKJD.ToolForms
|
||||
BaseMsgForm.ShowError("请在网页上选择要搜索的供应商商品列表页面");
|
||||
return;
|
||||
}
|
||||
if (dgvProduct.Rows.Count > 0)
|
||||
{
|
||||
if (BaseMsgForm.ShowConfirm("当前列表已有采集数据,是否重新采集?").DialogResult == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.pbLoading.Visible = true;
|
||||
dgvProduct.Rows.Clear();
|
||||
lstJSTListProductInfo.Clear();
|
||||
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
lstJSTListProductInfo.Clear();
|
||||
//if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
@@ -356,14 +371,7 @@ namespace TemuKJD.ToolForms
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
page++;
|
||||
|
||||
string url = "https://sc.scm121.com/api/goods/buyer/supplier/goods/list";
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + Jobj["supplierId"] + "?showErpList=1";
|
||||
var lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(Jobj), referer, appVersion);
|
||||
for (int i = 0; i < 3 && !lstRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(Jobj), referer, appVersion);
|
||||
}
|
||||
var lstRst = GetGoodsLst(shop, Jobj);
|
||||
if (!lstRst.Contains("\"success\":true"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref lstRst, "message");
|
||||
@@ -415,25 +423,30 @@ namespace TemuKJD.ToolForms
|
||||
jstLst = jstLst.Where(p => !lstJSTListProductInfo.Any(p1 => p1.id == p.id)).ToList();
|
||||
|
||||
lstJSTListProductInfo.AddRange(jstLst);
|
||||
foreach (var prod in jstLst)
|
||||
{
|
||||
//var t = Task.Run(() =>
|
||||
//{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
var id = dgvProduct.Rows.Add(
|
||||
true,
|
||||
prod.id,
|
||||
(prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"),
|
||||
DataGridViewExtension.defaultBitmap,
|
||||
prod.itemName,
|
||||
prod.saleSeven,
|
||||
prod.saleThirty,
|
||||
prod.categoryName,
|
||||
"预估:" + prod.minSalesPrice + " 采集详情后显示实际值",
|
||||
"删除"
|
||||
);
|
||||
dgvProduct.Rows[id].Height = 60;
|
||||
foreach (var prod in jstLst)
|
||||
{
|
||||
var id = dgvProduct.Rows.Add(
|
||||
true,
|
||||
prod.id,
|
||||
(prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"),
|
||||
DataGridViewExtension.defaultBitmap,
|
||||
prod.itemName,
|
||||
prod.saleSeven,
|
||||
prod.saleThirty,
|
||||
prod.categoryName,
|
||||
"预估:" + prod.minSalesPrice + " 采集详情后显示实际值",
|
||||
"删除"
|
||||
);
|
||||
dgvProduct.Rows[id].Height = 60;
|
||||
|
||||
}
|
||||
}));
|
||||
}
|
||||
//});
|
||||
//t.Wait(5000);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -490,27 +503,31 @@ namespace TemuKJD.ToolForms
|
||||
|
||||
private void btnSaveDb_Click(object sender, EventArgs e)
|
||||
{
|
||||
Task.Run(() => { });
|
||||
//"&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 = new CancellationTokenSource();
|
||||
//if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
this.pbLoading.Visible = true;
|
||||
var t = Task.Run(() =>
|
||||
{
|
||||
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
|
||||
var shop = new ShopLoginInfo();
|
||||
shop.Cookies = JsonHelper.SerializeObject(cookieList);
|
||||
|
||||
foreach (var row in rowLst)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在入库表格第 " + (row.Index + 1) + " 行数据";
|
||||
}));
|
||||
|
||||
var prodId = row.Cells["colProductId"].Value.ParseToString();
|
||||
var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId);
|
||||
if (prod == null || prod.dbProduct == null || prod.dbProduct.product_json.Length < 10)
|
||||
@@ -537,7 +554,7 @@ namespace TemuKJD.ToolForms
|
||||
isExist = true;
|
||||
}
|
||||
|
||||
var SetPartnerSpuRst = "";
|
||||
//var SetPartnerSpuRst = "";
|
||||
var url = BaseClass.BuildObjString("product/add_product");
|
||||
if (isExist)
|
||||
{
|
||||
@@ -554,10 +571,24 @@ namespace TemuKJD.ToolForms
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
//else
|
||||
{
|
||||
SetPartnerSpuRst = SetPartnerSpu(shop, prod);
|
||||
//{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}}
|
||||
////设置分销
|
||||
//SetPartnerSpuRst = SetPartnerSpu(shop, prod);
|
||||
//for (int i = 0; i < 3 && !SetPartnerSpuRst.Contains("\"success\":true"); i++)
|
||||
//{
|
||||
// Thread.Sleep(Randomx.GetId(2000, 4000));
|
||||
// SetPartnerSpuRst = SetPartnerSpu(shop, prod);
|
||||
//}
|
||||
//if (!SetPartnerSpuRst.Contains("\"success\":true"))
|
||||
//{
|
||||
// Invoke(new Action(() =>
|
||||
// {
|
||||
// row.Cells["colMsg"].Value = "分销设置失败,请下次重试,暂时跳过入库";
|
||||
// }));
|
||||
// continue;
|
||||
//}
|
||||
////{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}}
|
||||
}
|
||||
|
||||
var data = Work.UserLogin.GetSignaturex() +
|
||||
@@ -568,10 +599,6 @@ namespace TemuKJD.ToolForms
|
||||
"&spu_id=" + prod.dbProduct.spu_id.ParseToString() +
|
||||
"&skc_id=" + prod.dbProduct.skc_id.ParseToString() +
|
||||
"&price_text=" + prod.dbProduct.price_text +
|
||||
"&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.categoryName).ParseToString(), Encoding.UTF8) +
|
||||
"&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) +
|
||||
@@ -580,7 +607,18 @@ namespace TemuKJD.ToolForms
|
||||
"&sale_count_text=" + HttpUtility.UrlEncode(dbProd.sale_count_text, Encoding.UTF8) +
|
||||
"&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) +
|
||||
"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
|
||||
if (SetPartnerSpuRst.Contains("\"success\":true"))
|
||||
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.categoryName).ParseToString(), Encoding.UTF8);
|
||||
}
|
||||
//if (SetPartnerSpuRst.Contains("\"success\":true"))
|
||||
//{
|
||||
// data += "&distribution_set=1";
|
||||
//}
|
||||
if (prod.dbProduct.distribution_set > 0)
|
||||
{
|
||||
data += "&distribution_set=1";
|
||||
}
|
||||
@@ -658,35 +696,38 @@ namespace TemuKJD.ToolForms
|
||||
//https://sc.scm121.com/manage/goods/qualitySupplier/detail/93D12D2BD21649DC8240E2265BE37E2A?showErpList=1
|
||||
|
||||
this.pbLoading.Visible = true;
|
||||
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
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 = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
|
||||
var shop = new ShopLoginInfo();
|
||||
shop.Cookies = JsonHelper.SerializeObject(cookieList);
|
||||
|
||||
List<string> pIds = new List<string>();
|
||||
pIds.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Select(r => r.Cells["colProductId"].Value.ParseToString()).ToList());
|
||||
foreach (var prodId in pIds)
|
||||
foreach (var row in rowLst)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colProductId"].Value.ParseToString() == prodId);
|
||||
|
||||
if (row == null || row.Index < 0 || row.Cells["colCheck"].Value.ParseToBool() != true)
|
||||
continue;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在采集表格第 " + (row.Index + 1) + " 行详情数据";
|
||||
}));
|
||||
|
||||
var prodId = row.Cells["colProductId"].Value.ParseToString();
|
||||
var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId);
|
||||
// 不存在或已经采集过
|
||||
if (prod == null || prod?.dbProduct?.product_json?.ParseToString().Length > 10)
|
||||
continue;
|
||||
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
if (chkSkip.Checked)
|
||||
{
|
||||
if (prod.getProductMsg == "商品已存在,跳过详情采集")
|
||||
continue;
|
||||
|
||||
bool isExist = false;
|
||||
var existUrl = BaseClass.BuildObjString("product/get_product_list");
|
||||
string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId;
|
||||
@@ -713,12 +754,33 @@ namespace TemuKJD.ToolForms
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
|
||||
string url = "https://sc.scm121.com/api/goods/goods/goGoodsPdd/queryBaseData?itemSpuId=" + prod.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + prod.itemCoId;
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + prod.supplierId + "?showErpList=1";
|
||||
var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
if (!getDetailRst.Contains("\"success\":true"))
|
||||
getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
|
||||
//设置分销
|
||||
var SetPartnerSpuRst = SetPartnerSpu(shop, prod);
|
||||
for (int i = 0; i < 3 && !SetPartnerSpuRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(2000, 4000));
|
||||
SetPartnerSpuRst = SetPartnerSpu(shop, prod);
|
||||
}
|
||||
if (!SetPartnerSpuRst.Contains("\"success\":true"))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colMsg"].Value = "分销设置失败,请下次重试,暂时跳过入库";
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
prod.dbProduct.distribution_set = 1;
|
||||
}
|
||||
//{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}}
|
||||
|
||||
|
||||
// 采集商品详情
|
||||
var getDetailRst = GetPddBaseData(shop, prod);
|
||||
if (!getDetailRst.Contains("\"success\":true"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref getDetailRst, "message");
|
||||
@@ -736,9 +798,46 @@ namespace TemuKJD.ToolForms
|
||||
{
|
||||
var jObj = JsonHelper.JObjectParse(getDetailRst)["data"];
|
||||
prod.dbProduct.cat_id = jObj["catId"].ParseToString();
|
||||
|
||||
if (string.IsNullOrEmpty(jstPddShopId))
|
||||
{
|
||||
var getShopIdRst = GetPddShopId(shop, prod);
|
||||
//{"success":true,"total":1,"data":[{"shopId":"20115638","supplierId":"14791477","shopName":"阿杰小铺浦哈哈","shopType":"拼多多","shopTypeKey":"拼多多","shopTypeValue":"拼多多","itemSpuId":null,"shopItemSpuId":null,"shopAuthorizationDate":"2027-01-23 11:17:00","userName":null,"shelvesStatus":false,"updated":null,"sessionStatus":2,"sessionUid":null,"created":null,"hasPermission":true,"enabled":true,"mainSpuId":null,"shelved":false,"appCid":0,"riskVerifyUrl":null,"storeType":"COMMON"}],"message":null,"code":"0000","hasNext":false,"now":1769588598917,"extra":{}}
|
||||
jstPddShopId = BaseRegex.GetStringJson(ref getShopIdRst, "shopId");
|
||||
}
|
||||
|
||||
var getPropRst = GetPddProp(shop, prod, prod.dbProduct.cat_id, jstPddShopId);
|
||||
if (!getPropRst.Contains("\"success\":true"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref getPropRst, "message");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = getPropRst;
|
||||
prod.getProductMsg = "采集失败 " + errMsg;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
List<PDDPropRefPidNameMap> pddPropMap = new List<PDDPropRefPidNameMap>();
|
||||
var pddPropObj = JsonHelper.JObjectParse(getPropRst)["data"];
|
||||
foreach (JObject pObj in pddPropObj["properties"])
|
||||
{
|
||||
pddPropMap.Add(new PDDPropRefPidNameMap()
|
||||
{
|
||||
id = pObj["id"].IsJTokenNullOrEmpty() ? new long?() : pObj["id"].ParseToLong(),
|
||||
ref_pid = pObj["ref_pid"].IsJTokenNullOrEmpty() ? new long?() : pObj["ref_pid"].ParseToLong(),
|
||||
name = pObj["name"].IsJTokenNullOrEmpty() ? null : pObj["name"].ParseToString(),
|
||||
name_alias = pObj["name_alias"].IsJTokenNullOrEmpty() ? null : pObj["name_alias"].ParseToString(),
|
||||
});
|
||||
}
|
||||
// 不进行类目属性预测
|
||||
//var getPropRstV2 = GetPddPropForecastV2(shop, prod, prod.dbProduct.cat_id);
|
||||
|
||||
prod.dbProduct.main_cat_id = jObj["categoryData"].FirstOrDefault().ParseToString();
|
||||
var prodDataJson = JsonHelper.SerializeObject(jObj);
|
||||
prod.dbProduct.product_json = "{\"pddData\":" + prodDataJson + ",\"jstProd\":" + prod.jstProductJson + "}";
|
||||
var propMapJson = JsonHelper.SerializeObject(pddPropMap);
|
||||
prod.dbProduct.product_json = "{\"pddData\":" + prodDataJson + ",\"pddPropMap\":" + propMapJson + ",\"jstProd\":" + prod.jstProductJson + "}";
|
||||
var priceMin = jObj["skuInfo"]["goodsSkuDetail"].Min(s => s["supplyPrice"].ParseToDecimal());
|
||||
var priceMax = jObj["skuInfo"]["goodsSkuDetail"].Max(s => s["supplyPrice"].ParseToDecimal());
|
||||
prod.dbProduct.price_text = priceMin + "-" + priceMax;
|
||||
@@ -760,7 +859,7 @@ namespace TemuKJD.ToolForms
|
||||
}));
|
||||
}
|
||||
|
||||
if (pIds.IndexOf(prodId) % 20 == 0 )
|
||||
if (row.Index % 20 == 0 )
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
|
||||
}
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
|
||||
@@ -775,8 +874,8 @@ namespace TemuKJD.ToolForms
|
||||
private void GetDyProd()
|
||||
{
|
||||
this.pbLoading.Visible = true;
|
||||
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
//if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
@@ -811,11 +910,11 @@ namespace TemuKJD.ToolForms
|
||||
html = GetHtml.PostUtf8(existUrl, existData);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
// row.Cells["colMsg"].Value = "采集详情失败,产品数据库连接失败";
|
||||
//}));
|
||||
//continue;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
row.Cells["colMsg"].Value = "采集详情失败,产品数据库连接失败";
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -830,11 +929,7 @@ namespace TemuKJD.ToolForms
|
||||
}
|
||||
}
|
||||
|
||||
string url = "https://sc.scm121.com/api/goods/goods/goGoodsDouyin/queryBaseData?itemSpuId=" + prod.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + prod.itemCoId;
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + prod.supplierId + "?showErpList=1";
|
||||
var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
if (!getDetailRst.Contains("\"success\":true"))
|
||||
getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer);
|
||||
var getDetailRst = GetPddBaseData(shop, prod);
|
||||
if (!getDetailRst.Contains("\"success\":true"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref getDetailRst, "message");
|
||||
@@ -886,6 +981,62 @@ namespace TemuKJD.ToolForms
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
public string GetGoodsLst(ShopLoginInfo shop, JObject searchDataObj)
|
||||
{
|
||||
string url = "https://sc.scm121.com/api/goods/buyer/supplier/goods/list";
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + searchDataObj["supplierId"] + "?showErpList=1";
|
||||
var lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(searchDataObj), referer, appVersion);
|
||||
for (int i = 0; i < 3 && !lstRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(searchDataObj), referer, appVersion);
|
||||
}
|
||||
return lstRst;
|
||||
}
|
||||
|
||||
public string GetPddBaseData(ShopLoginInfo shop, JSTListProductInfo jstLstProd)
|
||||
{
|
||||
string url = "https://sc.scm121.com/api/goods/goods/goGoodsPdd/queryBaseData?itemSpuId=" + jstLstProd.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + jstLstProd.itemCoId;
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstLstProd.supplierId + "?showErpList=1";
|
||||
var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
for (int i = 0; i< 3 && !getDetailRst.Contains("\"success\":true"); i++)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
}
|
||||
return getDetailRst;
|
||||
}
|
||||
|
||||
public string GetPddShopId(ShopLoginInfo shop, JSTListProductInfo jstLstProd)
|
||||
{
|
||||
string url = "https://sc.scm121.com/api/goods/shelves/mxStoresInformation/selectStoresInfo?shopTypeKey=%E6%8B%BC%E5%A4%9A%E5%A4%9A&spuId=" +
|
||||
jstLstProd.spuId + "&itemCoId=" + jstLstProd.itemCoId + "&isUpdate=false&pageNum=1&pageSize=20";
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstLstProd.supplierId + "?showErpList=1";
|
||||
var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
return response;
|
||||
}
|
||||
|
||||
public string GetPddProp(ShopLoginInfo shop, JSTListProductInfo jstLstProd, string catId, string shopId = "20115638")
|
||||
{
|
||||
string url = "https://sc.scm121.com/api/goods/shelves/pddShelves/queryGoodsTemplate?catId=" + catId + "&shopId=" + shopId;
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstLstProd.supplierId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true";
|
||||
var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 没有商品属性的,类目属性预测
|
||||
/// </summary>
|
||||
public string GetPddPropForecastV2(ShopLoginInfo shop, JSTListProductInfo jstProd, string catId, string shopId = "20115638")
|
||||
{
|
||||
//string url = "https://sc.scm121.com/api/goods/platform/category/categoryPropForecastV2?shopId=20115638&itemSpuId=DD0FCC6A42C94EAC9D2A0BFEBA33A683&itemCoId=10361546&shopType=Pinduoduo&categoryId=10799";
|
||||
string url = "https://sc.scm121.com/api/goods/platform/category/categoryPropForecastV2?shopId=" + shopId +
|
||||
"&itemSpuId=" + jstProd.itemSpuId + "&itemCoId=" + jstProd.itemCoId + "&shopType=Pinduoduo&categoryId=" + catId;
|
||||
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstProd.supplierId + "?showErpList=1";
|
||||
var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
|
||||
return response;
|
||||
}
|
||||
|
||||
public string SetPartnerSpu(ShopLoginInfo shop, JSTListProductInfo jstProd)
|
||||
{
|
||||
string url = "https://sc.scm121.com/api/goods/buyer/partnerSpu/add";
|
||||
@@ -894,5 +1045,28 @@ namespace TemuKJD.ToolForms
|
||||
var response = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
|
||||
return response;
|
||||
}
|
||||
|
||||
private void btnSearchTitle_Click(object sender, EventArgs e)
|
||||
{
|
||||
pbLoading.Visible = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvProduct.Rows)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
|
||||
row.Visible = (row.Cells["colGoodsName"].Value.ParseToString().Contains(txtTitle.Text.Trim()) || txtTitle.Text.Trim() == "");
|
||||
if (row.Visible == false)
|
||||
row.Cells["colCheck"].Value = false;
|
||||
|
||||
}));
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
pbLoading.Visible = false;
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user