diff --git a/AllBase/AllBase.csproj b/AllBase/AllBase.csproj index ee8ab38..c65c837 100644 --- a/AllBase/AllBase.csproj +++ b/AllBase/AllBase.csproj @@ -195,6 +195,7 @@ + diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index f3436fe..0148872 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,8 +27,8 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 593; - //public static int VersionCount = 593; + public static int VersionCount = 596; + //public static int VersionCount = 596; /// /// 版本号 diff --git a/AllBase/Model/Result/PDDResult/PDDMaterialInfo.cs b/AllBase/Model/Result/PDDResult/PDDMaterialInfo.cs new file mode 100644 index 0000000..1626963 --- /dev/null +++ b/AllBase/Model/Result/PDDResult/PDDMaterialInfo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AllBase.Model.Result.PDDResult +{ + public class PDDMaterialInfo + { + public long? latest_material_id { get; set; } + public string latest_material { get; set; } + public int? check_status { get; set; } + public object check_comment { get; set; } + public string online_material { get; set; } + } +} diff --git a/AllBase/Model/Result/PDDResult/PDDProductInfo.cs b/AllBase/Model/Result/PDDResult/PDDProductInfo.cs index dd6156b..93419b1 100644 --- a/AllBase/Model/Result/PDDResult/PDDProductInfo.cs +++ b/AllBase/Model/Result/PDDResult/PDDProductInfo.cs @@ -12,5 +12,13 @@ namespace AllBase.Model.Result.PDDResult public PDDSizeSpecInfo size { get; set; } public PDDProductDecorationInfo decoration { get; set; } public PDDProductPropertyInfo property { get; set; } + /// + /// 白底图 + /// + public PDDMaterialInfo material1 { get; set; } + /// + /// 长图 + /// + public PDDMaterialInfo material3 { get; set; } } } diff --git a/TEMUKJD/BLL/ShopBLL.cs b/TEMUKJD/BLL/ShopBLL.cs index 8ffead1..6fc9b2b 100644 --- a/TEMUKJD/BLL/ShopBLL.cs +++ b/TEMUKJD/BLL/ShopBLL.cs @@ -14,6 +14,79 @@ namespace TemuKJD.BLL { public class ShopBLL { + public static string AddServerShop(ShopLoginInfo _shop) + { + var url = BaseClass.BuildObjString("shop/add_shop"); + var data = UserLogin.GetSignaturex() + + "&login_name=" + _shop.LoginName + + "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password) + + "&shop_id=" + _shop.ShopId + + "&shop_account=" + _shop.ShopAccount + + "&cookie=" + _shop.Cookies + + "&cookie2=" + _shop.Cookies2 + + "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName) + + "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName) + + "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes) + + "&login_status=" + _shop.LoginStatus + + "&anti_contents=" + JsonHelper.SerializeObject(_shop.AntiContents); + + var result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) + result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) + result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200")) + { + var msg = BaseRegex.GetStringJson(ref result, "msg"); + if (string.IsNullOrEmpty(msg)) + msg = "店铺保存失败!"; + BaseMsgForm.ShowError(msg); + } + return result; + } + + /// + /// 更新店铺子账号和分组备注信息 + /// + /// + /// + public static string MdyServerShopSubInfo(ShopLoginInfo _shop) + { + var url = BaseClass.BuildObjString("shop/mdy_shop"); + var data = UserLogin.GetSignaturex() + + "&login_name=" + _shop.LoginName + + "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password) + + "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName) + + "&sub_user_name=" + _shop.SubUserName + + "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes); + + var result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) + result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) + result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200")) + { + var msg = BaseRegex.GetStringJson(ref result, "msg"); + if (string.IsNullOrEmpty(msg)) + msg = "店铺保存失败!"; + BaseMsgForm.ShowError(msg); + } + return result; + } + + public static string MdyAntiContent(ShopLoginInfo shop) + { + var urlAddress = BaseClass.BuildObjString("shop/mdy_anti_content"); + var data = UserLogin.GetSignaturex() + + "&login_name=" + shop.LoginName + + "&shop_id=" + shop.ShopId + + "&anti_contents=[]"; //+ JsonHelper.SerializeObject(shop.AntiContents); + var result = GetHtml.PostUtf8(urlAddress, data); + NaiBa.Util.Helper.ConfigHelper.SaveConfig("verifi_code\\" + shop.ShopId, JsonHelper.SerializeObject(shop.AntiContents)); + return result; + } + public static List AdminGetServerShopLstByIds(List shop_ids) { List list = new List(); @@ -66,16 +139,17 @@ namespace TemuKJD.BLL { var url = BaseClass.BuildObjString("shop/admin_add_shop"); var data = UserLogin.GetSignaturex() - + "&shop_user_name=" + _shop.UserName + "&login_name=" + _shop.LoginName + "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password) + "&shop_id=" + _shop.ShopId + "&shop_account=" + _shop.ShopAccount + "&cookie=" + _shop.Cookies + + "&cookie2=" + _shop.Cookies2 + "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName) + "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName) + "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes) - + "&login_status=" + _shop.LoginStatus; + + "&login_status=" + _shop.LoginStatus + + "&shop_user_name=" + _shop.UserName; var result = GetHtml.PostUtf8(url, data); if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) @@ -162,8 +236,6 @@ namespace TemuKJD.BLL //shop.Cookies2 = BaseRegex.GetStringJson(ref shopStr, "cookie2").ParseToString(); shop.Cookies2 = jObj["cookie2"].ToString(); shop.Cookies2 = shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+"); - shop.AntiContents.Clear(); - shop.AntiContents.AddRange(JsonHelper.DeserializeJsonToList(jObj["anti_contents"].IsNullOrEmpty() ? "[]" : jObj["anti_contents"].ToString())); shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name"); shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes"); shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status"); @@ -171,6 +243,14 @@ namespace TemuKJD.BLL shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name"); shop.AddProductRemaining = BaseRegex.GetIntJson(ref shopStr, "add_product_remaining"); + if (BaseClass.MainPath == "binxixi") + { + shop.AntiContents.Clear(); + //shop.AntiContents.AddRange(JsonHelper.DeserializeJsonToList(jObj["anti_contents"].IsNullOrEmpty() ? "[]" : jObj["anti_contents"].ToString())); + shop.AntiContents = NaiBa.Util.Helper.ConfigHelper.LoadConfig>("verifi_code\\" + shop.ShopId); + if (shop.AntiContents == null) + shop.AntiContents = new NaiBa.Util.ConcurrentList(); + } list.Add(shop); } return list; diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.Designer.cs index b2b7a16..c525629 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.Designer.cs @@ -30,11 +30,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - 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 dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.pnlEmpty = new DevComponents.DotNetBar.PanelEx(); @@ -98,6 +98,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.btnClear = new DevComponents.DotNetBar.PanelEx(); this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.txtFilter = new System.Windows.Forms.TextBox(); + this.btnFilter = new DevComponents.DotNetBar.PanelEx(); + this.btnRestore = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -439,6 +442,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms | System.Windows.Forms.AnchorStyles.Left))); this.ucGroupBoxEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx1.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx1.Controls.Add(this.btnRestore); + this.ucGroupBoxEx1.Controls.Add(this.btnFilter); + this.ucGroupBoxEx1.Controls.Add(this.txtFilter); this.ucGroupBoxEx1.Controls.Add(this.btnRefreshShop); this.ucGroupBoxEx1.Location = new System.Drawing.Point(3, 2); this.ucGroupBoxEx1.Name = "ucGroupBoxEx1"; @@ -516,18 +522,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms // this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11; this.dgvShop.BackgroundColor = System.Drawing.Color.White; this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - 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; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -644,18 +650,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms // this.dgvSelectProduct.AllowUserToAddRows = false; this.dgvSelectProduct.AllowUserToDeleteRows = false; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White; this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - 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; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colCheck, @@ -774,8 +780,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms // // colProductName // - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle15; this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; @@ -915,14 +921,74 @@ namespace TemuKJD.KJDForms.ProductSelectForms // this.ucSplitPage1.CurrentPage = 1; this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; + this.ucSplitPage1.IsShowPageSize = false; this.ucSplitPage1.Location = new System.Drawing.Point(114, 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.PageSize = 50; this.ucSplitPage1.Size = new System.Drawing.Size(573, 26); this.ucSplitPage1.TabIndex = 675; this.ucSplitPage1.TotalPage = 1; // + // txtFilter + // + this.txtFilter.Location = new System.Drawing.Point(17, 59); + this.txtFilter.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); + this.txtFilter.Name = "txtFilter"; + this.txtFilter.Size = new System.Drawing.Size(110, 23); + this.txtFilter.TabIndex = 482; + // + // btnFilter + // + this.btnFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnFilter.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnFilter.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnFilter.DisabledBackColor = System.Drawing.Color.Empty; + this.btnFilter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnFilter.Location = new System.Drawing.Point(17, 86); + this.btnFilter.Name = "btnFilter"; + this.btnFilter.Size = new System.Drawing.Size(67, 24); + this.btnFilter.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnFilter.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnFilter.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnFilter.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnFilter.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnFilter.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnFilter.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnFilter.Style.GradientAngle = 90; + this.btnFilter.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnFilter.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnFilter.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnFilter.TabIndex = 486; + this.btnFilter.Text = "筛选店铺"; + this.btnFilter.Click += new System.EventHandler(this.btnFilter_Click); + // + // btnRestore + // + this.btnRestore.CanvasColor = System.Drawing.SystemColors.Control; + this.btnRestore.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnRestore.DisabledBackColor = System.Drawing.Color.Empty; + this.btnRestore.Location = new System.Drawing.Point(86, 87); + this.btnRestore.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); + this.btnRestore.Name = "btnRestore"; + this.btnRestore.Size = new System.Drawing.Size(41, 23); + this.btnRestore.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnRestore.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnRestore.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnRestore.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.btnRestore.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRestore.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.btnRestore.Style.GradientAngle = 90; + this.btnRestore.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.btnRestore.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnRestore.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRestore.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRestore.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnRestore.TabIndex = 508; + this.btnRestore.Text = "还原"; + this.btnRestore.Click += new System.EventHandler(this.btnRestore_Click); + // // DbProductUserSelectForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -941,6 +1007,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.ucGroupBoxEx4.ResumeLayout(false); this.ucGroupBoxEx4.PerformLayout(); this.ucGroupBoxEx1.ResumeLayout(false); + this.ucGroupBoxEx1.PerformLayout(); this.splitContainer3.Panel1.ResumeLayout(false); this.splitContainer3.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); @@ -1025,5 +1092,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining; private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; + private System.Windows.Forms.TextBox txtFilter; + private DevComponents.DotNetBar.PanelEx btnRestore; + private DevComponents.DotNetBar.PanelEx btnFilter; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.cs index 33554af..3d2aaba 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductUserSelectForm.cs @@ -528,5 +528,33 @@ namespace TemuKJD.KJDForms.ProductSelectForms { ShowDgvImg(); } + + private void btnFilter_Click(object sender, EventArgs e) + { + var filterText = txtFilter.Text.Trim(); + foreach(DataGridViewRow row in this.dgvShop.Rows) + { + if (row.Cells["colShopId"].Value.ParseToString().Contains(filterText) || + row.Cells["colShopName"].Value.ParseToString().Contains(filterText) || + row.Cells["colShopNotes"].Value.ParseToString().Contains(filterText)) + { + row.Visible = true; + } + else + { + row.Visible = false; + row.Cells["colSelect"].Value = false; + } + } + } + + private void btnRestore_Click(object sender, EventArgs e) + { + txtFilter.Text = ""; + foreach (DataGridViewRow row in this.dgvShop.Rows) + { + row.Visible = true; + } + } } } diff --git a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs index 1c56636..56b2c7f 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs @@ -33,61 +33,6 @@ namespace TemuKJD.KJDForms.ShopForms private bool isLoading { get; set; } = false; #region 服务端店铺管理 - public static string AddServerDouShop(ShopLoginInfo _shop) - { - var url = BaseClass.BuildObjString("shop/add_shop"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + _shop.LoginName - + "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password) - + "&shop_id=" + _shop.ShopId - + "&shop_account=" + _shop.ShopAccount - + "&cookie=" + _shop.Cookies - + "&cookie2=" + _shop.Cookies2 - + "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName) - + "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName) - + "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes) - + "&login_status=" + _shop.LoginStatus; - - var result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200")) - { - var msg = BaseRegex.GetStringJson(ref result, "msg"); - if (string.IsNullOrEmpty(msg)) - msg = "店铺保存失败!"; - BaseMsgForm.ShowError(msg); - } - return result; - } - - public static string MdyServerDouShop(ShopLoginInfo _shop) - { - var url = BaseClass.BuildObjString("shop/mdy_shop"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + _shop.LoginName - + "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password) - + "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName) - + "&sub_user_name=" + _shop.SubUserName - + "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes); - - var result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200")) - { - var msg = BaseRegex.GetStringJson(ref result, "msg"); - if (string.IsNullOrEmpty(msg)) - msg = "店铺保存失败!"; - BaseMsgForm.ShowError(msg); - } - return result; - } - public static void UpdateShop() { // 获取本地店铺和服务端店铺。将服务端相关信息与本地店铺合并后暂时存在内存中(不保存敏感信息)。 @@ -327,13 +272,13 @@ namespace TemuKJD.KJDForms.ShopForms } else { - ShopListForm.AddServerDouShop(shopInfo); + ShopBLL.AddServerShop(shopInfo); btnRefreshCookie_Click(null, null); } } else { - ShopListForm.MdyServerDouShop(shopInfo); + ShopBLL.MdyServerShopSubInfo(shopInfo); btnRefreshCookie_Click(null, null); } } @@ -417,7 +362,7 @@ namespace TemuKJD.KJDForms.ShopForms else GlobalConfig.ShopLoginList.Add(shop); StartUp.SaveLocalShopLoginInfo(); - ShopListForm.AddServerDouShop(shop); + ShopBLL.AddServerShop(shop); } } } diff --git a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs index 7b49fad..819fa5c 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs @@ -25,6 +25,7 @@ using System.Windows.Forms; using Work; using Work.BLL.Tools; using TemuKJD.KJDForms.AdminForms; +using TemuKJD.BLL; namespace TemuKJD.KJDForms.ShopForms { @@ -169,7 +170,7 @@ namespace TemuKJD.KJDForms.ShopForms if (oldShop == null) { GlobalConfig.ShopLoginList.Add(newShop); - ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端 + ShopBLL.AddServerShop(newShop); // 店铺写入到服务端 } else { @@ -276,7 +277,7 @@ namespace TemuKJD.KJDForms.ShopForms if (oldShop == null) { GlobalConfig.ShopLoginList.Add(newShop); - ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端 + ShopBLL.AddServerShop(newShop); // 店铺写入到服务端 } else { diff --git a/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs index c21c8b9..40238b5 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopUpdateCookieForm.cs @@ -313,7 +313,7 @@ namespace TemuKJD.KJDForms.ShopForms if (updateFrom != SetCookieFromEnum.normal_user) ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端 else - ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端 + ShopBLL.AddServerShop(newShop); // 店铺写入到服务端 } } } diff --git a/TEMUKJD/PDDForms/AdminForms/PDDAdminShopLoginForm.cs b/TEMUKJD/PDDForms/AdminForms/PDDAdminShopLoginForm.cs index 0332838..3899e15 100644 --- a/TEMUKJD/PDDForms/AdminForms/PDDAdminShopLoginForm.cs +++ b/TEMUKJD/PDDForms/AdminForms/PDDAdminShopLoginForm.cs @@ -188,13 +188,8 @@ namespace TemuKJD.PDDForms.AdminForms } else { - shop.AntiContents = newShop.AntiContents; - var urlAddress = BaseClass.BuildObjString("shop/mdy_anti_content"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + shop.LoginName - + "&shop_id=" + shop.ShopId - + "&anti_contents=" + JsonHelper.SerializeObject(newShop.AntiContents); - var result = GetHtml.PostUtf8(urlAddress, data); + shop.AntiContents.AddRange(newShop.AntiContents); + ShopBLL.MdyAntiContent(shop); } } shop.Cookies = cookies; @@ -508,15 +503,9 @@ namespace TemuKJD.PDDForms.AdminForms if (!string.IsNullOrEmpty(shop.ShopId) && GetAntiContentsTimes > 50) { GetAntiContentsTimes = 0; - var antis = shop.AntiContents; Task.Run(() => { - var urlAddress = BaseClass.BuildObjString("shop/mdy_anti_content"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + shop.LoginName - + "&shop_id=" + shop.ShopId - + "&anti_contents=" + JsonHelper.SerializeObject(antis); - var result = GetHtml.PostUtf8(urlAddress, data); + ShopBLL.MdyAntiContent(shop); }); } } diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs index c72c577..d645304 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs @@ -59,8 +59,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvDbProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.col_db_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colFromShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_product_name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMainImg = new System.Windows.Forms.DataGridViewImageColumn(); @@ -75,11 +78,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colEndWords = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colFissionWords = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colAddTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colMdyTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_edit = new System.Windows.Forms.DataGridViewLinkColumn(); this.col_delete = new System.Windows.Forms.DataGridViewLinkColumn(); this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn(); - 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(); @@ -110,8 +112,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer1.Panel1.Controls.Add(this.lblNotes); this.splitContainer1.Panel1.Controls.Add(this.txtSPU); this.splitContainer1.Panel1.Controls.Add(this.label5); - this.splitContainer1.Panel1.Controls.Add(this.txtSKC); - this.splitContainer1.Panel1.Controls.Add(this.label1); this.splitContainer1.Panel1.Controls.Add(this.pnlEmpty); this.splitContainer1.Panel1.Controls.Add(this.btnSearch); this.splitContainer1.Panel1.Controls.Add(this.txtExtCode); @@ -153,7 +153,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.cmbSort.Items.AddRange(new object[] { "入库时间", "认领总数"}); - this.cmbSort.Location = new System.Drawing.Point(1001, 15); + this.cmbSort.Location = new System.Drawing.Point(887, 16); this.cmbSort.Name = "cmbSort"; this.cmbSort.Size = new System.Drawing.Size(79, 25); this.cmbSort.TabIndex = 448; @@ -179,7 +179,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // txtNotes // - this.txtNotes.Location = new System.Drawing.Point(683, 16); + this.txtNotes.Location = new System.Drawing.Point(569, 17); this.txtNotes.Name = "txtNotes"; this.txtNotes.Size = new System.Drawing.Size(90, 23); this.txtNotes.TabIndex = 439; @@ -187,7 +187,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // lblNotes // this.lblNotes.AutoSize = true; - this.lblNotes.Location = new System.Drawing.Point(649, 19); + this.lblNotes.Location = new System.Drawing.Point(535, 20); this.lblNotes.Name = "lblNotes"; this.lblNotes.Size = new System.Drawing.Size(44, 17); this.lblNotes.TabIndex = 440; @@ -195,7 +195,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // txtSPU // - this.txtSPU.Location = new System.Drawing.Point(44, 16); + this.txtSPU.Location = new System.Drawing.Point(57, 16); this.txtSPU.Name = "txtSPU"; this.txtSPU.Size = new System.Drawing.Size(90, 23); this.txtSPU.TabIndex = 434; @@ -205,32 +205,34 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(11, 19); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(43, 17); + this.label5.Size = new System.Drawing.Size(57, 17); this.label5.TabIndex = 435; - this.label5.Text = "SPU:"; + this.label5.Text = "商品ID:"; // // txtSKC // - this.txtSKC.Location = new System.Drawing.Point(171, 16); + this.txtSKC.Location = new System.Drawing.Point(87, 80); this.txtSKC.Name = "txtSKC"; this.txtSKC.Size = new System.Drawing.Size(90, 23); this.txtSKC.TabIndex = 432; + this.txtSKC.Visible = false; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(138, 19); + this.label1.Location = new System.Drawing.Point(54, 83); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(43, 17); this.label1.TabIndex = 433; this.label1.Text = "SKC:"; + this.label1.Visible = false; // // pnlEmpty // this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control; this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty; - this.pnlEmpty.Location = new System.Drawing.Point(843, 14); + this.pnlEmpty.Location = new System.Drawing.Point(729, 15); this.pnlEmpty.Name = "pnlEmpty"; this.pnlEmpty.Size = new System.Drawing.Size(56, 26); this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -256,7 +258,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSearch.ForeColor = System.Drawing.Color.White; - this.btnSearch.Location = new System.Drawing.Point(782, 14); + this.btnSearch.Location = new System.Drawing.Point(668, 15); this.btnSearch.Margin = new System.Windows.Forms.Padding(2); this.btnSearch.Name = "btnSearch"; this.btnSearch.Size = new System.Drawing.Size(56, 26); @@ -267,7 +269,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // txtExtCode // - this.txtExtCode.Location = new System.Drawing.Point(555, 16); + this.txtExtCode.Location = new System.Drawing.Point(441, 17); this.txtExtCode.Name = "txtExtCode"; this.txtExtCode.Size = new System.Drawing.Size(90, 23); this.txtExtCode.TabIndex = 429; @@ -275,7 +277,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(521, 19); + this.label4.Location = new System.Drawing.Point(407, 20); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(44, 17); this.label4.TabIndex = 430; @@ -283,7 +285,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // txtProdName // - this.txtProdName.Location = new System.Drawing.Point(427, 16); + this.txtProdName.Location = new System.Drawing.Point(313, 17); this.txtProdName.Name = "txtProdName"; this.txtProdName.Size = new System.Drawing.Size(90, 23); this.txtProdName.TabIndex = 427; @@ -291,7 +293,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(393, 19); + this.label3.Location = new System.Drawing.Point(279, 20); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(44, 17); this.label3.TabIndex = 428; @@ -299,7 +301,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // txtCat // - this.txtCat.Location = new System.Drawing.Point(299, 16); + this.txtCat.Location = new System.Drawing.Point(185, 17); this.txtCat.Name = "txtCat"; this.txtCat.Size = new System.Drawing.Size(90, 23); this.txtCat.TabIndex = 425; @@ -307,7 +309,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(265, 19); + this.label2.Location = new System.Drawing.Point(151, 20); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(44, 17); this.label2.TabIndex = 426; @@ -316,7 +318,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(944, 19); + this.label6.Location = new System.Drawing.Point(830, 20); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(68, 17); this.label6.TabIndex = 449; @@ -333,6 +335,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms // splitContainer2.Panel1 // this.splitContainer2.Panel1.Controls.Add(this.pbLoading); + this.splitContainer2.Panel1.Controls.Add(this.txtSKC); + this.splitContainer2.Panel1.Controls.Add(this.label1); this.splitContainer2.Panel1.Controls.Add(this.dgvDbProduct); this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0); // @@ -376,6 +380,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.dgvDbProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, this.col_db_id, + this.colFromShopId, this.col_product_name, this.colImgUrl, this.colMainImg, @@ -390,6 +395,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colEndWords, this.colFissionWords, this.colAddTime, + this.colMdyTime, this.col_edit, this.col_delete, this.col_select_product}); @@ -403,6 +409,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.dgvDbProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellContentClick); this.dgvDbProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvDbProduct_Scroll); // + // ucSplitPage1 + // + this.ucSplitPage1.CurrentPage = 1; + this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; + this.ucSplitPage1.IsShowPageSize = false; + this.ucSplitPage1.Location = new System.Drawing.Point(996, 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.PageSize = 50; + 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(1358, 25); + this.statusBar.TabIndex = 5; + // // colSelect // this.colSelect.FillWeight = 26F; @@ -414,16 +445,24 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // col_db_id // + this.col_db_id.FillWeight = 50F; this.col_db_id.HeaderText = "数据库Id"; this.col_db_id.Name = "col_db_id"; this.col_db_id.ReadOnly = true; this.col_db_id.Visible = false; // + // colFromShopId + // + this.colFromShopId.HeaderText = "来源店铺Id"; + this.colFromShopId.Name = "colFromShopId"; + this.colFromShopId.ReadOnly = true; + this.colFromShopId.Visible = false; + // // col_product_name // dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.col_product_name.DefaultCellStyle = dataGridViewCellStyle3; - this.col_product_name.FillWeight = 200F; + this.col_product_name.FillWeight = 150F; this.col_product_name.HeaderText = "标题"; this.col_product_name.Name = "col_product_name"; this.col_product_name.ReadOnly = true; @@ -447,7 +486,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // col_spu_id // - this.col_spu_id.HeaderText = "SPU Id"; + this.col_spu_id.HeaderText = "商品Id"; this.col_spu_id.Name = "col_spu_id"; this.col_spu_id.ReadOnly = true; // @@ -456,6 +495,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.col_skc_id.HeaderText = "SKC Id"; this.col_skc_id.Name = "col_skc_id"; this.col_skc_id.ReadOnly = true; + this.col_skc_id.Visible = false; // // col_cat_name // @@ -520,10 +560,18 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // colAddTime // + this.colAddTime.FillWeight = 80F; this.colAddTime.HeaderText = "入库时间"; this.colAddTime.Name = "colAddTime"; this.colAddTime.ReadOnly = true; // + // colMdyTime + // + this.colMdyTime.FillWeight = 80F; + this.colMdyTime.HeaderText = "更新时间"; + this.colMdyTime.Name = "colMdyTime"; + this.colMdyTime.ReadOnly = true; + // // col_edit // this.col_edit.FillWeight = 60F; @@ -549,31 +597,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.col_select_product.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.col_select_product.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; // - // ucSplitPage1 - // - this.ucSplitPage1.CurrentPage = 1; - this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; - this.ucSplitPage1.IsShowPageSize = false; - this.ucSplitPage1.Location = new System.Drawing.Point(996, 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.PageSize = 50; - 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(1358, 25); - this.statusBar.TabIndex = 5; - // // PDDDBProdListForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -593,6 +616,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel1.PerformLayout(); this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); @@ -627,8 +651,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms private UserControls.ButtonEx btnSelect; private System.Windows.Forms.ComboBox cmbSort; private System.Windows.Forms.Label label6; + private UserControls.ButtonEx btnDelSelect; private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn col_db_id; + private System.Windows.Forms.DataGridViewTextBoxColumn colFromShopId; private System.Windows.Forms.DataGridViewTextBoxColumn col_product_name; private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; private System.Windows.Forms.DataGridViewImageColumn colMainImg; @@ -643,9 +669,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.DataGridViewTextBoxColumn colEndWords; private System.Windows.Forms.DataGridViewTextBoxColumn colFissionWords; private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime; + private System.Windows.Forms.DataGridViewTextBoxColumn colMdyTime; private System.Windows.Forms.DataGridViewLinkColumn col_edit; private System.Windows.Forms.DataGridViewLinkColumn col_delete; private System.Windows.Forms.DataGridViewLinkColumn col_select_product; - private UserControls.ButtonEx btnDelSelect; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs index 55912e3..f368bbe 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs @@ -42,6 +42,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms { if (BaseClass.SaLevel == 1 && shop == null) // 一级管理员且不是选品状态 { + this.dgvDbProduct.Columns["col_db_id"].Visible = true; + this.dgvDbProduct.Columns["colFromShopId"].Visible = true; this.dgvDbProduct.Columns["col_delete"].Visible = true; this.dgvDbProduct.Columns["col_edit"].Visible = true; this.dgvDbProduct.Columns["colHeadWords"].Visible = true; @@ -55,6 +57,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms } else { + this.dgvDbProduct.Columns["col_db_id"].Visible = false; + this.dgvDbProduct.Columns["colFromShopId"].Visible = false; this.dgvDbProduct.Columns["col_delete"].Visible = false; this.dgvDbProduct.Columns["col_edit"].Visible = false; this.dgvDbProduct.Columns["colHeadWords"].Visible = false; @@ -128,6 +132,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms int rowIndex = this.dgvDbProduct.Rows.Add( false, prod.id, + prod.from_shop_id, prod.product_name, prod?.main_img?.Replace("https", "http"), defaultBitmap, // prod.main_img, @@ -141,7 +146,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms prod.head_words, prod.end_words, prod.fission_words, - prod.add_time, + prod.add_time.ToString("yy-MM-dd HH:mm"), + prod.mdy_time.ToString("yy-MM-dd HH:mm"), "编辑", "删除", "认领"); diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx index bcab5c3..bf932f6 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx @@ -123,6 +123,9 @@ True + + True + True @@ -165,6 +168,9 @@ True + + True + True diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs index 4838a58..027494d 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs @@ -1260,7 +1260,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms content = (propInfo.values.FirstOrDefault()?.value).ParseToString(), }; - sleepTime = Randomx.GetId(500, 1500); + sleepTime = Randomx.GetId(500, 1399); sleepTimeTotal += sleepTime; Thread.Sleep(sleepTime); if (!isChanceApi) @@ -1419,6 +1419,42 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.out_goods_sn = prodInfo.detail.out_goods_sn; prodParam.oversea_goods = prodInfo.detail.oversea_goods == null ? new object() : prodInfo.detail.oversea_goods; prodParam.prefillWhitePic = ""; // 白底图,需要研究如何获取 + // 白底图 + if (prodInfo.material1 != null && !string.IsNullOrEmpty(prodInfo.material1.online_material)) + { + prodParam.prefillWhitePic = prodInfo.material1.online_material; + + sleepTime = Randomx.GetId(500, 1440); + sleepTimeTotal += sleepTime; + Thread.Sleep(sleepTime); + var material_html = create_material(shop, prodParam.prefillWhitePic, 1, prodParam.cat_ids, + prodParam.goods_id.ParseToString(), prodParam.goods_commit_id); + if (!material_html.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref material_html, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = material_html; + return "上传失败 " + error; + } + } + // 长图 + if (prodInfo.material3 != null && !string.IsNullOrEmpty(prodInfo.material3.online_material)) + { + //prodParam.prefillWhitePic = prodInfo.material3.online_material; + sleepTime = Randomx.GetId(500, 1399); + sleepTimeTotal += sleepTime; + Thread.Sleep(sleepTime); + var material_html = create_material(shop, prodInfo.material3.online_material, 3, prodParam.cat_ids, + prodParam.goods_id.ParseToString(), prodParam.goods_commit_id); + if (!material_html.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref material_html, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = material_html; + return "上传失败 " + error; + } + } + prodParam.pre_sale_time = prodInfo.detail.pre_sale_time.ParseToString(); prodParam.privacy_delivery = prodInfo.detail.privacy_delivery; prodParam.processing_charges = prodInfo.detail.processing_charges.ParseToInt(); @@ -1650,6 +1686,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms var specModule = prodCatTemplateInfo.spec_module; var specProp = prodCatTemplateInfo.spec_module.properties.FirstOrDefault(p => p.name_alias == skuSpec.parent_name); + var defaultPropValue = specProp.values.FirstOrDefault(); + var defaultGroup = (defaultPropValue?.group) == null ? 2 : defaultPropValue.group.id; var specPropValue = specProp.values.FirstOrDefault(v => v.value == skuSpec.spec_name); if (specProp != null) { @@ -1665,7 +1703,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms spec_id = skuSpec.spec_id, note = "", img_url = "", - group_id = 1, //specPropValue == null ? 2 : (specPropValue?.group?.id).ParseToInt(), + group_id = /*2, */ (specPropValue?.group?.id) == null ? defaultGroup : (specPropValue.group.id).ParseToInt(), template_module_id = specModule.id, }; prodParam.goods_properties.Add(spec_prop); @@ -1684,6 +1722,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms var specModule = prodCatTemplateInfo.spec_module; var specProp = prodCatTemplateInfo.spec_module.properties.FirstOrDefault(p => p.name_alias == skuSpec.parent_name); + var defaultPropValue = specProp.values.FirstOrDefault(); + var defaultGroup = (defaultPropValue?.group) == null ? 3 : defaultPropValue.group.id; var specPropValue = specProp.values.FirstOrDefault(v => v.value == skuSpec.spec_name); if (specProp != null) { @@ -1699,7 +1739,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms spec_id = skuSpec.spec_id, note = "", img_url = "", - group_id = 2, //specPropValue == null ? 2 : (specPropValue?.group?.id).ParseToInt(), + group_id = /*3, */ (specPropValue?.group?.id) == null ? defaultGroup : (specPropValue.group.id).ParseToInt(), template_module_id = specModule.id, }; prodParam.goods_properties.Add(spec_prop); @@ -2082,6 +2122,50 @@ namespace TemuKJD.PDDForms.ProductSelectForms return result; } + /// + /// 创建物料 1为白底图 whitepic + /// + /// + /// + /// + /// + /// + /// + /// + private string create_material(ShopLoginInfo shop, string imgUrl, int type, List catList, string goodsId, string commitId) + { + if (catList == null) + catList = new List(); + while (catList.Count < 4) + catList.Add(null); + + var anti = shop.AntiContents.LastOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + string url = "https://mms.pinduoduo.com/giraffe/mms/material/create"; // 商品已存在 + url = "https://mms.pinduoduo.com/giraffe/mms/material/createDraft"; // 新建商品 + string body = @"{""content"":""" + imgUrl + @""",""type"":" + type + @",""source"":2,""cat_id_1"":" + catList[0] + + @",""cat_id_2"":" + catList[1] + @",""cat_id_3"":" + catList[2] + @",""cat_id_4"":" + catList[3] + @",""goods_id"":" + goodsId + @"}"; + string refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=add&from=category&id=" + commitId + + "&goods_id=" + goodsId + "&sourcePage=goodsList"; + if (isChanceApi) + refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=add&from=chance&id=" + commitId + + "&goods_id=" + goodsId + "&chance_tab=search&sourcePage=goodsListTopButton_CHANCE"; + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.FirstOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(300, 500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + private string reusable_sizespec(ShopLoginInfo shop, string catId, string goodsId, string commitId) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs index 10d41ba..ebf6c09 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs @@ -64,6 +64,7 @@ namespace TemuKJD.PDDForms.ShopForms return; } + Thread.Sleep(Randomx.GetId(10, 50)); var detail_json = "{}"; PDDProductDetailInfo product = null; try @@ -84,6 +85,7 @@ namespace TemuKJD.PDDForms.ShopForms return; } + Thread.Sleep(Randomx.GetId(10, 50)); var size_json = "{}"; if (product.size_spec_id.ParseToLong() != 0) { @@ -121,6 +123,7 @@ namespace TemuKJD.PDDForms.ShopForms // } //} + Thread.Sleep(Randomx.GetId(10, 50)); var property_json = "{}"; PDDProductPropertyInfo property = null; try @@ -138,35 +141,6 @@ namespace TemuKJD.PDDForms.ShopForms return; } - var decoration_json = "{}"; - PDDProductDecorationInfo decoration = null; - try - { - var prod_decoration_rst = GetPddProdDecoration(sourceShop, sourceProdId.ToString(), commitId); - if (!prod_decoration_rst.Contains("\"success\":true")) - { - var errMsg = BaseRegex.GetStringJson(ref prod_decoration_rst, "error_msg"); - if (string.IsNullOrEmpty(errMsg)) - errMsg = commit_id_rst; - OnInfoReceived("商品获取失败!商品详情图获取失败!" + errMsg); - return; - } - JObject prod_decoration_obj = JObject.Parse(prod_decoration_rst); - if (!prod_decoration_obj["result"].IsNullOrEmpty()) - decoration_json = JsonHelper.SerializeObject(prod_decoration_obj["result"]); - decoration = JsonHelper.DeserializeJsonToObject(decoration_json); - } - catch (Exception ex) - { - OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); - return; - } - if (decoration == null) - { - OnInfoReceived("商品获取失败!商品详情图获取失败!"); - return; - } - // 属性模板暂时注释 //var prop_template_json = "{}"; //PDDProductTemplateInfo templateInfo = null; @@ -184,6 +158,97 @@ namespace TemuKJD.PDDForms.ShopForms // return; //} + Thread.Sleep(Randomx.GetId(10, 50)); + var decoration_json = "{}"; + PDDProductDecorationInfo decoration = null; + try + { + var prod_decoration_rst = GetPddProdDecoration(sourceShop, sourceProdId.ToString(), commitId); + if (!prod_decoration_rst.Contains("\"success\":true")) + { + var errMsg = BaseRegex.GetStringJson(ref prod_decoration_rst, "error_msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = prod_decoration_rst; + OnInfoReceived("商品获取失败!商品详情图获取失败!" + errMsg); + return; + } + JObject prod_decoration_obj = JObject.Parse(prod_decoration_rst); + if (!prod_decoration_obj["result"].IsNullOrEmpty()) + decoration_json = JsonHelper.SerializeObject(prod_decoration_obj["result"]); + decoration = JsonHelper.DeserializeJsonToObject(decoration_json); + } + catch (Exception ex) + { + OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); + return; + } + if (decoration == null) + { + OnInfoReceived("商品获取失败!商品详情图获取失败!"); + return; + } + + Thread.Sleep(Randomx.GetId(10, 50)); + var material3_json = "{}"; + PDDMaterialInfo material3 = null; + try + { + var material3_rst = GetPddGoodsMaterial(sourceShop, sourceProdId.ToString(), commitId, 3); + if (!material3_rst.Contains("\"success\":true")) + { + var errMsg = BaseRegex.GetStringJson(ref material3_rst, "error_msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = material3_rst; + OnInfoReceived("商品获取失败!商品长图获取失败!" + errMsg); + return; + } + JObject material3_obj = JObject.Parse(material3_rst); + if (!material3_obj["result"].IsNullOrEmpty()) + material3_json = JsonHelper.SerializeObject(material3_obj["result"]); + material3 = JsonHelper.DeserializeJsonToObject(material3_json); + } + catch (Exception ex) + { + OnInfoReceived("商品获取失败!商品长图获取失败!" + ex.Message); + return; + } + if (material3 == null) + { + OnInfoReceived("商品获取失败!商品长图获取失败!"); + return; + } + + Thread.Sleep(Randomx.GetId(10, 50)); + var material1_json = "{}"; + PDDMaterialInfo material1 = null; + try + { + var material1_rst = GetPddGoodsMaterial(sourceShop, sourceProdId.ToString(), commitId, 1); + if (!material1_rst.Contains("\"success\":true")) + { + var errMsg = BaseRegex.GetStringJson(ref material1_rst, "error_msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = material1_rst; + OnInfoReceived("商品获取失败!商品白底图获取失败!" + errMsg); + return; + } + JObject material1_obj = JObject.Parse(material1_rst); + if (!material1_obj["result"].IsNullOrEmpty()) + material1_json = JsonHelper.SerializeObject(material1_obj["result"]); + material1 = JsonHelper.DeserializeJsonToObject(material1_json); + } + catch (Exception ex) + { + OnInfoReceived("商品获取失败!商品白底图获取失败!" + ex.Message); + return; + } + if (material1 == null) + { + OnInfoReceived("商品获取失败!商品白底图获取失败!"); + return; + } + + bool isExist = false; var existUrl = BaseClass.BuildObjString("product/get_product_list"); string existData = UserLogin.GetSignaturex() + "&search_spu=" + product.goods_id; @@ -199,7 +264,8 @@ namespace TemuKJD.PDDForms.ShopForms } - string product_json = "{\"detail\":" + detail_json + ",\"size\":" + size_json + ",\"decoration\":" + decoration_json + ",\"property\":" + property_json + "}"; + string product_json = "{\"detail\":" + detail_json + ",\"size\":" + size_json + ",\"decoration\":" + decoration_json + + ",\"material3\":" + material3_json + ",\"material1\":" + material1_json + ",\"property\":" + property_json + "}"; string main_img = product.image_url; if (string.IsNullOrEmpty(main_img)) main_img = product.hd_thumb_url; @@ -594,6 +660,38 @@ namespace TemuKJD.PDDForms.ShopForms return result; } + /// + /// 获取物料详情 type = 1 或者 3 1是白底图,3是长图 + /// + /// + /// + /// + /// + /// + /// + private string GetPddGoodsMaterial(ShopLoginInfo shop, string prodId, string commitId, int type) + { + var anti = shop.AntiContents.LastOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + string url = "https://mms.pinduoduo.com/giraffe/mms/material/goodsMaterialInfo"; + string body = @"{""goods_id"":" + prodId + @",""type"":" + type + "}"; + string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit"; + var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + for (int i = 0; i < 5 && (result.Contains("操作太过频繁") || result.Contains("网络繁忙,请不要频繁操作")); i++) + { + shop.AntiContents.Remove(anti); + anti = shop.AntiContents.LastOrDefault().ParseToString(); + if (shop.AntiContents.Count > 0) + { + Thread.Sleep(Randomx.GetId(300, 500)); + anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; + result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti); + } + } + return result; + } + private string GetPddCatPropTemplate(ShopLoginInfo shop, string catId, string prodId, string commitId) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); @@ -602,8 +700,7 @@ namespace TemuKJD.PDDForms.ShopForms string url = "https://mms.pinduoduo.com/draco-ms/mms/template/mall?catId=" + catId + "&goodsCommitId=" + commitId + "&goodsId=" + prodId; string body = @""; - string refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=add&from=category&id=" + commitId + - "&goods_id=" + prodId + "&sourcePage=goodsList"; + string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit"; var result = HttpResponseBLL.PDDGetResponse(shop, url, body, refere, anti); for (int i = 0; i < 5 && (result.Contains("操作太过频繁") || result.Contains("网络繁忙,请不要频繁操作")); i++) { diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs index 8fe0183..bbba06f 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs @@ -33,64 +33,6 @@ namespace TemuKJD.PDDForms.ShopForms private bool isLoading { get; set; } = false; #region 服务端店铺管理 - public static string AddServerPddShop(ShopLoginInfo _shop) - { - var url = BaseClass.BuildObjString("shop/add_shop"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + _shop.LoginName - + "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password) - + "&shop_id=" + _shop.ShopId - + "&shop_account=" + _shop.ShopAccount - + "&cookie=" + _shop.Cookies - + "&cookie2=" + _shop.Cookies2 - + "&anti_contents=" + JsonHelper.SerializeObject(_shop.AntiContents) - + "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName) - + "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName) - + "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes) - + "&login_status=" + _shop.LoginStatus; - - var result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200")) - { - var msg = BaseRegex.GetStringJson(ref result, "msg"); - if (string.IsNullOrEmpty(msg)) - msg = "店铺保存失败!"; - BaseMsgForm.ShowError(msg); - } - return result; - } - - public static string MdyServerPddShop(ShopLoginInfo _shop) - { - var url = BaseClass.BuildObjString("shop/mdy_shop"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + _shop.LoginName - + "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password) - + "&shop_id=" + _shop.ShopId - + "&shop_account=" + _shop.ShopAccount - + "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName) - + "&sub_user_name=" + _shop.SubUserName - + "¬es=" + GetHtml.UrlEncodeUtf8(_shop.Notes); - - var result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200")) - { - var msg = BaseRegex.GetStringJson(ref result, "msg"); - if (string.IsNullOrEmpty(msg)) - msg = "店铺保存失败!"; - BaseMsgForm.ShowError(msg); - } - return result; - } - public static void UpdateShop() { // 获取本地店铺和服务端店铺。将服务端相关信息与本地店铺合并后暂时存在内存中(不保存敏感信息)。 @@ -320,13 +262,13 @@ namespace TemuKJD.PDDForms.ShopForms } else { - PDDShopListForm.AddServerPddShop(shopInfo); + ShopBLL.AddServerShop(shopInfo); btnRefreshCookie_Click(null, null); } } else { - PDDShopListForm.MdyServerPddShop(shopInfo); + ShopBLL.MdyServerShopSubInfo(shopInfo); btnRefreshCookie_Click(null, null); } } @@ -410,7 +352,7 @@ namespace TemuKJD.PDDForms.ShopForms else GlobalConfig.ShopLoginList.Add(shop); StartUp.SaveLocalShopLoginInfo(); - PDDShopListForm.AddServerPddShop(shop); + ShopBLL.AddServerShop(shop); } } } diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs index 72a3615..864ab59 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs @@ -24,6 +24,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using Work; using Work.BLL.Tools; +using TemuKJD.BLL; namespace TemuKJD.PDDForms.ShopForms { @@ -165,7 +166,7 @@ namespace TemuKJD.PDDForms.ShopForms if (oldShop == null) { GlobalConfig.ShopLoginList.Add(newShop); - PDDShopListForm.AddServerPddShop(newShop); // 店铺写入到服务端 + ShopBLL.AddServerShop(newShop); // 店铺写入到服务端 } else { @@ -188,12 +189,7 @@ namespace TemuKJD.PDDForms.ShopForms + "&shop_account=" + oldShop.ShopAccount; var result = GetHtml.PostUtf8(url, data); - var urlAddress = BaseClass.BuildObjString("shop/mdy_anti_content"); - data = UserLogin.GetSignaturex() - + "&login_name=" + shop.LoginName - + "&shop_id=" + shop.ShopId - + "&anti_contents=" + JsonHelper.SerializeObject(shop.AntiContents); - result = GetHtml.PostUtf8(urlAddress, data); + ShopBLL.MdyAntiContent(oldShop); } } var lstShop = GlobalConfig.ShopLoginList.Where(l => l.LoginName == shop.LoginName).ToList(); @@ -460,28 +456,23 @@ namespace TemuKJD.PDDForms.ShopForms cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString()); } - int GetAntiContentsTimes = 40; + static int GetAntiContentsTimes = 40; private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request) { var antiContent = request.Headers.AllKeys.Contains("Anti-Content") ? request.Headers["Anti-Content"] : ""; if (shop != null && !url.StartsWith("https://mms.pinduoduo.com/janus/api/userinfo") && !string.IsNullOrEmpty(antiContent)) { GetAntiContentsTimes++; + Invoke(new Action(() => { this.TitleText = "店铺登录 - " + GetAntiContentsTimes; })); shop.AntiContents.Add(antiContent); while (shop.AntiContents.Count > 50) shop.AntiContents.RemoveAt(0); - if (!string.IsNullOrEmpty(shop.ShopId) && GetAntiContentsTimes > 50) + if (!string.IsNullOrEmpty(shop.ShopId) && GetAntiContentsTimes > 500) { GetAntiContentsTimes = 0; - var antis = shop.AntiContents; Task.Run(() => { - var urlAddress = BaseClass.BuildObjString("shop/mdy_anti_content"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + shop.LoginName - + "&shop_id=" + shop.ShopId - + "&anti_contents=" + JsonHelper.SerializeObject(antis); - var result = GetHtml.PostUtf8(urlAddress, data); + ShopBLL.MdyAntiContent(shop); }); } } diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopUpdateCookieForm.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopUpdateCookieForm.cs index 3b9a707..d7c7783 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopUpdateCookieForm.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopUpdateCookieForm.cs @@ -312,7 +312,7 @@ namespace TemuKJD.PDDForms.ShopForms if (updateFrom != SetCookieFromEnum.normal_user) ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端 else - PDDShopListForm.AddServerPddShop(newShop); // 店铺写入到服务端 + ShopBLL.AddServerShop(newShop); // 店铺写入到服务端 } } }