diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index af38e29..7c3080d 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 761; + public static int VersionCount = 763; //public static int VersionCount = 613; /// @@ -726,20 +726,13 @@ namespace AllBase { return LoginApiUrl + "/bxx_" + file + "?obj=" + BaseClass.MainPath + "/bxx_" + file; } + if (BaseClass.MainPath == "douyin") + { + return LoginApiUrl + "/dyxd_" + file + "?obj=" + BaseClass.MainPath + "/dyxd_" + file; + } return LoginApiUrl + "/" + file+ "?obj=" + BaseClass.MainPath + "/" + file; } - /// - /// 净化数据OBJ路径生成 - /// - /// - /// - public static string BuildFissionObjString(string file) - { - var FessionBaseUrl = "http://m.qimake.cn/"; - var ObjFissionUrl = "obj=douyin/"; - return FessionBaseUrl + "?" + ObjFissionUrl + file; - } } public class KeyValueBase diff --git a/AllBase/Model/Param/PDDProdParam/PDDProductUploadParam.cs b/AllBase/Model/Param/PDDProdParam/PDDProductUploadParam.cs index e783fe3..075d74e 100644 --- a/AllBase/Model/Param/PDDProdParam/PDDProductUploadParam.cs +++ b/AllBase/Model/Param/PDDProdParam/PDDProductUploadParam.cs @@ -16,6 +16,7 @@ namespace AllBase.Model.Param.PDDProdParam public List reject_reason { get; set; } = new List(); public string reject_status { get; set; } = ""; public int? check_status { get; set; } = 9; + public string tiny_name { get; set; } public string goods_name { get; set; } public List carousel_video { get; set; } = new List(); public List detail_video { get; set; } = new List(); @@ -61,20 +62,23 @@ namespace AllBase.Model.Param.PDDProdParam public bool? materialModalAbGray { get; set; } = true; public bool? uploadDragAB { get; set; } = false; public bool? materialReplaceTagGray { get; set; } = true; + public bool? localUploadVideoGray { get; set; } = true; + public bool? aiGray { get; set; } = false; + public bool? materialShowTagGray { get; set; } = true; public bool? hide_apply { get; set; } = false; public bool? showGoodsInstruction { get; set; } = true; public bool? decorationCanEdit { get; set; } = true; + public List title_keywords { get; set; } + public object title_recommend { get; set; } + public string prefillWhitePic { get; set; } + + public List decorationDetail { get; set; } + public string decorationPreview { get; set; } public bool? must_have_spu { get; set; } = false; public bool? can_not_change_cat { get; set; } = false; public bool? can_not_change_spu { get; set; } = false; public bool? is_transfer_spu { get; set; } = false; - public List title_keywords { get; set; } - public object title_recommend { get; set; } - public string prefillWhitePic { get; set; } - public string tiny_name { get; set; } - public List decorationDetail { get; set; } - public string decorationPreview { get; set; } public object size_parent_spec_id { get; set; } public int? is_shop { get; set; } = 0; public int? goods_type { get; set; } = 1; @@ -95,7 +99,7 @@ namespace AllBase.Model.Param.PDDProdParam public long? shipment_limit_second { get; set; } = 172800; public object delivery_type { get; set; } public long? cost_template_id { get; set; } //136204643207510; - public string weight { get; set; } = ""; + public int? weight { get; set; } = 1; public bool? is_all_weight_same { get; set; } = true; public group_item groups { get; set; } @@ -119,8 +123,9 @@ namespace AllBase.Model.Param.PDDProdParam public int? is_refundable_fifteen_day { get; set; } = 0; public int? is_warranty_one_year { get; set; } = 0; public extend_warranty_dto_param extend_warranty_dto { get; set; } - + public int? is_refundable_thirty_day { get; set; } = 0; public string home_delivery_template_name { get; set; } = ""; + public string promise_delivery_template_name { get; set; } = ""; public object invoice_mode_sub_type { get; set; } public int? is_certificate_provide { get; set; } = 0; public bool? isAddLocalCityGoods { get; set; } = false; diff --git a/KJDService/KJD_WebService/BLL/KJD/ShopManage.cs b/KJDService/KJD_WebService/BLL/KJD/ShopManage.cs index 1483eb5..c9a7e48 100644 --- a/KJDService/KJD_WebService/BLL/KJD/ShopManage.cs +++ b/KJDService/KJD_WebService/BLL/KJD/ShopManage.cs @@ -95,7 +95,9 @@ namespace KJD_Web.BLL } else { - sql = "SELECT s.*,c.add_product_remaining add_remaining,c.add_product_month add_month,cc.jit_expire_time FROM kjd.shop s" + + sql = "SELECT s.*, c.add_product_remaining add_remaining, c.add_product_month add_month, cc.jit_expire_time FROM kjd.shop s" + + /*, u.sub_nick_name*/ + //" LEFT JOIN (SELECT parent_user_name, GROUP_CONCAT(nick_name) as sub_nick_name FROM kjd.user WHERE user_name in(s.sub_user_name) GROUP BY parent_user_name) u ON s.shop_id=u.parent_user_name" + " LEFT JOIN kjd.shop_add_prod_count c ON s.shop_id=c.shop_id" + " LEFT JOIN (SELECT shop_id, MAX(expire_time) as jit_expire_time FROM kjd.jit_card_code GROUP BY shop_id) cc ON s.shop_id=cc.shop_id" + " WHERE 1=1"; @@ -123,6 +125,7 @@ namespace KJD_Web.BLL shop_id = row["shop_id"].ToString(), shop_account = row["shop_account"].ToString(), sub_user_name = row["sub_user_name"].ToString(), + //sub_nick_name = row["sub_nick_name"].ToString(), user_name = row["user_name"].ToString(), company_name = row["company_name"].ToString(), notes = row["notes"].ToString(), diff --git a/KJDService/KJD_WebService/BLL/KJD/UserManage.cs b/KJDService/KJD_WebService/BLL/KJD/UserManage.cs index b472eed..df1d385 100644 --- a/KJDService/KJD_WebService/BLL/KJD/UserManage.cs +++ b/KJDService/KJD_WebService/BLL/KJD/UserManage.cs @@ -238,6 +238,7 @@ namespace KJD_Web.BLL var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'"); var search = RegexUtils.GetStringQuery(ref inputData, "search")?.Replace("'", "\\'"); var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'"); + var user_name_in = RegexUtils.GetStringQuery(ref inputData, "user_name_in")?.Replace("'", "\\'"); int r2 = 0; int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2); @@ -249,6 +250,8 @@ namespace KJD_Web.BLL sql += " and group_id=" + group_id; if (!string.IsNullOrEmpty(sa_level)) sql += " and sa_level=" + sa_level; + if (!string.IsNullOrEmpty(user_name_in)) + sql += " AND user_name IN(" + user_name_in + ")"; if (!string.IsNullOrEmpty(search)) sql += " and (user_name like '%" + search + "%' or nick_name like '%" + search + diff --git a/KJDService/KJD_WebService/DYShopService.asmx b/KJDService/KJD_WebService/DYShopService.asmx new file mode 100644 index 0000000..bd9fe38 --- /dev/null +++ b/KJDService/KJD_WebService/DYShopService.asmx @@ -0,0 +1 @@ +<%@ WebService Language="C#" CodeBehind="DYShopService.asmx.cs" Class="KJD_Web.DYShopService" %> diff --git a/KJDService/KJD_WebService/DYShopService.asmx.cs b/KJDService/KJD_WebService/DYShopService.asmx.cs new file mode 100644 index 0000000..89f16e8 --- /dev/null +++ b/KJDService/KJD_WebService/DYShopService.asmx.cs @@ -0,0 +1,219 @@ +using KJD_Web.BLL.BXX; +using KJD_Web.Utils; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.Services; + +namespace KJD_Web +{ + /// + /// ShopService 的摘要说明 + /// + [WebService(Namespace = "http://tempuri.org/")] + [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] + [System.ComponentModel.ToolboxItem(false)] + // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 + // [System.Web.Script.Services.ScriptService] + public class DYShopService : System.Web.Services.WebService + { + private string GetRequestJsonString() + { + Context.Response.ContentType = "text/html;charset=utf-8"; + Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); + + using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流 + { + // 还原数据流 + byte[] b = new byte[s.Length]; + s.Read(b, 0, (int)s.Length); + string jsonText = Encoding.UTF8.GetString(b); // JSON字符串 + if (string.IsNullOrEmpty(jsonText)) + { + var qs = HttpContext.Current.Request.QueryString; + if (qs != null && qs.Keys.Count > 0) + { + jsonText = "{"; + foreach (var key in qs.Keys) + { + jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";"; + } + jsonText = jsonText.TrimEnd(';') + "}"; + } + } + return jsonText; + } + } + + [WebMethod] + public void get_shop_list() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().GetShop(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void get_one_login_name_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().GetOneLoginNameShop(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void add_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().AddShop(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void del_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().DelShop(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void mdy_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().MdyShop(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void mdy_anti_content() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().MdyAntiContent(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void mdy_shop_cookie_and_login_status() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().MdyCookieAndLoginStatus(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void admin_get_shop_list() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().GetShop(jsontext, true); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void sub_sa_get_select_prod_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().SubSaGetSelectProdShop(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void update_add_prod_remaining() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().UpdateAddProdRemaining(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void admin_mdy_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().MdyShop(jsontext, true); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void admin_add_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().AddShop(jsontext, true); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void admin_del_shop() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().DelShop(jsontext, true); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void set_shop_sub_sa() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXShopManage().SetShopSubSa(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + } +} diff --git a/KJDService/KJD_WebService/DYUserService.asmx b/KJDService/KJD_WebService/DYUserService.asmx new file mode 100644 index 0000000..500c319 --- /dev/null +++ b/KJDService/KJD_WebService/DYUserService.asmx @@ -0,0 +1 @@ +<%@ WebService Language="C#" CodeBehind="DYUserService.asmx.cs" Class="KJD_Web.DYUserService" %> diff --git a/KJDService/KJD_WebService/DYUserService.asmx.cs b/KJDService/KJD_WebService/DYUserService.asmx.cs new file mode 100644 index 0000000..d718e12 --- /dev/null +++ b/KJDService/KJD_WebService/DYUserService.asmx.cs @@ -0,0 +1,177 @@ +using KJD_Web.BLL.BXX; +using KJD_Web.Utils; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.Services; + +namespace KJD_Web +{ + /// + /// UserService 的摘要说明 + /// + [WebService(Namespace = "http://tempuri.org/")] + [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] + [System.ComponentModel.ToolboxItem(false)] + // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 + // [System.Web.Script.Services.ScriptService] + public class DYUserService : System.Web.Services.WebService + { + [WebMethod] + public string hello_world() + { + return "Hello World"; + } + + private string GetRequestJsonString() + { + Context.Response.ContentType = "text/html;charset=utf-8"; + Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); + + using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流 + { + // 还原数据流 + byte[] b = new byte[s.Length]; + s.Read(b, 0, (int)s.Length); + string jsonText = Encoding.UTF8.GetString(b); // JSON字符串 + if (string.IsNullOrEmpty(jsonText)) + { + var qs = HttpContext.Current.Request.QueryString; + if (qs != null && qs.Keys.Count > 0) + { + jsonText = "{"; + foreach (var key in qs.Keys) + { + jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";"; + } + jsonText = jsonText.TrimEnd(';') + "}"; + } + } + return jsonText; + } + } + + [WebMethod] + public void user_login() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().CheckUserLogin(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void get_package_sign() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().GetPackageSign(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void change_password() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().ChangePassword(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void get_sub_user() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().GetSubUser(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void update_sub_user() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().UpdateSubUser(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void add_sub_user() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().AddSubUser(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void delete_user() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().DelUser(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void get_all_user() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().GetAllUser(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void update_user() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().UpdateUser(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void add_user() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().AddUser(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + } +} diff --git a/KJDService/KJD_WebService/Global.asax.cs b/KJDService/KJD_WebService/Global.asax.cs index 05b1aba..dc63528 100644 --- a/KJDService/KJD_WebService/Global.asax.cs +++ b/KJDService/KJD_WebService/Global.asax.cs @@ -90,6 +90,38 @@ namespace KJD_Web hPath = hPath.Replace("/bxx_price/", "/BXXPriceService.asmx/"); Context.RewritePath(hPath); } + + + if (!hPath.Contains(".asmx") && hPath.Contains("/dyxd_user/")) + { + hPath = hPath.Replace("/dyxd_user/", "/DYUserService.asmx/"); + Context.RewritePath(hPath); + } + else if (!hPath.Contains(".asmx") && hPath.Contains("/dyxd_shop/")) + { + hPath = hPath.Replace("/dyxd_shop/", "/DYShopService.asmx/"); + Context.RewritePath(hPath); + } + //else if (!hPath.Contains(".asmx") && hPath.Contains("/update/")) + //{ + // hPath = hPath.Replace("/update/", "/UpdateService.asmx/"); + // Context.RewritePath(hPath); + //} + else if (!hPath.Contains(".asmx") && hPath.Contains("/dyxd_product/")) + { + hPath = hPath.Replace("/dyxd_product/", "/DYProductService.asmx/"); + Context.RewritePath(hPath); + } + else if (!hPath.Contains(".asmx") && hPath.Contains("/dyxd_product_third/")) + { + hPath = hPath.Replace("/dyxd_product_third/", "/DYProductThirdService.asmx/"); + Context.RewritePath(hPath); + } + else if (!hPath.Contains(".asmx") && hPath.Contains("/dyxd_price/")) + { + hPath = hPath.Replace("/dyxd_price/", "/DYPriceService.asmx/"); + Context.RewritePath(hPath); + } } protected void Application_AuthenticateRequest(object sender, EventArgs e) diff --git a/KJDService/KJD_WebService/KJD_WebService.csproj b/KJDService/KJD_WebService/KJD_WebService.csproj index 2310444..b932e6b 100644 --- a/KJDService/KJD_WebService/KJD_WebService.csproj +++ b/KJDService/KJD_WebService/KJD_WebService.csproj @@ -74,6 +74,8 @@ + + @@ -106,6 +108,14 @@ + + DYShopService.asmx + Component + + + DYUserService.asmx + Component + Global.asax diff --git a/KJDService/KJD_WebService/KJD_WebService.csproj.user b/KJDService/KJD_WebService/KJD_WebService.csproj.user index 4bcdc04..1b87364 100644 --- a/KJDService/KJD_WebService/KJD_WebService.csproj.user +++ b/KJDService/KJD_WebService/KJD_WebService.csproj.user @@ -8,7 +8,7 @@ - Release|Any CPU + Debug|Any CPU ShowAllFiles diff --git a/KJDService/KJD_WebService/Model/ShopModel/ShopParam.cs b/KJDService/KJD_WebService/Model/ShopModel/ShopParam.cs index 7e81ebe..c158cd8 100644 --- a/KJDService/KJD_WebService/Model/ShopModel/ShopParam.cs +++ b/KJDService/KJD_WebService/Model/ShopModel/ShopParam.cs @@ -23,6 +23,7 @@ namespace KJD_Web.Model.ShopModel public string shop_id { get; set; } public string shop_account { get; set; } public string sub_user_name { get; set; } + public string sub_nick_name { get; set; } public string user_name { get; set; } public string company_name { get; set; } /// diff --git a/TEMUKJD/BaseForms/LRBaseForm.cs b/TEMUKJD/BaseForms/LRBaseForm.cs index 3612e79..c58ef9c 100644 --- a/TEMUKJD/BaseForms/LRBaseForm.cs +++ b/TEMUKJD/BaseForms/LRBaseForm.cs @@ -128,7 +128,12 @@ namespace TemuKJD.BaseForms } } - if (this.TopLevel || DesignMode) + SetPanelVisible(this.TopLevel || DesignMode); + } + + public void SetPanelVisible(bool visible) + { + if (visible) { this.Padding = new Padding(1); this.panel1.Visible = true; diff --git a/TEMUKJD/InitForm.Designer.cs b/TEMUKJD/InitForm.Designer.cs index 082d170..220b01d 100644 --- a/TEMUKJD/InitForm.Designer.cs +++ b/TEMUKJD/InitForm.Designer.cs @@ -33,20 +33,20 @@ this.panel2 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); this.btnOK = new DevComponents.DotNetBar.PanelEx(); - this.chkRemember = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.rbTemu = new System.Windows.Forms.RadioButton(); this.rbPdd = new System.Windows.Forms.RadioButton(); + this.rbDy = new System.Windows.Forms.RadioButton(); + this.chkRemember = new TemuKJD.UserComponent.UcCheckBox(this.components); this.panel3 = new System.Windows.Forms.Panel(); - this.pbShopLoading = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.progressBarX1 = new DevComponents.DotNetBar.Controls.ProgressBarX(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.rbDy = new System.Windows.Forms.RadioButton(); + this.pbShopLoading = new System.Windows.Forms.PictureBox(); this.panel2.SuspendLayout(); this.panel4.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbShopLoading)).BeginInit(); - this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // panel2 @@ -95,17 +95,16 @@ this.btnOK.Visible = false; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // - // chkRemember + // flowLayoutPanel1 // - this.chkRemember.AutoSize = true; - this.chkRemember.Location = new System.Drawing.Point(170, 0); - this.chkRemember.Margin = new System.Windows.Forms.Padding(0); - this.chkRemember.Name = "chkRemember"; - this.chkRemember.Size = new System.Drawing.Size(75, 21); - this.chkRemember.TabIndex = 28; - this.chkRemember.Text = "自动选择"; - this.chkRemember.UseVisualStyleBackColor = true; - this.chkRemember.CheckedChanged += new System.EventHandler(this.chkRemember_CheckedChanged); + this.flowLayoutPanel1.Controls.Add(this.rbTemu); + this.flowLayoutPanel1.Controls.Add(this.rbPdd); + this.flowLayoutPanel1.Controls.Add(this.rbDy); + this.flowLayoutPanel1.Controls.Add(this.chkRemember); + this.flowLayoutPanel1.Location = new System.Drawing.Point(9, 1); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(250, 48); + this.flowLayoutPanel1.TabIndex = 757; // // rbTemu // @@ -117,9 +116,9 @@ this.rbTemu.Name = "rbTemu"; this.rbTemu.Size = new System.Drawing.Size(58, 21); this.rbTemu.TabIndex = 26; + this.rbTemu.TabStop = true; this.rbTemu.Text = "Temu"; this.rbTemu.UseVisualStyleBackColor = true; - this.rbTemu.CheckedChanged += new System.EventHandler(this.rbTemu_CheckedChanged); // // rbPdd // @@ -133,6 +132,31 @@ this.rbPdd.Text = "拼多多"; this.rbPdd.UseVisualStyleBackColor = true; // + // rbDy + // + this.rbDy.AutoSize = true; + this.rbDy.ForeColor = System.Drawing.SystemColors.InfoText; + this.rbDy.Location = new System.Drawing.Point(120, 0); + this.rbDy.Margin = new System.Windows.Forms.Padding(0); + this.rbDy.Name = "rbDy"; + this.rbDy.Size = new System.Drawing.Size(50, 21); + this.rbDy.TabIndex = 28; + this.rbDy.Text = "抖音"; + this.rbDy.UseVisualStyleBackColor = true; + this.rbDy.Visible = false; + // + // chkRemember + // + this.chkRemember.AutoSize = true; + this.chkRemember.Location = new System.Drawing.Point(170, 0); + this.chkRemember.Margin = new System.Windows.Forms.Padding(0); + this.chkRemember.Name = "chkRemember"; + this.chkRemember.Size = new System.Drawing.Size(75, 21); + this.chkRemember.TabIndex = 28; + this.chkRemember.Text = "自动选择"; + this.chkRemember.UseVisualStyleBackColor = true; + this.chkRemember.CheckedChanged += new System.EventHandler(this.chkRemember_CheckedChanged); + // // panel3 // this.panel3.Controls.Add(this.label1); @@ -143,19 +167,6 @@ this.panel3.Size = new System.Drawing.Size(257, 125); this.panel3.TabIndex = 39; // - // pbShopLoading - // - this.pbShopLoading.Anchor = System.Windows.Forms.AnchorStyles.None; - this.pbShopLoading.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.pbShopLoading.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.pbShopLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbShopLoading.Location = new System.Drawing.Point(96, 35); - this.pbShopLoading.Name = "pbShopLoading"; - this.pbShopLoading.Size = new System.Drawing.Size(64, 64); - this.pbShopLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pbShopLoading.TabIndex = 37; - this.pbShopLoading.TabStop = false; - // // label1 // this.label1.AutoSize = true; @@ -181,29 +192,18 @@ this.progressBarX1.TabStop = false; this.progressBarX1.Text = "progressBarX1"; // - // flowLayoutPanel1 + // pbShopLoading // - this.flowLayoutPanel1.Controls.Add(this.rbTemu); - this.flowLayoutPanel1.Controls.Add(this.rbPdd); - this.flowLayoutPanel1.Controls.Add(this.rbDy); - this.flowLayoutPanel1.Controls.Add(this.chkRemember); - this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 1); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(250, 48); - this.flowLayoutPanel1.TabIndex = 757; - // - // rbDy - // - this.rbDy.AutoSize = true; - this.rbDy.ForeColor = System.Drawing.SystemColors.InfoText; - this.rbDy.Location = new System.Drawing.Point(120, 0); - this.rbDy.Margin = new System.Windows.Forms.Padding(0); - this.rbDy.Name = "rbDy"; - this.rbDy.Size = new System.Drawing.Size(50, 21); - this.rbDy.TabIndex = 28; - this.rbDy.Text = "抖音"; - this.rbDy.UseVisualStyleBackColor = true; - this.rbDy.Visible = false; + this.pbShopLoading.Anchor = System.Windows.Forms.AnchorStyles.None; + this.pbShopLoading.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); + this.pbShopLoading.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.pbShopLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; + this.pbShopLoading.Location = new System.Drawing.Point(96, 35); + this.pbShopLoading.Name = "pbShopLoading"; + this.pbShopLoading.Size = new System.Drawing.Size(64, 64); + this.pbShopLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pbShopLoading.TabIndex = 37; + this.pbShopLoading.TabStop = false; // // InitForm // @@ -220,11 +220,11 @@ this.Controls.SetChildIndex(this.panel2, 0); this.panel2.ResumeLayout(false); this.panel4.ResumeLayout(false); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbShopLoading)).EndInit(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } diff --git a/TEMUKJD/InitForm.cs b/TEMUKJD/InitForm.cs index ff34307..a47ec8e 100644 --- a/TEMUKJD/InitForm.cs +++ b/TEMUKJD/InitForm.cs @@ -36,6 +36,7 @@ namespace TemuKJD #if DEBUG this.panel3.Location = new Point(4, 4); this.panel4.Visible=true; + this.rbDy.Visible = true; #endif initFormSettings = ConfigHelper.LoadConfig("initFormSettings"); if (initFormSettings == null) @@ -43,7 +44,10 @@ namespace TemuKJD this.chkRemember.Checked = initFormSettings.Remember; this.rbTemu.Checked = initFormSettings.LoginType.ToLower() == "temu"; this.rbPdd.Checked = initFormSettings.LoginType.ToLower() == "pdd"; - this.rbPdd.Checked = initFormSettings.LoginType.ToLower() == "dy"; + this.rbDy.Checked = initFormSettings.LoginType.ToLower() == "dy"; + this.rbTemu.CheckedChanged += rbTemu_CheckedChanged; + this.rbPdd.CheckedChanged += rbTemu_CheckedChanged; + this.rbDy.CheckedChanged += rbTemu_CheckedChanged; if (rbDy.Visible == false) flowLayoutPanel1.Location = new Point(38, flowLayoutPanel1.Location.Y); @@ -129,12 +133,12 @@ namespace TemuKJD bool isChangeType = false; private void rbTemu_CheckedChanged(object sender, EventArgs e) { - string newLoginType; - if (rbTemu.Checked) + string newLoginType = "Temu"; + if (sender == rbTemu && rbTemu.Checked) newLoginType = "Temu"; - else if (rbPdd.Checked) + else if (sender == rbPdd && rbPdd.Checked) newLoginType = "Pdd"; - else + else if (sender == rbDy && rbDy.Checked) newLoginType = "Dy"; if (initFormSettings.LoginType != newLoginType) { diff --git a/TEMUKJD/KJD.csproj b/TEMUKJD/KJD.csproj index a9cfb08..c7f3ca9 100644 --- a/TEMUKJD/KJD.csproj +++ b/TEMUKJD/KJD.csproj @@ -650,6 +650,12 @@ PDDDBProdEditForm.cs + + Form + + + PDDGetChanceProd.cs + Form diff --git a/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs index 703fa15..09eff01 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopListForm.Designer.cs @@ -54,8 +54,6 @@ this.btnRefreshAuth = new TemuKJD.UserControls.ButtonEx(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); - this.chkAutoDrag = new System.Windows.Forms.CheckBox(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -80,6 +78,10 @@ this.colCopyCookies = new System.Windows.Forms.DataGridViewLinkColumn(); this.colEdit = new System.Windows.Forms.DataGridViewLinkColumn(); this.colDelete = new System.Windows.Forms.DataGridViewLinkColumn(); + this.chkAutoDrag = new System.Windows.Forms.CheckBox(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.txtSubAccount = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -146,15 +148,15 @@ this.panel5.Controls.Add(this.btnRefreshShop); this.panel5.Controls.Add(this.btnLoginSelect); this.panel5.Controls.Add(this.btnCheck); - this.panel5.Location = new System.Drawing.Point(901, 3); + this.panel5.Location = new System.Drawing.Point(919, 3); this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(360, 40); + this.panel5.Size = new System.Drawing.Size(342, 40); this.panel5.TabIndex = 1; // // chkLoginAds // this.chkLoginAds.AutoSize = true; - this.chkLoginAds.Location = new System.Drawing.Point(254, 11); + this.chkLoginAds.Location = new System.Drawing.Point(232, 11); this.chkLoginAds.Name = "chkLoginAds"; this.chkLoginAds.Size = new System.Drawing.Size(111, 21); this.chkLoginAds.TabIndex = 376; @@ -168,7 +170,7 @@ this.btnRefreshShop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnRefreshShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnRefreshShop.ForeColor = System.Drawing.Color.White; - this.btnRefreshShop.Location = new System.Drawing.Point(43, 8); + this.btnRefreshShop.Location = new System.Drawing.Point(21, 8); this.btnRefreshShop.Margin = new System.Windows.Forms.Padding(2); this.btnRefreshShop.Name = "btnRefreshShop"; this.btnRefreshShop.Size = new System.Drawing.Size(66, 26); @@ -184,7 +186,7 @@ this.btnLoginSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnLoginSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnLoginSelect.ForeColor = System.Drawing.Color.White; - this.btnLoginSelect.Location = new System.Drawing.Point(184, 8); + this.btnLoginSelect.Location = new System.Drawing.Point(162, 8); this.btnLoginSelect.Margin = new System.Windows.Forms.Padding(2); this.btnLoginSelect.Name = "btnLoginSelect"; this.btnLoginSelect.Size = new System.Drawing.Size(66, 26); @@ -200,7 +202,7 @@ this.btnCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCheck.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCheck.ForeColor = System.Drawing.Color.White; - this.btnCheck.Location = new System.Drawing.Point(114, 8); + this.btnCheck.Location = new System.Drawing.Point(92, 8); this.btnCheck.Margin = new System.Windows.Forms.Padding(2); this.btnCheck.Name = "btnCheck"; this.btnCheck.Size = new System.Drawing.Size(66, 26); @@ -211,6 +213,8 @@ // // panel4 // + this.panel4.Controls.Add(this.txtSubAccount); + this.panel4.Controls.Add(this.label5); this.panel4.Controls.Add(this.cmbNotes); this.panel4.Controls.Add(this.pnlEmpty); this.panel4.Controls.Add(this.btnSearch); @@ -224,15 +228,15 @@ this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; this.panel4.Location = new System.Drawing.Point(3, 3); this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(892, 40); + this.panel4.Size = new System.Drawing.Size(910, 40); this.panel4.TabIndex = 0; // // cmbNotes // this.cmbNotes.FormattingEnabled = true; - this.cmbNotes.Location = new System.Drawing.Point(597, 9); + this.cmbNotes.Location = new System.Drawing.Point(500, 9); this.cmbNotes.Name = "cmbNotes"; - this.cmbNotes.Size = new System.Drawing.Size(120, 25); + this.cmbNotes.Size = new System.Drawing.Size(111, 25); this.cmbNotes.TabIndex = 413; this.cmbNotes.Text = "全部"; // @@ -241,7 +245,7 @@ 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(799, 8); + this.pnlEmpty.Location = new System.Drawing.Point(843, 8); this.pnlEmpty.Name = "pnlEmpty"; this.pnlEmpty.Size = new System.Drawing.Size(66, 26); this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -267,7 +271,7 @@ 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(728, 8); + this.btnSearch.Location = new System.Drawing.Point(772, 8); this.btnSearch.Margin = new System.Windows.Forms.Padding(2); this.btnSearch.Name = "btnSearch"; this.btnSearch.Size = new System.Drawing.Size(66, 26); @@ -279,23 +283,23 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(538, 13); + this.label4.Location = new System.Drawing.Point(465, 13); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(68, 17); + this.label4.Size = new System.Drawing.Size(44, 17); this.label4.TabIndex = 377; - this.label4.Text = "分组备注:"; + this.label4.Text = "备注:"; // // txtShopName // - this.txtShopName.Location = new System.Drawing.Point(415, 10); + this.txtShopName.Location = new System.Drawing.Point(357, 10); this.txtShopName.Name = "txtShopName"; - this.txtShopName.Size = new System.Drawing.Size(110, 23); + this.txtShopName.Size = new System.Drawing.Size(101, 23); this.txtShopName.TabIndex = 374; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(367, 13); + this.label3.Location = new System.Drawing.Point(309, 13); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(56, 17); this.label3.TabIndex = 375; @@ -303,15 +307,15 @@ // // txtShopId // - this.txtShopId.Location = new System.Drawing.Point(245, 10); + this.txtShopId.Location = new System.Drawing.Point(204, 10); this.txtShopId.Name = "txtShopId"; - this.txtShopId.Size = new System.Drawing.Size(110, 23); + this.txtShopId.Size = new System.Drawing.Size(101, 23); this.txtShopId.TabIndex = 372; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(197, 13); + this.label2.Location = new System.Drawing.Point(156, 13); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(55, 17); this.label2.TabIndex = 373; @@ -454,31 +458,6 @@ this.dgvShop.TabIndex = 5; this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); // - // chkAutoDrag - // - this.chkAutoDrag.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.chkAutoDrag.AutoSize = true; - this.chkAutoDrag.BackColor = System.Drawing.Color.White; - this.chkAutoDrag.Location = new System.Drawing.Point(1108, 2); - this.chkAutoDrag.Name = "chkAutoDrag"; - this.chkAutoDrag.Size = new System.Drawing.Size(159, 21); - this.chkAutoDrag.TabIndex = 3; - this.chkAutoDrag.Text = "登录时自动滑动拼图验证"; - this.chkAutoDrag.UseVisualStyleBackColor = false; - this.chkAutoDrag.Visible = false; - this.chkAutoDrag.Click += new System.EventHandler(this.chkAutoDrag_Click); - // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom; - 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(1264, 29); - this.statusBar.TabIndex = 1; - // // colSelect // this.colSelect.FillWeight = 26F; @@ -673,6 +652,47 @@ this.colDelete.Name = "colDelete"; this.colDelete.ReadOnly = true; // + // chkAutoDrag + // + this.chkAutoDrag.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.chkAutoDrag.AutoSize = true; + this.chkAutoDrag.BackColor = System.Drawing.Color.White; + this.chkAutoDrag.Location = new System.Drawing.Point(1108, 2); + this.chkAutoDrag.Name = "chkAutoDrag"; + this.chkAutoDrag.Size = new System.Drawing.Size(159, 21); + this.chkAutoDrag.TabIndex = 3; + this.chkAutoDrag.Text = "登录时自动滑动拼图验证"; + this.chkAutoDrag.UseVisualStyleBackColor = false; + this.chkAutoDrag.Visible = false; + this.chkAutoDrag.Click += new System.EventHandler(this.chkAutoDrag_Click); + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom; + 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(1264, 29); + this.statusBar.TabIndex = 1; + // + // txtSubAccount + // + this.txtSubAccount.Location = new System.Drawing.Point(666, 10); + this.txtSubAccount.Name = "txtSubAccount"; + this.txtSubAccount.Size = new System.Drawing.Size(101, 23); + this.txtSubAccount.TabIndex = 417; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(618, 13); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(56, 17); + this.label5.TabIndex = 418; + this.label5.Text = "子账户:"; + // // ShopListForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -758,5 +778,7 @@ private System.Windows.Forms.DataGridViewLinkColumn colCopyCookies; private System.Windows.Forms.DataGridViewLinkColumn colEdit; private System.Windows.Forms.DataGridViewLinkColumn colDelete; + private System.Windows.Forms.TextBox txtSubAccount; + private System.Windows.Forms.Label label5; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs index ea61ce4..d691e61 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs @@ -87,7 +87,7 @@ namespace TemuKJD.KJDForms.ShopForms } } - public static List GetServerShop() + public static List GetServerShop(bool getSubUserNick = false) { List list = new List(); @@ -113,7 +113,14 @@ namespace TemuKJD.KJDForms.ShopForms if (jArr.Count() == 0) break; - list.AddRange(ShopBLL.DeserializationShop(html)); + List shopLoginInfoLst = ShopBLL.DeserializationShop(html); + //if (getSubUserNick) + //{ + // url = BaseClass.BuildObjString("user/get_all_user"); + // data = UserLogin.GetSignaturex(); + // data += "&user_name_in=" + + //} + list.AddRange(shopLoginInfoLst); } return list; } @@ -443,6 +450,10 @@ namespace TemuKJD.KJDForms.ShopForms { shopList = shopList.Where(s => s.ShopAccount.ParseToString().ToLower().Contains(txtShopName.Text.ToLower())).ToList(); } + if (!string.IsNullOrEmpty(txtSubAccount.Text)) + { + shopList = shopList.Where(s => s.SubUserName.ParseToString().ToLower().Contains(txtSubAccount.Text.ToLower())).ToList(); + } })); List shopIdList = GetCheckedShopIdList(); diff --git a/TEMUKJD/MainForm.cs b/TEMUKJD/MainForm.cs index 20876cf..d67ef78 100644 --- a/TEMUKJD/MainForm.cs +++ b/TEMUKJD/MainForm.cs @@ -704,6 +704,14 @@ namespace TemuKJD } ShowMainPanel(adminForm as PDDAdminForm, sender as Panel); } + else if (BaseClass.MainPath == "douyin") + { + //if (adminForm == null) + //{ + // adminForm = new PDDAdminForm(); + //} + //ShowMainPanel(adminForm as PDDAdminForm, sender as Panel); + } } private object uploadForm; diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs index cb70a23..a3a83f1 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs @@ -119,10 +119,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.pbLoading = new System.Windows.Forms.PictureBox(); this.panel1 = new System.Windows.Forms.Panel(); this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx(); - this.splitContainer4 = new System.Windows.Forms.SplitContainer(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); - this.btnClear = new DevComponents.DotNetBar.PanelEx(); - this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSelectId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -145,6 +141,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn(); this.colAddTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.splitContainer4 = new System.Windows.Forms.SplitContainer(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.btnClear = new DevComponents.DotNetBar.PanelEx(); + this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -176,7 +176,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // splitContainer1 // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; @@ -1168,7 +1167,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer2.Panel2.Controls.Add(this.txtTest20981); this.splitContainer2.Panel2.Controls.Add(this.btnTest20981); this.splitContainer2.Panel2.Controls.Add(this.pbLoading); - this.splitContainer2.Panel2.Controls.Add(this.panel1); this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); this.splitContainer2.Size = new System.Drawing.Size(1484, 372); @@ -1349,9 +1347,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.Location = new System.Drawing.Point(35, 53); + this.panel1.Location = new System.Drawing.Point(699, 552); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(1106, 286); + this.panel1.Size = new System.Drawing.Size(881, 86); this.panel1.TabIndex = 189; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // @@ -1406,86 +1404,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick); this.dgvSelectProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll); // - // splitContainer4 - // - this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this.splitContainer4.Location = new System.Drawing.Point(0, 0); - this.splitContainer4.Name = "splitContainer4"; - // - // splitContainer4.Panel1 - // - this.splitContainer4.Panel1.Controls.Add(this.statusBar); - // - // splitContainer4.Panel2 - // - this.splitContainer4.Panel2.Controls.Add(this.btnClear); - this.splitContainer4.Panel2.Controls.Add(this.panelEx1); - this.splitContainer4.Size = new System.Drawing.Size(1484, 26); - this.splitContainer4.SplitterDistance = 793; - this.splitContainer4.TabIndex = 3; - // - // 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(793, 26); - this.statusBar.TabIndex = 2; - // - // btnClear - // - this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnClear.DisabledBackColor = System.Drawing.Color.Empty; - this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnClear.Location = new System.Drawing.Point(475, 2); - this.btnClear.Name = "btnClear"; - this.btnClear.Size = new System.Drawing.Size(90, 21); - this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnClear.Style.GradientAngle = 90; - this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.btnClear.TabIndex = 440; - this.btnClear.Text = "清空结果"; - this.btnClear.Visible = false; - // - // panelEx1 - // - this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control; - this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty; - this.panelEx1.Location = new System.Drawing.Point(568, 2); - this.panelEx1.Name = "panelEx1"; - this.panelEx1.Size = new System.Drawing.Size(115, 21); - this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.panelEx1.Style.GradientAngle = 90; - this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.panelEx1.TabIndex = 668; - this.panelEx1.Text = "停止当前操作"; - this.panelEx1.Visible = false; - // // colCheck // this.colCheck.Frozen = true; @@ -1664,12 +1582,93 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colOpResult.ReadOnly = true; this.colOpResult.Width = 260; // + // splitContainer4 + // + this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer4.Location = new System.Drawing.Point(0, 0); + this.splitContainer4.Name = "splitContainer4"; + // + // splitContainer4.Panel1 + // + this.splitContainer4.Panel1.Controls.Add(this.statusBar); + // + // splitContainer4.Panel2 + // + this.splitContainer4.Panel2.Controls.Add(this.btnClear); + this.splitContainer4.Panel2.Controls.Add(this.panelEx1); + this.splitContainer4.Size = new System.Drawing.Size(1484, 26); + this.splitContainer4.SplitterDistance = 793; + this.splitContainer4.TabIndex = 3; + // + // 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(793, 26); + this.statusBar.TabIndex = 2; + // + // btnClear + // + this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnClear.DisabledBackColor = System.Drawing.Color.Empty; + this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnClear.Location = new System.Drawing.Point(475, 2); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(90, 21); + this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.Style.GradientAngle = 90; + this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.TabIndex = 440; + this.btnClear.Text = "清空结果"; + this.btnClear.Visible = false; + // + // panelEx1 + // + this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control; + this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty; + this.panelEx1.Location = new System.Drawing.Point(568, 2); + this.panelEx1.Name = "panelEx1"; + this.panelEx1.Size = new System.Drawing.Size(115, 21); + this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.panelEx1.Style.GradientAngle = 90; + this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.panelEx1.TabIndex = 668; + this.panelEx1.Text = "停止当前操作"; + this.panelEx1.Visible = false; + // // PDDDBProdUserSelectForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1484, 546); + this.ClientSize = new System.Drawing.Size(1583, 641); this.Controls.Add(this.splitContainer1); + this.Controls.Add(this.panel1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Name = "PDDDBProdUserSelectForm"; this.Text = "PDDDBProdUserSelectForm"; diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs index 315a347..4ead8b6 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs @@ -66,6 +66,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms private void UserSelectDbProductForm_Load(object sender, EventArgs e) { + this.splitContainer1.Dock = DockStyle.Fill; + this.panel1.Location = new Point(40, 30); + this.panel1.Width = this.Width - 80; + this.panel1.Height = this.Height - 60; + this.panel1.SendToBack(); + lstTemuDBProductSelect = NaiBa.Util.Helper.ConfigHelper.LoadConfig>("pdd_db_prod_upload_list"); if (lstTemuDBProductSelect == null) lstTemuDBProductSelect = new NaiBa.Util.ConcurrentList(); @@ -1109,6 +1115,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms } } + var xxx = new PDDShopBrowserObject().getPDDProductWidthEdit(shop, prodParam.goods_id.ToString(), prodParam.goods_commit_id, true, true); Thread.Sleep(Randomx.GetId(10, 50)); rst = QueryChanceCommitDetail(shop, goods_id.ToString(), draftId, prodInfo.chance_tab); @@ -1287,7 +1294,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.country_id = prodInfo.detail.country_id.ParseToString(); prodParam.customizable = prodInfo.detail.customizable; prodParam.customs = prodInfo.detail.customs; - prodParam.damage_claim = prodInfo.detail.damage_claim; + prodParam.damage_claim = prodInfo.detail.damage_claim.ParseToInt(); prodParam.dead_line_seconds = 86399; // 1天? prodParam.decorationCanEdit = true; foreach (var floorItem in prodInfo.decoration.floor_list) @@ -1358,11 +1365,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.delivery_one_day = 0; prodParam.delivery_type = null; prodParam.detail_video = new List(); - prodParam.effect_logistics_weight_limit = 20000; + //prodParam.effect_logistics_weight_limit = 20000; + prodParam.effect_logistics_weight_limit = 10000; prodParam.electric_status = 0; prodParam.elec_goods_attributes = prodInfo.detail.elec_goods_attributes; prodParam.explanation_video = new List(); prodParam.extend_warranty_dto = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(prodInfo.detail.extend_warranty_dto)); + if (prodParam.extend_warranty_dto == null) + { + prodParam.extend_warranty_dto = new extend_warranty_dto_param(); + } prodParam.first_upload_carousel = true; prodParam.gallery = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(prodInfo.detail.galleries)); // 机会商品保留最后一张主图将一直是机会商品 @@ -1383,8 +1395,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.goods_name = prodInfo.detail.goods_name; prodParam.goods_name_prefix = prodInfo.detail.goods_name_prefix; prodParam.goods_pattern = prodInfo.detail.goods_pattern; - //prodParam.goods_properties = new List(); // 商品属性,通过接口获取商品模板并做匹配 prodParam.goods_properties = new List(); // 商品属性,通过接口获取商品模板并做匹配 + var goods_properties = new List(); // 商品属性,暂存 //step1(共3个step)通过商品属性获取二级必填属性 foreach (var propInfo in prodInfo.property.goods_properties) { @@ -1487,7 +1499,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms value_unit = "", content = (propInfo.values.FirstOrDefault()?.value).ParseToString(), }; - prodParam.goods_properties.Add(prop); + goods_properties.Add(prop); } //step3(共3个step)如果有遗漏的必填(required)商品属性,按默认值填写 foreach (var propTemp in prodCatTemplateInfo.modules.FirstOrDefault()?.propertys) @@ -1509,10 +1521,28 @@ namespace TemuKJD.PDDForms.ProductSelectForms value_unit = "", content = contentOther.value, }; - prodParam.goods_properties.Add(prop); + goods_properties.Add(prop); } } } + foreach (var prodTempInfo in prodCatTemplateInfo.modules.FirstOrDefault()?.propertys) + { + var prop = goods_properties.FirstOrDefault(p => p.ref_pid == prodTempInfo.ref_pid); + if (prop == null) + { + prop = new goods_spec_property_param() + { + template_pid = prodTempInfo.id, + template_module_id = prodCatTemplateInfo.modules.FirstOrDefault().id, + ref_pid = prodTempInfo.ref_pid, + pid = prodTempInfo.pid, + value = "", + value_unit = "", + content = "", + }; + } + prodParam.goods_properties.Add(prop); + } //foreach (var spec_prop in prodInfo.property.) @@ -1537,7 +1567,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.is_all_weight_same = true; prodParam.is_auto_save = false; prodParam.is_certificate_provide = prodInfo.detail.is_certificate_provide; - prodParam.is_customized = prodInfo.detail.is_customized; + prodParam.is_customized = prodInfo.detail.is_customized.ParseToInt(); prodParam.is_customs = prodInfo.detail.is_customs; prodParam.is_default_template_id = 0; // ? prodParam.is_default_template_id = 1; // ? @@ -1549,17 +1579,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.is_only_for_remote_area = prodInfo.detail.is_only_for_remote_area; prodParam.is_pre_sale = prodInfo.detail.is_pre_sale; prodParam.is_refundable = prodInfo.detail.is_refundable; - prodParam.is_refundable_fifteen_day = prodInfo.detail.is_refundable_fifteen_day; - prodParam.is_shop = 0; // 是否上架? prodInfo.detail.is_shop; - prodParam.is_size_change_casually = prodInfo.detail.is_size_change_casually; + prodParam.is_refundable_fifteen_day = prodInfo.detail.is_refundable_fifteen_day.ParseToInt(); + prodParam.is_shop = 1; // 是否上架? prodInfo.detail.is_shop; + prodParam.is_size_change_casually = prodInfo.detail.is_size_change_casually.ParseToInt(); prodParam.is_sku_pre_sale = prodInfo.detail.is_sku_pre_sale; - prodParam.is_sku_shipment = prodInfo.detail.is_sku_shipment; + prodParam.is_sku_shipment = prodInfo.detail.is_sku_shipment.ParseToInt(); prodParam.is_spring_festival_open_tag = prodInfo.detail.is_spring_festival_open_tag; prodParam.is_transfer_spu = false; prodParam.is_two_num_group = prodInfo.detail.is_two_num_group; - prodParam.is_warranty_one_year = prodInfo.detail.is_warranty_one_year; - prodParam.is_wp_service = prodInfo.detail.is_wp_service; - prodParam.lack_of_weight_claim = prodInfo.detail.lack_of_weight_claim; + prodParam.is_warranty_one_year = prodInfo.detail.is_warranty_one_year.ParseToInt(); + prodParam.is_wp_service = prodInfo.detail.is_wp_service.ParseToInt(); + prodParam.lack_of_weight_claim = prodInfo.detail.lack_of_weight_claim.ParseToInt(); prodParam.local_service_id_list = prodInfo.detail.local_service_id_list; prodParam.mai_jia_zi_ti = prodInfo.detail.mai_jia_zi_ti; prodParam.market_price = prodInfo.detail.market_price; @@ -1630,7 +1660,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.shipment_limit_second = prodInfo.detail.shipment_limit_second; //发货时间 86400 = 24 小时 一般设置成2天 //if (prodParam.shipment_limit_second == 0) prodParam.shipment_limit_second = 86400 * 2; - prodParam.shipment_limit_second_origin_value = 0; + prodParam.shipment_limit_second_origin_value = 172800; prodParam.shop_group_id = prodInfo.detail.shop_group_id.ParseToInt(); prodParam.showGoodsInstruction = true; prodParam.size_parent_spec_id = prodInfo.detail.size_parent_spec_id; //尝试使用上家的尺码表,不行则下面再修改 @@ -1690,6 +1720,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms skuInfoEditLst = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(prodInfo.detail.sku)); } + Dictionary new_Sku_Img_Dic = new Dictionary(); foreach (var skuInfo in skuInfoEditLst) { var skuParam = new sku_param() @@ -1752,6 +1783,55 @@ namespace TemuKJD.PDDForms.ProductSelectForms } } + if (pddUploadRule.IsSignActivity && 1 == 1) // 在图片上画线,没有效果 + { + if (!new_Sku_Img_Dic.Keys.Contains(skuParam.thumb_url)) + { + string getImgError; + var image = GetHtml.GetUrlImg(skuParam.thumb_url.Replace("https://", "http://"), out getImgError); + var imageBg = new Bitmap(image.Width, image.Height); + if (!string.IsNullOrEmpty(getImgError) || image == null) + { + return "设置升级款sku失败 图片上传失败"; + } + try + { + using (Graphics g = Graphics.FromImage(imageBg)) + { + g.DrawImage(image, new Rectangle(0, 0, image.Width, image.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + //Pen pen = new Pen(Color.White); + //g.DrawLine(pen, Randomx.GetId(0, image.Width), Randomx.GetId(0, image.Height), Randomx.GetId(0, image.Width), Randomx.GetId(0, image.Height)); + //pen = new Pen(Color.Blue); + //g.DrawLine(pen, Randomx.GetId(0, image.Width), Randomx.GetId(0, image.Height), Randomx.GetId(0, image.Width), Randomx.GetId(0, image.Height)); + //pen = new Pen(Color.Green); + //g.DrawLine(pen, Randomx.GetId(0, image.Width), Randomx.GetId(0, image.Height), Randomx.GetId(0, image.Width), Randomx.GetId(0, image.Height)); + ////var imageUp = pbUpgradeVersion.Image; + ////// 将升级版图片绘制到sku图片上 + ////g.DrawImage(imageUp, new Rectangle(0, 0, image.Width, image.Height), 0, 0, imageUp.Width, imageUp.Height, GraphicsUnit.Pixel); + } + } + catch (Exception ex) + { + return "修改sku图片失败 " + ex.Message; + } + string uploadUpgradeSkuImgRst = UploadProdSkuImg(shop, imageBg, prodParam.goods_id.ParseToString(), prodParam.goods_commit_id, prodInfo.chance_tab); + if (!uploadUpgradeSkuImgRst.Contains("\"url\":\"https:")) + { + var error = BaseRegex.GetStringJson(ref uploadUpgradeSkuImgRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = uploadUpgradeSkuImgRst; + return "上传升级款sku图片失败 " + error; + } + else + { + var upgrid_thumb_url = BaseRegex.GetStringJson(ref uploadUpgradeSkuImgRst, "url"); + new_Sku_Img_Dic[skuParam.thumb_url] = upgrid_thumb_url; + } + } + skuParam.thumb_url = new_Sku_Img_Dic[skuParam.thumb_url]; + skuParam.thumb_url_file_id = null; + } + baseSkuParamLst.Add(skuParam); } @@ -1787,6 +1867,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.market_price = skuParam.price + 1000; prodParam.market_price_in_yuan = (prodParam.market_price * 0.01).ParseToString(); } + prodParam.skus.Add(skuParam); } @@ -1957,7 +2038,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.song_huo_ru_hu = prodInfo.detail.song_huo_ru_hu; prodParam.spu = new object(); prodParam.tag_price_gallery = new List(); - prodParam.thawed_refund = prodInfo.detail.thawed_refund; + prodParam.thawed_refund = prodInfo.detail.thawed_refund.ParseToInt(); prodParam.third_type = prodInfo.detail.third_type; prodParam.tiny_name = prodInfo.detail.tiny_name; prodParam.transport_type_list = prodInfo.detail.transport_type_list == null ? new List() : prodInfo.detail.transport_type_list as List; @@ -1965,7 +2046,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodParam.uploadDragAB = false; prodParam.warehouse = prodInfo.detail.warehouse; prodParam.warm_tips = prodInfo.detail.warm_tips; - prodParam.weight = ""; + prodParam.weight = 1; prodParam.zhi_huan_bu_xiu = prodInfo.detail.zhi_huan_bu_xiu; prodParam.validate_message = "dd3837f48ccafb7c9b410fc4a650d20a8d0c7bf4602a7d808b757f4642be0647";//加密信息,暂时写死不影响上传 @@ -2570,6 +2651,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms { prodParam.decorationPreview = BaseRegex.GetStringJson(ref decoration_preview_html, "preview_url"); prodParamHighPriceFakeSkuImg.decorationPreview = prodParam.decorationPreview; + prodParamHighPrice.decorationPreview = prodParam.decorationPreview; } else { @@ -2718,10 +2800,42 @@ namespace TemuKJD.PDDForms.ProductSelectForms } } - string activityErr = SignActivity(shop, prodParam, sign22347, sign20981, sign23165, sign15996); + PDDShopLoginForm loginForm = null; + if (pddUploadRule.IsSignActivity) + { + Invoke(new Action(() => + { + //this.panel1.SendToBack(); + this.panel1.BringToFront(); + loginForm = new PDDShopLoginForm(shop); + loginForm.TopLevel = false; + loginForm.openType = EnumOpenType.manage; + loginForm.WindowState = FormWindowState.Maximized; + loginForm.InitUrl = "https://mms.pinduoduo.com"; + loginForm.Dock = DockStyle.Fill; + this.panel1.Controls.Add(loginForm); + loginForm.Show(); + })); + Thread.Sleep(Randomx.GetId(4000, 10000)); + if (sign20981) + { + Invoke(new Action(() => + { + loginForm.cefWebBrowser.Load("https://mms.pinduoduo.com/act/multi-act-enroll?activityId=20981&activityType=27&SourceType=PROMO-OwnHome&formInfoSceneType=realBigSaleQuickEnrollMultiActivityScene"); + })); + } + Thread.Sleep(Randomx.GetId(4000, 10000)); - Thread.Sleep(Randomx.GetId(6000, 12000)); - var getProdIdRst = get_prod_commit_id(shop, prodParamHighPrice.goods_id.ParseToString()); + Invoke(new Action(() => + { + //if (PDDShopLoginForm.shopLoginInstance != null) + // PDDShopLoginForm.shopLoginInstance.Close(); + if (loginForm != null) + loginForm.Close(); + })); + } + + var getProdIdRst = get_prod_commit_id(shop, prodParamHighPrice.goods_id.ParseToString(), false); var newCommitId = BaseRegex.GetStringJson(ref getProdIdRst, "goods_commit_id"); prodParamHighPrice.goods_commit_id = newCommitId; if (string.IsNullOrEmpty(newCommitId) || !getProdIdRst.Contains("\"success\":true")) @@ -2747,11 +2861,117 @@ namespace TemuKJD.PDDForms.ProductSelectForms return; } - foreach (var sku in prodParamHighPrice.skus) + PDDProductDetailInfo dbProdDetailInfo = null; + try { - sku.quantity_delta = 0; + var prod_on_shop_rst = PDDShopBrowserObject.GetPddProdDetailOnShop(shop, prodParamHighPrice.goods_id.ParseToString(), prodParamHighPrice.goods_commit_id); + + var prod_detail_rst = PDDShopBrowserObject.GetPddProdDetail(shop, prodParamHighPrice.goods_id.ParseToString(), prodParamHighPrice.goods_commit_id); + + JObject prod_detail_obj = JObject.Parse(prod_detail_rst); + var detail_json = JsonHelper.SerializeObject(prod_detail_obj["result"]); + + dbProdDetailInfo = JsonHelper.DeserializeJsonToObject(detail_json); + if (dbProdDetailInfo == null || detail_json.Length < 10) + { + Invoke(new Action(() => + { + cell.Value = "商品获取失败!商品数据格式获取失败!" + " " + duration.ParseToInt() + "秒"; + })); + return; + } } - var reSaveProdRst = save_goods_edit(shop, prodParamHighPrice, prodParamHighPrice.goods_id.ParseToString(), prodParamHighPrice.goods_commit_id, isChanceApi, "edit"); + catch (Exception ex) + { + Invoke(new Action(() => + { + cell.Value = "商品获取失败!商品数据格式获取失败!" + ex.Message + " " + duration.ParseToInt() + "秒"; + })); + return; + } + + prodParamHighPrice.check_status = 9; + prodParamHighPrice.first_upload_carousel = null; + prodParamHighPrice.uploadDragAB = null; + prodParamHighPrice.title_keywords = null; + prodParamHighPrice.prefillWhitePic = null; + prodParamHighPrice.is_shop = 1; + prodParamHighPrice.pre_sale_time = ""; + prodParam.goods_pattern = dbProdDetailInfo.goods_pattern; + foreach (var skuParam in prodParamHighPrice.skus) + { + var skuInfo = dbProdDetailInfo.sku.FirstOrDefault(sk => string.Join(";", sk.spec.Select(s => s.spec_name)) == string.Join(";", skuParam.spec.Select(s => s.spec_name))); + if (skuInfo != null) + { + skuParam.id = skuInfo.id; + skuParam.is_onsale = skuInfo.is_onsale; + skuParam.limit_quantity = skuInfo.limit_quantity; + skuParam.multi_price = skuInfo.multi_price; + skuParam.out_sku_sn = skuInfo.out_sku_sn; + skuParam.oversea_sku = skuInfo.oversea_sku == null ? new object() : skuInfo.oversea_sku; + skuParam.price = skuInfo.price; + skuParam.quantity_delta = txtStockNum.Text.Trim().ParseToInt(); // 商品数量 + skuParam.shipment_limit_second_list = skuInfo.shipment_limit_second_list == null ? new List() : skuInfo.shipment_limit_second_list; + skuParam.sku69_code = skuInfo.sku69_code.ParseToString(); + skuParam.sku_srv_templates = skuInfo.sku_srv_templates.ParseToString(); + skuParam.spec = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(skuInfo.spec)); + //skuParam.thumb_url = skuInfo.thumb_url; + //skuParam.thumb_url_file_id = skuInfo.thumb_url_file_id; + //skuParam.thumb_url_file_id = skuInfo.ref_sku_commit_id; + skuParam.weight = skuInfo.weight; + skuParam.length = skuInfo.length; + skuParam.price_in_yuan = ""; // 内部计算直接置空 + skuParam.multi_price_in_yuan = ""; // 内部计算直接置空 + skuParam.pre_sale_time = skuInfo.pre_sale_time; + skuParam.sku_id = skuInfo.sku_id; + foreach(var spec in skuParam.spec) + { + spec.is_custom = spec.is_custom.ParseToInt(); + } + } + skuParam.quantity_delta = 0; + } + + loginForm = null; + if (pddUploadRule.IsSignActivity && 1 == 1) + { + Invoke(new Action(() => + { + //this.panel1.SendToBack(); + this.panel1.BringToFront(); + loginForm = new PDDShopLoginForm(shop); + loginForm.prodParam = prodParamHighPrice; + loginForm.TopLevel = false; + loginForm.openType = EnumOpenType.manage; + loginForm.WindowState = FormWindowState.Maximized; + loginForm.InitUrl = "https://mms.pinduoduo.com"; + loginForm.Dock = DockStyle.Fill; + this.panel1.Controls.Add(loginForm); + loginForm.Show(); + loginForm.SetPanelVisible(true); + })); + Thread.Sleep(Randomx.GetId(3000, 8000)); + if (sign20981) + { + Invoke(new Action(() => + { + loginForm.cefWebBrowser.Load("https://mms.pinduoduo.com/goods/goods_add/index?id=" + prodParamHighPrice.goods_commit_id + + "&goods_id=" + prodParamHighPrice.goods_id + "&type=edit"); + })); + } + Thread.Sleep(Randomx.GetId(5000, 10000)); + } + while (loginForm != null && loginForm.Created && !loginForm.Disposing && !loginForm.IsDisposed) + { + Thread.Sleep(Randomx.GetId(500, 1000)); + } + Invoke(new Action(() => + { + this.panel1.SendToBack(); + })); + + //var reSaveProdRst = save_goods_edit(shop, prodParamHighPrice, prodParamHighPrice.goods_id.ParseToString(), prodParamHighPrice.goods_commit_id, isChanceApi, "edit"); + var reSaveProdRst = save_goods_edit(shop, prodParamHighPrice, prodParamHighPrice.goods_id.ParseToString(), prodParamHighPrice.goods_commit_id, false, "edit"); if (!reSaveProdRst.Contains("\"success\":true")) { var error = BaseRegex.GetStringJson(ref reSaveProdRst, "error_msg"); @@ -2776,6 +2996,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms Thread.Sleep(Randomx.GetId(20, 100)); //var str = JsonHelper.SerializeObject(prodParam); + //var reUploadRst = submit_goods_edit(shop, prodParamHighPrice.goods_id.ParseToString(), prodParamHighPrice.goods_commit_id, isChanceApi, "edit"); var reUploadRst = submit_goods_edit(shop, prodParamHighPrice.goods_id.ParseToString(), prodParamHighPrice.goods_commit_id, isChanceApi, "edit"); if (!reUploadRst.Contains("\"success\":true")) { @@ -2800,6 +3021,15 @@ namespace TemuKJD.PDDForms.ProductSelectForms return; } + Invoke(new Action(() => + { + if (loginForm != null) + loginForm.Close(); + loginForm = null; + })); + Thread.Sleep(Randomx.GetId(12000, 15000)); + string activityErr = SignActivity(shop, prodParam, sign22347, sign20981, sign23165, sign15996); + //Thread.Sleep(Randomx.GetId(4000, 8000)); if (!string.IsNullOrEmpty(activityErr)) { @@ -3694,7 +3924,7 @@ Content-Disposition: form-data; name=""pic_operations"" /// /// /// - private string get_prod_commit_id(ShopLoginInfo shop, string prodId) + private string get_prod_commit_id(ShopLoginInfo shop, string prodId, bool _isChanceApi) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); if (shop.AntiContents.Count > 0) @@ -3702,7 +3932,7 @@ Content-Disposition: form-data; name=""pic_operations"" string url = "https://mms.pinduoduo.com/glide/v2/mms/edit/commit/create_by_sn"; string body = @"{""goods_id"":" + prodId + "}"; string refere = "https://mms.pinduoduo.com/goods/goods_list?msfrom=mms_sidenav"; - if (isChanceApi) + if (_isChanceApi) { refere = "https://mms.pinduoduo.com/goods/category?chance_tab=search"; } @@ -4195,8 +4425,24 @@ Content-Disposition: form-data; name=""pic_operations"" anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)]; string url = "https://mms.pinduoduo.com/glide/mms/goodsCommit/action/edit"; string body = JsonHelper.SerializeObject(prod); + if (type != "add") + { + body = body.Replace("\"first_upload_carousel\":null,", ""); + body = body.Replace("\"uploadDragAB\":null,", ""); + body = body.Replace("\"title_keywords\":null,", ""); + body = body.Replace("\"title_recommend\":null,", ""); + body = body.Replace("\"prefillWhitePic\":null,", ""); + + body = body.Replace("\"parent_spec_id\":null,", ""); + body = body.Replace("\"spec_id\":null,", ""); + body = body.Replace("\"note\":null,", ""); + body = body.Replace("\"img_url\":null,", ""); + body = body.Replace("\"group_id\":null,", ""); + //body = body.Replace("\"vid\":null,", ""); + } string refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=" + type + "&from=category&id=" + commitId + "&goods_id=" + prodId + "&sourcePage=goodsList"; + refere = "https://mms.pinduoduo.com/goods/goods_add/index?id="+ commitId + "&goods_id=" + prodId + "&type=edit"; if (isChance) { //refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=" + type + "&from=chance&id=" + commitId + @@ -4271,6 +4517,7 @@ Content-Disposition: form-data; name=""pic_operations"" string refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=" + type + "&from=category&id=" + commitId + "&goods_id=" + prodId + "&sourcePage=goodsList"; + refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit"; if (isChance) { //refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=" + type + "&from=chance&id=" + commitId + @@ -4511,7 +4758,7 @@ Content-Disposition: form-data; name=""pic_operations"" return result; } - private string GetChanceGoodsId(ShopLoginInfo shop, string searchWord = "头发绳", string chanceId = "fff84ef8fc1b2919a9c3383d350f44cc", string _refere="") + public static string GetChanceGoodsId(ShopLoginInfo shop, string searchWord = "头发绳", string chanceId = "fff84ef8fc1b2919a9c3383d350f44cc", string _refere="") { var anti = shop.AntiContents.LastOrDefault().ParseToString(); if (shop.AntiContents.Count > 0) @@ -5254,7 +5501,7 @@ Content-Type: image/jpeg } catch (Exception ex) { - BaseMsgForm.ShowError("打开增强版sku叠加图片失败 " + ex.Message); + BaseMsgForm.ShowError("打开升级版sku叠加图片失败 " + ex.Message); return; } } diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProd.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProd.Designer.cs new file mode 100644 index 0000000..0b208cf --- /dev/null +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProd.Designer.cs @@ -0,0 +1,40 @@ + +namespace TemuKJD.PDDForms.ProductSelectForms +{ + partial class PDDGetChanceProd + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "PDDGetChanceProd"; + } + + #endregion + } +} \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProd.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProd.cs new file mode 100644 index 0000000..2ce120c --- /dev/null +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProd.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace TemuKJD.PDDForms.ProductSelectForms +{ + public partial class PDDGetChanceProd : Form + { + public PDDGetChanceProd() + { + InitializeComponent(); + } + } +} diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs index d2cb1f2..35acb2e 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopBrowserObject.cs @@ -25,7 +25,7 @@ namespace TemuKJD.PDDForms.ShopForms public delegate void InfoReceivedHandler(string information); public event InfoReceivedHandler OnInfoReceived; - public string getProduct(string sProdId, string supplierId, PDDProductInfo prodInfo = null, bool notSaveDb = false) + public string getProduct(string sProdId, string supplierId, bool notSaveDb = false) { var prodId = sProdId.ParseToLong(); if (prodId <= 0) @@ -43,91 +43,107 @@ namespace TemuKJD.PDDForms.ShopForms Task.Run(() => { - try + var msg = getPDDProductWidthEdit(shop, sProdId, "", false, notSaveDb); + if (!string.IsNullOrEmpty(msg)) + { + if (!msg.StartsWith("success") && !msg.StartsWith("商品采集保存成功")) + { + MainForm.instance.Invoke(new Action(() => + { + BaseMsgForm.ShowError(msg); + })); + } + else + { + MainForm.instance.Invoke(new Action(() => + { + BaseMsgForm.ShowInfo(msg); + })); + } + } + }); + + return "success"; + } + + public string getPDDProductWidthEdit(ShopLoginInfo shop, string prodId, string commitId = "", bool isChance = false, bool notSaveDb = false) + { + try + { + var sourceShop = shop; + var sourceProdId = prodId; + string success_err_msg = ""; + //string errorMsg = ""; + if (string.IsNullOrEmpty(commitId)) { - var sourceShop = shop; - var sourceProdId = prodId; - string success_err_msg = ""; - //string errorMsg = ""; var commit_id_rst = GetPddProdCommitId(sourceShop, sourceProdId.ToString()); if (!commit_id_rst.Contains("\"success\":true") || !commit_id_rst.Contains("\"result\"")) { var errMsg = BaseRegex.GetStringJson(ref commit_id_rst, "error_msg"); if (string.IsNullOrEmpty(errMsg)) errMsg = commit_id_rst; - OnInfoReceived("商品获取失败!" + errMsg); - return; + //OnInfoReceived("商品获取失败!" + errMsg); + return "商品获取失败!" + errMsg; } - var commitId = BaseRegex.GetStringJson(ref commit_id_rst, "goods_commit_id"); + commitId = BaseRegex.GetStringJson(ref commit_id_rst, "goods_commit_id"); if (string.IsNullOrEmpty(commitId)) { - OnInfoReceived("商品获取失败!商品提交编号获取失败!"); - return; + //OnInfoReceived("商品获取失败!商品提交编号获取失败!"); + return "商品获取失败!商品提交编号获取失败!"; } + } - Thread.Sleep(Randomx.GetId(10, 50)); - var detail_json = "{}"; - PDDProductDetailInfo product = null; + Thread.Sleep(Randomx.GetId(10, 50)); + var detail_json = "{}"; + PDDProductDetailInfo product = null; + try + { + var prod_detail_rst = GetPddProdDetail(sourceShop, sourceProdId.ToString(), commitId); + JObject prod_detail_obj = JObject.Parse(prod_detail_rst); + detail_json = JsonHelper.SerializeObject(prod_detail_obj["result"]); + + product = JsonHelper.DeserializeJsonToObject(detail_json); + if (product == null || detail_json.Length < 10) + { + //OnInfoReceived("商品获取失败!商品数据格式获取失败!"); + return "商品获取失败!商品数据格式获取失败!"; + } + } + catch (Exception ex) + { + //OnInfoReceived("商品获取失败!商品数据格式获取失败!" + ex.Message); + return "商品获取失败!商品数据格式获取失败!" + ex.Message; + } + + Thread.Sleep(Randomx.GetId(10, 50)); + var size_json = "{}"; + if (product.size_spec_id.ParseToLong() != 0) + { try { - var prod_detail_rst = GetPddProdDetail(sourceShop, sourceProdId.ToString(), commitId); - JObject prod_detail_obj = JObject.Parse(prod_detail_rst); - detail_json = JsonHelper.SerializeObject(prod_detail_obj["result"]); - - product = JsonHelper.DeserializeJsonToObject(detail_json); - if (product == null || detail_json.Length < 10) + var prod_size_rst = GetPddProdSizeSpec(sourceShop, sourceProdId.ToString(), commitId, product.size_spec_id.ParseToString()); + prod_size_rst = GetHtml.Unicode2String(prod_size_rst); + JObject prod_size_obj = JObject.Parse(prod_size_rst); + size_json = JsonHelper.SerializeObject(prod_size_obj["result"]); + var size = JsonHelper.DeserializeJsonToObject(size_json); + if (size == null) { - OnInfoReceived("商品获取失败!商品数据格式获取失败!"); - return; + //OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!"); + return "尺码表获取失败!尺码数据格式获取失败!"; } } catch (Exception ex) { - OnInfoReceived("商品获取失败!商品数据格式获取失败!" + ex.Message); - return; + //OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!" + ex.Message); + return "尺码表获取失败!尺码数据格式获取失败!" + ex.Message; } + } - Thread.Sleep(Randomx.GetId(10, 50)); - var size_json = "{}"; - if (product.size_spec_id.ParseToLong() != 0) - { - try - { - var prod_size_rst = GetPddProdSizeSpec(sourceShop, sourceProdId.ToString(), commitId, product.size_spec_id.ParseToString()); - prod_size_rst = GetHtml.Unicode2String(prod_size_rst); - JObject prod_size_obj = JObject.Parse(prod_size_rst); - size_json = JsonHelper.SerializeObject(prod_size_obj["result"]); - var size = JsonHelper.DeserializeJsonToObject(size_json); - if (size == null) - { - OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!"); - return; - } - } - catch (Exception ex) - { - OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!" + ex.Message); - return; - } - } - //temu尺码表暂时注释 - //if (product.sizeTemplateId > 0) - //{ - // html = SizeSpecQuery(shop1, prodId1.ToString(), product.sizeTemplateId.ToString()); - // if(!html.Contains("\"success\":true")) - // { - // success_err_msg += " 尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg"); - // } - // else - // { - // obj = JObject.Parse(html); - // sizeRst = JsonHelper.SerializeObject(obj["result"]); - // } - //} - - Thread.Sleep(Randomx.GetId(10, 50)); - var property_json = "{}"; - PDDProductPropertyInfo property = null; + Thread.Sleep(Randomx.GetId(10, 50)); + var property_json = "{}"; + PDDProductPropertyInfo property = null; + if (!isChance) + { try { var prod_property_rst = GetPddProdProperty(sourceShop, sourceProdId.ToString(), commitId); @@ -139,30 +155,123 @@ namespace TemuKJD.PDDForms.ShopForms catch (Exception ex) { } if (property == null) { - OnInfoReceived("商品获取失败!商品属性获取失败!"); - return; + //OnInfoReceived("商品获取失败!商品属性获取失败!"); + return "商品获取失败!商品属性获取失败!"; } + } + else + { + try + { + var prod_property_rst = get_chance_cat_prop_template(sourceShop, "", sourceProdId.ToString(), commitId); + prod_property_rst = GetHtml.Unicode2String(prod_property_rst); + JObject prod_property_obj = JObject.Parse(prod_property_rst); + property_json = JsonHelper.SerializeObject(prod_property_obj["result"]); + property = JsonHelper.DeserializeJsonToObject(property_json); + } + catch (Exception ex) { } + if (property == null) + { + //OnInfoReceived("商品获取失败!商品属性获取失败!"); + return "商品获取失败!商品属性获取失败!"; + } + } + - // 属性模板暂时注释 - //var prop_template_json = "{}"; - //PDDProductTemplateInfo templateInfo = null; + // 属性模板暂时注释 + //var prop_template_json = "{}"; + //PDDProductTemplateInfo templateInfo = null; + //try + //{ + // var prop_template_rst = GetPddCatPropTemplate(sourceShop, product.cat_id.ParseToString(), sourceProdId.ToString(), commitId); + // JObject prop_template_obj = JObject.Parse(prop_template_rst); + // prop_template_json = JsonHelper.SerializeObject(prop_template_obj["result"]); + // templateInfo = JsonHelper.DeserializeJsonToObject(prop_template_json); + //} + //catch (Exception ex) { } + //if (templateInfo == null) + //{ + // OnInfoReceived("商品获取失败!商品属性模板获取失败!"); + // 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 "商品获取失败!商品详情图获取失败!" + errMsg; + } + 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 "商品获取失败!商品详情图获取失败!" + ex.Message; + } + if (decoration != null && decoration_json.ParseToString().Length < 20) + { //try - //{ - // var prop_template_rst = GetPddCatPropTemplate(sourceShop, product.cat_id.ParseToString(), sourceProdId.ToString(), commitId); - // JObject prop_template_obj = JObject.Parse(prop_template_rst); - // prop_template_json = JsonHelper.SerializeObject(prop_template_obj["result"]); - // templateInfo = JsonHelper.DeserializeJsonToObject(prop_template_json); + //{ // 获取另一组详情数据,结构和主详情不一样无法通用 + // var prod_detail_decoration_rst = GetPddProdOnShopDetail(sourceShop, sourceProdId.ToString(), commitId); + // JObject prod_detail_decoration_obj = JObject.Parse(prod_detail_decoration_rst); + // foreach (JObject ob in prod_detail_decoration_obj["result"]["carousel_gallery"]) + // { + + // } //} - //catch (Exception ex) { } - //if (templateInfo == null) + //catch (Exception ex) //{ - // OnInfoReceived("商品获取失败!商品属性模板获取失败!"); + // OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); // return; //} + PDDProdDecorationCommitParam decorationParam = new PDDProdDecorationCommitParam(); + decorationParam.goods_id = product.goods_id; + decorationParam.goods_commit_id = commitId.ParseToLong(); + decorationParam.preview_key = ""; + decorationParam.decoration_floor_list = new List(); + foreach (var gallary in product.galleries) + { + if (gallary.type != 2) + continue; + + var floor_param = new decoration_floor_param(); + //floor_param.floor_id = 0; // floorItem.floor_id; + floor_param.type = "image"; // floorItem.type; + floor_param.content_list = new List(); + //foreach (var c in floorItem.content_list) + { + var decorationContentParam = new decoration_content_param() + { + //file_id = c.file_id, + img_url = gallary.url, //c.img_url, + //height = c.height, + //text = c.text, + //text_module_details = null, + //width = c.width, + }; + //try { decorationContentParam.text_module_details = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(c.text_module_details)); } + //catch (Exception ex) { } + floor_param.content_list.Add(decorationContentParam); + } + decorationParam.decoration_floor_list.Add(floor_param); + } + + var addDecorationRst = save_decoration(shop, decorationParam, product.goods_id.ParseToString(), commitId); Thread.Sleep(Randomx.GetId(10, 50)); - var decoration_json = "{}"; - PDDProductDecorationInfo decoration = null; + + // 第二次获取详情图 try { var prod_decoration_rst = GetPddProdDecoration(sourceShop, sourceProdId.ToString(), commitId); @@ -171,8 +280,8 @@ namespace TemuKJD.PDDForms.ShopForms var errMsg = BaseRegex.GetStringJson(ref prod_decoration_rst, "error_msg"); if (string.IsNullOrEmpty(errMsg)) errMsg = prod_decoration_rst; - OnInfoReceived("商品获取失败!商品详情图获取失败!" + errMsg); - return; + //OnInfoReceived("商品获取失败!商品详情图获取失败!" + errMsg); + return "商品获取失败!商品详情图获取失败!" + errMsg; } JObject prod_decoration_obj = JObject.Parse(prod_decoration_rst); if (!prod_decoration_obj["result"].IsNullOrEmpty()) @@ -181,272 +290,185 @@ namespace TemuKJD.PDDForms.ShopForms } catch (Exception ex) { - OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); - return; + //OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); + return "商品获取失败!商品详情图获取失败!" + ex.Message; } - if (decoration != null && decoration_json.ParseToString().Length < 20) + } + + + if (decoration == null || decoration_json.ParseToString().Length < 20) + { + //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")) { - //try - //{ // 获取另一组详情数据,结构和主详情不一样无法通用 - // var prod_detail_decoration_rst = GetPddProdOnShopDetail(sourceShop, sourceProdId.ToString(), commitId); - // JObject prod_detail_decoration_obj = JObject.Parse(prod_detail_decoration_rst); - // foreach (JObject ob in prod_detail_decoration_obj["result"]["carousel_gallery"]) - // { - - // } - //} - //catch (Exception ex) - //{ - // OnInfoReceived("商品获取失败!商品详情图获取失败!" + ex.Message); - // return; - //} - - PDDProdDecorationCommitParam decorationParam = new PDDProdDecorationCommitParam(); - decorationParam.goods_id = product.goods_id; - decorationParam.goods_commit_id = commitId.ParseToLong(); - decorationParam.preview_key = ""; - decorationParam.decoration_floor_list = new List(); - foreach (var gallary in product.galleries) - { - if (gallary.type != 2) - continue; - - var floor_param = new decoration_floor_param(); - //floor_param.floor_id = 0; // floorItem.floor_id; - floor_param.type = "image"; // floorItem.type; - floor_param.content_list = new List(); - //foreach (var c in floorItem.content_list) - { - var decorationContentParam = new decoration_content_param() - { - //file_id = c.file_id, - img_url = gallary.url, //c.img_url, - //height = c.height, - //text = c.text, - //text_module_details = null, - //width = c.width, - }; - //try { decorationContentParam.text_module_details = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(c.text_module_details)); } - //catch (Exception ex) { } - floor_param.content_list.Add(decorationContentParam); - } - decorationParam.decoration_floor_list.Add(floor_param); - } - - var addDecorationRst = save_decoration(shop, decorationParam, product.goods_id.ParseToString(), commitId); - Thread.Sleep(Randomx.GetId(10, 50)); - - // 第二次获取详情图 - 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 || decoration_json.ParseToString().Length < 20) - { - 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; - string html = GetHtml.PostUtf8(existUrl, existData); - if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) - html = GetHtml.PostUtf8(existUrl, existData); - if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) - html = GetHtml.PostUtf8(existUrl, existData); - if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200")) - { - if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]")) - isExist = true; - } - - - string product_json = "{\"detail\":" + detail_json + ",\"size\":" + size_json + ",\"decoration\":" + decoration_json + - ",\"material3\":" + material3_json + ",\"material1\":" + material1_json + ",\"property\":" + property_json + "}"; - - if (notSaveDb) - { - prodInfo = JsonHelper.DeserializeJsonToObject(product_json); - } - else - { - string main_img = product.image_url; - if (string.IsNullOrEmpty(main_img)) - main_img = product.hd_thumb_url; - if (string.IsNullOrEmpty(main_img)) - main_img = product.thumb_url; - if (string.IsNullOrEmpty(main_img)) - main_img = (product.galleries?.FirstOrDefault()?.url).ParseToString().Replace("https://", "http://"); - var url = BaseClass.BuildObjString("product/add_product"); - if (isExist) - { - bool isCover = false; - MainForm.instance.Invoke(new Action(() => - { - var ok = BaseMsgForm.ShowConfirm("产品库内已存在相同id商品,是否更新?").DialogResult; - if (ok == DialogResult.OK) - isCover = true; - })); - if (isCover) - url = BaseClass.BuildObjString("product/mdy_product"); - else - return; - } - - var data = Work.UserLogin.GetSignaturex() + - "&from_shop_id=" + shop.ShopId + - "&spu_id=" + product.goods_id.ParseToString() + - "&skc_id=" + product.goods_id.ParseToString() + - "&price_text=" + product.sku.Min(s => s.multi_price).ParseToInt() * 0.01m + "-" + product.sku.Max(s => s.multi_price).ParseToInt() * 0.01m + - "&main_cat_id=" + (product.cat_ids?.FirstOrDefault(c => c != null)).ParseToString() + - "&main_cat_name=" + HttpUtility.UrlEncode((product.cats?.FirstOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) + - "&cat_id=" + (product.cat_id).ParseToString() + - "&cat_name=" + HttpUtility.UrlEncode((product.cats?.LastOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) + - "&ext_code=" + HttpUtility.UrlEncode(product.out_goods_sn, Encoding.UTF8) + - "&product_name=" + HttpUtility.UrlEncode(product.goods_name, Encoding.UTF8) + - "&product_json=" + HttpUtility.UrlEncode(product_json, Encoding.UTF8) + - "&size_json=" + HttpUtility.UrlEncode(size_json, Encoding.UTF8) + - "&main_img=" + HttpUtility.UrlEncode(main_img, Encoding.UTF8); - - 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("\"code\":200")) - { - string msg = "选品商品保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg"); - //OnInfoReceived(msg); - MainForm.instance.Invoke(new Action(() => - { - BaseMsgForm.ShowError(msg); - })); - } - else - { - //OnInfoReceived("选品商品保存成功!" + success_err_msg); - MainForm.instance.Invoke(new Action(() => - { - BaseMsgForm.ShowInfo("选品商品保存成功!" + success_err_msg); - })); - } - - //// 创建 SaveFileDialog 的实例 - //SaveFileDialog saveFileDialog = new SaveFileDialog(); - - //// 单线程单元(STA)模式运行文件对话框,否则会报错。 - //System.Threading.Thread InvokeThread = new System.Threading.Thread(new System.Threading.ThreadStart(()=> { - - // // 设置对话框的属性 - // saveFileDialog.Title = "保存商品"; - // saveFileDialog.Filter = "商品文件 (*.prd)|*.prd|所有文件 (*.*)|*.*"; // 过滤文件类型 - // saveFileDialog.FileName = product.productId.ParseToString(); // 默认文件名 - // saveFileDialog.DefaultExt = "txt"; // 默认文件扩展名 - - // // 显示对话框并获取结果 - // if (saveFileDialog.ShowDialog() == DialogResult.OK) - // { - // // 用户点击了“保存”按钮,此时可以获取文件的路径 - // string filePath = saveFileDialog.FileName; - // // 在这里处理文件保存逻辑,例如写入数据到文件 - // System.IO.File.WriteAllText(filePath, result); - - // //BaseMsgForm.ShowInfo("商品保存成功!"); - // } - //})); - //InvokeThread.SetApartmentState(System.Threading.ApartmentState.STA); - //InvokeThread.Start(); - //InvokeThread.Join(); + var errMsg = BaseRegex.GetStringJson(ref material3_rst, "error_msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = material3_rst; + //OnInfoReceived("商品获取失败!商品长图获取失败!" + errMsg); + return "商品获取失败!商品长图获取失败!" + errMsg; } + 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 "商品获取失败!商品长图获取失败!" + ex.Message; + } + if (material3 == null) + { + //OnInfoReceived("商品获取失败!商品长图获取失败!"); + return "商品获取失败!商品长图获取失败!"; } - }); - return "success"; + 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 "商品获取失败!商品白底图获取失败!" + errMsg; + } + 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 "商品获取失败!商品白底图获取失败!" + ex.Message; + } + 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; + string html = GetHtml.PostUtf8(existUrl, existData); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(existUrl, existData); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(existUrl, existData); + if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200")) + { + if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]")) + isExist = true; + } + + string product_json = "{\"detail\":" + detail_json + ",\"size\":" + size_json + ",\"decoration\":" + decoration_json + + ",\"material3\":" + material3_json + ",\"material1\":" + material1_json + ",\"property\":" + property_json + "}"; + + if (notSaveDb) + { + //prodInfo = JsonHelper.DeserializeJsonToObject(product_json); + + string main_img = product.image_url; + if (string.IsNullOrEmpty(main_img)) + main_img = product.hd_thumb_url; + if (string.IsNullOrEmpty(main_img)) + main_img = product.thumb_url; + if (string.IsNullOrEmpty(main_img)) + main_img = (product.galleries?.FirstOrDefault()?.url).ParseToString().Replace("https://", "http://"); + KJDDBProduct dbProd = new KJDDBProduct(); + dbProd.from_shop_id = shop.ShopId; + dbProd.spu_id = product.goods_id.ParseToString(); + dbProd.skc_id = product.goods_id.ParseToString(); + dbProd.main_cat_id = (product.cat_ids?.FirstOrDefault(c => c != null)).ParseToString(); + dbProd.main_cat_name = (product.cats?.FirstOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(); + dbProd.cat_id = (product.cat_id).ParseToString(); + dbProd.cat_name = (product.cats?.LastOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(); + dbProd.ext_code = product.out_goods_sn; + dbProd.product_name = product.goods_name; + dbProd.product_json = product_json; + dbProd.size_json = size_json; + dbProd.main_img = main_img; + + return "success" + JsonHelper.SerializeObject(dbProd); + } + else + { + string main_img = product.image_url; + if (string.IsNullOrEmpty(main_img)) + main_img = product.hd_thumb_url; + if (string.IsNullOrEmpty(main_img)) + main_img = product.thumb_url; + if (string.IsNullOrEmpty(main_img)) + main_img = (product.galleries?.FirstOrDefault()?.url).ParseToString().Replace("https://", "http://"); + var url = BaseClass.BuildObjString("product/add_product"); + if (isExist) + { + bool isOverride = false; + MainForm.instance.Invoke(new Action(() => + { + var ok = BaseMsgForm.ShowConfirm("产品库内已存在相同id商品,是否更新?").DialogResult; + if (ok == DialogResult.OK) + isOverride = true; + })); + if (isOverride) + url = BaseClass.BuildObjString("product/mdy_product"); + else + return ""; + } + + var data = Work.UserLogin.GetSignaturex() + + "&from_shop_id=" + shop.ShopId + + "&spu_id=" + product.goods_id.ParseToString() + + "&skc_id=" + product.goods_id.ParseToString() + + "&price_text=" + product.sku.Min(s => s.multi_price).ParseToInt() * 0.01m + "-" + product.sku.Max(s => s.multi_price).ParseToInt() * 0.01m + + "&main_cat_id=" + (product.cat_ids?.FirstOrDefault(c => c != null)).ParseToString() + + "&main_cat_name=" + HttpUtility.UrlEncode((product.cats?.FirstOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) + + "&cat_id=" + (product.cat_id).ParseToString() + + "&cat_name=" + HttpUtility.UrlEncode((product.cats?.LastOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) + + "&ext_code=" + HttpUtility.UrlEncode(product.out_goods_sn, Encoding.UTF8) + + "&product_name=" + HttpUtility.UrlEncode(product.goods_name, Encoding.UTF8) + + "&product_json=" + HttpUtility.UrlEncode(product_json, Encoding.UTF8) + + "&size_json=" + HttpUtility.UrlEncode(size_json, Encoding.UTF8) + + "&main_img=" + HttpUtility.UrlEncode(main_img, Encoding.UTF8); + + 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("\"code\":200")) + { + string msg = "商品采集保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg"); + //OnInfoReceived(msg); + return msg; + } + else + { + string msg = "商品采集保存成功!" + success_err_msg; + return msg; + } + } + } + catch (Exception ex) + { + return "商品采集失败!" + ex.Message; + } } /// @@ -662,7 +684,7 @@ namespace TemuKJD.PDDForms.ShopForms } return result; } - private string GetPddProdDetail(ShopLoginInfo shop, string prodId, string commitId) + public static string GetPddProdDetail(ShopLoginInfo shop, string prodId, string commitId) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); if (shop.AntiContents.Count > 0) @@ -687,6 +709,29 @@ namespace TemuKJD.PDDForms.ShopForms return result; } + public static string GetPddProdDetailOnShop(ShopLoginInfo shop, string prodId, string commitId) + { + 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/glide/v2/mms/query/commit/on_shop/detail"; //on_shop + string body = @"{""goods_commit_id"":""" + commitId + @""",""goods_id"":""" + prodId + @"""}"; + 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("网络繁忙,请不要频繁操作"); 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 GetPddProdOnShopDetail(ShopLoginInfo shop, string prodId, string commitId) { @@ -793,6 +838,33 @@ namespace TemuKJD.PDDForms.ShopForms } return result; } + private string get_chance_cat_prop_template(ShopLoginInfo shop, string catId, string goodsId, string commitId, string chanceTab = "") + { + 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/draco-ms/mms/template/mall?catId=" + catId + + "&goodsCommitId=" + commitId + "&goodsId=" + goodsId; + string body = @""; + string refere = "https://mms.pinduoduo.com/goods/goods_add/index?type=add&from=chance&id=" + commitId + + "&goods_id=" + goodsId + "&chance_tab=hot_theme&sourcePage=goodsListTopButton_CHANCE"; // chance_tab=search + if (!string.IsNullOrEmpty(chanceTab)) + refere = refere.Replace("chance_tab=hot_theme", "chance_tab=" + chanceTab); + var result = HttpResponseBLL.PDDGetResponse(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.PDDGetResponse(shop, url, body, refere, anti); + } + } + return result; + } + private string GetPddProdDecoration(ShopLoginInfo shop, string prodId, string commitId) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs index a0bf4ef..aac4c5a 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopLoginForm.cs @@ -26,6 +26,7 @@ using Work; using Work.BLL.Tools; using TemuKJD.BLL; using AllBase.Model.Result.PDDResult; +using AllBase.Model.Param.PDDProdParam; namespace TemuKJD.PDDForms.ShopForms { @@ -583,9 +584,55 @@ namespace TemuKJD.PDDForms.ShopForms ////headers["Accept-Encoding"] = "gzip, deflate, br"; //request.Headers = headers; } + if (url == "https://mms.pinduoduo.com/glide/mms/goodsCommit/action/edit" && prodParam != null) + { + //postData = postData.Replace( + // "https://img.pddpic.com/mms-goods-image/2025-12-27/e7d145cb-1147-46b5-a673-e3df4b93cd02.jpeg.a.jpeg", + // "https://img.pddpic.com/mms-material-img/2025-12-26/748ae660-53f4-4806-9e88-2712a7b5114b.jpeg.a.jpeg"); + + //postData = postData.Replace( + // "https://img.pddpic.com/mms-material-img/2025-12-26/748ae660-53f4-4806-9e88-2712a7b5114b.jpeg.a.jpeg", + // "https://img.pddpic.com/mms-goods-image/2025-12-26/1a788e0c-468a-4b6d-9389-cc2dab1f69a0.jpeg.a.jpeg?imageView2/2/w/1700/q/85"); + + JObject jObj = JObject.Parse(postData); + var skuStr = JsonHelper.SerializeObject(jObj["skus"]); + var skuStrNew = JsonHelper.SerializeObject(prodParam.skus); + foreach(JObject skuObj in jObj["skus"]) + { + var skuName = ""; + foreach (JObject specObj in skuObj["spec"]) + { + skuName += specObj["spec_name"].ParseToString() + ";"; + } + skuName = skuName.TrimEnd(';'); + var skuBase = prodParam.skus.FirstOrDefault(s => string.Join(";", s.spec.Select(sp => sp.spec_name)) == skuName); + if (skuBase != null) + skuObj["thumb_url"] = skuBase.thumb_url; + + skuObj["thumb_url"] = "https://img.pddpic.com/mms-material-img/2025-12-27/23e40222-1a08-4ba1-a6a3-65588c75e0cd.jpeg.a.jpeg"; + } + + //https://img.pddpic.com/mms-material-img/2025-12-18/4b0e7e61-1a78-4842-a0e8-f6b7ef88fe18.jpeg.a.jpeg + + //postData = postData.Replace( + // "https://img.pddpic.com/mms-material-img/2025-12-18/4b0e7e61-1a78-4842-a0e8-f6b7ef88fe18.jpeg.a.jpeg", + // "https://img.pddpic.com/mms-material-img/2025-12-26/748ae660-53f4-4806-9e88-2712a7b5114b.jpeg.a.jpeg"); + + //postData = postData.Replace( + // "https://img.pddpic.com/mms-material-img/2025-12-26/748ae660-53f4-4806-9e88-2712a7b5114b.jpeg.a.jpeg", + // "https://img.pddpic.com/mms-goods-image/2025-12-26/1a788e0c-468a-4b6d-9389-cc2dab1f69a0.jpeg.a.jpeg?imageView2/2/w/1700/q/85"); + + //skuStrNew = skuStrNew.Replace("\"thumb_url_file_id\":null,", ""); + //postData = postData.Replace(skuStr, skuStrNew); + + postData = JsonHelper.SerializeObject(jObj); + + request.PostData.Elements[0].Bytes = System.Text.Encoding.UTF8.GetBytes(postData); + } return false; } + public PDDProductUploadParam prodParam = null; static int GetAntiContentsTimes = 40; private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)