diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index cde5844..80f75b7 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,8 +27,8 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 395; - //public static int VersionCount = 395; + public static int VersionCount = 397; + //public static int VersionCount = 397; /// /// 版本号 diff --git a/AllBase/Model/Result/ShopLoginInfo.cs b/AllBase/Model/Result/ShopLoginInfo.cs index ec0e554..a42a364 100644 --- a/AllBase/Model/Result/ShopLoginInfo.cs +++ b/AllBase/Model/Result/ShopLoginInfo.cs @@ -162,6 +162,9 @@ namespace AllBase.Model.Result public int Y { get; set; } public List LstShopCategory { get; set; } = new List(); + + //在一次检测中是否已检测同一个账户下的不同店铺,如果已检测,使用相同cookie即可,不用多次检测 + public bool isCheckLogin { get; set; } } public class AuthInfo diff --git a/TEMUKJD/KJD.csproj b/TEMUKJD/KJD.csproj index e184bee..ec7daa8 100644 --- a/TEMUKJD/KJD.csproj +++ b/TEMUKJD/KJD.csproj @@ -227,11 +227,11 @@ AdminShopLoginForm.cs - + Form - - AdminShopForm.cs + + AdminShopListForm.cs Form @@ -888,8 +888,8 @@ AdminShopLoginForm.cs - - AdminShopForm.cs + + AdminShopListForm.cs BaseForm.cs diff --git a/TEMUKJD/KJDForms/AdminForms/AdminForm.cs b/TEMUKJD/KJDForms/AdminForms/AdminForm.cs index 8c84da8..fdd7c80 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminForm.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminForm.cs @@ -19,7 +19,7 @@ namespace TemuKJD.KJDForms.AdminForms public partial class AdminForm : BaseForm { public Lazy adminAccountForm = new Lazy(); - public Lazy adminShopForm = new Lazy(); + public Lazy adminShopForm = new Lazy(); public Lazy dbProductListForm = new Lazy(); public Lazy dbProductSelectListManageForm = new Lazy(); public Lazy productThirdSelectListManageForm = new Lazy(); diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopForm.Designer.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopListForm.Designer.cs similarity index 99% rename from TEMUKJD/KJDForms/AdminForms/AdminShopForm.Designer.cs rename to TEMUKJD/KJDForms/AdminForms/AdminShopListForm.Designer.cs index 6c71091..e298ebf 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopForm.Designer.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopListForm.Designer.cs @@ -1,7 +1,7 @@  namespace TemuKJD.KJDForms.AdminForms { - partial class AdminShopForm + partial class AdminShopListForm { /// /// Required designer variable. @@ -635,7 +635,7 @@ namespace TemuKJD.KJDForms.AdminForms // colImportCookies // this.colImportCookies.FillWeight = 70F; - this.colImportCookies.HeaderText = "导入Cookies"; + this.colImportCookies.HeaderText = "导入Cookie"; this.colImportCookies.Name = "colImportCookies"; this.colImportCookies.ReadOnly = true; this.colImportCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; @@ -644,7 +644,7 @@ namespace TemuKJD.KJDForms.AdminForms // colCopyCookies // this.colCopyCookies.FillWeight = 70F; - this.colCopyCookies.HeaderText = "复制Cookies"; + this.colCopyCookies.HeaderText = "复制Cookie"; this.colCopyCookies.Name = "colCopyCookies"; this.colCopyCookies.ReadOnly = true; this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopListForm.cs similarity index 89% rename from TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs rename to TEMUKJD/KJDForms/AdminForms/AdminShopListForm.cs index 79c6668..a7accc1 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopListForm.cs @@ -22,11 +22,11 @@ using Work; namespace TemuKJD.KJDForms.AdminForms { - public partial class AdminShopForm : BaseForm + public partial class AdminShopListForm : BaseForm { - public static List lstAdminShopInfo = new List(); + public static List lstAdminShopInfo { get; set; } = new List(); - public AdminShopForm() + public AdminShopListForm() { InitializeComponent(); } @@ -62,6 +62,7 @@ namespace TemuKJD.KJDForms.AdminForms public void SearchShop(int page) { + List shopIdList = GetCheckedShopIdList(); if (InvokeRequired) { Invoke(new Action(() => @@ -80,7 +81,7 @@ namespace TemuKJD.KJDForms.AdminForms Task.Run(() => { int pageCount; - var list = AdminGetServerShop(out pageCount, page); + var list = AdminGetServerShopLst(out pageCount, page); lstAdminShopInfo.AddRange(list); this.ucSplitPage1.TotalPage = pageCount; @@ -89,7 +90,7 @@ namespace TemuKJD.KJDForms.AdminForms Invoke(new Action(() => { int rowIndex = this.dgvShop.Rows.Add( - false, + shopIdList.Contains(shop.ShopId + shop.UserName), shop.LoginName, shop.ShopId, shop.ShopAccount, @@ -109,8 +110,8 @@ namespace TemuKJD.KJDForms.AdminForms "多重登录", shop.ApiAuthStatus, shop.BuyApiAuth.ApiAuthStatus, - "导入Cookies", - "复制Cookies", + "导入Cookie", + "复制Cookie", "上传", shop.OperateSubSaName, "编辑", @@ -208,7 +209,7 @@ namespace TemuKJD.KJDForms.AdminForms } IsOperate = false; break; - case "复制Cookies": + case "复制Cookie": string cook = shop.Cookies; string cookJs = ""; var keys = new string[] { "a42", "_bee", "_f77", "_nano_fp", "api_uid", "rckk", "ru1k", "ru2k", "SUB_PASS_ID" }; @@ -257,7 +258,7 @@ namespace TemuKJD.KJDForms.AdminForms Clipboard.SetDataObject(cookJs); BaseMsgForm.ShowInfo("复制成功"); break; - case "导入Cookies": + case "导入Cookie": ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa); updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete; updateCookieForm.ShowDialog(); @@ -344,7 +345,22 @@ namespace TemuKJD.KJDForms.AdminForms return shopNameList; } - public List AdminGetServerShop(out int pageCount, int page = 1, int pageSize = 50) + private List GetCheckedShopIdList() + { + List shopNameList = new List(); + for (int i = 0; i < dgvShop.Rows.Count; i++) + { + if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool()) + { + string shopName = dgvShop.Rows[i].Cells["colShopId"].Value.ParseToString(); + shopName += dgvShop.Rows[i].Cells["colUser"].Value.ParseToString(); + shopNameList.Add(shopName); + } + } + return shopNameList; + } + + public List AdminGetServerShopLst(out int pageCount, int page = 1, int pageSize = 50) { List list = new List(); pageCount = 1; @@ -375,9 +391,67 @@ namespace TemuKJD.KJDForms.AdminForms pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt(); pageCount = Math.Max(pageCount, 1); - var jArr = JObject.Parse(html)["data"]; + return DeserializationShop(html); + } + + public static List AdminGetServerShopLstByIds(List shop_ids) + { + List list = new List(); + shop_ids = shop_ids.Where(s => !string.IsNullOrEmpty(s)).ToList(); + + var url = BaseClass.BuildObjString("shop/admin_get_shop_list"); + var data = UserLogin.GetSignaturex() + + "&shop_ids='" + string.Join("','", shop_ids) + "'"; + data += "&page_size=200"; + 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")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) + || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) + { + return new List(); + } + + return DeserializationShop(html); + } + + public static string AdminGetServerShopLstForSetCookie(ShopLoginInfo loginShop, List lstRst) + { + if (lstRst == null) + lstRst = new List(); + + var url = BaseClass.BuildObjString("shop/admin_get_shop_list"); + var data = UserLogin.GetSignaturex() + + "&search_user_name=" + loginShop.UserName + + "&search_login_name=" + loginShop.LoginName; + 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")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) + || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) + { + return "获取失败:" + BaseRegex.GetStringJson(ref html, "msg"); + } + + lstRst.AddRange(DeserializationShop(html)); + + return "success"; + } + + public static List DeserializationShop(string shopJson) + { + List list = new List(); + if (!shopJson.Contains("data")) + return list; + + var jArr = JObject.Parse(shopJson)["data"]; if (jArr.Count() == 0) return list; + foreach (JObject jObj in jArr) { string shopStr = jObj.ToString(); @@ -401,6 +475,7 @@ namespace TemuKJD.KJDForms.AdminForms shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status"); shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2"); shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name"); + shop.AddProductRemaining = BaseRegex.GetIntJson(ref shopStr, "add_product_remaining"); list.Add(shop); } @@ -514,7 +589,8 @@ namespace TemuKJD.KJDForms.AdminForms })); } - CheckShopLogin(shopNames, isShowProgress); + var shops = lstAdminShopInfo.Where(s => shopNames.Contains(s.LoginName)); + CheckShopLogin(shops.ToArray(), isShowProgress); if (this.Created && isShowProgress) { @@ -526,21 +602,38 @@ namespace TemuKJD.KJDForms.AdminForms } } - public void CheckShopLogin(string[] shopNames, bool isShowProgress = true) + public void CheckShopLogin(ShopLoginInfo[] shops, bool isShowProgress = true) { - for (int i = 0; i < shopNames.Length; i++) + var shopLoginNames = shops.Select(s => s.LoginName).Distinct().ToArray(); + for (int i = 0; i < shopLoginNames.Length; i++) { - var shop = lstAdminShopInfo.FirstOrDefault(v => v.LoginName == shopNames[i]); - var campanys = lstAdminShopInfo.Where(v => v.LoginName == shopNames[i]).ToList(); + var campanys = shops.Where(v => v.LoginName == shopLoginNames[i]).ToList(); + var shop = shops.FirstOrDefault(v => v.LoginName == shopLoginNames[i]); + + // 先从服务端取最新cookie + var serverCampanys = AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList()); + var serverShop = serverCampanys.FirstOrDefault(); + if (shop != null && serverShop != null) + { + shop.Cookies = serverShop.Cookies; + shop.Cookies2 = serverShop.Cookies2; + foreach (var sc in campanys) + { + sc.Cookies = serverShop.Cookies; + sc.Cookies2 = serverShop.Cookies2; + } + } + if (shop != null) { - //var loginResult = "\"code\":0";//GetShopStatus(shop); var loginResult = ShopListForm.GetShopStatus(shop); if (!loginResult.Contains("\"success\":true")) { + shop.Cookies = "empty=true;"; foreach (var sc in campanys) { sc.LoginStatus = "未登录"; + shop.Cookies = "empty=true;"; } } else @@ -548,6 +641,7 @@ namespace TemuKJD.KJDForms.AdminForms foreach (var sc in campanys) { sc.LoginStatus = "登录成功"; + sc.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); } } loginResult = ShopListForm.GetShopStatus2(shop); @@ -575,7 +669,7 @@ namespace TemuKJD.KJDForms.AdminForms { this.statusBar.lblTaskStatus.Text = "正在检测..."; this.statusBar.pgbTaskProgress.Value = (i + 1); - this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopNames.Length; + this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopLoginNames.Length; })); } } diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopForm.resx b/TEMUKJD/KJDForms/AdminForms/AdminShopListForm.resx similarity index 100% rename from TEMUKJD/KJDForms/AdminForms/AdminShopForm.resx rename to TEMUKJD/KJDForms/AdminForms/AdminShopListForm.resx diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs index bcd30fa..a54d8be 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs @@ -164,7 +164,7 @@ namespace TemuKJD.KJDForms.AdminForms { newShop.LoginStatus = "登录成功"; newShop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); - var html = AdminShopForm.AdminAddServerShop(newShop); // 店铺写入到服务端 + var html = AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端 if (!html.Contains("\"code\":200")) isSuccess = false; } @@ -261,7 +261,7 @@ namespace TemuKJD.KJDForms.AdminForms { newShop.LoginStatus2 = "国际版在线"; newShop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); - var html = AdminShopForm.AdminAddServerShop(newShop); // 店铺写入到服务端 + var html = AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端 if (!html.Contains("\"code\":200")) isSuccess = false; } diff --git a/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs b/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs index 62d52d3..ce12b11 100644 --- a/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs +++ b/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs @@ -29,7 +29,7 @@ namespace TemuKJD.KJDForms.AdminForms BaseMsgForm.ShowError("商品Id不存在!"); return "failed"; } - var shop = AdminShopForm.lstAdminShopInfo.FirstOrDefault(s => s.ShopId == supplierId.ToString()); + var shop = AdminShopListForm.lstAdminShopInfo.FirstOrDefault(s => s.ShopId == supplierId.ToString()); if (supplierId <= 0 || shop == null) { BaseMsgForm.ShowError("店铺不存在!"); diff --git a/TEMUKJD/KJDForms/ProductForms/Old/TbSettleSlideForm.designer.cs b/TEMUKJD/KJDForms/ProductForms/Old/TbSettleSlideForm.designer.cs index c86c4a6..d2eeac0 100644 --- a/TEMUKJD/KJDForms/ProductForms/Old/TbSettleSlideForm.designer.cs +++ b/TEMUKJD/KJDForms/ProductForms/Old/TbSettleSlideForm.designer.cs @@ -68,7 +68,7 @@ this.panelCopyCookies.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; this.panelCopyCookies.StyleMouseOver.BackColor2.Color = System.Drawing.Color.LightGray; this.panelCopyCookies.TabIndex = 575; - this.panelCopyCookies.Text = "复制Cookies成功后点我"; + this.panelCopyCookies.Text = "复制Cookie成功后点我"; this.panelCopyCookies.Click += new System.EventHandler(this.panelCopyCookies_Click); // // panelInstall @@ -203,7 +203,7 @@ this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(551, 12); this.label5.TabIndex = 595; - this.label5.Text = "第三步:解除滑块之后,点击点我复制原滑块链接按钮,复制网址到浏览器中,按照下面指示复制cookies"; + this.label5.Text = "第三步:解除滑块之后,点击点我复制原滑块链接按钮,复制网址到浏览器中,按照下面指示复制Cookie"; // // pictureBox1 // diff --git a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs index 9bec28f..e94588d 100644 --- a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs @@ -70,6 +70,13 @@ namespace TemuKJD.KJDForms.ProductForms this.btnStop = new DevComponents.DotNetBar.PanelEx(); this.label1 = new System.Windows.Forms.Label(); this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); + this.colSelect = new TemuKJD.UserComponent.UcDataGridViewCheckBoxColumn(this.components); + this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colLoginStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ucGroupBoxEx99 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.cmbCity = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.cmbProvince = new DevComponents.DotNetBar.Controls.ComboBoxEx(); @@ -132,13 +139,6 @@ namespace TemuKJD.KJDForms.ProductForms this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); this.btnClear = new DevComponents.DotNetBar.PanelEx(); - this.colSelect = new TemuKJD.UserComponent.UcDataGridViewCheckBoxColumn(this.components); - this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colLoginStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -221,17 +221,16 @@ namespace TemuKJD.KJDForms.ProductForms // // ucCheckBox1 // + this.ucCheckBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.ucCheckBox1.AutoSize = true; - this.ucCheckBox1.Checked = true; - this.ucCheckBox1.CheckState = System.Windows.Forms.CheckState.Checked; - this.ucCheckBox1.Location = new System.Drawing.Point(505, 28); + this.ucCheckBox1.Location = new System.Drawing.Point(557, 34); this.ucCheckBox1.Name = "ucCheckBox1"; - this.ucCheckBox1.Size = new System.Drawing.Size(69, 21); + this.ucCheckBox1.Size = new System.Drawing.Size(87, 21); this.ucCheckBox1.TabIndex = 713; - this.ucCheckBox1.Text = "123456"; + this.ucCheckBox1.Text = "使用新接口"; this.ucCheckBox1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ucCheckBox1.UseVisualStyleBackColor = true; - this.ucCheckBox1.Visible = false; + this.ucCheckBox1.CheckedChanged += new System.EventHandler(this.chkNewService_CheckedChanged); // // flowLayoutPanel1 // @@ -749,6 +748,62 @@ namespace TemuKJD.KJDForms.ProductForms this.dgvShop.TabIndex = 6; this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); // + // colSelect + // + this.colSelect.HeaderText = "全选"; + this.colSelect.Name = "colSelect"; + this.colSelect.ReadOnly = true; + this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSelect.Width = 28; + // + // colShopLoginName + // + this.colShopLoginName.HeaderText = "店铺登录名"; + this.colShopLoginName.Name = "colShopLoginName"; + this.colShopLoginName.ReadOnly = true; + this.colShopLoginName.Visible = false; + // + // colShopId + // + this.colShopId.HeaderText = "店铺Id"; + this.colShopId.Name = "colShopId"; + this.colShopId.ReadOnly = true; + this.colShopId.Visible = false; + this.colShopId.Width = 55; + // + // colShopName + // + this.colShopName.FillWeight = 150F; + this.colShopName.HeaderText = "店铺名称"; + this.colShopName.Name = "colShopName"; + this.colShopName.ReadOnly = true; + this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colShopName.Width = 75; + // + // colLoginStatus + // + this.colLoginStatus.HeaderText = "登录状态"; + this.colLoginStatus.Name = "colLoginStatus"; + this.colLoginStatus.ReadOnly = true; + this.colLoginStatus.Width = 65; + // + // colCanUse + // + this.colCanUse.HeaderText = "可用"; + this.colCanUse.Name = "colCanUse"; + this.colCanUse.ReadOnly = true; + this.colCanUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCanUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCanUse.Width = 28; + // + // colMessage + // + this.colMessage.HeaderText = "消息"; + this.colMessage.Name = "colMessage"; + this.colMessage.ReadOnly = true; + this.colMessage.Width = 120; + // // ucGroupBoxEx99 // this.ucGroupBoxEx99.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -1524,62 +1579,6 @@ namespace TemuKJD.KJDForms.ProductForms this.btnClear.Text = "清空结果"; this.btnClear.Visible = false; // - // colSelect - // - this.colSelect.HeaderText = "全选"; - this.colSelect.Name = "colSelect"; - this.colSelect.ReadOnly = true; - this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSelect.Width = 28; - // - // colShopLoginName - // - this.colShopLoginName.HeaderText = "店铺登录名"; - this.colShopLoginName.Name = "colShopLoginName"; - this.colShopLoginName.ReadOnly = true; - this.colShopLoginName.Visible = false; - // - // colShopId - // - this.colShopId.HeaderText = "店铺Id"; - this.colShopId.Name = "colShopId"; - this.colShopId.ReadOnly = true; - this.colShopId.Visible = false; - this.colShopId.Width = 55; - // - // colShopName - // - this.colShopName.FillWeight = 150F; - this.colShopName.HeaderText = "店铺名称"; - this.colShopName.Name = "colShopName"; - this.colShopName.ReadOnly = true; - this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colShopName.Width = 75; - // - // colLoginStatus - // - this.colLoginStatus.HeaderText = "登录状态"; - this.colLoginStatus.Name = "colLoginStatus"; - this.colLoginStatus.ReadOnly = true; - this.colLoginStatus.Width = 65; - // - // colCanUse - // - this.colCanUse.HeaderText = "可用"; - this.colCanUse.Name = "colCanUse"; - this.colCanUse.ReadOnly = true; - this.colCanUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colCanUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colCanUse.Width = 28; - // - // colMessage - // - this.colMessage.HeaderText = "消息"; - this.colMessage.Name = "colMessage"; - this.colMessage.ReadOnly = true; - this.colMessage.Width = 120; - // // SaleStockUpForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs index 096d8db..9ddea65 100644 --- a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs +++ b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs @@ -27,6 +27,8 @@ namespace TemuKJD.KJDForms.ProductForms /// public partial class SaleStockUpForm : BaseForm { + public bool isNewService = false; + private CheckBox chkSelectAll = null; //private CheckBox chkCheckAll = null; public CancellationTokenSource cancellationTokenSource { get; set; } = null; @@ -350,13 +352,16 @@ namespace TemuKJD.KJDForms.ProductForms } /// - /// 根据店铺获取备货单列表 + /// 根据店铺获取备货单列表 首页--备货单管理--我的备货单 /// /// /// /// private string GetShopStockList(ShopLoginInfo shop, int page = 1, string type = "待创建") { + if (isNewService) + return GetShopStockList2(shop, page, type); + page = Math.Max(page, 1); string url = "https://seller.kuajingmaihuo.com/oms/bg/venom/api/supplier/purchase/manager/querySubOrderList"; string body; @@ -370,14 +375,32 @@ namespace TemuKJD.KJDForms.ProductForms return KJDHttpResponse.PostResponse(shop, url, body,refere); } + private string GetShopStockList2(ShopLoginInfo shop, int page = 1, string type = "待创建") + { + page = Math.Max(page, 1); + string url = "https://agentseller.temu.com/mms/venom/api/supplier/purchase/manager/querySubOrderList"; + string body; + if (type == "已送货") + body = @"{""pageNo"":" + page + @",""pageSize"":20,""urgencyType"":0,""isCustomGoods"":false,""statusList"":[2],""oneDimensionSort"":{""firstOrderByParam"":""realDeliverTime"",""firstOrderByDesc"":1}}"; //已送货 + else + body = @"{""pageNo"":" + page + @",""pageSize"":20,""urgencyType"":0,""isCustomGoods"":false,""statusList"":[0],""oneDimensionSort"":{""firstOrderByParam"":""expectLatestDeliverTime"",""firstOrderByDesc"":0}}"; //待创建 + + string refere = "https://agentseller.temu.com/stock/fully-mgt/order-manage-urgency"; + + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + /// - /// 取消待创建 + /// 取消待创建备货单 首页--备货单管理--我的备货单 /// /// /// /// private string CancelSubPurchaseOrder(ShopLoginInfo shop, string subPurchaseOrderSn) { + if (isNewService) + return CancelSubPurchaseOrder2(shop, subPurchaseOrderSn); + string url = "https://seller.kuajingmaihuo.com/oms/bg/venom/api/supplier/purchase/manager/batchCancelSubPurchaseOrder"; string body = "{\"subPurchaseOrderSnList\":[\"" + subPurchaseOrderSn + "\"]}"; string refere = "https://seller.kuajingmaihuo.com/main/order-manage"; @@ -385,8 +408,26 @@ namespace TemuKJD.KJDForms.ProductForms return KJDHttpResponse.PostResponse(shop, url, body, refere); } + private string CancelSubPurchaseOrder2(ShopLoginInfo shop, string subPurchaseOrderSn) + { + string url = "https://agentseller.temu.com/mms/venom/api/supplier/purchase/manager/batchCancelSubPurchaseOrder"; + string body = "{\"subPurchaseOrderSnList\":[\"" + subPurchaseOrderSn + "\"]}"; + string refere = "https://agentseller.temu.com/stock/fully-mgt/order-manage"; + + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + + /// + /// 查询销售列表 + /// + /// + /// + /// private string GetWarehouseList(ShopLoginInfo shop, int page = 1) { + if (isNewService) + return GetWarehouseList2(shop, page); + page = Math.Max(page, 1); string url = "https://seller.kuajingmaihuo.com/marvel-mms/cn/api/kiana/venom/sales/management/listWarehouse"; string body = @"{""pageNo"":" + page + @",""pageSize"":10,""isLack"":0,""selectStatusList"":[12],""priceAdjustRecentDays"":7}"; @@ -395,6 +436,16 @@ namespace TemuKJD.KJDForms.ProductForms return KJDHttpResponse.PostResponse(shop, url, body, refere); } + private string GetWarehouseList2(ShopLoginInfo shop, int page = 1) + { + page = Math.Max(page, 1); + string url = "https://agentseller.temu.com/mms/venom/api/supplier/sales/management/listWarehouse"; + string body = @"{""pageNo"":" + page + @",""pageSize"":10,""isLack"":0,""selectStatusList"":[12],""priceAdjustRecentDays"":7}"; + string refere = "https://agentseller.temu.com/stock/fully-mgt/sale-manage/main"; + + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + /// /// 查询单个商品申请备货条件 /// @@ -403,13 +454,25 @@ namespace TemuKJD.KJDForms.ProductForms /// private string QueryStockBaseInfo(ShopLoginInfo shop, SubOrderInfo subOrderInfo) { + if (isNewService) + return QueryStockBaseInfo2(shop, subOrderInfo); + string url = "https://seller.kuajingmaihuo.com/oms/bg/venom/api/supplier/sales/management/queryStockBaseInfo"; string body = "{\"productSkcId\":" + subOrderInfo.productSkcId - + ",\"warehouseGroupId\":" + subOrderInfo.warehouseGroupIdList.FirstOrDefault() + "}"; + + ",\"warehouseGroupId\":" + subOrderInfo.warehouseGroupIdList.FirstOrDefault() + "}"; string refere = "https://seller.kuajingmaihuo.com/main/sale-manage/main"; return KJDHttpResponse.PostResponse(shop, url, body, refere); } + private string QueryStockBaseInfo2(ShopLoginInfo shop, SubOrderInfo subOrderInfo) + { + string url = "https://agentseller.temu.com/mms/venom/api/supplier/sales/management/queryStockBaseInfo"; + string body = "{\"productSkcId\":" + subOrderInfo.productSkcId + + ",\"warehouseGroupId\":" + subOrderInfo.warehouseGroupIdList.FirstOrDefault() + "}"; + string refere = "https://agentseller.temu.com/stock/fully-mgt/sale-manage/main"; + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + /// /// 单个商品申请备货 /// @@ -418,6 +481,9 @@ namespace TemuKJD.KJDForms.ProductForms /// private string CreateStockOrder(ShopLoginInfo shop, SubOrderInfo subOrderInfo) { + if (isNewService) + return CreateStockOrder2(shop, subOrderInfo); + string url = "https://seller.kuajingmaihuo.com/oms/bg/venom/api/supplier/sales/management/createStockOrder"; string body = "{\"productSkcId\":" + subOrderInfo.productSkcId + "," + "\"purchaseDetailList\":["; @@ -432,6 +498,22 @@ namespace TemuKJD.KJDForms.ProductForms return KJDHttpResponse.PostResponse(shop, url, body, refere); } + private string CreateStockOrder2(ShopLoginInfo shop, SubOrderInfo subOrderInfo) + { + string url = "https://agentseller.temu.com/mms/venom/api/supplier/sales/management/createStockOrder"; + string body = "{\"productSkcId\":" + subOrderInfo.productSkcId + "," + + "\"purchaseDetailList\":["; + foreach (var sku in subOrderInfo.skuQuantityDetailList) + { + if (sku.wantStockUpBound > 0) + body += "{\"productSkuId\":" + sku.productSkuId + ",\"productSkuPurchaseQuantity\":\"" + sku.wantStockUpBound + "\"},"; + } + body = body.TrimEnd(','); + body += "],\"warehouseGroupId\":" + subOrderInfo.warehouseGroupIdList.FirstOrDefault() + "}"; + string refere = "https://agentseller.temu.com/stock/fully-mgt/sale-manage/main"; + + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e) { @@ -1042,5 +1124,10 @@ namespace TemuKJD.KJDForms.ProductForms this.lblMinBound.Text = "备货量小于" + txtMinBound.Text.ParseToInt() + "按"; //this.chkIfLessMakeZero.Text = "平台允许备货数量小于" + txtMinBound.Text.ParseToInt() + "不备货"; } + + private void chkNewService_CheckedChanged(object sender, EventArgs e) + { + this.isNewService = ucCheckBox1.Checked; + } } } diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs index 2479f73..39667f7 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs @@ -430,17 +430,17 @@ namespace TemuKJD.KJDForms.ProductSelectForms int maxNum = 19; if (numbers.Count > 0 && numbers[0] > 0) { - minNum = numbers[0]; + minNum = numbers[0]; + if (numbers.Count > 1 && numbers[1] > 0) + { + maxNum = numbers[1]; + } + if (maxNum < minNum) + { + maxNum = minNum; + } + headWords += Randomx.GetId(minNum, maxNum + 1) + "个"; } - if (numbers.Count > 1 && numbers[1] > 0) - { - maxNum = numbers[1]; - } - if (maxNum < minNum) - { - maxNum = minNum; - } - headWords += Randomx.GetId(minNum, maxNum + 1) + "个"; } //string endWords = string.IsNullOrEmpty(prod.end_words) ? "适合不同的搭配风格" : prod.end_words; diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs index 589d1d6..d83644e 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs @@ -33,6 +33,10 @@ 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(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductSelectListManageForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.btnReFission = new TemuKJD.UserControls.ButtonEx(); @@ -62,6 +66,8 @@ this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSelectId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -79,6 +85,7 @@ this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colDraftId = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colAddTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMdyTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubSa = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubSaNick = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -86,8 +93,6 @@ this.colEditNotes = new System.Windows.Forms.DataGridViewLinkColumn(); this.colDelete = new System.Windows.Forms.DataGridViewLinkColumn(); this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -522,6 +527,7 @@ this.colExtCode, this.colStatus, this.colDraftId, + this.colAddTime, this.colMdyTime, this.colSubSa, this.colSubSaNick, @@ -540,6 +546,29 @@ this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick); this.dgvSelectProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll); // + // ucSplitPage1 + // + this.ucSplitPage1.CurrentPage = 1; + this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; + this.ucSplitPage1.Location = new System.Drawing.Point(1076, 0); + this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); + this.ucSplitPage1.Name = "ucSplitPage1"; + this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); + this.ucSplitPage1.Size = new System.Drawing.Size(362, 25); + this.ucSplitPage1.TabIndex = 6; + this.ucSplitPage1.TotalPage = 1; + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(1438, 25); + this.statusBar.TabIndex = 5; + // // colSelect // this.colSelect.HeaderText = "选择"; @@ -587,21 +616,21 @@ // // colImportCookies // - this.colImportCookies.HeaderText = "导入Cookies"; + this.colImportCookies.HeaderText = "导入Cookie"; this.colImportCookies.Name = "colImportCookies"; this.colImportCookies.ReadOnly = true; this.colImportCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colImportCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colImportCookies.Width = 85; + this.colImportCookies.Width = 80; // // colCopyCookies // - this.colCopyCookies.HeaderText = "复制Cookies"; + this.colCopyCookies.HeaderText = "复制Cookie"; this.colCopyCookies.Name = "colCopyCookies"; this.colCopyCookies.ReadOnly = true; this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colCopyCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colCopyCookies.Width = 85; + this.colCopyCookies.Width = 80; // // colSpuId // @@ -644,14 +673,16 @@ this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; - this.colProductName.Width = 180; + this.colProductName.Width = 160; // // colProductCat // + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductCat.DefaultCellStyle = dataGridViewCellStyle4; this.colProductCat.HeaderText = "商品类目"; this.colProductCat.Name = "colProductCat"; this.colProductCat.ReadOnly = true; - this.colProductCat.Width = 90; + this.colProductCat.Width = 72; // // colExtCode // @@ -676,12 +707,23 @@ this.colDraftId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.colDraftId.Width = 88; // + // colAddTime + // + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colAddTime.DefaultCellStyle = dataGridViewCellStyle5; + this.colAddTime.HeaderText = "认领时间"; + this.colAddTime.Name = "colAddTime"; + this.colAddTime.ReadOnly = true; + this.colAddTime.Width = 65; + // // colMdyTime // + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colMdyTime.DefaultCellStyle = dataGridViewCellStyle6; this.colMdyTime.HeaderText = "上传时间"; this.colMdyTime.Name = "colMdyTime"; this.colMdyTime.ReadOnly = true; - this.colMdyTime.Width = 95; + this.colMdyTime.Width = 65; // // colSubSa // @@ -692,15 +734,17 @@ // // colSubSaNick // + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colSubSaNick.DefaultCellStyle = dataGridViewCellStyle7; this.colSubSaNick.HeaderText = "二级超管"; this.colSubSaNick.Name = "colSubSaNick"; this.colSubSaNick.ReadOnly = true; - this.colSubSaNick.Width = 80; + this.colSubSaNick.Width = 65; // // colNotes // - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colNotes.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colNotes.DefaultCellStyle = dataGridViewCellStyle8; this.colNotes.HeaderText = "备注"; this.colNotes.Name = "colNotes"; this.colNotes.ReadOnly = true; @@ -728,29 +772,6 @@ this.colOpResult.ReadOnly = true; this.colOpResult.Width = 150; // - // ucSplitPage1 - // - this.ucSplitPage1.CurrentPage = 1; - this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; - this.ucSplitPage1.Location = new System.Drawing.Point(1076, 0); - this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); - this.ucSplitPage1.Name = "ucSplitPage1"; - this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.ucSplitPage1.Size = new System.Drawing.Size(362, 25); - this.ucSplitPage1.TabIndex = 6; - this.ucSplitPage1.TotalPage = 1; - // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, 0); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(1438, 25); - this.statusBar.TabIndex = 5; - // // DbProductSelectListManageForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -812,6 +833,7 @@ private UserComponent.DataGridViewEx dgvSelectProduct; private UserComponent.UcCheckBox chkShowDel; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private UserControls.ButtonEx btnReFission; private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; @@ -829,6 +851,7 @@ private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode; private System.Windows.Forms.DataGridViewTextBoxColumn colStatus; private System.Windows.Forms.DataGridViewLinkColumn colDraftId; + private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime; private System.Windows.Forms.DataGridViewTextBoxColumn colMdyTime; private System.Windows.Forms.DataGridViewTextBoxColumn colSubSa; private System.Windows.Forms.DataGridViewTextBoxColumn colSubSaNick; @@ -836,6 +859,5 @@ private System.Windows.Forms.DataGridViewLinkColumn colEditNotes; private System.Windows.Forms.DataGridViewLinkColumn colDelete; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; - private UserControls.ButtonEx btnReFission; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs index b7ee3e4..e5f5216 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs @@ -107,7 +107,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.ucSplitPage1.TotalPage = pageCount; var shopIdLst = list.Select(p => p.shop_id).Distinct().ToList(); - shopLst = AdminGetServerShopLst(shopIdLst); + shopLst = AdminShopListForm.AdminGetServerShopLstByIds(shopIdLst); if (defaultBitmap == null) defaultBitmap = new Bitmap(80, 80); @@ -128,8 +128,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms prodSelect.shop_account, "进店", shopLst.FirstOrDefault(s=>s.ShopId == prodSelect.shop_id)?.LoginStatus2 == "国际版在线" ? "在线" : "登录", - "导入Cookies", - "复制Cookies", + "导入Cookie", + "复制Cookie", prodSelect.spu_id, prodSelect.skc_id, prodSelect.main_img.Replace("https:","http:"), @@ -139,7 +139,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms prodSelect.ext_code, prodSelect.status, prodSelect.draft_id, - prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yy/MM/dd HH:mm"), + prodSelect.add_time.ToString("yy/MM/dd\r\n HH:mm"), + prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yy/MM/dd\r\n HH:mm"), prodSelect.operate_sub_sa_name == "" ? "-" : prodSelect.operate_sub_sa_name, prodSelect.operate_sub_sa_nick == "" ? "-" : prodSelect.operate_sub_sa_nick, prodSelect.notes, @@ -342,15 +343,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms } break; - case "导入Cookies": + case "导入Cookie": { var shop = GetShop(shopId); - ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa, "国际版"); + ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa, "国内版"); updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete; updateCookieForm.ShowDialog(); } break; - case "复制Cookies": + case "复制Cookie": { var shop = GetShop(shopId); string cookJs = ""; @@ -653,62 +654,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms public ShopLoginInfo AdminGetServerShop(string shop_id) { - List list = AdminGetServerShopLst(new string[] { shop_id }.ToList()); + List list = AdminShopListForm.AdminGetServerShopLstByIds(new string[] { shop_id }.ToList()); return list.FirstOrDefault(); } - public List AdminGetServerShopLst(List shop_ids) - { - List list = new List(); - - var url = BaseClass.BuildObjString("shop/admin_get_shop_list"); - var data = UserLogin.GetSignaturex() + - "&shop_ids='" + string.Join("','", shop_ids) + "'"; - data += "&page_size=200"; - 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")) - html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) - || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) - { - return new List(); - } - - var jArr = JObject.Parse(html)["data"]; - if (jArr.Count() == 0) - return new List(); - - foreach (JObject jObj in jArr) - { - string shopStr = jObj.ToString(); - ShopLoginInfo shop = new ShopLoginInfo(); - shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id"); - if (shop.DbId == null) - continue; - shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name"); - shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass"); - shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id"); - shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account"); - shop.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name"); - shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name"); - shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group"); - shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie"); - shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.Cookies2 = BaseRegex.GetStringJson(ref shopStr, "cookie2"); - shop.Cookies2 = shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name"); - shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes"); - shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status"); - shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2"); - shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name"); - - list.Add(shop); - } - return list; - } - public static TemuDBProduct GetProductDetail(string prodDbId) { if (string.IsNullOrEmpty(prodDbId)) diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx index 07f1936..eddfce1 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx @@ -165,6 +165,9 @@ True + + True + True diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs index fca3728..62952b2 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs @@ -33,6 +33,10 @@ 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(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProductThirdSelectListManageForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.pbFissionSetting = new System.Windows.Forms.PictureBox(); @@ -80,6 +84,7 @@ this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colDraftId = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colAddTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMdyTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubSa = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubSaNick = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -539,6 +544,7 @@ this.colExtCode, this.colStatus, this.colDraftId, + this.colAddTime, this.colMdyTime, this.colSubSa, this.colSubSaNick, @@ -604,21 +610,21 @@ // // colImportCookies // - this.colImportCookies.HeaderText = "导入Cookies"; + this.colImportCookies.HeaderText = "导入Cookie"; this.colImportCookies.Name = "colImportCookies"; this.colImportCookies.ReadOnly = true; this.colImportCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colImportCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colImportCookies.Width = 85; + this.colImportCookies.Width = 80; // // colCopyCookies // - this.colCopyCookies.HeaderText = "复制Cookies"; + this.colCopyCookies.HeaderText = "复制Cookie"; this.colCopyCookies.Name = "colCopyCookies"; this.colCopyCookies.ReadOnly = true; this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colCopyCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colCopyCookies.Width = 85; + this.colCopyCookies.Width = 80; // // colSpuId // @@ -661,14 +667,16 @@ this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; - this.colProductName.Width = 180; + this.colProductName.Width = 160; // // colProductCat // + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductCat.DefaultCellStyle = dataGridViewCellStyle4; this.colProductCat.HeaderText = "商品类目"; this.colProductCat.Name = "colProductCat"; this.colProductCat.ReadOnly = true; - this.colProductCat.Width = 90; + this.colProductCat.Width = 72; // // colExtCode // @@ -693,12 +701,23 @@ this.colDraftId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.colDraftId.Width = 88; // + // colAddTime + // + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colAddTime.DefaultCellStyle = dataGridViewCellStyle5; + this.colAddTime.HeaderText = "添加时间"; + this.colAddTime.Name = "colAddTime"; + this.colAddTime.ReadOnly = true; + this.colAddTime.Width = 65; + // // colMdyTime // + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colMdyTime.DefaultCellStyle = dataGridViewCellStyle6; this.colMdyTime.HeaderText = "上传时间"; this.colMdyTime.Name = "colMdyTime"; this.colMdyTime.ReadOnly = true; - this.colMdyTime.Width = 95; + this.colMdyTime.Width = 65; // // colSubSa // @@ -709,15 +728,17 @@ // // colSubSaNick // + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colSubSaNick.DefaultCellStyle = dataGridViewCellStyle7; this.colSubSaNick.HeaderText = "二级超管"; this.colSubSaNick.Name = "colSubSaNick"; this.colSubSaNick.ReadOnly = true; - this.colSubSaNick.Width = 80; + this.colSubSaNick.Width = 65; // // colNotes // - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colNotes.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colNotes.DefaultCellStyle = dataGridViewCellStyle8; this.colNotes.HeaderText = "备注"; this.colNotes.Name = "colNotes"; this.colNotes.ReadOnly = true; @@ -831,6 +852,8 @@ private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox txtProdName; private UserComponent.UcCheckBox chkNoSubSa; + private UserControls.ButtonEx btnReFission; + private System.Windows.Forms.PictureBox pbFissionSetting; private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; @@ -848,6 +871,7 @@ private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode; private System.Windows.Forms.DataGridViewTextBoxColumn colStatus; private System.Windows.Forms.DataGridViewLinkColumn colDraftId; + private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime; private System.Windows.Forms.DataGridViewTextBoxColumn colMdyTime; private System.Windows.Forms.DataGridViewTextBoxColumn colSubSa; private System.Windows.Forms.DataGridViewTextBoxColumn colSubSaNick; @@ -855,7 +879,5 @@ private System.Windows.Forms.DataGridViewLinkColumn colEditNotes; private System.Windows.Forms.DataGridViewLinkColumn ColDelete; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; - private UserControls.ButtonEx btnReFission; - private System.Windows.Forms.PictureBox pbFissionSetting; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs index cf6a4d8..8b5ab7c 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs @@ -111,7 +111,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms this.ucSplitPage1.TotalPage = pageCount; var shopIdLst = list.Select(p => p.shop_id).Distinct().ToList(); - shopLst = AdminGetServerShopLst(shopIdLst); + shopLst = AdminShopListForm.AdminGetServerShopLstByIds(shopIdLst); if (defaultBitmap == null) defaultBitmap = new Bitmap(80, 80); @@ -132,8 +132,8 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms prodSelect.shop_account, "进店", shopLst.FirstOrDefault(s => s.ShopId == prodSelect.shop_id)?.LoginStatus2 == "国际版在线" ? "在线" : "登录", - "导入Cookies", - "复制Cookies", + "导入Cookie", + "复制Cookie", prodSelect.spu_id, prodSelect.skc_id, prodSelect.main_img.Replace("https:", "http:"), @@ -143,7 +143,8 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms prodSelect.ext_code, prodSelect.status, prodSelect.draft_id, - prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yy/MM/dd HH:mm"), + prodSelect.add_time.ToString("yy/MM/dd\r\n HH:mm"), + prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yy/MM/dd\r\n HH:mm"), string.IsNullOrEmpty(prodSelect.operate_sub_sa_name) ? "-" : prodSelect.operate_sub_sa_name, string.IsNullOrEmpty(prodSelect.operate_sub_sa_nick) ? "-" : prodSelect.operate_sub_sa_nick, prodSelect.notes, @@ -346,15 +347,15 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms } break; - case "导入Cookies": + case "导入Cookie": { var shop = GetShop(shopId); - ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa, "国际版"); + ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop, SetCookieFromEnum.sa, "国内版"); updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete; updateCookieForm.ShowDialog(); } break; - case "复制Cookies": + case "复制Cookie": { var shop = GetShop(shopId); string cookJs = ""; @@ -440,7 +441,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms var shop = shopLst.FirstOrDefault(s => s.ShopId == shopId); if (shop == null) { - shop = AdminGetServerShop(shopId); + shop = GetServerShopById(shopId); if (shop == null) { shop = new ShopLoginInfo() { ShopId = shopId }; @@ -526,7 +527,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms var shop = shopLst.FirstOrDefault(s => s.ShopId == prod.shop_id); if (shop == null) { - shop = AdminGetServerShop(prod.shop_id); + shop = GetServerShopById(prod.shop_id); if (shop == null) { shop = new ShopLoginInfo() { ShopId = prod.shop_id }; @@ -667,64 +668,12 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms })); } - public ShopLoginInfo AdminGetServerShop(string shop_id) + public ShopLoginInfo GetServerShopById(string shop_id) { - List list = AdminGetServerShopLst(new string[] { shop_id }.ToList()); + List list = AdminShopListForm.AdminGetServerShopLstByIds(new string[] { shop_id }.ToList()); return list.FirstOrDefault(); } - public List AdminGetServerShopLst(List shop_ids) - { - List list = new List(); - - var url = BaseClass.BuildObjString("shop/admin_get_shop_list"); - var data = UserLogin.GetSignaturex() + - "&shop_ids='" + string.Join("','", shop_ids) + "'"; - data += "&page_size=200"; - 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")) - html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) - || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) - { - return new List(); - } - - var jArr = JObject.Parse(html)["data"]; - if (jArr.Count() == 0) - return new List(); - - foreach (JObject jObj in jArr) - { - string shopStr = jObj.ToString(); - ShopLoginInfo shop = new ShopLoginInfo(); - shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id"); - if (shop.DbId == null) - continue; - shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name"); - shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass"); - shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id"); - shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account"); - shop.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name"); - shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name"); - shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group"); - shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie"); - shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.Cookies2 = BaseRegex.GetStringJson(ref shopStr, "cookie2"); - shop.Cookies2 = shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name"); - shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes"); - shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status"); - shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2"); - shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name"); - - list.Add(shop); - } - return list; - } - public TemuDBProduct GetProductDetail(string prodDbId) { if (string.IsNullOrEmpty(prodDbId)) @@ -1354,16 +1303,16 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms if (numbers.Count > 0 && numbers[0] > 0) { minNum = numbers[0]; + if (numbers.Count > 1 && numbers[1] > 0) + { + maxNum = numbers[1]; + } + if (maxNum < minNum) + { + maxNum = minNum; + } + headWords += Randomx.GetId(minNum, maxNum + 1) + "个"; } - if (numbers.Count > 1 && numbers[1] > 0) - { - maxNum = numbers[1]; - } - if (maxNum < minNum) - { - maxNum = minNum; - } - headWords += Randomx.GetId(minNum, maxNum + 1) + "个"; } string endWords = string.IsNullOrWhiteSpace(GlobalConfig.ProductWords.EndWords) ? "" : GlobalConfig.ProductWords.EndWords; diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx index 58ecc01..4d7c582 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx @@ -165,6 +165,9 @@ True + + True + True diff --git a/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs index a955e3d..9ba90b4 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs @@ -617,7 +617,7 @@ // colUpdateCookies // this.colUpdateCookies.FillWeight = 67F; - this.colUpdateCookies.HeaderText = "导入Cookies"; + this.colUpdateCookies.HeaderText = "导入Cookie"; this.colUpdateCookies.Name = "colUpdateCookies"; this.colUpdateCookies.ReadOnly = true; this.colUpdateCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; @@ -626,7 +626,7 @@ // colCopyCookies // this.colCopyCookies.FillWeight = 70F; - this.colCopyCookies.HeaderText = "复制Cookies"; + this.colCopyCookies.HeaderText = "复制Cookie"; this.colCopyCookies.Name = "colCopyCookies"; this.colCopyCookies.ReadOnly = true; this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; diff --git a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs index d604278..9b6b535 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs @@ -20,6 +20,7 @@ using System.Windows.Forms; using Work; using NaiBa.Util; using System.Globalization; +using TemuKJD.KJDForms.AdminForms; namespace TemuKJD.KJDForms.ShopForms { @@ -169,72 +170,8 @@ namespace TemuKJD.KJDForms.ShopForms var jArr = JObject.Parse(html)["data"]; if (jArr.Count() == 0) break; - foreach (JObject jObj in jArr) - { - string shopStr = jObj.ToString(); - ShopLoginInfo shop = new ShopLoginInfo(); - shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id"); - if (shop.DbId == null) - continue; - shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name"); - shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass"); - shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id"); - shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account"); - shop.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name"); - shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name"); - shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group"); - shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie"); - shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.Cookies2 = BaseRegex.GetStringJson(ref shopStr, "cookie2").ParseToString(); - shop.Cookies2 = shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name"); - shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes"); - shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status"); - shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2"); - shop.AddProductRemaining = BaseRegex.GetIntJson(ref shopStr, "add_product_remaining"); - shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name"); - //shop.PayStatus = BaseRegex.GetIntJson(ref shopStr, "shop_pay_status"); - //if (list.Any(l => l.ShopId == shop.ShopId) || list.Any(l => l.ShopName == shop.ShopName)) - // continue; - list.Add(shop); - } - } - - if (list.Count > 0) - { - #region 获取服务端保存的店铺cookies 暂时作废 - //string shopNames = ""; - //foreach (var shop in list) - //{ - // shopNames += shop.ShopName + ","; - //} - - //var cookies = GetServerShopCookies(shopNames); - //if (cookies?.Contains("\"code\":200") == false) - // cookies = GetServerShopCookies(shopNames); - //if (cookies?.Contains("\"code\":200") == false) - // cookies = GetServerShopCookies(shopNames); - //if (!string.IsNullOrEmpty(cookies) && cookies.Contains("\"code\":200")) - //{ - // var data = JObject.Parse(cookies)["data"]; - // foreach (var shop in list) - // { - // for (int j = 0; data != null && j < data.Count(); j++) - // { - // if (data[j][shop.ShopName] != null) - // { - // shop.Cookies = data[j][shop.ShopName].ToString().Replace("&", "&").Replace("%", "%").Replace("+", "+"); - // break; - // } - // } - // } - //} - #endregion - - #region 获取服务端保存的店铺授权信息 暂时作废 - //UpdateShopTokens(list); - #endregion + list.AddRange(AdminForms.AdminShopListForm.DeserializationShop(html)); } return list; } @@ -525,6 +462,7 @@ namespace TemuKJD.KJDForms.ShopForms shopList = shopList.Where(s => s.ShopAccount.ParseToString().ToLower().Contains(txtShopName.Text.ToLower())).ToList(); } + List shopIdList = GetCheckedShopIdList(); this.Invoke(new Action(() => { this.dgvShop.Rows.Clear(); @@ -543,7 +481,7 @@ namespace TemuKJD.KJDForms.ShopForms this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopList.Count; })); } - AddDataGridViewRow(shopList[i], true); + AddDataGridViewRow(shopList[i], true, shopIdList.Contains(shopList[i].ShopId)); } if (this.Created) { @@ -558,7 +496,7 @@ namespace TemuKJD.KJDForms.ShopForms }); } - private void AddDataGridViewRow(ShopLoginInfo param, bool isRefresh = false) + private void AddDataGridViewRow(ShopLoginInfo param, bool isRefresh = false, bool isRowCheck = false) { if (!this.Created) return; @@ -579,7 +517,7 @@ namespace TemuKJD.KJDForms.ShopForms else { int rowIndex = this.dgvShop.Rows.Add( - false, + isRowCheck, param.LoginName, param.ShopId, param.ShopAccount, @@ -598,8 +536,8 @@ namespace TemuKJD.KJDForms.ShopForms "多重登录", param.ApiAuthStatus, param.BuyApiAuth.ApiAuthStatus, - "导入Cookies", - "复制Cookies", + "导入Cookie", + "复制Cookie", "编辑", "删除"); if (!isRefresh) @@ -662,19 +600,37 @@ namespace TemuKJD.KJDForms.ShopForms public void CheckShopLogin(string[] shopNames, bool isShowProgress = true) { + for (int i = 0; i < shopNames.Length; i++) { - var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopNames[i]); var campanys = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopNames[i]).ToList(); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopNames[i]); + + // 先从服务端取最新cookie + var serverCampanys = AdminShopListForm.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList()); + var sss = string.Join(",", serverCampanys.Select(s => s.UserName + s.ShopAccount)); + var serverShop = serverCampanys.FirstOrDefault(); + if (shop != null && serverShop != null) + { + shop.Cookies = serverShop.Cookies; + shop.Cookies2 = serverShop.Cookies2; + foreach (var sc in campanys) + { + sc.Cookies = serverShop.Cookies; + sc.Cookies2 = serverShop.Cookies2; + } + } + if (shop != null) { - //var loginResult = "\"code\":0";//GetShopStatus(shop); var loginResult = GetShopStatus(shop); if (!loginResult.Contains("\"success\":true")) { + shop.Cookies = "empty=true;"; foreach (var sc in campanys) { sc.LoginStatus = "未登录"; + shop.Cookies = "empty=true;"; } } else @@ -682,10 +638,9 @@ namespace TemuKJD.KJDForms.ShopForms foreach(var sc in campanys) { sc.LoginStatus = "登录成功"; + sc.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); } } - //if (!string.IsNullOrEmpty(loginResult)) - // shop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); loginResult = ShopListForm.GetShopStatus2(shop); if (!loginResult.Contains("\"success\":true")) { @@ -701,9 +656,10 @@ namespace TemuKJD.KJDForms.ShopForms foreach (var sc in campanys) { sc.LoginStatus2 = "国际版在线"; - } } + //if (!string.IsNullOrEmpty(loginResult)) + // shop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie StartUp.SaveLocalShopLoginInfo(); } @@ -725,64 +681,6 @@ namespace TemuKJD.KJDForms.ShopForms string refere = "https://seller.kuajingmaihuo.com/"; string body = @"{}"; return KJDHttpResponse.PostResponse(shop, url, body, refere); - - //HttpWebResponse response = null; - //string result; - //try - //{ - // string url = "https://seller.kuajingmaihuo.com/bg/quiet/api/mms/userInfo"; - // HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - - // request.KeepAlive = true; - // request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); - // request.Headers.Add("Anti-Content", @"0aqAfqFyXcGvBgd9Q0HiJJ7kvWcKK7muUHnJ6oMAdmem0tmm_enmX1DBr-nJNxmoki33dqHTkZU18BU2p8P72Cg2uEZ_acOOBCxGmIs-Gym4EtKpTdZ6kWRCSClS9L6maLm0imx0GIjodHtLnwpx4ayHnhzNnCXEFecZSC8lBRHb9WCAoyY79kMLIWxBMZZSZrR2_LYUJ5UXzf-82ob455f7OvJa6s895N4wiMGR4vbVH8gFN2VuCxS27RpXDa2WCQQQd6XsJPw7amSUaob6oZ2MXuYb9K3ZqoCX5-nJimNZDR0rNCLB13sYgWq9jy0Q3gjnsFY2dJQDh3ewXS2vvf2DN9IAEzInwWTY31Fn0B6-s8DqwIm61OlXsfYt1AYOOyNMLzkw5llaDaqK21f7vspAuXwnJdAdKXJXSyyEimvTyF_AYLp1gkNqBqN1_ik_jc6cKTDJtGUgFjRojR4g4zM7Ww3wfW63WQrJftYhiTIJiS1tZcsceZht3Zu3MsvyxpAbx4bxFrvL0A6OFx752XsVi04Tm6HDhgt7MmpsrTO5WD_KjgjxNX8VNoGndD0OmriAYVn6kwmZXE6Y_khGedxumIGy4sOQI36__CeiuiPIvB8itfOqd7eyqyeCIaEODrh9dSLBQz8AxQ2xt60OTn4HSiPmlwo1J0TFtjUw2DUZB68tdrINb7ugulMsaIwMKr8S0bilSKW6JuYw3oAsmK3daQfJWy3mzVowY1UwPQfTB4Ibz6uRQxHkvhsRTXkrAygGeZIc9S"); - // request.Headers.Add("sec-ch-ua-platform", @"""Windows"""); - // request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"; - // request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24"""); - // request.Headers.Add("Sec-Purpose", @"prefetch;prerender"); - // request.ContentType = "application/json"; - // request.Headers.Add("sec-ch-ua-mobile", @"?0"); - // request.Accept = "*/*"; - // request.Headers.Add("Origin", @"https://seller.kuajingmaihuo.com"); - // request.Headers.Add("Purpose", @"prefetch"); - // request.Headers.Add("Sec-Fetch-Site", @"same-origin"); - // request.Headers.Add("Sec-Fetch-Mode", @"cors"); - // request.Headers.Add("Sec-Fetch-Dest", @"empty"); - // request.Referer = "https://seller.kuajingmaihuo.com/"; - // request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd"); - // //request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); - // request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); - // request.Headers.Set(HttpRequestHeader.Cookie, shop.Cookies); - - // request.Method = "POST"; - // request.ServicePoint.Expect100Continue = false; - - // string body = @"{}"; - // byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body); - // request.ContentLength = postBytes.Length; - // Stream stream = request.GetRequestStream(); - // stream.Write(postBytes, 0, postBytes.Length); - // stream.Close(); - - // response = (HttpWebResponse)request.GetResponse(); - //} - //catch (WebException ex) - //{ - // if (ex.Status == WebExceptionStatus.ProtocolError) - // { - // response = (HttpWebResponse)ex.Response; - // result = GetProxyHtml.ReadResponse(response); - // return result; - // } - // else return ex.Message; - //} - //catch (Exception e) - //{ - // if (response != null) response.Close(); - // return e.Message; - //} - //result = GetProxyHtml.ReadResponse(response); - //return result; } /// @@ -884,7 +782,7 @@ namespace TemuKJD.KJDForms.ShopForms IsOperate = false; } break; - case "复制Cookies": + case "复制Cookie": //SUB_PASS_ID=eyJ0IjoiRHBPWTBvVGxKWlZCZ1FmNVpPNGFwUjczdDZzUGk5bWVzbHZGejBUYlFkK3c4VjN4ZUIyV1RtZ24ybCtwWkhyNSIsInYiOjEsInMiOjEwMDAwLCJ1IjoyNDg3NDUxOTIxNzE0fQ== string cook = shop.Cookies; //cook = BaseRegex.GetStringCookie(ref cook, "SUB_PASS_ID"); @@ -946,7 +844,7 @@ namespace TemuKJD.KJDForms.ShopForms Clipboard.SetDataObject(cookJs); BaseMsgForm.ShowInfo("复制成功"); break; - case "导入Cookies": + case "导入Cookie": ShopUpdateCookieForm updateCookieForm = new ShopUpdateCookieForm(shop); updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete; updateCookieForm.ShowDialog(); @@ -1095,6 +993,20 @@ namespace TemuKJD.KJDForms.ShopForms return shopNameList; } + private List GetCheckedShopIdList() + { + List shopNameList = new List(); + for (int i = 0; i < dgvShop.Rows.Count; i++) + { + if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool()) + { + string shopName = dgvShop.Rows[i].Cells["colShopId"].Value.ParseToString(); + shopNameList.Add(shopName); + } + } + return shopNameList; + } + private void btnLoginSelect_Click(object sender, EventArgs e) { ShopListForm.IsOperate = true; diff --git a/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs index 5136db2..01efd91 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs @@ -136,7 +136,7 @@ namespace TemuKJD.KJDForms.ShopForms } List serverShopLst = new List(); - var rst = AdminGetServerShopListForSetCookie(shopLoginInfo, serverShopLst); + var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst); if (rst != "success") { @@ -211,7 +211,7 @@ namespace TemuKJD.KJDForms.ShopForms } List serverShopLst = new List(); - var rst = AdminGetServerShopListForSetCookie(shopLoginInfo, serverShopLst); + var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst); if (rst != "success") { @@ -290,67 +290,13 @@ namespace TemuKJD.KJDForms.ShopForms if (oldServerShop == null) { if (updateFrom != SetCookieFromEnum.normal_user) - AdminShopForm.AdminAddServerShop(newShop); // 店铺写入到服务端 + AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端 else ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端 } } } - public static string AdminGetServerShopListForSetCookie(ShopLoginInfo loginShop, List lstRst) - { - if (lstRst == null) - lstRst = new List(); - - var url = BaseClass.BuildObjString("shop/admin_get_shop_list"); - var data = UserLogin.GetSignaturex() + - "&search_user_name=" + loginShop.UserName + - "&search_login_name=" + loginShop.LoginName; - 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")) - html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) - || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) - { - return "获取失败:" + BaseRegex.GetStringJson(ref html, "msg"); - } - - var jArr = JObject.Parse(html)["data"]; - if (jArr.Count() == 0) - return "获取失败:未获取到data数据"; - - foreach (JObject jObj in jArr) - { - string shopStr = jObj.ToString(); - ShopLoginInfo shop = new ShopLoginInfo(); - shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id"); - if (shop.DbId == null) - continue; - - shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name"); - shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass"); - shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id"); - shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account"); - shop.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name"); - shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name"); - shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group"); - shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie"); - shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.Cookies2 = BaseRegex.GetStringJson(ref shopStr, "cookie2"); - shop.Cookies2 = shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name"); - shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes"); - shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status"); - shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2"); - shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name"); - - lstRst.Add(shop); - } - return "success"; - } - private void btnGetCookie_Click(object sender, EventArgs e) { //复制cookie