Merge branch 'master' of github.com:KJD2025/KJD
This commit is contained in:
commit
8eb6a1cc0b
10 files changed
+307
-81
No files matched your search
@@ -104,8 +104,8 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
@@ -191,6 +191,7 @@
|
||||
<Compile Include="Model\Config\WxShopKfStatistics.cs" />
|
||||
<Compile Include="Model\Config\WxShopMainStatistics.cs" />
|
||||
<Compile Include="Model\Config\WxShopUploadInfo.cs" />
|
||||
<Compile Include="Model\Data\ProductLatestOutAmountInfo.cs" />
|
||||
<Compile Include="Model\Data\WXBuyUrlNotesInfo.cs" />
|
||||
<Compile Include="Model\Data\WXOrderDecryptAddressInfo.cs" />
|
||||
<Compile Include="Model\DBModel\oem.cs" />
|
||||
|
||||
+83
-7
@@ -1250,13 +1250,89 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// post 数据
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="byteData"></param>
|
||||
/// <returns></returns>
|
||||
public static string PostUtf8(string url, byte[] byteData)
|
||||
public static async Task<string> PostUtf8Async(string url, string postData, string contentType = "", int? timeOut = null)
|
||||
{
|
||||
|
||||
bool isError = false;
|
||||
string[] l = UserAgent.Split('\n');
|
||||
reTry:
|
||||
try
|
||||
{
|
||||
string codeType = "utf-8";
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.UserAgent = l[new Random(Guid.NewGuid().GetHashCode()).Next(l.Length)].Trim();
|
||||
byte[] byteData = Encoding.GetEncoding(codeType).GetBytes(postData);
|
||||
request.Method = "POST";
|
||||
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
|
||||
request.Timeout = BaseClass.TimeOut * 1000;
|
||||
request.ReadWriteTimeout = BaseClass.TimeOut * 1000;
|
||||
if (timeOut != null)
|
||||
{
|
||||
request.Timeout = timeOut.Value * 1000;
|
||||
request.ReadWriteTimeout = timeOut.Value * 1000;
|
||||
}
|
||||
request.Proxy = null;
|
||||
request.ContentType = "application/x-www-form-urlencoded; charset=" + codeType;
|
||||
//if(BaseClass.SaLevel > 0)
|
||||
{
|
||||
//260306 采用GZip/deflate压缩
|
||||
//request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
|
||||
}
|
||||
if (url.StartsWith("https://openapi.jinritemai.com/"))
|
||||
{
|
||||
request.Headers.Add("X-USE-BOE", "1");
|
||||
request.Headers.Add("Origin-From", "djt_prod");
|
||||
request.Headers.Add("djt_prod", "boe_time_sku");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(contentType))
|
||||
{
|
||||
request.ContentType = contentType;
|
||||
}
|
||||
request.ContentLength = byteData.Length;
|
||||
request.Referer = url;
|
||||
request.CookieContainer = new CookieContainer();
|
||||
request.AllowAutoRedirect = false;
|
||||
using (Stream requestStream = await request.GetRequestStreamAsync())
|
||||
{
|
||||
requestStream.Write(byteData, 0, byteData.Length);
|
||||
}
|
||||
HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync();
|
||||
|
||||
Stream receiveStream = response.GetResponseStream();
|
||||
StreamReader readStream = new StreamReader(receiveStream, Encoding.GetEncoding(codeType));
|
||||
|
||||
//if (BaseClass.SaLevel == 0)
|
||||
//{
|
||||
// return readStream.ReadToEnd().Trim();
|
||||
//}
|
||||
//else
|
||||
{
|
||||
//260306 超管采用GZip/deflate压缩
|
||||
//Thread.Sleep(50);
|
||||
return GetProxyHtml.ReadResponse(response);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogSave.Add(e.ToString());
|
||||
//if (!isError)
|
||||
//{
|
||||
// isError = true;
|
||||
// goto reTry;
|
||||
//}
|
||||
Thread.Sleep(50);
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// post 数据
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="byteData"></param>
|
||||
/// <returns></returns>
|
||||
public static string PostUtf8(string url, byte[] byteData)
|
||||
{
|
||||
WebClientx webClient = new WebClientx();
|
||||
try
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Data
|
||||
{
|
||||
public class ProductLatestOutAmountInfo
|
||||
{
|
||||
public string order_id { get; set; } // 3739003536152355584
|
||||
|
||||
public string out_product_id { get; set; } // EC1960398929745-15938489009A
|
||||
public string out_sku_id { get; set; } // BSEC18052272175281198712A
|
||||
public int sku_cnt { get; set; } // 1
|
||||
|
||||
/// <summary>
|
||||
/// 外采金额,单位分
|
||||
/// </summary>
|
||||
public int out_amount { get; set; } // 1129
|
||||
|
||||
public string shop_id { get; set; } // 1960967267443629494
|
||||
public string product_id { get; set; } // 10001456670425
|
||||
public string sku_id { get; set; } // 26988803933
|
||||
public string sku_code { get; set; } // BSEC18052272175281198712A
|
||||
}
|
||||
}
|
||||
@@ -49,13 +49,21 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
ucSplitPage1.PageChange += UcSplitPage1_PageChange;
|
||||
InitCategory();
|
||||
InitBindingDataGridView();
|
||||
txt_title.Text = "连衣裙";
|
||||
|
||||
|
||||
num_minsold.Value = 0;
|
||||
num_maxsold.Value = 999;
|
||||
num_minprice.Value = 0;
|
||||
num_maxprice.Value = 999;
|
||||
|
||||
cb_Platform.SelectedIndex = 0;
|
||||
ucSplitPage1.TotalCount = 0;
|
||||
|
||||
|
||||
if (EnvironmentHelper.IsDevelopment)
|
||||
{
|
||||
txt_title.Text = "连衣裙";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -301,33 +309,48 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
{
|
||||
btnSearch_Click(obj, null);
|
||||
}
|
||||
private void btnSearch_Click(object sender, EventArgs e)
|
||||
private async void btnSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
GoodsSearchRequest search = new GoodsSearchRequest();
|
||||
|
||||
search.Platform = cb_Platform.SelectedIndex == 1 ? PlatformType.PDD : cb_Platform.SelectedIndex == 2 ? PlatformType.WX : PlatformType.None;
|
||||
search.Title = txt_title.Text;
|
||||
search.MinSoldQuantity = (int)num_minsold.Value;
|
||||
search.MaxSoldQuantity = (int)num_maxsold.Value;
|
||||
search.MinPrice = (long)num_minprice.Value * 100;
|
||||
search.MaxPrice = (long)num_maxprice.Value * 100;
|
||||
if (cmbCatSelect1.SelectedItem is PddCatInfo cat1)
|
||||
try
|
||||
{
|
||||
search.CatId1 = (int)(cat1.cat_id);
|
||||
search.CatId1 = search.CatId1 == 0 ? null : search.CatId1;
|
||||
this.pbLoading.Visible = true;
|
||||
btnSearch.Enabled = false;
|
||||
|
||||
GoodsSearchRequest search = new GoodsSearchRequest();
|
||||
|
||||
search.Platform = cb_Platform.SelectedIndex == 1 ? PlatformType.PDD : cb_Platform.SelectedIndex == 2 ? PlatformType.WX : PlatformType.None;
|
||||
search.Title = txt_title.Text;
|
||||
search.MinSoldQuantity = (int)num_minsold.Value;
|
||||
search.MaxSoldQuantity = (int)num_maxsold.Value;
|
||||
search.MinPrice = (long)num_minprice.Value * 100;
|
||||
search.MaxPrice = (long)num_maxprice.Value * 100;
|
||||
if (cmbCatSelect1.SelectedItem is PddCatInfo cat1)
|
||||
{
|
||||
search.CatId1 = (int)(cat1.cat_id);
|
||||
search.CatId1 = search.CatId1 == 0 ? null : search.CatId1;
|
||||
}
|
||||
if (cmbCatSelect2.SelectedItem is PddCatInfo cat2)
|
||||
search.CatId2 = (int)(cat2.cat_id);
|
||||
if (cmbCatSelect3.SelectedItem is PddCatInfo cat3)
|
||||
search.CatId3 = (int)(cat3.cat_id);
|
||||
if (cmbCatSelect4.SelectedItem is PddCatInfo cat4)
|
||||
search.CatId4 = (int)(cat4.cat_id);
|
||||
search.PageIndex = ucSplitPage1.CurrentPage;
|
||||
search.PageSize = ucSplitPage1.PageSize;
|
||||
|
||||
|
||||
|
||||
GetGoods(search);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError($"查询失败:{ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.pbLoading.Visible = false;
|
||||
btnSearch.Enabled = true;
|
||||
}
|
||||
if (cmbCatSelect2.SelectedItem is PddCatInfo cat2)
|
||||
search.CatId2 = (int)(cat2.cat_id);
|
||||
if (cmbCatSelect3.SelectedItem is PddCatInfo cat3)
|
||||
search.CatId3 = (int)(cat3.cat_id);
|
||||
if (cmbCatSelect4.SelectedItem is PddCatInfo cat4)
|
||||
search.CatId4 = (int)(cat4.cat_id);
|
||||
search.PageIndex = ucSplitPage1.CurrentPage;
|
||||
search.PageSize = ucSplitPage1.PageSize;
|
||||
|
||||
|
||||
|
||||
GetGoods(search);
|
||||
|
||||
|
||||
}
|
||||
@@ -346,24 +369,20 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
}
|
||||
|
||||
|
||||
public void GetGoods(GoodsSearchRequest request)
|
||||
public async void GetGoods(GoodsSearchRequest request)
|
||||
{
|
||||
this.pbLoading.Visible = true;
|
||||
dataList.Clear();
|
||||
|
||||
Task.Run(() =>
|
||||
PageData<CloudGoods> ret = await CloudGoodsService.GetGoods(request);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
PageData<CloudGoods> ret = CloudGoodsService.GetGoods(request);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
ret.List.ForEach(a => dataList.Add(a));
|
||||
ucSplitPage1.TotalPage = Math.Max(1, ret.TotalPages);
|
||||
ucSplitPage1.TotalCount = ret.Total;
|
||||
this.pbLoading.Visible = false;
|
||||
// 异步加载商品缩略图(Column1 绑定 ThumbUrl)
|
||||
ShowDgvImg();
|
||||
}));
|
||||
});
|
||||
ret.List.ForEach(a => dataList.Add(a));
|
||||
ucSplitPage1.TotalPage = Math.Max(1, ret.TotalPages);
|
||||
ucSplitPage1.TotalCount = ret.Total;
|
||||
this.pbLoading.Visible = false;
|
||||
// 异步加载商品缩略图(Column1 绑定 ThumbUrl)
|
||||
ShowDgvImg();
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
@@ -377,32 +396,43 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
/// <param name="e"></param>
|
||||
private void bt_importUploadList_Click(object sender, EventArgs e)
|
||||
{
|
||||
int succ = 0;
|
||||
int err = 0;
|
||||
foreach (var item in dataList)
|
||||
{
|
||||
if (item.IsSelected == false) continue;
|
||||
string catName = "";
|
||||
if (item.CatId4.HasValue)
|
||||
try
|
||||
{
|
||||
catName = GlobalConfig.PddCatList.FirstOrDefault(a => a.cat_id == item.CatId4)?.cat_name ?? "";
|
||||
if (item.IsSelected == false) continue;
|
||||
string catName = "";
|
||||
if (item.CatId4.HasValue)
|
||||
{
|
||||
catName = GlobalConfig.PddCatList.FirstOrDefault(a => a.cat_id == item.CatId4)?.cat_name ?? "";
|
||||
}
|
||||
else if (item.CatId3.HasValue)
|
||||
{
|
||||
catName = GlobalConfig.PddCatList.FirstOrDefault(a => a.cat_id == item.CatId3)?.cat_name ?? "";
|
||||
}
|
||||
else if (item.CatId2.HasValue)
|
||||
{
|
||||
catName = GlobalConfig.PddCatList.FirstOrDefault(a => a.cat_id == item.CatId2)?.cat_name ?? "";
|
||||
}
|
||||
WXDBProdUploadForm.Instance.lstTemuDBProductSelect.Add(new TemuDBProductSelect
|
||||
{
|
||||
out_product_Id = item.GoodsId.ToString(),
|
||||
spu_id = item.GoodsId.ToString(),
|
||||
main_img = item.ThumbUrl,
|
||||
product_name = item.Title,
|
||||
cat_name = catName,
|
||||
});
|
||||
succ++;
|
||||
}
|
||||
else if (item.CatId3.HasValue)
|
||||
catch
|
||||
{
|
||||
catName = GlobalConfig.PddCatList.FirstOrDefault(a => a.cat_id == item.CatId3)?.cat_name ?? "";
|
||||
err++;
|
||||
}
|
||||
else if (item.CatId2.HasValue)
|
||||
{
|
||||
catName = GlobalConfig.PddCatList.FirstOrDefault(a => a.cat_id == item.CatId2)?.cat_name ?? "";
|
||||
}
|
||||
WXDBProdUploadForm.Instance.lstTemuDBProductSelect.Add(new TemuDBProductSelect
|
||||
{
|
||||
out_product_Id = item.GoodsId.ToString(),
|
||||
spu_id = item.GoodsId.ToString(),
|
||||
main_img = item.ThumbUrl,
|
||||
product_name = item.Title,
|
||||
cat_name = catName,
|
||||
});
|
||||
}
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_db_prod_upload_list", WXDBProdUploadForm.Instance.lstTemuDBProductSelect);
|
||||
BaseMsgForm.ShowInfo($"导入完成!{succ} 成功 {err} 失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Data;
|
||||
using AllBase.Model.Param;
|
||||
using AllBase.Model.Result;
|
||||
using AllBase.Model.Result._1688;
|
||||
@@ -173,14 +174,25 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
lstTemuDbProduct.Clear();
|
||||
dgvDbProduct.Columns["colViewUv"].Visible = false;
|
||||
}
|
||||
if (cancellationTokenSource!= null)
|
||||
cancellationTokenSource.Cancel();
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
{
|
||||
var cancelToken = cancellationTokenSource.Token;
|
||||
int pageCount;
|
||||
int pageSize = 100;
|
||||
decimal seconds;
|
||||
Invoke(new Action(() => { pageSize = this.ucSplitPage1.PageSize; }));
|
||||
var list = GetProductList(out pageCount, out seconds, page, pageSize);
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
// 测试获取爆款数据
|
||||
//var list = GetHotProductList(out pageCount, out seconds, page, pageSize);
|
||||
// 测试获取商品最后几笔订单的外采价格
|
||||
//var outAmountList = GetProductLatestOutAmountList(string.Join(",", list.Select(l => l.ext_code.IsNullOrEmpty() ? WXDBProdUploadForm.GetNewExtCode(l.spu_id) : l.ext_code)));
|
||||
|
||||
lstTemuDbProduct.AddRange(list);
|
||||
this.ucSplitPage1.TotalPage = pageCount;
|
||||
|
||||
@@ -199,6 +211,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
}));
|
||||
foreach (var prod in lstTemuDbProduct.Reverse().ToList())
|
||||
{
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
string catName = (prod.cat_name ?? prod.cat_id);
|
||||
if (prod.wx_cat_leaf != null)
|
||||
{
|
||||
@@ -286,6 +301,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
ShowDgvImg();
|
||||
@@ -295,7 +313,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.statusBar.lblTaskStatus.Text += ",耗时:" + seconds;
|
||||
#endif
|
||||
}));
|
||||
});
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
Bitmap defaultBitmap = null;
|
||||
@@ -443,6 +461,49 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
}
|
||||
}
|
||||
|
||||
public List<ProductLatestOutAmountInfo> GetProductLatestOutAmountList(string outProductIds)
|
||||
{
|
||||
List<ProductLatestOutAmountInfo> list = new List<ProductLatestOutAmountInfo>();
|
||||
|
||||
var url = BaseClass.BuildWXObjString("product/wx_get_product_latest_buy_amount_list");
|
||||
var data = "";
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
data = "&out_product_ids=" + outProductIds;
|
||||
data += "&latest_cnt=10";
|
||||
}));
|
||||
data += "&sign=" + BaseClass.GetMd5(DateTime.Now.ToString("yyyyMMddHHmm") + "wxxd").ToLower();
|
||||
var 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"))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowError("获取商品列表失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
|
||||
}));
|
||||
return list;
|
||||
}
|
||||
|
||||
var seconds = BaseRegex.GetDecimalJson(ref html, "seconds");
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return list;
|
||||
var sProd = JsonHelper.SerializeObject(jArr);
|
||||
|
||||
try
|
||||
{
|
||||
list = JsonHelper.DeserializeJsonToList<ProductLatestOutAmountInfo>(sProd);
|
||||
return list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new List<ProductLatestOutAmountInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
public List<KJDDBProduct> GetProductList(out int pageCount, out decimal seconds, int page = 1, int pageSize = 200)
|
||||
{
|
||||
List<KJDDBProduct> list = new List<KJDDBProduct>();
|
||||
|
||||
@@ -1545,7 +1545,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
}
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
|
||||
public static string GetEC1ExtCode(string spu_id)
|
||||
{
|
||||
if (spu_id.IsNullOrEmpty())
|
||||
throw new Exception("货号指定失败,值不能为空!");
|
||||
if (!spu_id.StartsWith("EC1") && !spu_id.EndsWith("A"))
|
||||
return "EC1" + spu_id + "A";
|
||||
return spu_id;
|
||||
}
|
||||
public static string GetNewExtCode(string spu_id)
|
||||
{
|
||||
if (spu_id.IsNullOrEmpty())
|
||||
throw new Exception("货号指定失败,值不能为空!");
|
||||
if (!spu_id.StartsWith("P1-"))
|
||||
return "P1-" + spu_id;
|
||||
return spu_id;
|
||||
}
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
|
||||
{
|
||||
#region 初始化上传商品对象
|
||||
// 生成初始化上传商品对象
|
||||
@@ -1627,7 +1644,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
var searchExtCode = dbProd.ext_code;
|
||||
if (searchExtCode.ParseToString().Length < 10)
|
||||
searchExtCode = "EC1" + dbProd.spu_id + "A";
|
||||
searchExtCode = GetEC1ExtCode(dbProd.spu_id);
|
||||
if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId"))
|
||||
{
|
||||
var sku_secret_json = dbProd.sku_secret_json;
|
||||
@@ -2371,7 +2388,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (extCode.IsNullOrEmpty() || extCode.Length <= 10)
|
||||
{
|
||||
//extCode = "EC" + Randomx.GetId(1000).ToString().PadLeft(3, '0') + dbProd.spu_id + "C";
|
||||
extCode = "EC1" + dbProd.spu_id + "A";
|
||||
extCode = GetEC1ExtCode(dbProd.spu_id);
|
||||
}
|
||||
upProdParam.product.info.spuCode = extCode;
|
||||
upProdParam.product.info.outProductId = extCode;
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("选品上传");
|
||||
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("云仓数据");
|
||||
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("云端数据");
|
||||
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("我的商品库");
|
||||
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("商品预售/下架");
|
||||
System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("云仓退货地址");
|
||||
@@ -149,8 +149,8 @@
|
||||
this.tv.Name = "tv";
|
||||
treeNode1.Name = "选品上传";
|
||||
treeNode1.Text = "选品上传";
|
||||
treeNode2.Name = "云仓数据";
|
||||
treeNode2.Text = "云仓数据";
|
||||
treeNode2.Name = "云端数据";
|
||||
treeNode2.Text = "云端数据";
|
||||
treeNode3.Name = "我的商品库";
|
||||
treeNode3.Text = "我的商品库";
|
||||
treeNode4.Name = "商品预售/下架";
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
case "选品上传":
|
||||
SetForm(userSelectDbProductForm.Value);
|
||||
break;
|
||||
case "云仓数据":
|
||||
case "云端数据":
|
||||
SetForm(cloudgoodsForm.Value);
|
||||
break;
|
||||
case "我的商品库":
|
||||
|
||||
@@ -189,15 +189,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
isNotCount = false;
|
||||
}
|
||||
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
int pageCount;
|
||||
var cancelToken = cancellationTokenSource.Token;
|
||||
|
||||
int pageCount;
|
||||
int totalCount;
|
||||
int pageSize = 100;
|
||||
decimal seconds;
|
||||
Invoke(new Action(() => { pageSize = this.ucSplitPage1.PageSize; }));
|
||||
var list = GetProductList(out pageCount, out totalCount, out seconds, page, pageSize, isNotCount);
|
||||
lstTemuDbProduct.AddRange(list);
|
||||
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
lstTemuDbProduct.AddRange(list);
|
||||
this.ucSplitPage1.TotalPage = pageCount;
|
||||
this.ucSplitPage1.TotalCount = totalCount;
|
||||
|
||||
@@ -211,6 +220,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
foreach (var prod in lstTemuDbProduct.Reverse().ToList())
|
||||
{
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
var catName = GetProdCateName(prod);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -270,7 +282,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}));
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
ShowDgvImg();
|
||||
this.pbLoading.Visible = false;
|
||||
@@ -280,7 +294,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
#endif
|
||||
this.statusBar.lblTaskStatus.Text += needKeepStatusText;
|
||||
}));
|
||||
});
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
public static string GetProdCateName(KJDDBProduct prod)
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace Work.Services
|
||||
public class CloudGoodsService
|
||||
{
|
||||
private const string ServerUrl = "http://119.45.4.202:14312";
|
||||
public static PageData<CloudGoods> GetGoods(GoodsSearchRequest request)
|
||||
public static async Task<PageData<CloudGoods>> GetGoods(GoodsSearchRequest request)
|
||||
{
|
||||
string data = JsonHelper.SerializeObject(request);
|
||||
var html = GetHtml.PostUtf8(ServerUrl + "/Goods/SearchGoods", data, "application/json");
|
||||
var html = await GetHtml.PostUtf8Async(ServerUrl + "/Goods/SearchGoods", data, "application/json");
|
||||
|
||||
var ret = JsonConvert.DeserializeObject<Result<PageData<CloudGoods>>>(html);
|
||||
if (ret.Code != 200)
|
||||
|
||||
Reference in new issue
Block a user