diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index d38fdb6..d5369f7 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 815; + public static int VersionCount = 817; //public static int VersionCount = 613; /// diff --git a/AllBase/Model/Result/JSTListProductInfo.cs b/AllBase/Model/Result/JSTListProductInfo.cs index 11d25b8..64fdb63 100644 --- a/AllBase/Model/Result/JSTListProductInfo.cs +++ b/AllBase/Model/Result/JSTListProductInfo.cs @@ -114,6 +114,6 @@ namespace AllBase.Model.Result public KJDDBProduct dbProduct { get; set; } public string jstProductJson { get; set; } - public string getProductMsg { get; set; } + public string getProductMsg { get; set; } = ""; } } diff --git a/AllBase/Model/Result/ShopLoginInfo.cs b/AllBase/Model/Result/ShopLoginInfo.cs index 9e8d9dc..86d3854 100644 --- a/AllBase/Model/Result/ShopLoginInfo.cs +++ b/AllBase/Model/Result/ShopLoginInfo.cs @@ -29,6 +29,8 @@ namespace AllBase.Model.Result public string ShopToken { get; set; } public string Signature { get; set; } public string TouTiaoId { get; set; } + public string WxToken { get; set; } + public DateTime WxTokenExpire { get; set; } public string Cookies { get; set; } = ""; public string Cookies2 { get; set; } = ""; public string pddid { get; set; } diff --git a/AllBase/Model/Result/WXResult/WXShopTokenInfo.cs b/AllBase/Model/Result/WXResult/WXShopTokenInfo.cs index 6d1b7f7..f07d8e7 100644 --- a/AllBase/Model/Result/WXResult/WXShopTokenInfo.cs +++ b/AllBase/Model/Result/WXResult/WXShopTokenInfo.cs @@ -14,7 +14,7 @@ namespace AllBase.Model.Result.WXResult public int? markupRate { get; set; } // 10, public string accessToken { get; set; } // "100_cw6r7-hhGaLKG7ndv558eO_3z3-5PokAG8d0Y1vc3Rczd3FuIqkefdaqVj5CNtkCYtMbTYvhnwJ7-JkBVQVe9nE0KK5SBI8AlfA7E0_sTtqcwMqKAXoCj1X4h3sjZIMX84dboC-PfzlI0wh0ADHeAHDSVZ" public DateTime mdyTime { get; set; } - public bool isExpire { get { return mdyTime.AddMinutes(115) < DateTime.Now; } } + public bool isExpire { get { return mdyTime.AddMinutes(60) < DateTime.Now; } } } } diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index e0e678d..8957b1c 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -1787,7 +1787,7 @@ namespace KJD_Web.BLL.BXX { string tokens = rst["tokens"].ParseToString(); var mdyTime = Convert.ToDateTime(rst["mdy_time"]); - if (mdyTime.AddMinutes(115) < DateTime.Now) + if (mdyTime.AddMinutes(60) < DateTime.Now) { var tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", ""); if (!tokenRst.Contains("\"code\":0")) diff --git a/KJDService/KJD_WebService/KJD_WebService.csproj.user b/KJDService/KJD_WebService/KJD_WebService.csproj.user index 4bcdc04..c789fae 100644 --- a/KJDService/KJD_WebService/KJD_WebService.csproj.user +++ b/KJDService/KJD_WebService/KJD_WebService.csproj.user @@ -1,4 +1,4 @@ - + true diff --git a/TEMUKJD/BLL/PDDProdFormConverter.cs b/TEMUKJD/BLL/PDDProdFormConverter.cs index cb94c42..525fa8a 100644 --- a/TEMUKJD/BLL/PDDProdFormConverter.cs +++ b/TEMUKJD/BLL/PDDProdFormConverter.cs @@ -548,7 +548,7 @@ namespace TemuKJD.BLL prodInfo.detail.origin_country_name = ""; // 货号 prodInfo.detail.out_goods_sn = jstSecretCodeLst["goodsId"].ParseToString(); - // 货号直接替换成加密的,注意千万不要入库 + // 货号直接替换成加密的,注意千万不要再把这个ext_code入库 dbProd.ext_code = prodInfo.detail.out_goods_sn; if (prodInfo.detail.out_goods_sn.IsNullOrEmpty()) { diff --git a/TEMUKJD/BLL/WxApiBLL.cs b/TEMUKJD/BLL/WxApiBLL.cs index b600c2c..caf6cf0 100644 --- a/TEMUKJD/BLL/WxApiBLL.cs +++ b/TEMUKJD/BLL/WxApiBLL.cs @@ -1,5 +1,6 @@ using AllBase; using AllBase.Helper; +using AllBase.Model.Result; using AllBase.Model.Result.WXResult; using NaiBa.Util; using System; @@ -14,24 +15,51 @@ namespace TemuKJD.BLL { public class WxApiBLL { - public string GetWxToken() + public WXShopTokenInfo GetRandomWxToken() { - if (GlobalConfig.WxTokenList.Count == 0 || GlobalConfig.WxTokenList.Any(t => t.isExpire == true)) + if (GlobalConfig.WxTokenList.Count == 0 || GlobalConfig.WxTokenList.All(t => t.isExpire == true)) { var url = BaseClass.BuildPDDObjString("product/get_wx_tokens"); var data = UserLogin.GetSignaturex(); var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { - BaseMsgForm.ShowError("获取类目失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); - return ""; + BaseMsgForm.ShowError("获取授权失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); + return new WXShopTokenInfo(); } var tokenStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(html)["tokens"].FirstOrDefault()); GlobalConfig.WxTokenList = new ConcurrentList(); GlobalConfig.WxTokenList.AddRange(JsonHelper.DeserializeJsonToList(tokenStr)); + foreach (var token in GlobalConfig.WxTokenList) + { + token.mdyTime = Convert.ToDateTime(BaseRegex.GetStringJson(ref html, "mdy_time")); + } } - return GlobalConfig.WxTokenList.OrderBy(x => Guid.NewGuid()).FirstOrDefault()?.accessToken; + var tokenCount = GlobalConfig.WxTokenList.Where(t => t.isExpire != true).Count(); + + return GlobalConfig.WxTokenList.Where(t => t.isExpire != true).OrderBy(x => Guid.NewGuid()).FirstOrDefault(); + } + + public string GetShopWxToken(ShopLoginInfo shop) + { + if (string.IsNullOrEmpty(shop.WxToken) || DateTime.Now.AddMinutes(115) > shop.WxTokenExpire) + { + var url = BaseClass.BuildPDDObjString("product/get_shop_wx_token"); + var data = UserLogin.GetSignaturex(); + data += "&shop_id=" + shop.ShopId; + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + { + BaseMsgForm.ShowError("获取授权失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); + return ""; + } + var tokenStr = BaseRegex.GetStringJson(ref html, "token"); + var ExpireStr = BaseRegex.GetStringJson(ref html, "expire"); + shop.WxToken = tokenStr; + shop.WxTokenExpire = Convert.ToDateTime(ExpireStr); + } + return shop.WxToken; } } } diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs index 57e86ac..f2200a5 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs @@ -976,7 +976,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms private void btnGetAllCate_Click(object sender, EventArgs e) { - new WxApiBLL().GetWxToken(); + new WxApiBLL().GetRandomWxToken(); var url1 = BaseClass.BuildPDDObjString("product/get_wx_all_cate"); var data1 = UserLogin.GetSignaturex(); @@ -1055,7 +1055,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.statusBar.lblTaskStatus.Text = "正在识别微信类目 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count; })); // 获取微信accessToken - var token = new WxApiBLL().GetWxToken(); + var token = new WxApiBLL().GetRandomWxToken(); try { JObject obj = new JObject(); @@ -1073,7 +1073,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms { var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image"); var upDate = UserLogin.GetSignaturex(); - upDate += "&token=" + token; + upDate += "&token=" + token.accessToken; upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + img + "\"}"); var upDateRst = GetHtml.PostUtf8(urlImg, upDate); var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url"); @@ -1085,7 +1085,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms var url1 = BaseClass.BuildPDDObjString("product/wx_api_category_classify"); var data1 = UserLogin.GetSignaturex(); - data1 += "&token=" + token; + data1 += "&token=" + token.accessToken; data1 += "&post_data=" + GetHtml.UrlEncodeUtf8(post_data); var html1 = GetHtml.PostUtf8(url1, data1); var catId = BaseRegex.GetStringJson(ref html1, "cat_id"); @@ -1259,7 +1259,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms { continue; } - var prodDataStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(rst)["data"]); + var prodDataStr = ""; + try + { + var prodDataObj = JsonHelper.JObjectParse(rst)["data"]; + prodDataObj["spuCode"] = dbProd.ext_code; + prodDataStr = JsonHelper.SerializeObject(prodDataObj); + } + catch + { + continue; + } string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/addGoods"; var exportRst = WXHttpResponseBLL.e57PostResponse(url, prodDataStr, ""); Thread.Sleep(500); @@ -1394,7 +1404,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms var spuCodes = string.Join("\",\"", dbProdTmp20Lst.Select(p => p.ext_code)); // 原批量拉取,已废弃 "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?page_size=10"; // 按spuCode(ext_code)拉取 - string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get"; + string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?" + Randomx.GetId(100,999); string body = "{\"spuCodes\":[\"" + spuCodes + "\"]}"; var getRst = WXHttpResponseBLL.e57PostResponse(url, body, ""); Thread.Sleep(500); diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs index 96fde6d..13de8c5 100644 --- a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs @@ -133,7 +133,7 @@ namespace TemuKJD.ToolForms Task.Run(() => { string serverCookie = ""; - var url = BaseClass.BuildObjString("user/get_scm121_cookie"); + var url = BaseClass.BuildPDDObjString("user/get_scm121_cookie"); var data = UserLogin.GetSignaturex(); var result = GetHtml.PostUtf8(url, data); if (!result.Contains("\"code\":200")) @@ -231,7 +231,7 @@ namespace TemuKJD.ToolForms { List cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null)); - var url = BaseClass.BuildObjString("user/update_scm121_cookie"); + var url = BaseClass.BuildPDDObjString("user/update_scm121_cookie"); var data = UserLogin.GetSignaturex(); data += "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList)); var result = GetHtml.PostUtf8(url, data); @@ -537,14 +537,14 @@ namespace TemuKJD.ToolForms continue; var dbProd = prod.dbProduct; - if (prod.getProductMsg.Contains("入库成功") || prod.getProductMsg.Contains("已存在相同id商品")) + if (prod.getProductMsg.ParseToString().Contains("入库成功") || prod.getProductMsg.ParseToString().Contains("已存在相同id商品")) { if (!chkOverride.Checked) continue; } bool isExist = false; - var existUrl = BaseClass.BuildObjString("product/get_product_list"); + var existUrl = BaseClass.BuildPDDObjString("product/get_product_list"); string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId; string html = GetHtml.PostUtf8(existUrl, existData); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -564,12 +564,12 @@ namespace TemuKJD.ToolForms } //var SetPartnerSpuRst = ""; - var url = BaseClass.BuildObjString("product/add_product"); + var url = BaseClass.BuildPDDObjString("product/add_product"); if (isExist) { if (chkOverride.Checked) { - url = BaseClass.BuildObjString("product/mdy_product"); + url = BaseClass.BuildPDDObjString("product/mdy_product"); } else { @@ -743,11 +743,11 @@ namespace TemuKJD.ToolForms { if (prod.getProductMsg == "商品已存在,跳过详情采集") continue; - if (prod.getProductMsg.Contains("入库成功") || prod.getProductMsg.Contains("已存在相同id商品")) + if (prod.getProductMsg.ParseToString().Contains("入库成功") || prod.getProductMsg.ParseToString().Contains("已存在相同id商品")) continue; bool isExist = false; - var existUrl = BaseClass.BuildObjString("product/get_product_list"); + var existUrl = BaseClass.BuildPDDObjString("product/get_product_list"); string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId; string html = GetHtml.PostUtf8(existUrl, existData); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -918,7 +918,7 @@ namespace TemuKJD.ToolForms if (chkSkip.Checked) { bool isExist = false; - var existUrl = BaseClass.BuildObjString("product/get_product_list"); + var existUrl = BaseClass.BuildPDDObjString("product/get_product_list"); string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId; string html = GetHtml.PostUtf8(existUrl, existData); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs b/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs index 23c30e0..5d51103 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs @@ -31,20 +31,12 @@ System.Windows.Forms.TreeNode treeNode1 = 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("PDD产品库"); - System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("SKU替换图"); - System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("选品加价管理"); - System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("认领待上传"); - System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("库存上传"); - System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("商品核价"); - System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("超级权限管理", 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("超级权限管理", new System.Windows.Forms.TreeNode[] { treeNode1, treeNode2, treeNode3, - treeNode4, - treeNode5, - treeNode6, - treeNode7, - treeNode8}); + treeNode4}); this.panel1 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); @@ -141,20 +133,12 @@ treeNode2.Text = "超级用户管理"; treeNode3.Name = "PDD产品库"; treeNode3.Text = "PDD产品库"; - treeNode4.Name = "SKU替换图"; - treeNode4.Text = "SKU替换图"; - treeNode5.Name = "选品加价管理"; - treeNode5.Text = "选品加价管理"; - treeNode6.Name = "认领待上传"; - treeNode6.Text = "认领待上传"; - treeNode7.Name = "库存上传"; - treeNode7.Text = "库存上传"; - treeNode8.Name = "商品核价"; - treeNode8.Text = "商品核价"; - treeNode9.Name = "超级权限管理"; - treeNode9.Text = "超级权限管理"; + treeNode4.Name = "厂家商品采集"; + treeNode4.Text = "厂家商品采集"; + treeNode5.Name = "超级权限管理"; + treeNode5.Text = "超级权限管理"; this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode9}); + treeNode5}); this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); this.tv.Size = new System.Drawing.Size(140, 446); this.tv.TabIndex = 1; diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs b/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs index 02aa61e..628707f 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using TemuKJD.BaseForms; using TemuKJD.PDDForms.ProductSelectForms; +using TemuKJD.ToolForms; namespace TemuKJD.WXForms.AdminForms { @@ -19,7 +20,7 @@ namespace TemuKJD.WXForms.AdminForms public Lazy adminAccountForm = new Lazy(); public Lazy adminShopForm = new Lazy(); public Lazy pddDbProdListForm = new Lazy(); - //public Lazy dbProdImgListForm = new Lazy(); + public Lazy getJuShuitanProdForm = new Lazy(); public WXAdminForm() { @@ -66,24 +67,24 @@ namespace TemuKJD.WXForms.AdminForms if (e.Node.Parent == null) return; //new Thread(() => //{ - //Thread.Sleep(200); - //Invoke(new Action(() => - //{ - switch (e.Node.Name) - { - case "超级用户管理": - SetForm(adminAccountForm.Value); - break; - case "超级店铺管理": - SetForm(adminShopForm.Value); - break; - case "PDD产品库": - SetForm(pddDbProdListForm.Value); - break; - //case "SKU替换图": - // SetForm(dbProdImgListForm.Value); - // break; - } + //Thread.Sleep(200); + //Invoke(new Action(() => + //{ + switch (e.Node.Name) + { + case "超级用户管理": + SetForm(adminAccountForm.Value); + break; + case "超级店铺管理": + SetForm(adminShopForm.Value); + break; + case "PDD产品库": + SetForm(pddDbProdListForm.Value); + break; + case "厂家商品采集": + SetForm(getJuShuitanProdForm.Value); + break; + } //})); //}).Start(); } diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.Designer.cs b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.Designer.cs index 3689bd6..d67ea1d 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.Designer.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.Designer.cs @@ -87,6 +87,7 @@ namespace TemuKJD.WXForms.AdminForms this.colShopOperate = new System.Windows.Forms.DataGridViewLinkColumn(); this.colRelogin = new System.Windows.Forms.DataGridViewLinkColumn(); this.colRelogin2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colBuyApi = new System.Windows.Forms.DataGridViewLinkColumn(); this.colMultiLogin = new System.Windows.Forms.DataGridViewLinkColumn(); this.colApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); this.colBuyApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); @@ -543,6 +544,7 @@ namespace TemuKJD.WXForms.AdminForms this.colShopOperate, this.colRelogin, this.colRelogin2, + this.colBuyApi, this.colMultiLogin, this.colApiAuth, this.colBuyApiAuth, @@ -743,7 +745,7 @@ namespace TemuKJD.WXForms.AdminForms // // colRelogin // - this.colRelogin.FillWeight = 40F; + this.colRelogin.FillWeight = 46F; this.colRelogin.HeaderText = "登录"; this.colRelogin.Name = "colRelogin"; this.colRelogin.ReadOnly = true; @@ -758,6 +760,15 @@ namespace TemuKJD.WXForms.AdminForms this.colRelogin2.ReadOnly = true; this.colRelogin2.Visible = false; // + // colBuyApi + // + this.colBuyApi.FillWeight = 46F; + this.colBuyApi.HeaderText = "API购买"; + this.colBuyApi.Name = "colBuyApi"; + this.colBuyApi.ReadOnly = true; + this.colBuyApi.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colBuyApi.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // // colMultiLogin // this.colMultiLogin.FillWeight = 52F; @@ -931,6 +942,7 @@ namespace TemuKJD.WXForms.AdminForms private System.Windows.Forms.DataGridViewLinkColumn colShopOperate; private System.Windows.Forms.DataGridViewLinkColumn colRelogin; private System.Windows.Forms.DataGridViewTextBoxColumn colRelogin2; + private System.Windows.Forms.DataGridViewLinkColumn colBuyApi; private System.Windows.Forms.DataGridViewLinkColumn colMultiLogin; private System.Windows.Forms.DataGridViewLinkColumn colApiAuth; private System.Windows.Forms.DataGridViewLinkColumn colBuyApiAuth; diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs index df2aa1c..ec979a7 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs @@ -130,6 +130,7 @@ namespace TemuKJD.WXForms.AdminForms "检测", string.IsNullOrWhiteSpace(shop.LoginStatus) ? "未登录" : shop.LoginStatus.Trim(), string.IsNullOrWhiteSpace(shop.LoginStatus2) ? "国际版未登录" : shop.LoginStatus2.Trim(), + "购买", "多重登录", shop.ApiAuthStatus, shop.BuyApiAuth.ApiAuthStatus, @@ -232,6 +233,15 @@ namespace TemuKJD.WXForms.AdminForms } IsOperate = false; break; + case "API购买": + { + WXAdminShopLoginForm shopLoginForm = new WXAdminShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=3984039898079707139"; + shopLoginForm.Show(); + } + break; case "复制Cookie": List cooks = null; try { cooks = JsonHelper.DeserializeJsonToList(shop.Cookies); } catch (Exception ex) { } diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.resx b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.resx index bf45c0b..117b3c0 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.resx +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.resx @@ -177,6 +177,9 @@ True + + True + True diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs index 3841d9c..0eaee95 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs @@ -45,9 +45,10 @@ this.btnReload = new TemuKJD.UserControls.ButtonEx(); this.chkCloseAfterLogin = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); - this.txtAddress = new System.Windows.Forms.TextBox(); this.btnNext = new System.Windows.Forms.Button(); this.btnPrev = new System.Windows.Forms.Button(); + this.txtAddress = new System.Windows.Forms.TextBox(); + this.btnOpenOrder = new TemuKJD.UserControls.ButtonEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -76,6 +77,7 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.btnOpenOrder); this.splitContainer1.Panel2.Controls.Add(this.btnLoginAgain); this.splitContainer1.Panel2.Controls.Add(this.label2); this.splitContainer1.Panel2.Controls.Add(this.label1); @@ -87,7 +89,7 @@ this.splitContainer1.Panel2.Controls.Add(this.btnReload); this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin); this.splitContainer1.Size = new System.Drawing.Size(1438, 736); - this.splitContainer1.SplitterDistance = 670; + this.splitContainer1.SplitterDistance = 671; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -325,17 +327,6 @@ this.splitContainer2.SplitterDistance = 26; this.splitContainer2.TabIndex = 5; // - // txtAddress - // - this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtAddress.Location = new System.Drawing.Point(67, 3); - this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.txtAddress.Name = "txtAddress"; - this.txtAddress.Size = new System.Drawing.Size(1368, 23); - this.txtAddress.TabIndex = 7; - this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown); - // // btnNext // this.btnNext.Location = new System.Drawing.Point(34, 2); @@ -356,6 +347,34 @@ this.btnPrev.UseVisualStyleBackColor = true; this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click); // + // txtAddress + // + this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtAddress.Location = new System.Drawing.Point(67, 3); + this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.txtAddress.Name = "txtAddress"; + this.txtAddress.Size = new System.Drawing.Size(1368, 23); + this.txtAddress.TabIndex = 7; + this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown); + // + // btnOpenOrder + // + this.btnOpenOrder.Anchor = System.Windows.Forms.AnchorStyles.None; + this.btnOpenOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnOpenOrder.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnOpenOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnOpenOrder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOpenOrder.ForeColor = System.Drawing.Color.White; + this.btnOpenOrder.Location = new System.Drawing.Point(648, 19); + this.btnOpenOrder.Margin = new System.Windows.Forms.Padding(2); + this.btnOpenOrder.Name = "btnOpenOrder"; + this.btnOpenOrder.Size = new System.Drawing.Size(143, 25); + this.btnOpenOrder.TabIndex = 465; + this.btnOpenOrder.Text = "登录订单系统"; + this.btnOpenOrder.UseVisualStyleBackColor = false; + this.btnOpenOrder.Click += new System.EventHandler(this.btnOpenOrder_Click); + // // WXAdminShopLoginForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -406,5 +425,6 @@ private DevComponents.DotNetBar.PanelEx btnDel; private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnPrev; + public UserControls.ButtonEx btnOpenOrder; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs index e9f32d9..5426955 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs @@ -909,5 +909,15 @@ function getElementWithText(sText) { cefWebBrowser.Forward(); } + + private void btnOpenOrder_Click(object sender, EventArgs e) + { + WXAdminShopLoginForm shopLoginForm = new WXAdminShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.InitUrl = "https://po.e57.cn/login?redirect=%2Findex"; + shopLoginForm.btnOpenOrder.Visible = false; + shopLoginForm.Show(); + } } } diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs index 554e3a4..247bbc1 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs @@ -32,14 +32,15 @@ namespace TemuKJD.WXForms.ProductForms private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.chkImgRandomBlock = new TemuKJD.UserComponent.UcCheckBox(this.components); this.txtShippingPriceTimes = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); @@ -216,8 +217,10 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.ucGroupBoxEx2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx2.Controls.Add(this.chkImgRandomBlock); this.ucGroupBoxEx2.Controls.Add(this.txtShippingPriceTimes); this.ucGroupBoxEx2.Controls.Add(this.label13); this.ucGroupBoxEx2.Controls.Add(this.label18); @@ -257,12 +260,23 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "商品上传"; // - // txtShippingPrice + // chkImgRandomBlock + // + this.chkImgRandomBlock.AutoSize = true; + this.chkImgRandomBlock.Location = new System.Drawing.Point(621, 16); + this.chkImgRandomBlock.Name = "chkImgRandomBlock"; + this.chkImgRandomBlock.Size = new System.Drawing.Size(123, 21); + this.chkImgRandomBlock.TabIndex = 821; + this.chkImgRandomBlock.Text = "图书图片随机打码"; + this.chkImgRandomBlock.UseVisualStyleBackColor = true; + this.chkImgRandomBlock.Visible = false; + // + // txtShippingPriceTimes // this.txtShippingPriceTimes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.txtShippingPriceTimes.Location = new System.Drawing.Point(344, 128); this.txtShippingPriceTimes.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); - this.txtShippingPriceTimes.Name = "txtShippingPrice"; + this.txtShippingPriceTimes.Name = "txtShippingPriceTimes"; this.txtShippingPriceTimes.Size = new System.Drawing.Size(32, 23); this.txtShippingPriceTimes.TabIndex = 810; this.txtShippingPriceTimes.Text = "1.5"; @@ -281,7 +295,7 @@ namespace TemuKJD.WXForms.ProductForms // label18 // this.label18.AutoSize = true; - this.label18.Location = new System.Drawing.Point(576, 120); + this.label18.Location = new System.Drawing.Point(576, 131); this.label18.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(54, 17); @@ -290,7 +304,7 @@ namespace TemuKJD.WXForms.ProductForms // // txtPreDays // - this.txtPreDays.Location = new System.Drawing.Point(543, 117); + this.txtPreDays.Location = new System.Drawing.Point(543, 128); this.txtPreDays.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.txtPreDays.Name = "txtPreDays"; this.txtPreDays.Size = new System.Drawing.Size(33, 23); @@ -301,7 +315,7 @@ namespace TemuKJD.WXForms.ProductForms // chkPreSale // this.chkPreSale.AutoSize = true; - this.chkPreSale.Location = new System.Drawing.Point(451, 118); + this.chkPreSale.Location = new System.Drawing.Point(451, 129); this.chkPreSale.Name = "chkPreSale"; this.chkPreSale.Size = new System.Drawing.Size(99, 21); this.chkPreSale.TabIndex = 789; @@ -314,7 +328,7 @@ namespace TemuKJD.WXForms.ProductForms this.chkSkipUploaded.AutoSize = true; this.chkSkipUploaded.Checked = true; this.chkSkipUploaded.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkSkipUploaded.Location = new System.Drawing.Point(451, 91); + this.chkSkipUploaded.Location = new System.Drawing.Point(451, 105); this.chkSkipUploaded.Name = "chkSkipUploaded"; this.chkSkipUploaded.Size = new System.Drawing.Size(135, 21); this.chkSkipUploaded.TabIndex = 755; @@ -327,7 +341,7 @@ namespace TemuKJD.WXForms.ProductForms this.chkSameSpecPrice.AutoSize = true; this.chkSameSpecPrice.Checked = true; this.chkSameSpecPrice.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkSameSpecPrice.Location = new System.Drawing.Point(576, 41); + this.chkSameSpecPrice.Location = new System.Drawing.Point(576, 40); this.chkSameSpecPrice.Name = "chkSameSpecPrice"; this.chkSameSpecPrice.Size = new System.Drawing.Size(99, 21); this.chkSameSpecPrice.TabIndex = 745; @@ -367,10 +381,13 @@ namespace TemuKJD.WXForms.ProductForms // // txtReplaceText // - this.txtReplaceText.Location = new System.Drawing.Point(578, 65); + this.txtReplaceText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtReplaceText.Location = new System.Drawing.Point(517, 63); this.txtReplaceText.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.txtReplaceText.Multiline = true; this.txtReplaceText.Name = "txtReplaceText"; - this.txtReplaceText.Size = new System.Drawing.Size(285, 23); + this.txtReplaceText.Size = new System.Drawing.Size(328, 40); this.txtReplaceText.TabIndex = 740; this.txtReplaceText.Text = "真丝,蚕丝,香云纱,羊绒,羊毛,羊羔绒,羊羔毛,羽绒,皮草"; this.txtReplaceText.TextChanged += new System.EventHandler(this.txtReplaceText_TextChanged); @@ -378,17 +395,17 @@ namespace TemuKJD.WXForms.ProductForms // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(448, 68); + this.label3.Location = new System.Drawing.Point(448, 66); this.label3.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(140, 17); + this.label3.Size = new System.Drawing.Size(80, 17); this.label3.TabIndex = 741; - this.label3.Text = "移除标题介绍中的词语:"; + this.label3.Text = "移除敏感词:"; // // chkUpDraft // this.chkUpDraft.AutoSize = true; - this.chkUpDraft.Location = new System.Drawing.Point(592, 91); + this.chkUpDraft.Location = new System.Drawing.Point(590, 105); this.chkUpDraft.Name = "chkUpDraft"; this.chkUpDraft.Size = new System.Drawing.Size(99, 21); this.chkUpDraft.TabIndex = 769; @@ -401,7 +418,7 @@ namespace TemuKJD.WXForms.ProductForms this.chkHighestPriceSku.AutoSize = true; this.chkHighestPriceSku.Checked = true; this.chkHighestPriceSku.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkHighestPriceSku.Location = new System.Drawing.Point(451, 41); + this.chkHighestPriceSku.Location = new System.Drawing.Point(451, 40); this.chkHighestPriceSku.Name = "chkHighestPriceSku"; this.chkHighestPriceSku.Size = new System.Drawing.Size(119, 21); this.chkHighestPriceSku.TabIndex = 739; @@ -801,22 +818,24 @@ namespace TemuKJD.WXForms.ProductForms this.btnFilterBound.Cursor = System.Windows.Forms.Cursors.Hand; this.btnFilterBound.DisabledBackColor = System.Drawing.Color.Empty; this.btnFilterBound.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnFilterBound.Location = new System.Drawing.Point(264, 101); + this.btnFilterBound.Location = new System.Drawing.Point(264, 100); this.btnFilterBound.Name = "btnFilterBound"; - this.btnFilterBound.Size = new System.Drawing.Size(42, 21); + this.btnFilterBound.Size = new System.Drawing.Size(58, 23); this.btnFilterBound.Style.Alignment = System.Drawing.StringAlignment.Center; this.btnFilterBound.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnFilterBound.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnFilterBound.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.btnFilterBound.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; this.btnFilterBound.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnFilterBound.Style.CornerDiameter = 3; + this.btnFilterBound.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; this.btnFilterBound.Style.ForeColor.Color = System.Drawing.Color.White; this.btnFilterBound.Style.GradientAngle = 90; this.btnFilterBound.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; this.btnFilterBound.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); this.btnFilterBound.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); this.btnFilterBound.TabIndex = 726; - this.btnFilterBound.Text = "过滤"; + this.btnFilterBound.Text = "立即过滤"; this.btnFilterBound.Click += new System.EventHandler(this.btnFilterBound_Click); // // label12 @@ -861,7 +880,7 @@ namespace TemuKJD.WXForms.ProductForms // txtExtCodeFilter // this.txtExtCodeFilter.Font = new System.Drawing.Font("微软雅黑", 10F); - this.txtExtCodeFilter.Location = new System.Drawing.Point(310, 72); + this.txtExtCodeFilter.Location = new System.Drawing.Point(309, 72); this.txtExtCodeFilter.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtExtCodeFilter.Name = "txtExtCodeFilter"; this.txtExtCodeFilter.Size = new System.Drawing.Size(92, 25); @@ -881,7 +900,7 @@ namespace TemuKJD.WXForms.ProductForms // cmbGroupFilter // this.cmbGroupFilter.FormattingEnabled = true; - this.cmbGroupFilter.Location = new System.Drawing.Point(48, 72); + this.cmbGroupFilter.Location = new System.Drawing.Point(47, 72); this.cmbGroupFilter.Name = "cmbGroupFilter"; this.cmbGroupFilter.Size = new System.Drawing.Size(92, 25); this.cmbGroupFilter.TabIndex = 641; @@ -890,7 +909,7 @@ namespace TemuKJD.WXForms.ProductForms // txtIdFilter // this.txtIdFilter.Font = new System.Drawing.Font("微软雅黑", 10F); - this.txtIdFilter.Location = new System.Drawing.Point(179, 72); + this.txtIdFilter.Location = new System.Drawing.Point(178, 72); this.txtIdFilter.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtIdFilter.Name = "txtIdFilter"; this.txtIdFilter.Size = new System.Drawing.Size(92, 25); @@ -913,7 +932,7 @@ namespace TemuKJD.WXForms.ProductForms // lblIdFilter // this.lblIdFilter.AutoSize = true; - this.lblIdFilter.Location = new System.Drawing.Point(159, 76); + this.lblIdFilter.Location = new System.Drawing.Point(158, 76); this.lblIdFilter.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.lblIdFilter.Name = "lblIdFilter"; this.lblIdFilter.Size = new System.Drawing.Size(21, 17); @@ -933,7 +952,7 @@ namespace TemuKJD.WXForms.ProductForms // lblExtCodeFilter // this.lblExtCodeFilter.AutoSize = true; - this.lblExtCodeFilter.Location = new System.Drawing.Point(279, 76); + this.lblExtCodeFilter.Location = new System.Drawing.Point(278, 76); this.lblExtCodeFilter.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.lblExtCodeFilter.Name = "lblExtCodeFilter"; this.lblExtCodeFilter.Size = new System.Drawing.Size(32, 17); @@ -1376,19 +1395,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.dgvShop.AutoRowNumber = true; this.dgvShop.BackgroundColor = System.Drawing.Color.White; this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -1586,19 +1605,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvSelectProduct.AllowUserToAddRows = false; this.dgvSelectProduct.AllowUserToDeleteRows = false; - dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; this.dgvSelectProduct.AutoRowNumber = true; this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White; this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colCheck, @@ -1658,8 +1677,8 @@ namespace TemuKJD.WXForms.ProductForms // // colSupplierName // - dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle11; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5; this.colSupplierName.Frozen = true; this.colSupplierName.HeaderText = "店铺名称"; this.colSupplierName.Name = "colSupplierName"; @@ -1737,8 +1756,8 @@ namespace TemuKJD.WXForms.ProductForms // // colProductName // - dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle12; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle6; this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; @@ -2076,5 +2095,6 @@ namespace TemuKJD.WXForms.ProductForms private System.Windows.Forms.TextBox txtFilterShopNotes; private System.Windows.Forms.Label label16; private DevComponents.DotNetBar.PanelEx btnEmptyShop; + private UserComponent.UcCheckBox chkImgRandomBlock; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index 2fa0c71..ef8e49a 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -49,6 +49,11 @@ namespace TemuKJD.WXForms.ProductForms public Dictionary dicCheckedShopId = new Dictionary(); public Dictionary dicShopUpload = new Dictionary(); public string pdd_product_cates = ""; + public List forceFilteKeyWords = new List() + { + "亏本", "冲量", "白菜价", "跳楼价", "xxx", "xx", "最大", "最小", "低价", "降价", "成本", "赔钱", "甩卖", + "真丝", "蚕丝", "香云纱", "羊绒", "羊毛", "羊羔绒", "羊羔毛", "羽绒", "皮草" + }; public WXDBProdUploadForm() { InitializeComponent(); @@ -137,6 +142,10 @@ namespace TemuKJD.WXForms.ProductForms wxUploadRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig("wx_upload_rule"); if (wxUploadRule == null) wxUploadRule = new WXUploadRule(); + var filteWords = wxUploadRule.FilterWords.Split(new string[] { ",", ",", " ", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); + filteWords.RemoveAll(w => forceFilteKeyWords.Contains(w)); + filteWords.AddRange(forceFilteKeyWords); + wxUploadRule.FilterWords = string.Join(",", filteWords); this.txtPreDays.TextChanged -= txtPreDays_TextChanged; this.txtReplaceText.TextChanged -= txtReplaceText_TextChanged; this.txtMinPrice.TextChanged -= txtMinPrice_TextChanged; @@ -187,14 +196,6 @@ namespace TemuKJD.WXForms.ProductForms dgvSelectProduct.Columns["colSkuFakeImg"].Visible = false; -// if (BaseClass.SaLevel == 1) -// { -// dgvSelectProduct.Columns["colSkuFakeImg"].Visible = true; -// } -//#if DEBUG -// dgvSelectProduct.Columns["colSkuFakeImg"].Visible = true; -//#endif - upload_draft_product_lst = NaiBa.Util.Helper.ConfigHelper.LoadConfig>("wx_select_upload_draft_products"); if (upload_draft_product_lst == null) upload_draft_product_lst = new ConcurrentList(); @@ -208,15 +209,15 @@ namespace TemuKJD.WXForms.ProductForms selectProd.shop_account, "登录", "进店", - selectProd.spu_id, + BaseClass.SaLevel > 0 ? selectProd.spu_id : selectProd.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'), selectProd.skc_id, selectProd.main_img, - null, + DataGridViewExtension.defaultBitmap, "", null, selectProd.product_name, // 用户端显示商品原名 selectProd.cat_name, - selectProd.ext_code, + BaseClass.SaLevel > 0 ? selectProd.ext_code : selectProd.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'), selectProd.status, selectProd.draft_id, selectProd.notes, @@ -234,6 +235,24 @@ namespace TemuKJD.WXForms.ProductForms } } +#if DEBUG + if (BaseClass.SaLevel == 1) + { + txtIdFilter.Visible = true; + txtExtCodeFilter.Visible = true; + cmbSourceType.Visible = true; + cmbGroupFilter.Visible = true; + lblIdFilter.Visible = true; + lblExtCodeFilter.Visible = true; + lblSourceType.Visible = true; + lblGroupFilter.Visible = true; + } +#endif + if (BaseClass.SaLevel == 1) + { + chkImgRandomBlock.Visible = true; + } + IsLoadComplate = true; } @@ -661,7 +680,7 @@ namespace TemuKJD.WXForms.ProductForms } if (cancellationTokenSource.IsCancellationRequested) break; - while (currentShopList.Count >= 5) // 最多5店同传 + while (currentShopList.Count >= 20) // 最多20店同传 { Thread.Sleep(100); } @@ -729,7 +748,7 @@ namespace TemuKJD.WXForms.ProductForms var lstTitleReplaceText = new List(); lstTitleReplaceText.Clear(); if (!txtReplaceText.Text.Trim().IsNullOrEmpty()) - lstTitleReplaceText.AddRange(txtReplaceText.Text.Trim().Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)); + lstTitleReplaceText.AddRange(txtReplaceText.Text.Trim().Split(new string[] { ",", ",", " ", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries)); // 过滤标题内指定词语 if (lstTitleReplaceText.Count > 0) { @@ -749,15 +768,15 @@ namespace TemuKJD.WXForms.ProductForms selectProd.shop_account, "登录", "进店", - selectProd.spu_id, + BaseClass.SaLevel > 0 ? selectProd.spu_id : selectProd.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'), selectProd.skc_id, selectProd.main_img, - null, + DataGridViewExtension.defaultBitmap, "", null, selectProd.product_name, // 用户端显示商品原名 selectProd.cat_name, - selectProd.ext_code, + BaseClass.SaLevel > 0 ? selectProd.ext_code : selectProd.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'), selectProd.status, selectProd.draft_id, selectProd.notes, @@ -881,8 +900,8 @@ namespace TemuKJD.WXForms.ProductForms var timeSpan = DateTime.Now - startTime; duration = timeSpan.TotalSeconds; - // 至少15秒才完成一件商品 - while (duration < 15) + // 至少10秒才完成一件商品 + while (duration < 10) { Thread.Sleep(1000); timeSpan = DateTime.Now - startTime; @@ -1051,8 +1070,8 @@ namespace TemuKJD.WXForms.ProductForms var lstTitleReplaceText = new List(); lstTitleReplaceText.Clear(); if (!txtReplaceText.Text.Trim().IsNullOrEmpty()) - lstTitleReplaceText.AddRange(txtReplaceText.Text.Trim().Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)); - // 过滤标题内指定词语 + lstTitleReplaceText.AddRange(txtReplaceText.Text.Trim().Split(new string[] { ",", ",", " ", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries)); + // 过滤标题敏感词 if (lstTitleReplaceText.Count > 0) { foreach (var txt in lstTitleReplaceText) @@ -1094,6 +1113,29 @@ namespace TemuKJD.WXForms.ProductForms // 替换编辑过的sku if (!string.IsNullOrEmpty(dbProd.sku_edit_json)) prodJObj["detail"]["sku"] = JArray.Parse(JsonHelper.SerializeObject(JsonHelper.DeserializeJsonToList(dbProd.sku_edit_json))); + // 过滤sku敏感词 + if (lstTitleReplaceText.Count> 0) + { + var skuJArr = prodJObj["detail"]["sku"] as JArray; + try + { + foreach (var skuJObj in skuJArr) + { + var specJArr = skuJObj["spec"] as JArray; + for (int i = 0; i < specJArr.Count; i++) + { + foreach (var txt in lstTitleReplaceText) + { + specJArr[i]["spec_name"] = specJArr[i]["spec_name"].ParseToString().Replace(txt, ""); + } + } + } + } + catch (Exception ex) + { + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品数据初始化失败" + ex.Message + "\"}"; + } + } if (chkSameSpecPrice.Checked) { var priceTextLst = dbProd.price_text.Split('-'); @@ -1243,7 +1285,9 @@ namespace TemuKJD.WXForms.ProductForms var upProdInitParam = new WXUploadProductInitParam(); // 生成上传商品对象 var upProdParam = new WXUploadProductParam(); - + // 随机获取一个上传图片的accessToken + var token = new WxApiBLL().GetRandomWxToken(); + // 设置标题 upProdInitParam.product.info.title = dbProd.product_name.IsNullOrEmpty() ? prodInfo.detail.goods_name : dbProd.product_name; upProdParam.product.info.title = dbProd.product_name.IsNullOrEmpty() ? prodInfo.detail.goods_name : dbProd.product_name; @@ -1266,21 +1310,46 @@ namespace TemuKJD.WXForms.ProductForms } Thread.Sleep(Randomx.GetId(500, 800)); - //------------------------------------------------------------------------------------------------------------------------------------- - // ai识别类目暂存主图位置 - int imgId = 0; - string tempImgPath = Path.GetTempPath() + "\\"; - string folderLetters = "abcdefghijklmnopqrstuvwxyz1234567890"; - for (int i = 0; i < 8; i++) - { - tempImgPath += folderLetters[Randomx.GetId(folderLetters.Length)]; - } - List tempImgFullPathLst = new List(); - - //------------------------------------------------------------------------------------------------------------------------------------- - // 上传主图 + //上传主图 foreach (var gallery_item in prodInfo.detail.galleries.Where(g => g.type == 1).Take(9)) // 9张主图 { + try + { + if (chkImgRandomBlock.Checked && (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸" || + dbProd.main_cat_name == "图书" || dbProd.main_cat_name == "书籍/杂志/报纸")) + { + // 图书暂时要加差异化主图,走不了api + } + else + { + // 使用接口链接传图 + var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image"); + var upDate = UserLogin.GetSignaturex(); + upDate += "&token=" + token.accessToken; + upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + gallery_item.url.Replace("https://", "http://") + "\"}"); + var upDateRst = GetHtml.PostUtf8(urlImg, upDate); + for (int i = 0; i < 5 && upDateRst.Contains("access_token expired"); i++) + { + token.mdyTime = DateTime.Now.AddDays(-100); + token = new WxApiBLL().GetRandomWxToken(); + upDateRst = GetHtml.PostUtf8(urlImg, upDate); + } + var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url"); + if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl)) + { + upProdInitParam.product.info.headImg.Add(upImgUrl); + upProdParam.product.info.headImg.Add(upImgUrl); + continue; + } + else + { + } + } + } + catch + { + } + var upImgAuthRst = WXUpload.getUploadTempImgAuth(shop); for (int i = 0; i < 10 && upImgAuthRst.Contains("LogicError"); i++) { @@ -1317,38 +1386,13 @@ namespace TemuKJD.WXForms.ProductForms using (Graphics g = Graphics.FromImage(imageBg)) { g.DrawImage(image, new Rectangle(0, 0, imageBg.Width, imageBg.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); - if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") + if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸" || + dbProd.main_cat_name == "图书" || dbProd.main_cat_name == "书籍/杂志/报纸") { - g.FillRectangle(new SolidBrush(Color.FromArgb(Randomx.GetId(256), Randomx.GetId(256), Randomx.GetId(256))), new Rectangle(Randomx.GetId(imageBg.Width - 30), Randomx.GetId(imageBg.Height - 30), 30, 30)); } } - - // 取前三张图片保存到系统temp路径,配合商品标题获取商品类目 - if (imgId < 3) - { - imgId++; - if (!Directory.Exists(tempImgPath)) - Directory.CreateDirectory(tempImgPath); - string imgFullPath = tempImgPath + "\\图片" + imgId + ".jpg"; - tempImgFullPathLst.Add(imgFullPath); - if (imgId == 1) - image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg); - else - { - // 只需要传一张真实图像即可 - int fileSize = Randomx.GetId(1024, 10240); - using (BinaryWriter writer = new BinaryWriter(File.Create(imgFullPath))) - { - for (int i = 0; i < fileSize; i++) - { - writer.Write((byte)Randomx.GetId(256)); // 生成0到255之间的随机字节 - } - } - } - } - using (MemoryStream memoryStream = new MemoryStream()) { imageBg.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg); @@ -1377,6 +1421,56 @@ namespace TemuKJD.WXForms.ProductForms Thread.Sleep(Randomx.GetId(10, 50)); } + //------------------------------------------------------------------------------------------------------------------------------------- + // ai识别类目暂存主图位置 + int imgId = 0; + string tempImgPath = Path.GetTempPath() + "\\"; + string folderLetters = "abcdefghijklmnopqrstuvwxyz1234567890"; + for (int i = 0; i < 8; i++) + { + tempImgPath += folderLetters[Randomx.GetId(folderLetters.Length)]; + } + List tempImgFullPathLst = new List(); + //------------------------------------------------------------------------------------------------------------------------------------- + // 生成ai识别类目所需图片 + foreach (var gallery_item in prodInfo.detail.galleries.Where(g => g.type == 1).Take(3)) // 9张主图 + { + string getImgError; + var image = GetHtml.GetUrlImg(gallery_item.url.Replace("https://", "http://"), out getImgError); + var imageBg = new Bitmap(800, 800); + if (!string.IsNullOrEmpty(getImgError) || image == null) + { + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"初始化主图上传失败\"}"; + } + using (Graphics g = Graphics.FromImage(imageBg)) + { + g.DrawImage(image, new Rectangle(0, 0, imageBg.Width, imageBg.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + } + + // 取前三张图片保存到系统temp路径,配合商品标题获取商品类目 + if (imgId <= 3) + { + if (!Directory.Exists(tempImgPath)) + Directory.CreateDirectory(tempImgPath); + string imgFullPath = tempImgPath + "\\图片" + imgId + ".jpg"; + tempImgFullPathLst.Add(imgFullPath); + if (imgId == 1) + image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg); + else + { + // 只需要传一张真实图像即可 + int fileSize = Randomx.GetId(1024, 10240); + using (BinaryWriter writer = new BinaryWriter(File.Create(imgFullPath))) + { + for (int i = 0; i < fileSize; i++) + { + writer.Write((byte)Randomx.GetId(256)); // 生成0到255之间的随机字节 + } + } + } + } + } + if (cell != null) { Invoke(new Action(() => @@ -1435,8 +1529,15 @@ namespace TemuKJD.WXForms.ProductForms return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"" + "根据图片获取类目失败 " + ex.Message + "\"}"; } - // 检测是否有类目上传权限 + // 获取叶子类目id long leafCatId = (upProdParam.product.info.category.LastOrDefault()?.catId).ParseToLong(); //哲学经典著作 + var bound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id == leafCatId); + if (bound == null) + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"获取类目保证金失败\"}"; + if (bound.cat_bound > txtFilterBound.Text.Trim().ParseToInt()) + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目保证金(" + bound.cat_bound + ")超过过滤限制(" + txtFilterBound.Text.Trim().ParseToInt() + ")\"}"; + + // 检测是否有类目上传权限 var cateUpCheckRst = WXUpload.batchCheckCategoryRelation(shop, leafCatId); if (!cateUpCheckRst.Contains("\"code\":0") && !cateUpCheckRst.Contains("\"success\":true")) { @@ -1703,8 +1804,39 @@ namespace TemuKJD.WXForms.ProductForms var detailGalleries = prodInfo.detail.galleries.Where(g => g.type == 2).ToList(); if (detailGalleries.Count == 0) detailGalleries.Add(new gallery_item() { type = 2, url = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1)?.url }); + foreach (var gallery_item in detailGalleries) { + if (chkImgRandomBlock.Checked && (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸" || + dbProd.main_cat_name == "图书" || dbProd.main_cat_name == "书籍/杂志/报纸")) + { + // 图书暂时要加差异化详情图,走不了api + } + else + { + // 使用接口链接传图 + var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image"); + var upDate = UserLogin.GetSignaturex(); + upDate += "&token=" + token.accessToken; + upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + gallery_item.url.Replace("https://", "http://") + "\"}"); + var upDateRst = GetHtml.PostUtf8(urlImg, upDate); + for (int i = 0; i < 5 && upDateRst.Contains("access_token expired"); i++) + { + token.mdyTime = DateTime.Now.AddDays(-100); + token = new WxApiBLL().GetRandomWxToken(); + upDateRst = GetHtml.PostUtf8(urlImg, upDate); + } + var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url"); + if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl)) + { + upProdParam.product.info.detail.detailImg.Add(upImgUrl); + continue; + } + else + { + } + } + bool randomDrawBlock = false; if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") randomDrawBlock = true; @@ -1972,6 +2104,28 @@ namespace TemuKJD.WXForms.ProductForms var spec = sku.spec[0]; if (!attrParam.items.Any(it => it.value == spec.spec_name)) { + // 使用接口链接传sku图 + var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image"); + var upDate = UserLogin.GetSignaturex(); + upDate += "&token=" + token.accessToken; + upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + sku.thumb_url.Replace("https://", "http://") + "\"}"); + var upDateRst = GetHtml.PostUtf8(urlImg, upDate); + for (int i = 0; i < 5 && upDateRst.Contains("access_token expired"); i++) + { + token.mdyTime = DateTime.Now.AddDays(-100); + token = new WxApiBLL().GetRandomWxToken(); + upDateRst = GetHtml.PostUtf8(urlImg, upDate); + } + var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url"); + if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl)) + { + attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = upImgUrl, }); + continue; // 传图成功跳过模拟上传 + } + else + { + } + // 上传sku图 var locationStr = UploadImg(shop, sku.thumb_url, cell); if (!locationStr.Contains("\"success\":true")) @@ -3357,7 +3511,7 @@ Content-Type: application/octet-stream { public int PreSaleDays { get; set; } = 5; - public string FilterWords { get; set; } = "真丝,蚕丝,香云纱,羊绒,羊毛,羊羔绒,羊羔毛,羽绒,皮草"; + public string FilterWords { get; set; } = "亏本,冲量,白菜价,跳楼价,xx,xxx,最大,最小,低价,降价,成本,赔钱,甩卖,真丝,蚕丝,香云纱,羊绒,羊毛,羊羔绒,羊羔毛,羽绒,皮草"; public int SkuMinPrice { get; set; } = 10; diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs index 457ac96..99ba3e2 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs @@ -70,6 +70,7 @@ this.colShopOperate = new System.Windows.Forms.DataGridViewLinkColumn(); this.colRelogin = new System.Windows.Forms.DataGridViewLinkColumn(); this.colReLogin2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colBuyApi = new System.Windows.Forms.DataGridViewLinkColumn(); this.colMultiLogin = new System.Windows.Forms.DataGridViewLinkColumn(); this.colApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); this.colBuyApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); @@ -424,6 +425,7 @@ this.colShopOperate, this.colRelogin, this.colReLogin2, + this.colBuyApi, this.colMultiLogin, this.colApiAuth, this.colBuyApiAuth, @@ -575,7 +577,7 @@ // // colRelogin // - this.colRelogin.FillWeight = 40F; + this.colRelogin.FillWeight = 46F; this.colRelogin.HeaderText = "登录"; this.colRelogin.Name = "colRelogin"; this.colRelogin.ReadOnly = true; @@ -590,6 +592,15 @@ this.colReLogin2.ReadOnly = true; this.colReLogin2.Visible = false; // + // colBuyApi + // + this.colBuyApi.FillWeight = 46F; + this.colBuyApi.HeaderText = "API购买"; + this.colBuyApi.Name = "colBuyApi"; + this.colBuyApi.ReadOnly = true; + this.colBuyApi.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colBuyApi.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // // colMultiLogin // this.colMultiLogin.FillWeight = 52F; @@ -729,6 +740,7 @@ private System.Windows.Forms.DataGridViewLinkColumn colShopOperate; private System.Windows.Forms.DataGridViewLinkColumn colRelogin; private System.Windows.Forms.DataGridViewTextBoxColumn colReLogin2; + private System.Windows.Forms.DataGridViewLinkColumn colBuyApi; private System.Windows.Forms.DataGridViewLinkColumn colMultiLogin; private System.Windows.Forms.DataGridViewLinkColumn colApiAuth; private System.Windows.Forms.DataGridViewLinkColumn colBuyApiAuth; diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs index a89b05d..ebdcbd7 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs @@ -491,6 +491,7 @@ namespace TemuKJD.WXForms.ShopForms "检测", string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim(), string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim(), + "购买", "多重登录", param.ApiAuthStatus, param.BuyApiAuth.ApiAuthStatus, @@ -700,6 +701,15 @@ namespace TemuKJD.WXForms.ShopForms } IsOperate = false; break; + case "API购买": + { + WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=3984039898079707139"; + shopLoginForm.Show(); + } + break; case "复制Cookie": List cooks = null; try { cooks = JsonHelper.DeserializeJsonToList(shop.Cookies); } catch (Exception ex) { } diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx b/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx index 5d11a9a..a64552f 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx @@ -165,6 +165,9 @@ True + + True + True diff --git a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs index 5500ce9..893589b 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs @@ -34,6 +34,7 @@ this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx(); this.btnDel = new DevComponents.DotNetBar.PanelEx(); + this.btnOpenOrder = new TemuKJD.UserControls.ButtonEx(); this.btnLoginAgain = new TemuKJD.UserControls.ButtonEx(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); @@ -76,6 +77,7 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.btnOpenOrder); this.splitContainer1.Panel2.Controls.Add(this.btnLoginAgain); this.splitContainer1.Panel2.Controls.Add(this.label2); this.splitContainer1.Panel2.Controls.Add(this.label1); @@ -87,7 +89,7 @@ this.splitContainer1.Panel2.Controls.Add(this.btnReload); this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin); this.splitContainer1.Size = new System.Drawing.Size(1438, 736); - this.splitContainer1.SplitterDistance = 671; + this.splitContainer1.SplitterDistance = 674; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -165,6 +167,23 @@ this.btnDel.Text = "删"; this.btnDel.Click += new System.EventHandler(this.btnDel_Click); // + // btnOpenOrder + // + this.btnOpenOrder.Anchor = System.Windows.Forms.AnchorStyles.None; + this.btnOpenOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnOpenOrder.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnOpenOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnOpenOrder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOpenOrder.ForeColor = System.Drawing.Color.White; + this.btnOpenOrder.Location = new System.Drawing.Point(648, 18); + this.btnOpenOrder.Margin = new System.Windows.Forms.Padding(2); + this.btnOpenOrder.Name = "btnOpenOrder"; + this.btnOpenOrder.Size = new System.Drawing.Size(143, 25); + this.btnOpenOrder.TabIndex = 464; + this.btnOpenOrder.Text = "登录订单系统"; + this.btnOpenOrder.UseVisualStyleBackColor = false; + this.btnOpenOrder.Click += new System.EventHandler(this.btnOpenOrder_Click); + // // btnLoginAgain // this.btnLoginAgain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -267,6 +286,7 @@ this.btnStop.TabIndex = 372; this.btnStop.Text = "停止操作"; this.btnStop.UseVisualStyleBackColor = false; + this.btnStop.Visible = false; this.btnStop.Click += new System.EventHandler(this.btnStop_Click); // // btnReload @@ -284,6 +304,7 @@ this.btnReload.TabIndex = 371; this.btnReload.Text = "重新加载"; this.btnReload.UseVisualStyleBackColor = false; + this.btnReload.Visible = false; this.btnReload.Click += new System.EventHandler(this.btnReload_Click); // // chkCloseAfterLogin @@ -406,5 +427,6 @@ private DevComponents.DotNetBar.PanelEx btnDel; private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnPrev; + public UserControls.ButtonEx btnOpenOrder; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs index ae6ebba..51fdd94 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs @@ -963,5 +963,15 @@ function getElementWithText(sText) { cefWebBrowser.Forward(); } + + private void btnOpenOrder_Click(object sender, EventArgs e) + { + WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.InitUrl = "https://po.e57.cn/login?redirect=%2Findex"; + shopLoginForm.btnOpenOrder.Visible = false; + shopLoginForm.Show(); + } } }