diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index d5369f7..b3f31d8 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 817; + public static int VersionCount = 819; //public static int VersionCount = 613; /// diff --git a/AllBase/Model/Result/KJDDBProduct.cs b/AllBase/Model/Result/KJDDBProduct.cs index 9185d98..ca6b82f 100644 --- a/AllBase/Model/Result/KJDDBProduct.cs +++ b/AllBase/Model/Result/KJDDBProduct.cs @@ -46,6 +46,7 @@ namespace AllBase.Model.Result /// public string sku_edit_json { get; set; } public string sku_secret_json { get; set; } + public string wx_img_map_json { get; set; } public int sku_img_replace_id { get; set; } public string sku_img_replace_base64 { get; set; } public string sku_img_replace_url { get; set; } diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index 8957b1c..054d5cb 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -138,6 +138,7 @@ namespace KJD_Web.BLL.BXX string send_to_out_server = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "send_to_out_server"))?.Replace("'", "\\'"); string sku_edit_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_edit_json"))?.Replace("'", "\\'"); string sku_secret_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_secret_json"))?.Replace("'", "\\'"); + string wx_img_map_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_img_map_json"))?.Replace("'", "\\'"); if (string.IsNullOrEmpty(user_name)) { @@ -209,6 +210,8 @@ namespace KJD_Web.BLL.BXX sql += " p.sku_edit_json='" + sku_edit_json + "',"; if (sku_secret_json != null) sql += " p.sku_secret_json=@sku_secret_json,"; + if (wx_img_map_json != null) + sql += " p.wx_img_map_json=@wx_img_map_json,"; sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"; sql = sql.TrimEnd(','); sql += " where spu_id='" + spu_id + "';"; @@ -217,6 +220,7 @@ namespace KJD_Web.BLL.BXX paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = product_json, }); paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "size_json", Value = size_json, }); paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "sku_secret_json", Value = sku_secret_json, }); + paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "wx_img_map_json", Value = wx_img_map_json, }); var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray()); mySql.Close(); @@ -438,6 +442,7 @@ namespace KJD_Web.BLL.BXX prod.sku_secret_json = row["sku_secret_json"].ToString(); prod.sku_img_replace_base64 = row["img_base64"].ToString(); //prod.sku_img_replace_url = row["img_url"].ToString(); + prod.wx_img_map_json = row["wx_img_map_json"].ToString(); } if (!string.IsNullOrEmpty(get_select_count)) { diff --git a/KJDService/KJD_WebService/Model/DBProductResultParam.cs b/KJDService/KJD_WebService/Model/DBProductResultParam.cs index 7ebb448..bd3df7c 100644 --- a/KJDService/KJD_WebService/Model/DBProductResultParam.cs +++ b/KJDService/KJD_WebService/Model/DBProductResultParam.cs @@ -62,6 +62,7 @@ namespace KJD_Web.Model /// 微信推单商品和sku加密code信息 /// public string sku_secret_json { get; set; } + public string wx_img_map_json { get; set; } public int sku_img_replace_id { get; set; } public string sku_img_replace_base64 { get; set; } public string sku_img_replace_url { get; set; } diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs index 0eaee95..8564701 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.Designer.cs @@ -48,7 +48,6 @@ this.btnNext = new System.Windows.Forms.Button(); this.btnPrev = new System.Windows.Forms.Button(); this.txtAddress = new System.Windows.Forms.TextBox(); - this.btnOpenOrder = new TemuKJD.UserControls.ButtonEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -77,7 +76,6 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; - this.splitContainer1.Panel2.Controls.Add(this.btnOpenOrder); this.splitContainer1.Panel2.Controls.Add(this.btnLoginAgain); this.splitContainer1.Panel2.Controls.Add(this.label2); this.splitContainer1.Panel2.Controls.Add(this.label1); @@ -89,7 +87,7 @@ this.splitContainer1.Panel2.Controls.Add(this.btnReload); this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin); this.splitContainer1.Size = new System.Drawing.Size(1438, 736); - this.splitContainer1.SplitterDistance = 671; + this.splitContainer1.SplitterDistance = 672; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -358,23 +356,6 @@ this.txtAddress.TabIndex = 7; this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown); // - // btnOpenOrder - // - this.btnOpenOrder.Anchor = System.Windows.Forms.AnchorStyles.None; - this.btnOpenOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnOpenOrder.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnOpenOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnOpenOrder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnOpenOrder.ForeColor = System.Drawing.Color.White; - this.btnOpenOrder.Location = new System.Drawing.Point(648, 19); - this.btnOpenOrder.Margin = new System.Windows.Forms.Padding(2); - this.btnOpenOrder.Name = "btnOpenOrder"; - this.btnOpenOrder.Size = new System.Drawing.Size(143, 25); - this.btnOpenOrder.TabIndex = 465; - this.btnOpenOrder.Text = "登录订单系统"; - this.btnOpenOrder.UseVisualStyleBackColor = false; - this.btnOpenOrder.Click += new System.EventHandler(this.btnOpenOrder_Click); - // // WXAdminShopLoginForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -425,6 +406,5 @@ private DevComponents.DotNetBar.PanelEx btnDel; private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnPrev; - public UserControls.ButtonEx btnOpenOrder; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs index 5426955..e9f32d9 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopLoginForm.cs @@ -909,15 +909,5 @@ function getElementWithText(sText) { cefWebBrowser.Forward(); } - - private void btnOpenOrder_Click(object sender, EventArgs e) - { - WXAdminShopLoginForm shopLoginForm = new WXAdminShopLoginForm(shop); - shopLoginForm.openType = EnumOpenType.manage; - shopLoginForm.WindowState = FormWindowState.Maximized; - shopLoginForm.InitUrl = "https://po.e57.cn/login?redirect=%2Findex"; - shopLoginForm.btnOpenOrder.Visible = false; - shopLoginForm.Show(); - } } } diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs index 247bbc1..6fac5b1 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs @@ -107,10 +107,10 @@ namespace TemuKJD.WXForms.ProductForms this.txtAddCount = new System.Windows.Forms.TextBox(); this.panelEx2 = new DevComponents.DotNetBar.PanelEx(); this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.cmbFilterShopNotes = new System.Windows.Forms.ComboBox(); this.btnEmptyShop = new DevComponents.DotNetBar.PanelEx(); this.btnFilterShop = new DevComponents.DotNetBar.PanelEx(); this.label17 = new System.Windows.Forms.Label(); - this.txtFilterShopNotes = new System.Windows.Forms.TextBox(); this.label16 = new System.Windows.Forms.Label(); this.txtFilterShopName = new System.Windows.Forms.TextBox(); this.btnRefreshShop = new DevComponents.DotNetBar.PanelEx(); @@ -1061,7 +1061,7 @@ namespace TemuKJD.WXForms.ProductForms // this.cmbWxSafe.FormattingEnabled = true; this.cmbWxSafe.Items.AddRange(new object[] { - "安全商品+未校验", + "安全+未校验", "安全商品", "未校验"}); this.cmbWxSafe.Location = new System.Drawing.Point(47, 45); @@ -1179,10 +1179,10 @@ namespace TemuKJD.WXForms.ProductForms | System.Windows.Forms.AnchorStyles.Left))); this.ucGroupBoxEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx1.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx1.Controls.Add(this.cmbFilterShopNotes); this.ucGroupBoxEx1.Controls.Add(this.btnEmptyShop); this.ucGroupBoxEx1.Controls.Add(this.btnFilterShop); this.ucGroupBoxEx1.Controls.Add(this.label17); - this.ucGroupBoxEx1.Controls.Add(this.txtFilterShopNotes); this.ucGroupBoxEx1.Controls.Add(this.label16); this.ucGroupBoxEx1.Controls.Add(this.txtFilterShopName); this.ucGroupBoxEx1.Controls.Add(this.btnRefreshShop); @@ -1193,13 +1193,21 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx1.TabStop = false; this.ucGroupBoxEx1.Text = "基础"; // + // cmbFilterShopNotes + // + this.cmbFilterShopNotes.FormattingEnabled = true; + this.cmbFilterShopNotes.Location = new System.Drawing.Point(38, 86); + this.cmbFilterShopNotes.Name = "cmbFilterShopNotes"; + this.cmbFilterShopNotes.Size = new System.Drawing.Size(89, 25); + this.cmbFilterShopNotes.TabIndex = 723; + // // btnEmptyShop // this.btnEmptyShop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnEmptyShop.CanvasColor = System.Drawing.SystemColors.Control; this.btnEmptyShop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnEmptyShop.DisabledBackColor = System.Drawing.Color.Empty; - this.btnEmptyShop.Location = new System.Drawing.Point(19, 119); + this.btnEmptyShop.Location = new System.Drawing.Point(10, 116); this.btnEmptyShop.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); this.btnEmptyShop.Name = "btnEmptyShop"; this.btnEmptyShop.Size = new System.Drawing.Size(37, 24); @@ -1226,9 +1234,9 @@ namespace TemuKJD.WXForms.ProductForms this.btnFilterShop.Cursor = System.Windows.Forms.Cursors.Hand; this.btnFilterShop.DisabledBackColor = System.Drawing.Color.Empty; this.btnFilterShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnFilterShop.Location = new System.Drawing.Point(58, 119); + this.btnFilterShop.Location = new System.Drawing.Point(49, 116); this.btnFilterShop.Name = "btnFilterShop"; - this.btnFilterShop.Size = new System.Drawing.Size(61, 24); + this.btnFilterShop.Size = new System.Drawing.Size(78, 24); this.btnFilterShop.Style.Alignment = System.Drawing.StringAlignment.Center; this.btnFilterShop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnFilterShop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -1247,26 +1255,17 @@ namespace TemuKJD.WXForms.ProductForms // label17 // this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(16, 64); + this.label17.Location = new System.Drawing.Point(6, 61); this.label17.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(32, 17); this.label17.TabIndex = 699; this.label17.Text = "名称"; // - // txtFilterShopNotes - // - this.txtFilterShopNotes.Font = new System.Drawing.Font("微软雅黑", 10F); - this.txtFilterShopNotes.Location = new System.Drawing.Point(48, 90); - this.txtFilterShopNotes.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); - this.txtFilterShopNotes.Name = "txtFilterShopNotes"; - this.txtFilterShopNotes.Size = new System.Drawing.Size(71, 25); - this.txtFilterShopNotes.TabIndex = 698; - // // label16 // this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point(16, 94); + this.label16.Location = new System.Drawing.Point(7, 90); this.label16.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(32, 17); @@ -1276,10 +1275,10 @@ namespace TemuKJD.WXForms.ProductForms // txtFilterShopName // this.txtFilterShopName.Font = new System.Drawing.Font("微软雅黑", 10F); - this.txtFilterShopName.Location = new System.Drawing.Point(48, 60); + this.txtFilterShopName.Location = new System.Drawing.Point(38, 57); this.txtFilterShopName.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtFilterShopName.Name = "txtFilterShopName"; - this.txtFilterShopName.Size = new System.Drawing.Size(71, 25); + this.txtFilterShopName.Size = new System.Drawing.Size(89, 25); this.txtFilterShopName.TabIndex = 653; // // btnRefreshShop @@ -1289,9 +1288,9 @@ namespace TemuKJD.WXForms.ProductForms this.btnRefreshShop.Cursor = System.Windows.Forms.Cursors.Hand; this.btnRefreshShop.DisabledBackColor = System.Drawing.Color.Empty; this.btnRefreshShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnRefreshShop.Location = new System.Drawing.Point(17, 31); + this.btnRefreshShop.Location = new System.Drawing.Point(14, 28); this.btnRefreshShop.Name = "btnRefreshShop"; - this.btnRefreshShop.Size = new System.Drawing.Size(102, 24); + this.btnRefreshShop.Size = new System.Drawing.Size(113, 24); this.btnRefreshShop.Style.Alignment = System.Drawing.StringAlignment.Center; this.btnRefreshShop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnRefreshShop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -1597,7 +1596,7 @@ namespace TemuKJD.WXForms.ProductForms this.chkTestNoAuditUpload.Name = "chkTestNoAuditUpload"; this.chkTestNoAuditUpload.Size = new System.Drawing.Size(123, 21); this.chkTestNoAuditUpload.TabIndex = 779; - this.chkTestNoAuditUpload.Text = "测试面审提交商品"; + this.chkTestNoAuditUpload.Text = "测试免审提交商品"; this.chkTestNoAuditUpload.UseVisualStyleBackColor = true; this.chkTestNoAuditUpload.Visible = false; // @@ -2092,9 +2091,9 @@ namespace TemuKJD.WXForms.ProductForms private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; private DevComponents.DotNetBar.PanelEx btnFilterShop; private System.Windows.Forms.Label label17; - private System.Windows.Forms.TextBox txtFilterShopNotes; private System.Windows.Forms.Label label16; private DevComponents.DotNetBar.PanelEx btnEmptyShop; private UserComponent.UcCheckBox chkImgRandomBlock; + private System.Windows.Forms.ComboBox cmbFilterShopNotes; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index ef8e49a..7c5b17c 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -235,7 +235,7 @@ namespace TemuKJD.WXForms.ProductForms } } -#if DEBUG +//#if DEBUG if (BaseClass.SaLevel == 1) { txtIdFilter.Visible = true; @@ -247,7 +247,7 @@ namespace TemuKJD.WXForms.ProductForms lblSourceType.Visible = true; lblGroupFilter.Visible = true; } -#endif +//#endif if (BaseClass.SaLevel == 1) { chkImgRandomBlock.Visible = true; @@ -413,6 +413,12 @@ namespace TemuKJD.WXForms.ProductForms if (!string.IsNullOrEmpty(shopEntity.ShopId)) BindShop(shopEntity, selectIds); } + cmbFilterShopNotes.Items.Clear(); + cmbFilterShopNotes.Items.Add(""); + foreach (var note in GlobalConfig.ShopLoginList.Select(s => s.Notes).Where(s => !s.IsNullOrEmpty()).Distinct()) + { + cmbFilterShopNotes.Items.Add(note); + } } private void BindShop(ShopLoginInfo shopEntity, List selectShopId = null) @@ -885,13 +891,13 @@ namespace TemuKJD.WXForms.ProductForms { result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"" + ex.Message + "\"}"; } - Thread.Sleep(Randomx.GetId(200, 300)); + Thread.Sleep(Randomx.GetId(100, 300)); //额外等待时间(无论失败与否) var waitTime = 0; Invoke(new Action(() => { waitTime = txtWaitSeconds.Text.Trim().ParseToInt(); })); if (waitTime > 0) - Thread.Sleep(Randomx.GetId(waitTime * 1000, (waitTime + 10) * 1000)); + Thread.Sleep(Randomx.GetId(waitTime * 1000, (waitTime + 2) * 1000)); selectProd.status = BaseRegex.GetStringJson(ref result, "status"); if (string.IsNullOrWhiteSpace(selectProd.status)) @@ -900,8 +906,8 @@ namespace TemuKJD.WXForms.ProductForms var timeSpan = DateTime.Now - startTime; duration = timeSpan.TotalSeconds; - // 至少10秒才完成一件商品 - while (duration < 10) + // 至少3秒才完成一件商品 + while (duration < 3) { Thread.Sleep(1000); timeSpan = DateTime.Now - startTime; @@ -1009,7 +1015,7 @@ namespace TemuKJD.WXForms.ProductForms string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime) { - Thread.Sleep(Randomx.GetId(200, 300)); + Thread.Sleep(Randomx.GetId(100, 300)); if (shop == null || string.IsNullOrEmpty(shop.ShopId) || shop.LoginStatus != "登录成功") { return "店铺为空或未登录!"; @@ -1022,6 +1028,9 @@ namespace TemuKJD.WXForms.ProductForms })); } + + + #region 跳过已上传商品 if (chkSkipUploaded.Checked) { var searchExtCode = "EC1" + dbProd.spu_id + "A"; @@ -1051,8 +1060,9 @@ namespace TemuKJD.WXForms.ProductForms return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品查询错误 " + ex.Message + "\"}"; } } + #endregion - // 加密数据将聚水潭产品数据格式进行转换 + #region 将聚水潭产品数据格式进行转换成pdd格式统一上传,匹配加密的spuCode和skuCoke if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId")) { string convertRst = ""; @@ -1060,6 +1070,7 @@ namespace TemuKJD.WXForms.ProductForms if (!string.IsNullOrEmpty(convertRst)) return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品查询错误 " + convertRst + "\"}"; } + #endregion #region 将产品数据初始化成微信小店支持的参数 JObject prodJObj = new JObject(); @@ -1239,14 +1250,34 @@ namespace TemuKJD.WXForms.ProductForms } #endregion + #region 图片盗链映射 + bool isChangeImgDic = false; + Dictionary wxImgMapDic = new Dictionary(); + if (!string.IsNullOrEmpty(dbProd.wx_img_map_json)) + { + try + { + wxImgMapDic = JsonHelper.DeserializeJsonToObject>(dbProd.wx_img_map_json); + } + catch + { + isChangeImgDic = true; + wxImgMapDic = new Dictionary(); + } + } + #endregion + + #region 暂时不上传视频 var prodInfo = JsonHelper.DeserializeJsonToObject(dbProd.product_json); prodInfo.detail.galleries.RemoveAll(g => g.type == 6); // 视频暂时移除,以后再视情况加上 + #endregion - + #region 主图不够详情图补充 int mainImgCount = (prodInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt(); if (mainImgCount > 0 && mainImgCount < 3) { var gallery1 = prodInfo?.detail?.galleries?.Where(g => g.type == 2).FirstOrDefault(); + // 先补一张 if (gallery1 != null) { prodInfo.detail.galleries.Add(new gallery_item() @@ -1257,6 +1288,7 @@ namespace TemuKJD.WXForms.ProductForms height = gallery1.height, }); } + // 如果补了只有两张再补一张 if (mainImgCount == 1 && (prodInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt() > 1) { var gallery2 = prodInfo?.detail?.galleries?[1]; @@ -1280,6 +1312,7 @@ namespace TemuKJD.WXForms.ProductForms })); return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"主图数量少于三张\"}"; } + #endregion // 生成初始化上传商品对象 var upProdInitParam = new WXUploadProductInitParam(); @@ -1287,12 +1320,14 @@ namespace TemuKJD.WXForms.ProductForms var upProdParam = new WXUploadProductParam(); // 随机获取一个上传图片的accessToken var token = new WxApiBLL().GetRandomWxToken(); - - // 设置标题 + + #region 设置标题 upProdInitParam.product.info.title = dbProd.product_name.IsNullOrEmpty() ? prodInfo.detail.goods_name : dbProd.product_name; upProdParam.product.info.title = dbProd.product_name.IsNullOrEmpty() ? prodInfo.detail.goods_name : dbProd.product_name; upProdParam.sessionInfo.sessionId = upProdInitParam.product.sessionId; - // 设置货号 + #endregion + + #region 设置货号 var extCode = dbProd.ext_code.IsNullOrEmpty() ? prodInfo.detail.out_goods_sn : dbProd.ext_code; if (extCode.IsNullOrEmpty()) { @@ -1300,19 +1335,27 @@ namespace TemuKJD.WXForms.ProductForms extCode = "EC1" + dbProd.spu_id + "A"; } upProdParam.product.info.spuCode = extCode; + #endregion + #region 上传主图 if (cell != null) { Invoke(new Action(() => { - cell.Value = "正在识别商品"; + cell.Value = "正在生成主图并识别商品"; })); } - Thread.Sleep(Randomx.GetId(500, 800)); - - //上传主图 + Thread.Sleep(Randomx.GetId(100, 300)); foreach (var gallery_item in prodInfo.detail.galleries.Where(g => g.type == 1).Take(9)) // 9张主图 { + // 先查主图缓存 + if (wxImgMapDic.ContainsKey(BaseClass.GetMd5(gallery_item.url))) + { + upProdInitParam.product.info.headImg.Add(wxImgMapDic[BaseClass.GetMd5(gallery_item.url)]); + upProdParam.product.info.headImg.Add(wxImgMapDic[BaseClass.GetMd5(gallery_item.url)]); + continue; + } + try { if (chkImgRandomBlock.Checked && (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸" || @@ -1327,7 +1370,17 @@ namespace TemuKJD.WXForms.ProductForms var upDate = UserLogin.GetSignaturex(); upDate += "&token=" + token.accessToken; upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + gallery_item.url.Replace("https://", "http://") + "\"}"); + + var sTime = DateTime.Now; var upDateRst = GetHtml.PostUtf8(urlImg, upDate); + if (cell != null) + { + Invoke(new Action(() => + { + cell.Value = "正在生成主图并识别商品 " + (DateTime.Now - sTime).TotalMilliseconds.ParseToInt(); + })); + } + for (int i = 0; i < 5 && upDateRst.Contains("access_token expired"); i++) { token.mdyTime = DateTime.Now.AddDays(-100); @@ -1339,6 +1392,8 @@ namespace TemuKJD.WXForms.ProductForms { upProdInitParam.product.info.headImg.Add(upImgUrl); upProdParam.product.info.headImg.Add(upImgUrl); + wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl; + isChangeImgDic = true; continue; } else @@ -1353,12 +1408,12 @@ namespace TemuKJD.WXForms.ProductForms var upImgAuthRst = WXUpload.getUploadTempImgAuth(shop); for (int i = 0; i < 10 && upImgAuthRst.Contains("LogicError"); i++) { - Thread.Sleep(Randomx.GetId(3000, 6000)); - upImgAuthRst = WXUpload.getUploadTempImgAuth(shop); Invoke(new Action(() => { cell.Value = "图片提报失败,正在重试。"; })); + Thread.Sleep(Randomx.GetId(3000, 6000)); + upImgAuthRst = WXUpload.getUploadTempImgAuth(shop); } if (!upImgAuthRst.Contains("\"code\":0")) { @@ -1418,59 +1473,13 @@ namespace TemuKJD.WXForms.ProductForms } upProdInitParam.product.info.headImg.Add(location); upProdParam.product.info.headImg.Add(location); + //wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = location; + //isChangeImgDic = true; Thread.Sleep(Randomx.GetId(10, 50)); } + #endregion - //------------------------------------------------------------------------------------------------------------------------------------- - // ai识别类目暂存主图位置 - int imgId = 0; - string tempImgPath = Path.GetTempPath() + "\\"; - string folderLetters = "abcdefghijklmnopqrstuvwxyz1234567890"; - for (int i = 0; i < 8; i++) - { - tempImgPath += folderLetters[Randomx.GetId(folderLetters.Length)]; - } - List tempImgFullPathLst = new List(); - //------------------------------------------------------------------------------------------------------------------------------------- - // 生成ai识别类目所需图片 - foreach (var gallery_item in prodInfo.detail.galleries.Where(g => g.type == 1).Take(3)) // 9张主图 - { - string getImgError; - var image = GetHtml.GetUrlImg(gallery_item.url.Replace("https://", "http://"), out getImgError); - var imageBg = new Bitmap(800, 800); - if (!string.IsNullOrEmpty(getImgError) || image == null) - { - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"初始化主图上传失败\"}"; - } - using (Graphics g = Graphics.FromImage(imageBg)) - { - g.DrawImage(image, new Rectangle(0, 0, imageBg.Width, imageBg.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); - } - - // 取前三张图片保存到系统temp路径,配合商品标题获取商品类目 - if (imgId <= 3) - { - if (!Directory.Exists(tempImgPath)) - Directory.CreateDirectory(tempImgPath); - string imgFullPath = tempImgPath + "\\图片" + imgId + ".jpg"; - tempImgFullPathLst.Add(imgFullPath); - if (imgId == 1) - image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg); - else - { - // 只需要传一张真实图像即可 - int fileSize = Randomx.GetId(1024, 10240); - using (BinaryWriter writer = new BinaryWriter(File.Create(imgFullPath))) - { - for (int i = 0; i < fileSize; i++) - { - writer.Write((byte)Randomx.GetId(256)); // 生成0到255之间的随机字节 - } - } - } - } - } - + #region 识别类目 if (cell != null) { Invoke(new Action(() => @@ -1478,57 +1487,132 @@ namespace TemuKJD.WXForms.ProductForms cell.Value = "正在生成类目属性"; })); } - Thread.Sleep(Randomx.GetId(500, 800)); - //------------------------------------------------------------------------------------------------------------------------------------- - // 根据Ai分类,获取类目信息 - //{"code":0,"predInfo":{"firstCatRes":[{"catId":10000111,"catName":"服饰内衣","level":1},{"catId":10000111,"catName":"服饰内衣","level":1},{"catId":10000111,"catName":"服饰内衣","level":1}],"secondCatRes":[{"catId":10000113,"catName":"女装","level":2},{"catId":10000113,"catName":"女装","level":2},{"catId":10000113,"catName":"女装","level":2}],"thirdCatRes":[{"catId":547705,"catName":"牛仔裤","level":3,"modelVersion":""},{"catId":547704,"catName":"加绒裤","level":3,"modelVersion":"商品标题含'加绒加厚、保暖'等关键词,这表示裤子具备加绒保暖功能。主图展示了加绒内衬,也符合【服饰内衣:女装:裤子:加绒裤】类目特征。"},{"catId":547701,"catName":"休闲裤","level":3,"modelVersion":""}],"singleSecondCatRes":[],"singleFirstCatRes":[],"isSupportedCate":1},"aiCategoryList":[{"id":547705,"paths":[{"id":"10000111","name":"服饰内衣","sonIdList":["10000397","10000115","10000112","10000113","10000114"],"fId":"0","level":1,"leaf":false},{"id":"10000113","name":"女装","sonIdList":["546810","546811","530041","547706","6090","6089","6088","6087","6083","6076","6073","6070","6065","6063","6058","10000672","10000671","10000670","10000669","10000668","10000667","10000666","10000665","10000664","10000663","10000662","10000661","10000660","10000659","10000658","10000657","10000656","10000655"],"fId":"10000111","level":2,"leaf":false},{"id":"10000672","name":"裤子","sonIdList":["547699","547700","547701","547702","547703","547704","547705"],"fId":"10000113","level":3,"leaf":false},{"id":"547705","name":"牛仔裤","fId":"10000672","level":4,"leaf":true,"state":0,"hasTrialCategory":false,"isTrialCategory":false,"isLocalLife":false}],"depositAmount":0,"catAuth":true,"limitSubjectTypes":[]},{"id":547704,"paths":[{"id":"10000111","name":"服饰内衣","sonIdList":["10000397","10000115","10000112","10000113","10000114"],"fId":"0","level":1,"leaf":false},{"id":"10000113","name":"女装","sonIdList":["546810","546811","530041","547706","6090","6089","6088","6087","6083","6076","6073","6070","6065","6063","6058","10000672","10000671","10000670","10000669","10000668","10000667","10000666","10000665","10000664","10000663","10000662","10000661","10000660","10000659","10000658","10000657","10000656","10000655"],"fId":"10000111","level":2,"leaf":false},{"id":"10000672","name":"裤子","sonIdList":["547699","547700","547701","547702","547703","547704","547705"],"fId":"10000113","level":3,"leaf":false},{"id":"547704","name":"加绒裤","fId":"10000672","level":4,"leaf":true,"state":0,"hasTrialCategory":false,"isTrialCategory":false,"isLocalLife":false}],"depositAmount":0,"catAuth":true,"limitSubjectTypes":[]},{"id":547701,"paths":[{"id":"10000111","name":"服饰内衣","sonIdList":["10000397","10000115","10000112","10000113","10000114"],"fId":"0","level":1,"leaf":false},{"id":"10000113","name":"女装","sonIdList":["546810","546811","530041","547706","6090","6089","6088","6087","6083","6076","6073","6070","6065","6063","6058","10000672","10000671","10000670","10000669","10000668","10000667","10000666","10000665","10000664","10000663","10000662","10000661","10000660","10000659","10000658","10000657","10000656","10000655"],"fId":"10000111","level":2,"leaf":false},{"id":"10000672","name":"裤子","sonIdList":["547699","547700","547701","547702","547703","547704","547705"],"fId":"10000113","level":3,"leaf":false},{"id":"547701","name":"休闲裤","fId":"10000672","level":4,"leaf":true,"state":0,"hasTrialCategory":false,"isTrialCategory":false,"isLocalLife":false}],"depositAmount":0,"catAuth":true,"limitSubjectTypes":[]}],"version":"ProductClsRAG","noQualificationCatIds":[547705,547704,547701],"depositCatInfos":[{"catId":547705,"amountToPay":0,"error":false},{"catId":547704,"amountToPay":0,"error":false},{"catId":547701,"amountToPay":0,"error":false}],"visionCallMethod":"ProductClsRAG"} - var productClassifyRst = WXUpload.getProductClassify(shop, upProdInitParam.product.info.title, tempImgFullPathLst); - if (!productClassifyRst.Contains("\"code\":0")) - { - var error = BaseRegex.GetStringJson(ref productClassifyRst, "msg"); - if (string.IsNullOrEmpty(error)) - error = productClassifyRst; - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"获取类目失败 " + error + "\"}"; - } - WXGetProdCateInfo cateInfo = new WXGetProdCateInfo(); List aiCateIdLst = new List(); - try + if (!dbProd.wx_cat_leaf.IsNullOrZero()) { - cateInfo = JsonHelper.DeserializeJsonToObject(productClassifyRst); - foreach (var catePath in cateInfo.aiCategoryList.FirstOrDefault().paths) + // 聚水潭商品已识别类目使用类目缓存 + if (!dbProd.wx_cat_1.IsNullOrZero()) + aiCateIdLst.Add(dbProd.wx_cat_1.ParseToLong()); + if (!dbProd.wx_cat_2.IsNullOrZero()) + aiCateIdLst.Add(dbProd.wx_cat_2.ParseToLong()); + if (!dbProd.wx_cat_3.IsNullOrZero()) + aiCateIdLst.Add(dbProd.wx_cat_3.ParseToLong()); + if (!dbProd.wx_cat_leaf.IsNullOrZero()) + aiCateIdLst.Add(dbProd.wx_cat_leaf.ParseToLong()); + aiCateIdLst = aiCateIdLst.Distinct().ToList(); + } + else + { + //------------------------------------------------------------------------------------------------------------------------------------- + // ai识别类目暂存主图位置 + int imgId = 0; + string tempImgPath = Path.GetTempPath() + "\\"; + string folderLetters = "abcdefghijklmnopqrstuvwxyz1234567890"; + for (int i = 0; i < 8; i++) { - aiCateIdLst.Add(catePath.id.ParseToLong()); + tempImgPath += folderLetters[Randomx.GetId(folderLetters.Length)]; } - string getCateRst = WXUpload.getCategoryOnShelf(shop, aiCateIdLst); - if (!getCateRst.Contains("\"code\":0")) + List tempImgFullPathLst = new List(); + //------------------------------------------------------------------------------------------------------------------------------------- + // 生成ai识别类目所需图片 + foreach (var gallery_item in prodInfo.detail.galleries.Where(g => g.type == 1).Take(3)) // 9张主图 { - var error = BaseRegex.GetStringJson(ref getCateRst, "msg"); + string getImgError; + var image = GetHtml.GetUrlImg(gallery_item.url.Replace("https://", "http://"), out getImgError); + var imageBg = new Bitmap(800, 800); + if (!string.IsNullOrEmpty(getImgError) || image == null) + { + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"初始化主图上传失败\"}"; + } + using (Graphics g = Graphics.FromImage(imageBg)) + { + g.DrawImage(image, new Rectangle(0, 0, imageBg.Width, imageBg.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + } + + // 取前三张图片保存到系统temp路径,配合商品标题获取商品类目 + if (imgId <= 3) + { + if (!Directory.Exists(tempImgPath)) + Directory.CreateDirectory(tempImgPath); + string imgFullPath = tempImgPath + "\\图片" + imgId + ".jpg"; + tempImgFullPathLst.Add(imgFullPath); + if (imgId == 1) + image.Save(imgFullPath, System.Drawing.Imaging.ImageFormat.Jpeg); + else + { + // 只需要传一张真实图像即可 + int fileSize = Randomx.GetId(1024, 10240); + using (BinaryWriter writer = new BinaryWriter(File.Create(imgFullPath))) + { + for (int i = 0; i < fileSize; i++) + { + writer.Write((byte)Randomx.GetId(256)); // 生成0到255之间的随机字节 + } + } + } + } + } + Thread.Sleep(Randomx.GetId(100, 300)); + //------------------------------------------------------------------------------------------------------------------------------------- + // 根据Ai分类,获取类目信息 + //{"code":0,"predInfo":{"firstCatRes":[{"catId":10000111,"catName":"服饰内衣","level":1},{"catId":10000111,"catName":"服饰内衣","level":1},{"catId":10000111,"catName":"服饰内衣","level":1}],"secondCatRes":[{"catId":10000113,"catName":"女装","level":2},{"catId":10000113,"catName":"女装","level":2},{"catId":10000113,"catName":"女装","level":2}],"thirdCatRes":[{"catId":547705,"catName":"牛仔裤","level":3,"modelVersion":""},{"catId":547704,"catName":"加绒裤","level":3,"modelVersion":"商品标题含'加绒加厚、保暖'等关键词,这表示裤子具备加绒保暖功能。主图展示了加绒内衬,也符合【服饰内衣:女装:裤子:加绒裤】类目特征。"},{"catId":547701,"catName":"休闲裤","level":3,"modelVersion":""}],"singleSecondCatRes":[],"singleFirstCatRes":[],"isSupportedCate":1},"aiCategoryList":[{"id":547705,"paths":[{"id":"10000111","name":"服饰内衣","sonIdList":["10000397","10000115","10000112","10000113","10000114"],"fId":"0","level":1,"leaf":false},{"id":"10000113","name":"女装","sonIdList":["546810","546811","530041","547706","6090","6089","6088","6087","6083","6076","6073","6070","6065","6063","6058","10000672","10000671","10000670","10000669","10000668","10000667","10000666","10000665","10000664","10000663","10000662","10000661","10000660","10000659","10000658","10000657","10000656","10000655"],"fId":"10000111","level":2,"leaf":false},{"id":"10000672","name":"裤子","sonIdList":["547699","547700","547701","547702","547703","547704","547705"],"fId":"10000113","level":3,"leaf":false},{"id":"547705","name":"牛仔裤","fId":"10000672","level":4,"leaf":true,"state":0,"hasTrialCategory":false,"isTrialCategory":false,"isLocalLife":false}],"depositAmount":0,"catAuth":true,"limitSubjectTypes":[]},{"id":547704,"paths":[{"id":"10000111","name":"服饰内衣","sonIdList":["10000397","10000115","10000112","10000113","10000114"],"fId":"0","level":1,"leaf":false},{"id":"10000113","name":"女装","sonIdList":["546810","546811","530041","547706","6090","6089","6088","6087","6083","6076","6073","6070","6065","6063","6058","10000672","10000671","10000670","10000669","10000668","10000667","10000666","10000665","10000664","10000663","10000662","10000661","10000660","10000659","10000658","10000657","10000656","10000655"],"fId":"10000111","level":2,"leaf":false},{"id":"10000672","name":"裤子","sonIdList":["547699","547700","547701","547702","547703","547704","547705"],"fId":"10000113","level":3,"leaf":false},{"id":"547704","name":"加绒裤","fId":"10000672","level":4,"leaf":true,"state":0,"hasTrialCategory":false,"isTrialCategory":false,"isLocalLife":false}],"depositAmount":0,"catAuth":true,"limitSubjectTypes":[]},{"id":547701,"paths":[{"id":"10000111","name":"服饰内衣","sonIdList":["10000397","10000115","10000112","10000113","10000114"],"fId":"0","level":1,"leaf":false},{"id":"10000113","name":"女装","sonIdList":["546810","546811","530041","547706","6090","6089","6088","6087","6083","6076","6073","6070","6065","6063","6058","10000672","10000671","10000670","10000669","10000668","10000667","10000666","10000665","10000664","10000663","10000662","10000661","10000660","10000659","10000658","10000657","10000656","10000655"],"fId":"10000111","level":2,"leaf":false},{"id":"10000672","name":"裤子","sonIdList":["547699","547700","547701","547702","547703","547704","547705"],"fId":"10000113","level":3,"leaf":false},{"id":"547701","name":"休闲裤","fId":"10000672","level":4,"leaf":true,"state":0,"hasTrialCategory":false,"isTrialCategory":false,"isLocalLife":false}],"depositAmount":0,"catAuth":true,"limitSubjectTypes":[]}],"version":"ProductClsRAG","noQualificationCatIds":[547705,547704,547701],"depositCatInfos":[{"catId":547705,"amountToPay":0,"error":false},{"catId":547704,"amountToPay":0,"error":false},{"catId":547701,"amountToPay":0,"error":false}],"visionCallMethod":"ProductClsRAG"} + var productClassifyRst = WXUpload.getProductClassify(shop, upProdInitParam.product.info.title, tempImgFullPathLst); + if (!productClassifyRst.Contains("\"code\":0")) + { + var error = BaseRegex.GetStringJson(ref productClassifyRst, "msg"); if (string.IsNullOrEmpty(error)) - error = getCateRst; - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"获取类目模板失败" + error + "\"}"; + error = productClassifyRst; + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"获取类目失败 " + error + "\"}"; } - - JObject jCateRst = JObject.Parse(getCateRst); - upProdParam.product.info.category = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(jCateRst["category"])); - // 这里用了ai获取类目,如下填写 - upProdParam.product.info.recommendCategory = new recommendCategoryParam() + WXGetProdCateInfo cateInfo = new WXGetProdCateInfo(); + try { - isAccepted = true, - categoryNames = new List(), - recommendSource = "ai", - interfaceName = "ProductClsRAG", - useNewInterface = 1, - }; - foreach (var cateParam in upProdParam.product.info.category) + cateInfo = JsonHelper.DeserializeJsonToObject(productClassifyRst); + foreach (var catePath in cateInfo.aiCategoryList.FirstOrDefault().paths) + { + aiCateIdLst.Add(catePath.id.ParseToLong()); + } + } + catch (Exception ex) { - upProdParam.product.info.recommendCategory.categoryNames.Add(cateParam.name); + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"" + "根据图片获取类目失败 " + ex.Message + "\"}"; } } - catch (Exception ex) + #endregion + + #region 生成类目模板 + if (cell != null) { - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"" + "根据图片获取类目失败 " + ex.Message + "\"}"; + Invoke(new Action(() => + { + cell.Value = "正在生成类目模板"; + })); + } + string getCateRst = WXUpload.getCategoryOnShelf(shop, aiCateIdLst); + if (!getCateRst.Contains("\"code\":0")) + { + var error = BaseRegex.GetStringJson(ref getCateRst, "msg"); + if (string.IsNullOrEmpty(error)) + error = getCateRst; + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"获取类目模板失败" + error + "\"}"; } + JObject jCateRst = JObject.Parse(getCateRst); + upProdParam.product.info.category = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(jCateRst["category"])); + // 这里用了ai获取类目,如下填写 + upProdParam.product.info.recommendCategory = new recommendCategoryParam() + { + isAccepted = true, + categoryNames = new List(), + recommendSource = "ai", + interfaceName = "ProductClsRAG", + useNewInterface = 1, + }; + foreach (var cateParam in upProdParam.product.info.category) + { + upProdParam.product.info.recommendCategory.categoryNames.Add(cateParam.name); + } + // 获取叶子类目id long leafCatId = (upProdParam.product.info.category.LastOrDefault()?.catId).ParseToLong(); //哲学经典著作 var bound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id == leafCatId); @@ -1558,34 +1642,165 @@ namespace TemuKJD.WXForms.ProductForms return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请错误 " + error + "\"}"; } } + #endregion - //todo //客服地址https://store.weixin.qq.com/shop/kf - // ai获取短标题 - #region 短标题 - WXGetShortTitleParam titleParam = new WXGetShortTitleParam() + #region 短标题 // ai获取短标题 // 暂时注释 + if (1 == 2) { - categories = new List(), - headImgUrls = upProdParam.product.info.headImg, - productTitle = upProdParam.product.info.title, - }; - foreach (var cate in upProdParam.product.info.category) - { - titleParam.categories.Add(new categorieParam() { catId = cate.catId, catName = cate.name }); + if (cell != null) + { + Invoke(new Action(() => + { + cell.Value = "正在生成短标题"; + })); + } + + WXGetShortTitleParam titleParam = new WXGetShortTitleParam() + { + categories = new List(), + headImgUrls = upProdParam.product.info.headImg, + productTitle = upProdParam.product.info.title, + }; + foreach (var cate in upProdParam.product.info.category) + { + titleParam.categories.Add(new categorieParam() { catId = cate.catId, catName = cate.name }); + } + var shortTitleRst = WXUpload.genProductShortTitle(shop, titleParam); + if (!shortTitleRst.Contains("\"code\":0") && !shortTitleRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref shortTitleRst, "msg"); + if (string.IsNullOrEmpty(error)) + error = shortTitleRst; + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"短标题获取失败 " + error + "\"}"; + } + upProdParam.product.info.shortTitle = BaseRegex.GetStringJson(ref shortTitleRst, "shortTitle"); + upProdParam.product.info.aiGenShortTitle = upProdParam.product.info.shortTitle; } - var shortTitleRst = WXUpload.genProductShortTitle(shop, titleParam); - if (!shortTitleRst.Contains("\"code\":0") && !shortTitleRst.Contains("\"success\":true")) + #endregion + + #region 售后信息 + + if (cell != null) { - var error = BaseRegex.GetStringJson(ref shortTitleRst, "msg"); + Invoke(new Action(() => + { + cell.Value = "正在选取售后属性"; + })); + } + + var afterSaleAddress = ""; + var afterSaleDetail = ""; + if (dbProd.wx_cat_leaf != null) + { + + var urlAfterSale = BaseClass.BuildObjString("product/wx_get_after_sale"); + var dataAfterSale = Work.UserLogin.GetSignaturex() + + "&coid=" + dbProd.skc_id; + var htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) + htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) + { + + } + else + { + if (htmlAfterSale.Contains("\"data\":\"\"")) + { + } + else + { + try + { + afterSaleAddress = JsonHelper.SerializeObject(JsonHelper.JObjectParse(htmlAfterSale)["data"]); + } + catch + { + + } + } + } + + if (string.IsNullOrEmpty(afterSaleAddress)) + { + // 获取推单售后地址 + //https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955 + var urlAfter = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + dbProd.skc_id; //+ "&userName=阿杰账户"; + var afterRst = WXHttpResponseBLL.e57GetResponse(urlAfter, ""); + try + { + afterSaleAddress = JsonHelper.SerializeObject(JsonHelper.JObjectParse(afterRst)["data"]); + if (afterRst.Contains("\"code\":0") && !string.IsNullOrEmpty(afterSaleAddress)) + { + urlAfterSale = BaseClass.BuildObjString("product/wx_add_mdy_after_sale"); + dataAfterSale = Work.UserLogin.GetSignaturex() + + "&coid=" + dbProd.skc_id + + "&after_sale_json=" + afterSaleAddress; + htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) + htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + } + } + catch (Exception ex) + { + } + } + } + + if (!string.IsNullOrEmpty(afterSaleAddress)) + { + afterSaleDetail = BaseRegex.GetStringJson(ref afterSaleAddress, "detail_info"); + } + + var addressRst = WXUpload.getAddress(shop, afterSaleDetail); + if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref addressRst, "msg"); if (string.IsNullOrEmpty(error)) - error = shortTitleRst; - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"短标题获取失败 " + error + "\"}"; + error = addressRst; + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败 " + error + "\"}"; } - upProdParam.product.info.shortTitle = BaseRegex.GetStringJson(ref shortTitleRst, "shortTitle"); - upProdParam.product.info.aiGenShortTitle = upProdParam.product.info.shortTitle; + if (addressRst.Contains("\"totalNum\":0") && !string.IsNullOrEmpty(afterSaleDetail)) + { + string provinceName = BaseRegex.GetStringJson(ref afterSaleAddress, "province_name"); + string cityName = BaseRegex.GetStringJson(ref afterSaleAddress, "city_name"); + string countyName = BaseRegex.GetStringJson(ref afterSaleAddress, "county_name"); + string detailInfo = afterSaleDetail; + string userName = BaseRegex.GetStringJson(ref afterSaleAddress, "user_name"); + string telNumber = BaseRegex.GetStringJson(ref afterSaleAddress, "tel_number"); + var addAddRst = WXUpload.addAddress(shop, provinceName, cityName, countyName, detailInfo, userName, telNumber); + + Thread.Sleep(Randomx.GetId(500, 1000)); + + addressRst = WXUpload.getAddress(shop, afterSaleDetail); + if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref addressRst, "msg"); + if (string.IsNullOrEmpty(error)) + error = addressRst; + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败 " + error + "\"}"; + } + } + + if (addressRst.Contains("\"totalNum\":0")) + { + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败\"}"; + } + + upProdParam.product.info.afterSaleInfo = new afterSaleInfoParam(); + upProdParam.product.info.afterSaleInfo.afterSaleAddressId = BaseRegex.GetStringJson(ref addressRst, "addressId"); #endregion #region 获取推单运费模板,计算运费加价。 + if (cell != null) + { + Invoke(new Action(() => + { + cell.Value = "正在选取运费模板"; + })); + } + var shippingTemplateJson = ""; var shipPrice = 0; @@ -1673,111 +1888,6 @@ namespace TemuKJD.WXForms.ProductForms } #endregion - #region 售后信息 - - var afterSaleAddress = ""; - var afterSaleDetail = ""; - if (dbProd.wx_cat_leaf != null) - { - - var urlAfterSale = BaseClass.BuildObjString("product/wx_get_after_sale"); - var dataAfterSale = Work.UserLogin.GetSignaturex() + - "&coid=" + dbProd.skc_id; - var htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); - if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) - htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); - if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) - { - - } - else - { - if (htmlAfterSale.Contains("\"data\":\"\"")) - { - } - else - { - try - { - afterSaleAddress = JsonHelper.SerializeObject(JsonHelper.JObjectParse(htmlAfterSale)["data"]); - } - catch - { - - } - } - } - - if (string.IsNullOrEmpty(afterSaleAddress)) - { - // 获取推单售后地址 - //https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955 - var urlAfter = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + dbProd.skc_id; //+ "&userName=阿杰账户"; - var afterRst = WXHttpResponseBLL.e57GetResponse(urlAfter, ""); - try - { - afterSaleAddress = JsonHelper.SerializeObject(JsonHelper.JObjectParse(afterRst)["data"]); - if(afterRst.Contains("\"code\":0") && !string.IsNullOrEmpty(afterSaleAddress)) - { - urlAfterSale = BaseClass.BuildObjString("product/wx_add_mdy_after_sale"); - dataAfterSale = Work.UserLogin.GetSignaturex() + - "&coid=" + dbProd.skc_id + - "&after_sale_json=" + afterSaleAddress; - htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); - if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) - htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); - } - } - catch (Exception ex) - { - } - } - } - - if (!string.IsNullOrEmpty (afterSaleAddress)) - { - afterSaleDetail = BaseRegex.GetStringJson(ref afterSaleAddress, "detail_info"); - } - - var addressRst = WXUpload.getAddress(shop, afterSaleDetail); - if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true")) - { - var error = BaseRegex.GetStringJson(ref addressRst, "msg"); - if (string.IsNullOrEmpty(error)) - error = addressRst; - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败 " + error + "\"}"; - } - if (addressRst.Contains("\"totalNum\":0") && !string.IsNullOrEmpty(afterSaleDetail)) - { - string provinceName = BaseRegex.GetStringJson(ref afterSaleAddress, "province_name"); - string cityName = BaseRegex.GetStringJson(ref afterSaleAddress, "city_name"); - string countyName = BaseRegex.GetStringJson(ref afterSaleAddress, "county_name"); - string detailInfo = afterSaleDetail; - string userName = BaseRegex.GetStringJson(ref afterSaleAddress, "user_name"); - string telNumber = BaseRegex.GetStringJson(ref afterSaleAddress, "tel_number"); - var addAddRst = WXUpload.addAddress(shop, provinceName, cityName, countyName, detailInfo, userName, telNumber); - - Thread.Sleep(Randomx.GetId(500, 1500)); - - addressRst = WXUpload.getAddress(shop, afterSaleDetail); - if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true")) - { - var error = BaseRegex.GetStringJson(ref addressRst, "msg"); - if (string.IsNullOrEmpty(error)) - error = addressRst; - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败 " + error + "\"}"; - } - } - - if (addressRst.Contains("\"totalNum\":0")) - { - return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败\"}"; - } - - upProdParam.product.info.afterSaleInfo = new afterSaleInfoParam(); - upProdParam.product.info.afterSaleInfo.afterSaleAddressId = BaseRegex.GetStringJson(ref addressRst, "addressId"); - #endregion - #region 运费模板 var expressRst = WXUpload.getFreightTemplate(shop); if (!expressRst.Contains("\"code\":0") && !expressRst.Contains("\"success\":true")) @@ -1799,7 +1909,7 @@ namespace TemuKJD.WXForms.ProductForms cell.Value = "正在生成商品详情"; })); } - Thread.Sleep(Randomx.GetId(500, 800)); + Thread.Sleep(Randomx.GetId(100, 300)); upProdParam.product.info.detail = new productDetailParam(); // 详情图 var detailGalleries = prodInfo.detail.galleries.Where(g => g.type == 2).ToList(); if (detailGalleries.Count == 0) @@ -1807,6 +1917,12 @@ namespace TemuKJD.WXForms.ProductForms foreach (var gallery_item in detailGalleries) { + if (wxImgMapDic.ContainsKey(BaseClass.GetMd5(gallery_item.url))) + { + upProdParam.product.info.detail.detailImg.Add(wxImgMapDic[BaseClass.GetMd5(gallery_item.url)]); + continue; + } + if (chkImgRandomBlock.Checked && (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸" || dbProd.main_cat_name == "图书" || dbProd.main_cat_name == "书籍/杂志/报纸")) { @@ -1819,7 +1935,17 @@ namespace TemuKJD.WXForms.ProductForms var upDate = UserLogin.GetSignaturex(); upDate += "&token=" + token.accessToken; upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + gallery_item.url.Replace("https://", "http://") + "\"}"); + + var sTime = DateTime.Now; var upDateRst = GetHtml.PostUtf8(urlImg, upDate); + if (cell != null) + { + Invoke(new Action(() => + { + cell.Value = "正在生成商品详情 " + (DateTime.Now - sTime).TotalMilliseconds.ParseToInt(); + })); + } + for (int i = 0; i < 5 && upDateRst.Contains("access_token expired"); i++) { token.mdyTime = DateTime.Now.AddDays(-100); @@ -1830,6 +1956,8 @@ namespace TemuKJD.WXForms.ProductForms if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl)) { upProdParam.product.info.detail.detailImg.Add(upImgUrl); + wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl; + isChangeImgDic = true; continue; } else @@ -1845,6 +1973,8 @@ namespace TemuKJD.WXForms.ProductForms return locationStr; var location = BaseRegex.GetStringJson(ref locationStr, "Location"); upProdParam.product.info.detail.detailImg.Add(location); + //wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = location; + //isChangeImgDic = true; Thread.Sleep(Randomx.GetId(10, 50)); } #endregion @@ -2077,7 +2207,7 @@ namespace TemuKJD.WXForms.ProductForms cell.Value = "正在生成sku"; })); } - Thread.Sleep(1000); + Thread.Sleep(Randomx.GetId(100, 300)); upProdParam.product.info.productSaleAttrs = new List(); if (prodInfo.detail.sku == null) @@ -2104,26 +2234,45 @@ namespace TemuKJD.WXForms.ProductForms var spec = sku.spec[0]; if (!attrParam.items.Any(it => it.value == spec.spec_name)) { + if (wxImgMapDic.ContainsKey(BaseClass.GetMd5(sku.thumb_url))) + { + attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)], }); + continue; + } // 使用接口链接传sku图 - var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image"); - var upDate = UserLogin.GetSignaturex(); - upDate += "&token=" + token.accessToken; - upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + sku.thumb_url.Replace("https://", "http://") + "\"}"); - var upDateRst = GetHtml.PostUtf8(urlImg, upDate); - for (int i = 0; i < 5 && upDateRst.Contains("access_token expired"); i++) { - token.mdyTime = DateTime.Now.AddDays(-100); - token = new WxApiBLL().GetRandomWxToken(); - upDateRst = GetHtml.PostUtf8(urlImg, upDate); - } - var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url"); - if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl)) - { - attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = upImgUrl, }); - continue; // 传图成功跳过模拟上传 - } - else - { + var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image"); + var upDate = UserLogin.GetSignaturex(); + upDate += "&token=" + token.accessToken; + upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + sku.thumb_url.Replace("https://", "http://") + "\"}"); + + var sTime = DateTime.Now; + var upDateRst = GetHtml.PostUtf8(urlImg, upDate); + if (cell != null) + { + Invoke(new Action(() => + { + cell.Value = "正在生成sku " + (DateTime.Now - sTime).TotalMilliseconds.ParseToInt(); + })); + } + + for (int i = 0; i < 5 && upDateRst.Contains("access_token expired"); i++) + { + token.mdyTime = DateTime.Now.AddDays(-100); + token = new WxApiBLL().GetRandomWxToken(); + upDateRst = GetHtml.PostUtf8(urlImg, upDate); + } + var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url"); + if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl)) + { + attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = upImgUrl, }); + wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)] = upImgUrl; + isChangeImgDic = true; + continue; // 传图成功跳过模拟上传 + } + else + { + } } // 上传sku图 @@ -2131,9 +2280,11 @@ namespace TemuKJD.WXForms.ProductForms if (!locationStr.Contains("\"success\":true")) return locationStr; var location = BaseRegex.GetStringJson(ref locationStr, "Location"); + attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = location, }); Thread.Sleep(Randomx.GetId(10, 50)); - attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = location, }); + //wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)] = location; + //isChangeImgDic = true; } } } @@ -2373,6 +2524,25 @@ namespace TemuKJD.WXForms.ProductForms })); } + #region 草稿保存成功,缓存盗链图片 + if (isChangeImgDic) + { + var url = BaseClass.BuildObjString("product/mdy_pdd_product"); + var data = ""; + Invoke(new Action(() => + { + data = UserLogin.GetSignaturex(); + data += "&spu_id=" + dbProd.spu_id; + data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic); + })); + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + } + #endregion + upProdParam.product.productKey.productId = BaseRegex.GetLongJson(ref uploadDraftRst, "productId").ParseToString(); if (chkUpDraft.Checked) { @@ -2404,7 +2574,7 @@ namespace TemuKJD.WXForms.ProductForms } else { - #region 尝试免审接口提交 未成功 + #region 尝试免审接口提交 未成功 作废 var getEditProd = WXUpload.getEditProductV2(shop, upProdParam.product.productKey.productId); //getEditProd = getEditProd.Replace("8388275713", "33333333"); //getEditProd = getEditProd.Replace("33333333", "8387633147"); @@ -2462,6 +2632,7 @@ namespace TemuKJD.WXForms.ProductForms var listingAuditFreeRst = WXUpload.listingAuditFree(shop, productJson, upProdParam.product.productKey.productId, time1, time2); string tempBlobPath = Path.GetTempPath(); + string folderLetters = "abcdefghijklmnopqrstuvwxyz1234567890"; for (int i = 0; i < 8; i++) { tempBlobPath += folderLetters[Randomx.GetId(folderLetters.Length)]; @@ -2500,7 +2671,7 @@ namespace TemuKJD.WXForms.ProductForms string rstParmStr = @"{""name"":""" + initFileName + @""",""uploadId"":""" + uploadPartId + @""",""etagList"":[""" + eTag + @"""],""partSeqList"":[1]}"; var complateRst = WXUpload.completeUploadPart(shop, rstParmStr, upProdParam.product.productKey.productId, time1, time2); - #endregion + #endregion } if (cell != null) @@ -3136,7 +3307,7 @@ namespace TemuKJD.WXForms.ProductForms row.Cells["colSelect"].Value = false; continue; } - if (!row.Cells["colShopNotes"].Value.ParseToString().Contains(txtFilterShopNotes.Text.Trim())) + if (!row.Cells["colShopNotes"].Value.ParseToString().Contains(cmbFilterShopNotes.Text.Trim())) { row.Visible = false; row.Cells["colSelect"].Value = false; @@ -3149,7 +3320,7 @@ namespace TemuKJD.WXForms.ProductForms private void btnEmptyShop_Click(object sender, EventArgs e) { txtFilterShopName.Text = ""; - txtFilterShopNotes.Text = ""; + cmbFilterShopNotes.Text = ""; btnFilterShop_Click(null, null); } } diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs index 99ba3e2..fc30940 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs @@ -38,6 +38,7 @@ this.btnLoginSelect = new TemuKJD.UserControls.ButtonEx(); this.btnCheck = new TemuKJD.UserControls.ButtonEx(); this.panel4 = new System.Windows.Forms.Panel(); + this.btnOpenOrder = new TemuKJD.UserControls.ButtonEx(); this.btnAddShop = new TemuKJD.UserControls.ButtonEx(); this.cmbNotes = new System.Windows.Forms.ComboBox(); this.pnlEmpty = new DevComponents.DotNetBar.PanelEx(); @@ -52,8 +53,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(); @@ -78,6 +77,8 @@ 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(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -198,6 +199,7 @@ // // panel4 // + this.panel4.Controls.Add(this.btnOpenOrder); this.panel4.Controls.Add(this.btnAddShop); this.panel4.Controls.Add(this.cmbNotes); this.panel4.Controls.Add(this.pnlEmpty); @@ -214,6 +216,23 @@ this.panel4.Size = new System.Drawing.Size(1023, 40); this.panel4.TabIndex = 0; // + // btnOpenOrder + // + this.btnOpenOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnOpenOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnOpenOrder.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnOpenOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnOpenOrder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOpenOrder.ForeColor = System.Drawing.Color.White; + this.btnOpenOrder.Location = new System.Drawing.Point(902, 10); + this.btnOpenOrder.Margin = new System.Windows.Forms.Padding(2); + this.btnOpenOrder.Name = "btnOpenOrder"; + this.btnOpenOrder.Size = new System.Drawing.Size(119, 25); + this.btnOpenOrder.TabIndex = 465; + this.btnOpenOrder.Text = "登录订单系统"; + this.btnOpenOrder.UseVisualStyleBackColor = false; + this.btnOpenOrder.Click += new System.EventHandler(this.btnOpenOrder_Click); + // // btnAddShop // this.btnAddShop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -442,31 +461,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, -1); - 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; @@ -665,6 +659,31 @@ 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, -1); + 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; + // // WXShopListForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -748,5 +767,6 @@ private System.Windows.Forms.DataGridViewLinkColumn colCopyCookies; private System.Windows.Forms.DataGridViewLinkColumn colEdit; private System.Windows.Forms.DataGridViewLinkColumn colDelete; + public UserControls.ButtonEx btnOpenOrder; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs index ebdcbd7..c02568f 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs @@ -1028,5 +1028,14 @@ namespace TemuKJD.WXForms.ShopForms this.txtShopId.Text = ""; this.txtShopName.Text = ""; } + + private void btnOpenOrder_Click(object sender, EventArgs e) + { + WXShopLoginForm shopLoginForm = new WXShopLoginForm(new ShopLoginInfo()); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.InitUrl = "https://po.e57.cn/login?redirect=%2Findex"; + shopLoginForm.Show(); + } } } diff --git a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs index 893589b..55fd6e4 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.Designer.cs @@ -34,7 +34,6 @@ this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx(); this.btnDel = new DevComponents.DotNetBar.PanelEx(); - this.btnOpenOrder = new TemuKJD.UserControls.ButtonEx(); this.btnLoginAgain = new TemuKJD.UserControls.ButtonEx(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); @@ -77,7 +76,6 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; - this.splitContainer1.Panel2.Controls.Add(this.btnOpenOrder); this.splitContainer1.Panel2.Controls.Add(this.btnLoginAgain); this.splitContainer1.Panel2.Controls.Add(this.label2); this.splitContainer1.Panel2.Controls.Add(this.label1); @@ -89,7 +87,7 @@ this.splitContainer1.Panel2.Controls.Add(this.btnReload); this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin); this.splitContainer1.Size = new System.Drawing.Size(1438, 736); - this.splitContainer1.SplitterDistance = 674; + this.splitContainer1.SplitterDistance = 671; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -167,23 +165,6 @@ this.btnDel.Text = "删"; this.btnDel.Click += new System.EventHandler(this.btnDel_Click); // - // btnOpenOrder - // - this.btnOpenOrder.Anchor = System.Windows.Forms.AnchorStyles.None; - this.btnOpenOrder.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnOpenOrder.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnOpenOrder.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnOpenOrder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnOpenOrder.ForeColor = System.Drawing.Color.White; - this.btnOpenOrder.Location = new System.Drawing.Point(648, 18); - this.btnOpenOrder.Margin = new System.Windows.Forms.Padding(2); - this.btnOpenOrder.Name = "btnOpenOrder"; - this.btnOpenOrder.Size = new System.Drawing.Size(143, 25); - this.btnOpenOrder.TabIndex = 464; - this.btnOpenOrder.Text = "登录订单系统"; - this.btnOpenOrder.UseVisualStyleBackColor = false; - this.btnOpenOrder.Click += new System.EventHandler(this.btnOpenOrder_Click); - // // btnLoginAgain // this.btnLoginAgain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -427,6 +408,5 @@ private DevComponents.DotNetBar.PanelEx btnDel; private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnPrev; - public UserControls.ButtonEx btnOpenOrder; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs index 51fdd94..ae6ebba 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs @@ -963,15 +963,5 @@ function getElementWithText(sText) { cefWebBrowser.Forward(); } - - private void btnOpenOrder_Click(object sender, EventArgs e) - { - WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); - shopLoginForm.openType = EnumOpenType.manage; - shopLoginForm.WindowState = FormWindowState.Maximized; - shopLoginForm.InitUrl = "https://po.e57.cn/login?redirect=%2Findex"; - shopLoginForm.btnOpenOrder.Visible = false; - shopLoginForm.Show(); - } } }