聚水潭授权 聚水潭爆款采集 其他功能优化

This commit is contained in:
wule committed 2026-02-28 00:33:30 +08:00
1 parent 30efe8fccb
commit d2d2396804
24 files changed
+5000 -695

No files matched your search

+456 -21
View File
@@ -30,12 +30,14 @@ namespace TemuKJD.ToolForms
{
public partial class GetJuShuitanProdForm : BaseForms.BaseForm
{
Dictionary<string, string> dicAfterSale = new Dictionary<string, string>();
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public CancellationTokenSource CancelGetDown { get; set; } = null;
string InitUrl = "https://sc.scm121.com/suppliersManage/suppliersList/onlineSuppliers";
public ChromiumWebBrowser cefWebBrowser = null;
private string currentUrl = "";
private string currentGetListData = "";
private string currentGetSupplierListParamData = "";
private string currentGetHotListParamData = "";
private string currentSupplierName = "";
private string appVersion = "";
private string currentSupplierId = "";
@@ -99,6 +101,8 @@ namespace TemuKJD.ToolForms
{
var rowId = this.dgvProduct.Rows.Add(
true,
prod.itemCoId,
prod.supplierName,
prod.id,
(prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"),
DataGridViewExtension.defaultBitmap,
@@ -237,24 +241,43 @@ namespace TemuKJD.ToolForms
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
if (url.Contains("api/goods/buyer/supplier/goods/list"))
{
if (request.Headers.AllKeys.Contains("App-Version"))
appVersion = request.Headers["App-Version"];
Task.Run(() => { GetCurrentSearchData(postData, responseData, request); });
Task.Run(() => { GetCurrentSupplierSearchData(postData, responseData, request); });
}
if (url.Contains("api/goods/freshman/mall/goods/list"))
{
if (request.Headers.AllKeys.Contains("App-Version"))
appVersion = request.Headers["App-Version"];
Task.Run(() => { GetCurrentHotSearchData(postData, responseData, request); });
}
}
void GetCurrentSearchData(string postData, string responseData, IRequest request)
void GetCurrentSupplierSearchData(string postData, string responseData, IRequest request)
{
currentGetListData = postData;
currentGetHotListParamData = "";
currentGetSupplierListParamData = postData;
currentSupplierId = BaseRegex.GetStringJson(ref postData, "supplierId");
currentSupplierName = BaseRegex.GetStringJson(ref responseData, "supplierName");
Invoke(new Action(() => {
Invoke(new Action(() =>
{
txtSupplierName.Text = currentSupplierName;
}));
}
void GetCurrentHotSearchData(string postData, string responseData, IRequest request)
{
currentGetSupplierListParamData = "";
currentGetHotListParamData = postData;
currentSupplierId = "";
currentSupplierName = "";
Invoke(new Action(() =>
{
txtSupplierName.Text = "爆款专区";
}));
}
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
@@ -376,9 +399,9 @@ namespace TemuKJD.ToolForms
}
}
private void btnCollect_Click(object sender, EventArgs e)
private void btnCollectSupplier_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(currentGetListData))
if (string.IsNullOrEmpty(currentGetSupplierListParamData))
{
BaseMsgForm.ShowError("请在网页上选择要搜索的供应商商品列表页面");
return;
@@ -400,7 +423,7 @@ namespace TemuKJD.ToolForms
{
try
{
GetProdList();
GetSupplierList();
}
catch (Exception ex)
{
@@ -414,13 +437,13 @@ namespace TemuKJD.ToolForms
}, cancellationTokenSource.Token);
}
void GetProdList()
void GetSupplierList()
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
var Jobj = JsonHelper.JObjectParse(currentGetListData);
var Jobj = JsonHelper.JObjectParse(currentGetSupplierListParamData);
Jobj["pageSize"] = 70;
int page = pageStart;
while(page <= pageEnd)
@@ -429,7 +452,7 @@ namespace TemuKJD.ToolForms
break;
Jobj["pageNum"] = page;
Jobj["mallSort"] = "SELL_SEVEN";
//Jobj["mallSort"] = "SELL_SEVEN"; // 采集近7日爆品 //CREATED 采集近30日新品
Jobj["platformType"] = platformType;
Invoke(new Action(() =>
{
@@ -461,7 +484,7 @@ namespace TemuKJD.ToolForms
jstProd.dbProduct.offline_supplier_id = jstProd.offlineSupplierId;
jstProd.dbProduct.offline_supplier_name = jstProd.offlineSupplierName;
jstProd.dbProduct.spu_id = jstProd.spuId;
jstProd.dbProduct.skc_id = jstProd.coId;
jstProd.dbProduct.skc_id = jstProd.itemCoId;
//jstProd.dbProduct.price_text = jstProd.minSalesPrice.ParseToString();
//jstProd.dbProduct.main_cat_id = jstProd.categoryLv1Id.ParseToString();
//jstProd.dbProduct.main_cat_name = jstProd.mainCategoryName.ParseToString();
@@ -498,6 +521,8 @@ namespace TemuKJD.ToolForms
{
var id = dgvProduct.Rows.Add(
true,
prod.itemCoId,
prod.supplierName,
prod.id,
(prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"),
DataGridViewExtension.defaultBitmap,
@@ -530,6 +555,200 @@ namespace TemuKJD.ToolForms
}));
}
private void btnCollectHot_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(currentGetHotListParamData))
{
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();
Task.Run(() =>
{
try
{
GetHotList();
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
//this.statusBar.lblTaskStatus.Text = "正在删除...";
}));
}, cancellationTokenSource.Token);
}
void GetHotList()
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
var Jobj = JsonHelper.JObjectParse(currentGetHotListParamData);
Jobj["pageSize"] = 70;
int page = pageStart;
while (page <= pageEnd)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
Jobj["pageNum"] = page;
//Jobj["mallSort"] = "SELL_SEVEN";
Jobj["platformType"] = platformType;
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在采集第 " + page + " 页";
}));
Thread.Sleep(Randomx.GetId(1000, 2000));
page++;
var lstRst = GetHotLst(shop, Jobj);
if (!lstRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref lstRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = lstRst;
BaseMsgForm.ShowError("查询错误:" + errMsg);
return;
}
List<JSTListProductInfo> jstLst = new List<JSTListProductInfo>();
try
{
foreach (var jItem in JsonHelper.JObjectParse(lstRst)["data"])
{
JSTListProductInfo jstProd = JsonHelper.DeserializeJsonToObject<JSTListProductInfo>(JsonHelper.SerializeObject(jItem));
jstProd.jstProductJson = JsonHelper.SerializeObject(jItem);
jstProd.dbProduct = new KJDDBProduct();
jstProd.dbProduct.from_shop_id = jstProd.supplierName; // jstProd.supplierId;
jstProd.dbProduct.from_shop_name = jstProd.supplierName;
jstProd.dbProduct.offline_supplier_id = jstProd.offlineSupplierId;
jstProd.dbProduct.offline_supplier_name = jstProd.offlineSupplierName;
jstProd.dbProduct.spu_id = jstProd.spuId;
jstProd.dbProduct.skc_id = jstProd.itemCoId;
//jstProd.dbProduct.price_text = jstProd.minSalesPrice.ParseToString();
//jstProd.dbProduct.main_cat_id = jstProd.categoryLv1Id.ParseToString();
//jstProd.dbProduct.main_cat_name = jstProd.mainCategoryName.ParseToString();
//jstProd.dbProduct.cat_id = jstProd.categoryLv3Id.ParseToString();
jstProd.dbProduct.cat_name = jstProd.categoryName.ParseToString();
jstProd.dbProduct.ext_code = jstProd.styleCode;
jstProd.dbProduct.product_name = jstProd.itemName;
jstProd.dbProduct.product_json = "";
jstProd.dbProduct.size_json = "{}";
jstProd.dbProduct.main_img = jstProd.itemMainImage?.FirstOrDefault();
jstProd.dbProduct.sale_count = jstProd.saleSeven;
jstProd.dbProduct.sale_count_text = string.IsNullOrEmpty(jstProd.saleSevenDesensitized) ? jstProd.saleSeven.ParseToString() : jstProd.saleSevenDesensitized;
jstProd.dbProduct.product_get_type_text = "厂商直采";
jstLst.Add(jstProd);
}
if (jstLst.Count <= 0)
break;
// 经销商销量小于设定值,则单品销量肯定小于设定值,退出
//jstLst = jstLst.Where(p => p.supplierSaleSeven >= filterSaleCount).ToList();
//if (jstLst.Count <= 0)
// break;
if (filterSaleCountDays == 7)
jstLst = jstLst.Where(p => p.saleSeven >= filterSaleCount).ToList();
else
jstLst = jstLst.Where(p => p.saleThirty >= filterSaleCount).ToList();
jstLst = jstLst.Where(p => !lstJSTListProductInfo.Any(p1 => p1.id == p.id)).ToList();
jstLst = jstLst.Where(p => !p.limitShelvesPlatformList.Contains("WXChannel")).ToList(); // 过滤微信禁售不发货商品
// 查询真实上家
var realCoidRst = BatchQueryRealCoid(shop, string.Join(",", jstLst.Select(j => j.itemSpuId)), "12840800");
Thread.Sleep(Randomx.GetId(200, 800));
if (!realCoidRst.Contains("\"success\":true"))
{
Thread.Sleep(Randomx.GetId(1000, 2000));
realCoidRst = BatchQueryRealCoid(shop, string.Join(",", jstLst.Select(j => j.itemSpuId)), "12840800");
}
if (!realCoidRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref realCoidRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = realCoidRst;
BaseMsgForm.ShowError("查询产品源错误:" + errMsg);
return;
}
try
{
var realUpObjs = JsonHelper.JObjectParse(realCoidRst)["data"];
foreach (var realUpObj in realUpObjs)
{
var jst = jstLst.FirstOrDefault(j => j.itemSpuId == realUpObj["itemSpuId"].ParseToString());
if (jst != null)
{
jst.dbProduct.real_spu_id = realUpObj["highestSupplierSpuId"].ParseToString();
jst.dbProduct.real_coid = realUpObj["supplierHierarchyList"].FirstOrDefault(sj => sj["level"].ParseToInt() == 1)["supCoId"].ParseToString();
}
}
jstLst = jstLst.Where(j => !string.IsNullOrEmpty(j.dbProduct.real_coid) && !string.IsNullOrEmpty(j.dbProduct.real_spu_id)).ToList();
}
catch (Exception ex)
{
BaseMsgForm.ShowError("查询产品源错误:" + ex.Message);
return;
}
lstJSTListProductInfo.AddRange(jstLst);
//var t = Task.Run(() =>
//{
Invoke(new Action(() =>
{
foreach (var prod in jstLst)
{
var id = dgvProduct.Rows.Add(
true,
prod.itemCoId,
prod.supplierName,
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)
{
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "发生错误 " + ex.Message;
}));
Thread.Sleep(2000);
}
}
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("采集完成");
}));
}
private void txtFilterSaleCount_TextChanged(object sender, EventArgs e)
{
filterSaleCount = txtFilterSaleCount.Text.Trim().ParseToInt();
@@ -611,8 +830,10 @@ namespace TemuKJD.ToolForms
}
bool isExist = false;
var existUrl = BaseClass.BuildPDDObjString("product/get_product_list");
string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId;
var existUrl = BaseClass.BuildPDDObjString("product/get_product_spu_id_list");
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.spuId;
//if (!string.IsNullOrEmpty(prod.dbProduct.real_spu_id))
// existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.spuId + "," + prod.dbProduct.real_spu_id;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
@@ -693,6 +914,10 @@ namespace TemuKJD.ToolForms
"&cat_id=" + prod.dbProduct.cat_id +
"&cat_name=" + HttpUtility.UrlEncode((prod.dbProduct.cat_name ?? prod.categoryName).ParseToString(), Encoding.UTF8);
}
if (!string.IsNullOrEmpty(prod.dbProduct.real_coid))
data += "&real_coid=" + prod.dbProduct.real_coid;
if (!string.IsNullOrEmpty(prod.dbProduct.real_spu_id))
data += "&real_spu_id=" + prod.dbProduct.real_spu_id;
//if (SetPartnerSpuRst.Contains("\"success\":true"))
//{
// data += "&distribution_set=1";
@@ -814,8 +1039,10 @@ namespace TemuKJD.ToolForms
continue;
bool isExist = false;
var existUrl = BaseClass.BuildPDDObjString("product/get_product_list");
string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId;
var existUrl = BaseClass.BuildPDDObjString("product/get_product_spu_id_list");
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.spuId;
//if (!string.IsNullOrEmpty(prod.dbProduct.real_spu_id))
// existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.spuId + "," + prod.dbProduct.real_spu_id;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
@@ -841,6 +1068,142 @@ namespace TemuKJD.ToolForms
}
Thread.Sleep(Randomx.GetId(500, 1500));
// 爆款专区查询真实供应商coid和供应商退货地址
if (prod.itemCoId == "12840800" || prod.supplierName == "寻合作-爆款专区")
{
if (dicAfterSale.Keys.Contains(prod.dbProduct.skc_id + "->" + prod.dbProduct.real_coid))
{
}
else
{
var urlAfterSale = BaseClass.BuildObjString("product/wx_get_after_sale");
var dataAfterSale = Work.UserLogin.GetSignaturex() +
"&coid=" + prod.dbProduct.skc_id + "->" + prod.dbProduct.real_coid;
var htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale);
if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200"))
htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale);
if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "爆款售后地址比对失败,请下次重试,暂时跳过入库";
}));
continue;
}
if (htmlAfterSale.Contains("\"data\":\"\""))
{
var afterSaleRst = GetAfterSaleAddress(shop, prod.dbProduct.real_spu_id, prod.dbProduct.spu_id, prod.dbProduct.real_coid, prod.dbProduct.skc_id);
string address_id = BaseRegex.GetStringJson(ref afterSaleRst, "returnAddressId").ParseToString();
string middlemanAddressId = BaseRegex.GetStringJson(ref afterSaleRst, "middlemanAddressId").ParseToString();
if (address_id.IsNullOrEmpty() && middlemanAddressId.IsNullOrEmpty())
{
Thread.Sleep(5000);
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "爆款售后地址获取失败,请下次重试,暂时跳过入库";
}));
continue;
}
retry:
var afterSaleMobileRst = "";
if (!address_id.IsNullOrEmpty())
afterSaleMobileRst = GetAfterSaleAddressMobile(shop, address_id,
prod.dbProduct.real_spu_id, prod.dbProduct.spu_id, prod.dbProduct.real_coid, prod.dbProduct.skc_id);
else
afterSaleMobileRst = GetAfterSaleAddressMobileById(shop, middlemanAddressId,
prod.dbProduct.real_spu_id, prod.dbProduct.spu_id, prod.dbProduct.real_coid, prod.dbProduct.skc_id);
Thread.Sleep(Randomx.GetId(1000, 5000));
//为了您的数据安全,复制手机号要求验证身份,已发送验证码到您手机:132*****859,请输入验证码后进行确认。
string tel_number = BaseRegex.GetStringJson(ref afterSaleMobileRst, "data");
if (tel_number.IsNullOrEmpty())
{
if (afterSaleMobileRst.Contains("为了您的数据安全,复制手机号要求验证身份,已发送验证码到您手机"))
{
GetJuShuitanAuthForm GetJuShuitanAuthForm = new GetJuShuitanAuthForm();
GetJuShuitanAuthForm.ShowDialog();
var authStr = GetJuShuitanAuthForm.authStr;
var authRst = AuthV2(shop, prod, authStr);
if (authRst.Contains("\"success\":true"))
goto retry;
else
{
if (BaseMsgForm.ShowConfirm("验证码校验失败,是否重试?").DialogResult == DialogResult.OK)
{
goto retry;
}
}
}
Thread.Sleep(5000);
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "爆款售后电话获取失败,请下次重试,暂时跳过入库";
}));
continue;
}
//聚水潭退货地址:{"success":true,"total":null,"data":{"supplierReturnAddresses":[{"supplierHierarchyChain":"12840800->14009332","spuId":"C1DE5AF0118D4588B32849FA87610622","hasReturnAddress":true,"currentSupplierName":"寻合作-爆款专区","returnAddress":{"uniqueKey":"12840800-1c6cef6a151608d52f032f03fa59fec9","province":"山东省","city":"聊城市","district":"茌平区","address":"顺河北街与信发路交汇处路北山东名威电子商务","recipientName":"乌先生","street":"信发街道","mobile":"1658***1111","encryptedMobile":"aRwLwihnqaLoahYFJ2+uXw==","returnAddressId":4101,"coId":14009332,"middlemanAddress":false,"middlemanAddressId":null}}]},"message":null,"code":"0000","hasNext":false,"now":1772178142906,"extra":{}}
//e57获取的地址格式{"address_id":null,"user_name":"孙庆裕","postal_code":null,"province_name":"浙江省","city_name":"金华市","county_name":"义乌市","street_name":"城西街道","detail_info":"城西街道圣达街18号金哥集团2号岗 5号电梯 三楼退件区","tel_number":"13024622251","number":"10010274","name":"义乌芸茄商贸有限公司"}
string coid = BaseRegex.GetStringJson(ref afterSaleRst, "supplierHierarchyChain");
string user_name = BaseRegex.GetStringJson(ref afterSaleRst, "recipientName");
string province_name = BaseRegex.GetStringJson(ref afterSaleRst, "province");
string city_name = BaseRegex.GetStringJson(ref afterSaleRst, "city");
string county_name = BaseRegex.GetStringJson(ref afterSaleRst, "district");
string street_name = BaseRegex.GetStringJson(ref afterSaleRst, "street");
string detail_info = BaseRegex.GetStringJson(ref afterSaleRst, "address");
// 电话号码上面查过立即赋值
//string tel_number = BaseRegex.GetStringJson(ref afterSaleRst, "mobile");
string number = prod.dbProduct.real_coid;
string name = BaseRegex.GetStringJson(ref afterSaleRst, "currentSupplierName");
var addressObj = new JObject();
addressObj.Add("address_id", address_id.IsNullOrEmpty() ? middlemanAddressId : address_id);
addressObj.Add("user_name", user_name);
addressObj.Add("postal_code", null);
addressObj.Add("province_name", province_name);
addressObj.Add("city_name", city_name);
addressObj.Add("county_name", county_name);
addressObj.Add("street_name", street_name);
addressObj.Add("detail_info", detail_info);
addressObj.Add("tel_number", tel_number);
addressObj.Add("number", number);
addressObj.Add("name", name);
if ((address_id + middlemanAddressId).IsNullOrEmpty() || coid.IsNullOrEmpty() || user_name.IsNullOrEmpty() || province_name.IsNullOrEmpty() || city_name.IsNullOrEmpty() ||
county_name.IsNullOrEmpty() || street_name.IsNullOrEmpty() || detail_info.IsNullOrEmpty() || tel_number.IsNullOrEmpty() || number.IsNullOrEmpty() ||
name.IsNullOrEmpty())
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "爆款售后地址获取失败,请下次重试,暂时跳过入库";
}));
continue;
}
var urlSaveAfterSale = BaseClass.BuildObjString("product/wx_add_mdy_after_sale");
var dataSaveAfterSale = Work.UserLogin.GetSignaturex() +
"&coid=" + coid +
"&after_sale_json=" + JsonHelper.SerializeObject(addressObj);
string htmlSaveAfterSale = GetHtml.PostUtf8(urlSaveAfterSale, dataSaveAfterSale);
if (string.IsNullOrEmpty(htmlSaveAfterSale) || !htmlSaveAfterSale.Contains("\"code\":200"))
htmlSaveAfterSale = GetHtml.PostUtf8(urlSaveAfterSale, dataSaveAfterSale);
if (string.IsNullOrEmpty(htmlSaveAfterSale) || !htmlSaveAfterSale.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "爆款售后地址保存失败,请下次重试,暂时跳过入库";
}));
continue;
}
dicAfterSale[coid] = JsonHelper.SerializeObject(addressObj);
}
}
}
//设置分销
var SetPartnerSpuRst = SetPartnerSpu(shop, prod);
@@ -1111,6 +1474,19 @@ namespace TemuKJD.ToolForms
return lstRst;
}
public string GetHotLst(ShopLoginInfo shop, JObject searchDataObj)
{
string url = "https://sc.ttdahuo.com/api/goods/freshman/mall/goods/list";
string referer = "https://sc.ttdahuo.com/findCooperation/newlywedZone";
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;
@@ -1169,6 +1545,53 @@ namespace TemuKJD.ToolForms
return response;
}
public string QueryRealCoid(ShopLoginInfo shop, JSTListProductInfo jstProd)
{
string url = "https://sc.scm121.com/api/goods/goodsQuery/queryGoodsDistributionHierarchyV2";
string referer = "https://sc.scm121.com/findCooperation/newlywedZone/goodsDetail/" + jstProd.itemSpuId + "?itemCoId=" + jstProd.itemCoId +
"&lookingFor=findCooperation&noBack=true";
string data = "[{\"supplierCoId\":\"" + jstProd.itemCoId + "\",\"itemSpuIdList\":[\"" + jstProd.itemSpuId + "\"]}]";
var response = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
return response;
}
public string BatchQueryRealCoid(ShopLoginInfo shop, string spuIds, string coid0 = "12840800")
{
string url = "https://sc.scm121.com/api/goods/goodsQuery/queryGoodsDistributionHierarchyV2";
string referer = "https://sc.ttdahuo.com/findCooperation/newlywedZone";
string data = "[{\"supplierCoId\":\"" + coid0 + "\",\"itemSpuIdList\":[\"" + spuIds.Replace(",", "\",\"") + "\"]}]";
var response = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
return response;
}
public string GetAfterSaleAddress(ShopLoginInfo shop, string realSpuId, string spuId, string supCoId1, string supCoId0 = "12840800")
{
string url = "https://innerapi.scm121.com/api/aftersale/addresses/queryMultiLevelSupplierReturnAddressWithSwitch";
string referer = "https://sc.scm121.com/findCooperation/newlywedZone/goodsDetail/" + spuId + "?itemCoId=" + supCoId0 + "&lookingFor=findCooperation&noBack=true";
string data = @"{""params"":[{""supplierHierarchyInfos"":[{""supCoId"":""" + supCoId0 + @""",""level"":0},{""supCoId"":""" + supCoId1 +
@""",""level"":1}],""spuId"":""" + realSpuId + @"""}]}";
var response = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
return response;
}
public string GetAfterSaleAddressMobile(ShopLoginInfo shop, string addressId, string realSpuId, string spuId, string realCoid, string supCoId = "12840800")
{
string url = "https://sc.scm121.com/api/company/phoneQuery/aftersale/supplier/getReturnPhone?returnAddressId=" + addressId + "&supplierCoId=" + realCoid;
string referer = "https://sc.scm121.com/findCooperation/newlywedZone/goodsDetail/" + spuId + "?itemCoId=" + supCoId + "&lookingFor=findCooperation&noBack=true";
var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
return response;
}
public string GetAfterSaleAddressMobileById(ShopLoginInfo shop, string Id, string realSpuId, string spuId, string realCoid, string supCoId = "12840800")
{
string url = "https://innerapi.scm121.com/api/aftersale/middleman/addresses/queryPhone?id=" + Id;
string referer = "https://sc.scm121.com/findCooperation/newlywedZone/goodsDetail/" + spuId + "?itemCoId=" + supCoId + "&lookingFor=findCooperation&noBack=true";
// "https://sc.scm121.com/findCooperation/newlywedZone/goodsDetail/ ?itemCoId= &lookingFor=findCooperation&noBack=true
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";
@@ -1179,6 +1602,18 @@ namespace TemuKJD.ToolForms
}
public string AuthV2(ShopLoginInfo shop, JSTListProductInfo jstProd, string authStr)
{
string url = "https://sc.scm121.com/api/company/open/auth/grantAuthV2";
string referer = "https://sc.scm121.com/findCooperation/newlywedZone/goodsDetail/" + jstProd.spuId + "?itemCoId=" + jstProd.itemCoId +
"&lookingFor=findCooperation&noBack=true";
string data = @"{""code"":""" + authStr + @""",""sensitiveOperationErrorCode"":""50716""}";
var response = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
return response;
}
public string GetDownSkuLst(ShopLoginInfo shop, DateTime startTime, DateTime endTime, int pageNum, int pageSize)
{
string url = "https://sc.scm121.com/api/goods/goChannelPartnerSku/queryChannelPartnerSkuList";
@@ -1261,7 +1696,7 @@ namespace TemuKJD.ToolForms
if (jstDownSkuGetInfo.status != "done")
BaseMsgForm.ShowError("采集并同步产品中断!");
else
BaseMsgForm.ShowError("采集并同步产品完成!");
BaseMsgForm.ShowInfo("采集并同步产品完成!");
pictureBox1.Visible = false;
}));
}, CancelGetDown.Token);
@@ -1355,9 +1790,9 @@ namespace TemuKJD.ToolForms
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
{
var errMsg = BaseRegex.GetStringJson(ref rst, "message");
var errMsg = BaseRegex.GetStringJson(ref result, "msg");
if (string.IsNullOrEmpty(errMsg))
errMsg = rst;
errMsg = result;
Invoke(new Action(() =>
{
this.statusBarUserControl1.lblTaskStatus.Text = "查询下架库错误:" + errMsg;
@@ -1527,7 +1962,7 @@ namespace TemuKJD.ToolForms
"&supplierName=" + downSku.supplierName +
"&shelvesTime=" + downSku.shelvesTime +
"&supplierCoId=" + downSku.supplierCoId +
"&coId=" + downSku.coId +
"&coId=" + downSku.coId + // 此处coId数值与供应商商品列表的coId不同,注意区分
"&spuId=" + downSku.spuId +
"&partnerSkuId=" + downSku.partnerSkuId +
"&partnerSpuId=" + downSku.partnerSpuId +