From 93d2956d95ce50938cdee6ca14593f82d26037f9 Mon Sep 17 00:00:00 2001 From: chfei Date: Mon, 21 Sep 2026 11:08:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E8=B4=A7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=BB=91=E5=AE=9A=E5=A4=9A=E6=AC=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProductForms/WXDBProdUploadForm.cs | 121 +++++++++--------- 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index b29e8f8..d5377c5 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -644,83 +644,67 @@ namespace TemuKJD.WXForms.ProductForms NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_checked_shop_dic", dicCheckedShopId); } - private void btnRefreshShop_Click(object sender, EventArgs e) + private async void btnRefreshShop_Click(object sender, EventArgs e) { pbLoadingShop.Visible = true; RefreshDbProdGroupAndCate(); RefreshShopLogin(); } - private void UserSelectDbProductForm_VisibleChanged(object sender, EventArgs e) + private async void UserSelectDbProductForm_VisibleChanged(object sender, EventArgs e) { if (Visible == true) { RefreshShopLogin(); updateAuthor(); - RefreshDbProdGroupAndCate(InitWaitingProductConfigBinding); + RefreshDbProdGroupAndCate(); + lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件"; if (!isInit) { - Task.Run(() => - { - foreach (var shop in GlobalConfig.ValidShopLoginList) - { - //if (shop.LoginStatus == "登录成功") - //{ - // var rst = WXPreSale.scanProductPreview(shop); - // if (!rst.Contains("\"code\":0") && !rst.Contains("\"success\":true")) - // { - // WXShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); - // } - //} - } - - }); + InitWaitingProductConfigBinding(); } - isInit = true; } } - private void RefreshDbProdGroupAndCate(Action call = null) + private async void RefreshDbProdGroupAndCate() { - Task.Run(() => + // 同时刷新下商品分组 + //string addUserName = BaseClass.UserAuthority.Contains("商品采集") ? ("admin," + BaseClass.UserName) : "admin"; + //if (BaseClass.GroupId != 3) + // addUserName = BaseClass.ParentAuthority.Contains("商品采集") ? ("admin," + BaseClass.ParentUserName) : "admin"; + //PDDDBProdListForm.GetPDDProductGroup(cmbGroupFilter, sourceType, "", addUserName); // 同时刷新下商品分组 + PDDDBProdListForm.GetPDDProductGroup(new List { cmbGroupFilter, }, "", "", "admin"); + if (BaseClass.UserAuthority.Contains("商品采集") || BaseClass.ParentAuthority.Contains("商品采集")) { - // 同时刷新下商品分组 - //string addUserName = BaseClass.UserAuthority.Contains("商品采集") ? ("admin," + BaseClass.UserName) : "admin"; - //if (BaseClass.GroupId != 3) - // addUserName = BaseClass.ParentAuthority.Contains("商品采集") ? ("admin," + BaseClass.ParentUserName) : "admin"; - //PDDDBProdListForm.GetPDDProductGroup(cmbGroupFilter, sourceType, "", addUserName); // 同时刷新下商品分组 - PDDDBProdListForm.GetPDDProductGroup(new List { cmbGroupFilter, }, "", "", "admin"); - if (BaseClass.UserAuthority.Contains("商品采集") || BaseClass.ParentAuthority.Contains("商品采集")) - { - Invoke(new Action(() => - { - //cmbGroupFilter.Items.Remove("用户" + mainUserName); - cmbGroupFilter.Items.Remove("--------"); - cmbGroupFilter.Items.Remove("我的商品"); - cmbGroupFilter.Items.Insert(0, "--------"); - cmbGroupFilter.Items.Insert(0, "我的商品"); - })); - } - GetPddProductCate(); Invoke(new Action(() => { - this.btnSwitchCatType.Text = "P"; - btnSwitchCatType_Click(null, null); - pbLoadingShop.Visible = false; - + //cmbGroupFilter.Items.Remove("用户" + mainUserName); + cmbGroupFilter.Items.Remove("--------"); + cmbGroupFilter.Items.Remove("我的商品"); + cmbGroupFilter.Items.Insert(0, "--------"); + cmbGroupFilter.Items.Insert(0, "我的商品"); })); - call?.Invoke(); + } + await GetPddProductCate(); + Invoke(new Action(() => + { + this.btnSwitchCatType.Text = "P"; + btnSwitchCatType_Click(null, null); + pbLoadingShop.Visible = false; - }); + })); + waiting_product_config.Assign(NaiBa.Util.Helper.ConfigHelper.LoadConfig(nameof(waiting_product_config))); + + //call?.Invoke(); } /// /// 获取商品所有类目 /// - void GetPddProductCate() + async Task GetPddProductCate() { var pddMainCats = GlobalConfig.PddCatList.Where(c => c.level == 1); var mainCatsText = string.Join(",", pddMainCats.Select(c => c.cat_name)) + "," + string.Join(",", pddMainCats.Select(c => c.cat_id)); @@ -729,9 +713,9 @@ namespace TemuKJD.WXForms.ProductForms var url = BaseClass.BuildObjString("product/get_pdd_product_cates"); var data = UserLogin.GetSignaturex(); - var html = GetHtml.PostUtf8(url, data); + var html = await GetHtml.PostUtf8Async(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) - html = GetHtml.PostUtf8(url, data); + html = await GetHtml.PostUtf8Async(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { BaseMsgForm.ShowError("商品类目获取失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); @@ -740,18 +724,6 @@ namespace TemuKJD.WXForms.ProductForms { pdd_product_cates = BaseRegex.GetStringJson(ref html, "data"); } - - //Invoke(new Action(() => - //{ - // if (cmbSourceType.Text.Trim() != "厂商直采" && cmbSourceType.Text.Trim() != "微信店采" && cmbSourceType.Text.Trim() != "微信小店") - // { - // fillPddCate(); - // } - // else - // { - // fillWxCate(); - // } - //})); } void fillPddCate() @@ -8287,5 +8259,34 @@ Content-Type: application/octet-stream get => GetValue(); set => SetValue(value); } + + public void Assign(WaitingProductConfig config) + { + if (config == null || ReferenceEquals(config, this)) return; + + IdFilter = config.IdFilter; + SearchGoodsName = config.SearchGoodsName; + SourceType = config.SourceType; + GroupFilter = config.GroupFilter; + Hot = config.Hot; + WxSafe = config.WxSafe; + CateFilter1 = config.CateFilter1; + CateFilter2 = config.CateFilter2; + CateFilter3 = config.CateFilter3; + Notes = config.Notes; + JstInitSet = config.JstInitSet; + AddCount = config.AddCount; + SkipQualification = config.SkipQualification; + RandomFissionProduct = config.RandomFissionProduct; + RandomFissionProductCount = config.RandomFissionProductCount; + WXComplateProd = config.WXComplateProd; + UpdateInDaysChecked = config.UpdateInDaysChecked; + UpdateInDays = config.UpdateInDays; + UpdateInDaysType = config.UpdateInDaysType; + FilterViewUvChecked = config.FilterViewUvChecked; + FilterViewUv = config.FilterViewUv; + FilterSaleCountNumChecked = config.FilterSaleCountNumChecked; + FilterSaleCountNum = config.FilterSaleCountNum; + } } }