From 281cf2e338e92b1ad156ad85a6b98cf732b80fc2 Mon Sep 17 00:00:00 2001 From: wule Date: Thu, 24 Jul 2025 15:40:39 +0800 Subject: [PATCH] =?UTF-8?q?1=E9=80=89=E5=93=81=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=8F=8A=E5=BA=93=E5=AD=98=E4=B8=8A=E4=BC=A0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=202=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E4=BF=A1=E6=81=AF=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E7=AC=A6=E5=8F=B7=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/AllBase.csproj | 1 + AllBase/BaseClass.cs | 4 +- AllBase/GetHtml.cs | 70 ++++ AllBase/Model/Result/TemuDBProduct.cs | 4 + .../KJD_WebService/BLL/ProductManage.cs | 95 +++-- .../KJD_WebService/BLL/ProductThirdManage.cs | 62 ++- KJDService/KJD_WebService/BLL/ShopManage.cs | 4 +- .../Model/DBProductResultParam.cs | 1 + .../KJD_WebService/ProductService.asmx.cs | 12 + .../ProductThirdService.asmx.cs | 13 + TEMUKJD/KJD.csproj | 27 +- TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs | 20 +- .../KJDForms/AdminForms/AdminShopLoginForm.cs | 14 +- .../KJDForms/AdminForms/ShopBrowserObject.cs | 7 +- TEMUKJD/KJDForms/BaseForms/BaseMsgForm.cs | 26 +- .../DbProductEditNotesForm.Designer.cs | 12 +- .../DbProductEditNotesForm.cs | 2 +- .../DbProductListForm.Designer.cs | 62 +-- .../ProductSelectForms/DbProductListForm.cs | 40 +- .../ProductSelectForms/DbProductListForm.resx | 3 + .../DbProductSelectListManageForm.Designer.cs | 78 ++-- .../DbProductSelectListManageForm.cs | 77 ++-- .../DbProductSelectListManageForm.resx | 9 + .../ProductSelectEditNotesForm.Designer.cs | 229 +++++++++++ .../ProductSelectEditNotesForm.cs | 79 ++++ .../ProductSelectEditNotesForm.resx | 298 ++++++++++++++ .../ProductSelectSetSubSaForm.Designer.cs | 30 +- .../ProductSelectSetSubSaForm.cs | 46 ++- .../UserSelectDbProductForm.cs | 22 +- ...oductThirdSelectListManageForm.Designer.cs | 376 +++++++++--------- .../ProductThirdSelectListManageForm.cs | 91 +++-- .../ProductThirdSelectListManageForm.resx | 9 + .../UserSelectThirdProductForm.cs | 20 +- TEMUKJD/KJDForms/ShopForms/ShopListForm.cs | 1 + TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs | 10 + TEMUKJD/MainForm.cs | 2 + Update/Update/MainForm.cs | 48 ++- Update/Update/MainForm.designer.cs | 32 +- 38 files changed, 1496 insertions(+), 440 deletions(-) create mode 100644 TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.Designer.cs create mode 100644 TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.cs create mode 100644 TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.resx diff --git a/AllBase/AllBase.csproj b/AllBase/AllBase.csproj index 9131067..43b2fd3 100644 --- a/AllBase/AllBase.csproj +++ b/AllBase/AllBase.csproj @@ -137,6 +137,7 @@ + diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 99e105c..9138456 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,8 +27,8 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 372; - //public static int VersionCount = 372; + public static int VersionCount = 377; + //public static int VersionCount = 377; /// /// 版本号 diff --git a/AllBase/GetHtml.cs b/AllBase/GetHtml.cs index c9fe3db..0cd0e85 100644 --- a/AllBase/GetHtml.cs +++ b/AllBase/GetHtml.cs @@ -13,10 +13,12 @@ using System.Globalization; using System.IO; using System.IO.Compression; using System.Net; +using System.Net.Http; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using System.Threading; +using System.Threading.Tasks; using System.Web; namespace AllBase @@ -43,6 +45,74 @@ namespace AllBase } } + /// + /// 读取网络图片转为Img以在DataGridView中显示,用于HttpWebRequest直接读取可能403的情况 + /// + /// + /// + /// + public static Image GetUrlImg(string imgUrl, out string rst) + { + rst = ""; + //return LoadImage(imgUrl); + Image image = null; + HttpWebResponse response = null; + try + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imgUrl); + + request.KeepAlive = true; + request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); + request.Headers.Add("Upgrade-Insecure-Requests", @"1"); + request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"; + request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + //request.IfModifiedSince = DateTime.Parse("Fri, 18 Jul 2025 06:00:49 GMT"); // 没改动不更新,CS程序无缓存不使用 + + response = (HttpWebResponse)request.GetResponse(); + + using (Stream stream = response.GetResponseStream()) + { + image = Image.FromStream(stream); + } + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.ProtocolError) + { + response = (HttpWebResponse)ex.Response; + rst = GetProxyHtml.ReadResponse(response); + } + if (string.IsNullOrEmpty(rst)) + rst = ex.Message; + } + catch (Exception e) + { + rst = e.Message; + } + if (response != null) + { + response.Close(); + response.Dispose(); + } + return image; + + //try + //{ + // if (!string.IsNullOrEmpty(prodSelect?.main_img)) + // { + // using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) + // { + // image = Image.FromStream(stream); + // } + // } + //} + //catch (Exception ex) + //{ + //} + } + public static Icon LoadIcon(string url) { try diff --git a/AllBase/Model/Result/TemuDBProduct.cs b/AllBase/Model/Result/TemuDBProduct.cs index 99bebdd..1e5114e 100644 --- a/AllBase/Model/Result/TemuDBProduct.cs +++ b/AllBase/Model/Result/TemuDBProduct.cs @@ -24,5 +24,9 @@ namespace AllBase.Model.Result public DateTime add_time { get; set; } public DateTime mdy_time { get; set; } public string notes { get; set; } + /// + /// (某个店铺)上传次数 + /// + public int select_count { get; set; } } } diff --git a/KJDService/KJD_WebService/BLL/ProductManage.cs b/KJDService/KJD_WebService/BLL/ProductManage.cs index 882a2de..606eb8a 100644 --- a/KJDService/KJD_WebService/BLL/ProductManage.cs +++ b/KJDService/KJD_WebService/BLL/ProductManage.cs @@ -81,6 +81,8 @@ namespace KJD_Web.BLL var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'"); var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'"); var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'"); + var get_select_count = RegexUtils.GetStringQuery(ref inputData, "get_select_count")?.Replace("'", "\\'"); + var select_shop_id = RegexUtils.GetStringQuery(ref inputData, "select_shop_id")?.Replace("'", "\\'"); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -89,20 +91,24 @@ namespace KJD_Web.BLL MysqlUtils mySql = new MysqlUtils(conn); string sql = "select count(id) from kjd.product where 1=1"; + + string where = ""; if (!string.IsNullOrWhiteSpace(search_spu)) - sql += " and spu_id like '%" + search_spu + "%'"; + where += " and spu_id like '%" + search_spu + "%'"; if (!string.IsNullOrWhiteSpace(search_skc)) - sql += " and skc_id like '%" + search_skc + "%'"; + where += " and skc_id like '%" + search_skc + "%'"; if (!string.IsNullOrWhiteSpace(search_cat)) - sql += " and cat_name like '%" + search_cat + "%'"; + where += " and cat_name like '%" + search_cat + "%'"; if (!string.IsNullOrWhiteSpace(search_ext_code)) - sql += " and ext_code like '%" + search_ext_code + "%'"; + where += " and ext_code like '%" + search_ext_code + "%'"; if (!string.IsNullOrWhiteSpace(search_prod_name)) - sql += " and product_name like '%" + search_prod_name + "%'"; + where += " and product_name like '%" + search_prod_name + "%'"; if (!string.IsNullOrWhiteSpace(search_notes)) - sql += " and notes like '%" + search_notes + "%'"; + where += " and notes like '%" + search_notes + "%'"; if (!string.IsNullOrEmpty(search_db_ids)) - sql += " and id in (" + search_db_ids + ")"; + where += " and id in (" + search_db_ids + ")"; + sql += where; + var count = mySql.ExecuteRowCount(sql); DataTable dt; @@ -112,26 +118,21 @@ namespace KJD_Web.BLL } else { - if (isDetail) - sql = "select * from kjd.product where 1=1"; + if (isDetail) + sql = "select * from kjd.product p where 1=1"; + else if (string.IsNullOrEmpty(get_select_count)) + sql = "select p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes," + + "p.add_time,p.mdy_time from kjd.product p where 1=1"; else - sql = "select id,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,notes,add_time,mdy_time from kjd.product where 1=1"; + sql = "SELECT p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes," + + "p.add_time,p.mdy_time,COUNT(s.id) AS select_count FROM kjd.product p " + + "LEFT JOIN kjd.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "' WHERE 1=1"; + + //where子句 + sql += where; - if (!string.IsNullOrWhiteSpace(search_spu)) - sql += " and spu_id like '%" + search_spu + "%'"; - if (!string.IsNullOrWhiteSpace(search_skc)) - sql += " and skc_id like '%" + search_skc + "%'"; - if (!string.IsNullOrWhiteSpace(search_cat)) - sql += " and cat_name like '%" + search_cat + "%'"; - if (!string.IsNullOrWhiteSpace(search_ext_code)) - sql += " and ext_code like '%" + search_ext_code + "%'"; - if (!string.IsNullOrWhiteSpace(search_prod_name)) - sql += " and product_name like '%" + search_prod_name + "%'"; - if (!string.IsNullOrWhiteSpace(search_notes)) - sql += " and notes like '%" + search_notes + "%'"; - if (!string.IsNullOrEmpty(search_db_ids)) - sql += " and id in (" + search_db_ids + ")"; - sql += " order by id desc"; + sql += " group by p.id"; + sql += " order by p.id desc"; sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size; dt = mySql.ExecuteDataTable(sql); } @@ -165,6 +166,10 @@ namespace KJD_Web.BLL prod.product_json = row["product_json"].ToString(); prod.size_json = row["size_json"].ToString(); } + if (!string.IsNullOrEmpty(get_select_count)) + { + prod.select_count = row["select_count"].ParseToInt(); + } productLst.Add(prod); } var data = JsonUtils.SerializerObjectToString(productLst); @@ -587,5 +592,45 @@ namespace KJD_Web.BLL } return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + + public string MdyProductSelectNotes(string inputData, bool isAdmin = false) + { + if (!string.IsNullOrEmpty(inputData)) + { + var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt(); + string time1 = RegexUtils.GetStringQuery(ref inputData, "code"); + if (time1 != EncrypUtil.Encryption(time)) + return "{\"code\":50000,\"msg\":\"校验失败\"}"; + + var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'"); + var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'"); + string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'"); + + if (string.IsNullOrEmpty(user_name)) + { + return "{\"code\":500,\"msg\":\"没有用户名\"}"; + } + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + string sql = "update kjd.product_select set"; + if (notes != null) + sql += " notes='" + notes + "',"; + sql = sql.TrimEnd(','); + sql += " where id=" + id + ";"; + + var rst = mySql.ExecuteNonQuery(sql); + mySql.Close(); + if (rst) + { + return "{\"code\":200,\"msg\":\"success\"}"; + } + else + { + return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/BLL/ProductThirdManage.cs b/KJDService/KJD_WebService/BLL/ProductThirdManage.cs index 9dfd4d5..2230814 100644 --- a/KJDService/KJD_WebService/BLL/ProductThirdManage.cs +++ b/KJDService/KJD_WebService/BLL/ProductThirdManage.cs @@ -1,6 +1,7 @@ using KJD_Web.Model; using KJD_Web.Utils; using MySql.Data.MySqlClient; +using MySqlX.XDevAPI.Common; using NaiBa.Util.Extension; using System; using System.Collections.Generic; @@ -43,14 +44,21 @@ namespace KJD_Web.BLL string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); string sql = ""; + var json_sign = RegexUtils.GetStringJson(ref product_json, "signedImageUrl"); // 取商品json数据里不同签名的部分 + var product_md5 = EncrypUtil.GetMd5(product_json.Replace(json_sign, "") + size_json); + sql = "select id from kjd.third_product where product_md5='" + product_md5 + "'"; + var rst = mySql.ExecuteFirstInt(sql).ParseToLong(); + if (rst <= 0) + { - sql = "insert into kjd.third_product (spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,add_time,mdy_time) " + - "values ('" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" + - ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" + - DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + - DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');"; - var rst = mySql.ExecuteInsertId(sql); - mySql.Close(); + sql = "insert into kjd.third_product (spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,product_md5,add_time,mdy_time) " + + "values ('" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" + + ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" + product_md5 + "','" + + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');"; + rst = mySql.ExecuteInsertId(sql); + mySql.Close(); + } if (rst > 0) { return "{\"code\":200,\"msg\":\"success\",\"id\":" + rst + "}"; @@ -587,5 +595,45 @@ namespace KJD_Web.BLL } return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + + public string MdyProductSelectNotes(string inputData, bool isAdmin = false) + { + if (!string.IsNullOrEmpty(inputData)) + { + var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt(); + string time1 = RegexUtils.GetStringQuery(ref inputData, "code"); + if (time1 != EncrypUtil.Encryption(time)) + return "{\"code\":50000,\"msg\":\"校验失败\"}"; + + var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'"); + var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'"); + string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'"); + + if (string.IsNullOrEmpty(user_name)) + { + return "{\"code\":500,\"msg\":\"没有用户名\"}"; + } + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + string sql = "update kjd.third_product_select set"; + if (notes != null) + sql += " notes='" + notes + "',"; + sql = sql.TrimEnd(','); + sql += " where id=" + id + ";"; + + var rst = mySql.ExecuteNonQuery(sql); + mySql.Close(); + if (rst) + { + return "{\"code\":200,\"msg\":\"success\"}"; + } + else + { + return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/BLL/ShopManage.cs b/KJDService/KJD_WebService/BLL/ShopManage.cs index c484c00..5e42b9f 100644 --- a/KJDService/KJD_WebService/BLL/ShopManage.cs +++ b/KJDService/KJD_WebService/BLL/ShopManage.cs @@ -106,10 +106,10 @@ namespace KJD_Web.BLL shopList.Add(shop); } int month = DateTime.Now.Month; - var shopMonthList = shopList.Where(s => s.add_product_month != DateTime.Now.Month); + var shopMonthList = shopList.Where(s => s.add_product_month != month); if (shopMonthList.Count() > 0) { - int remainCount = 40; + int remainCount = 100; var shopMonthIdList = shopMonthList.Select(s => s.id); mySql = new MysqlUtils(conn); string ids = string.Join(",", shopMonthIdList); diff --git a/KJDService/KJD_WebService/Model/DBProductResultParam.cs b/KJDService/KJD_WebService/Model/DBProductResultParam.cs index 1c30064..324eedf 100644 --- a/KJDService/KJD_WebService/Model/DBProductResultParam.cs +++ b/KJDService/KJD_WebService/Model/DBProductResultParam.cs @@ -23,5 +23,6 @@ namespace KJD_Web.Model public DateTime add_time { get; set; } public DateTime mdy_time { get; set; } public string notes { get; set; } + public int select_count { get; set; } = 0; } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/ProductService.asmx.cs b/KJDService/KJD_WebService/ProductService.asmx.cs index cc69a03..ec66ebb 100644 --- a/KJDService/KJD_WebService/ProductService.asmx.cs +++ b/KJDService/KJD_WebService/ProductService.asmx.cs @@ -193,5 +193,17 @@ namespace KJD_Web Context.Response.Write(result); Context.Response.End(); } + + [WebMethod] + public void mdy_product_select_notes() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new ProductManage().MdyProductSelectNotes(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } } } diff --git a/KJDService/KJD_WebService/ProductThirdService.asmx.cs b/KJDService/KJD_WebService/ProductThirdService.asmx.cs index b770888..36f5966 100644 --- a/KJDService/KJD_WebService/ProductThirdService.asmx.cs +++ b/KJDService/KJD_WebService/ProductThirdService.asmx.cs @@ -193,5 +193,18 @@ namespace KJD_Web Context.Response.Write(result); Context.Response.End(); } + + + [WebMethod] + public void mdy_product_select_notes() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new ProductThirdManage().MdyProductSelectNotes(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } } } diff --git a/TEMUKJD/KJD.csproj b/TEMUKJD/KJD.csproj index cd5a721..df7cc45 100644 --- a/TEMUKJD/KJD.csproj +++ b/TEMUKJD/KJD.csproj @@ -307,18 +307,24 @@ PriceManageForm.cs - - Form - - - DbProductListForm.cs - Form DbProductEditNotesForm.cs + + Form + + + ProductSelectEditNotesForm.cs + + + Form + + + DbProductListForm.cs + Form @@ -954,12 +960,15 @@ PriceManageForm.cs - - DbProductListForm.cs - DbProductEditNotesForm.cs + + ProductSelectEditNotesForm.cs + + + DbProductListForm.cs + DbProductSelectListManageForm.cs diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs index 996cd37..e44f3c0 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopForm.cs @@ -206,12 +206,26 @@ namespace TemuKJD.KJDForms.AdminForms IsOperate = false; break; case "复制Cookies": - string cook = shop.Cookies; string cookJs = ""; - foreach (var cookie in shop.Cookies.Split(';')) + foreach (var shopCook in shop.Cookies.Split(';')) { - cookJs += "\r\ndocument.cookie='" + cookie.Trim() + "';"; + var cookie = shopCook.Trim(); + if (cookie.StartsWith("mc-pc-cookie-captcha-token=")) + continue; + //if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp")) + cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';"; } + foreach (var shopCook in shop.Cookies.Split(';')) + { + var cookie = shopCook.Trim(); + if (cookie.StartsWith("mc-pc-cookie-captcha-token=")) + continue; + if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp")) + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.kuajingmaihuo.com;';"; + else + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=seller.kuajingmaihuo.com;';"; + } + cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');"; cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)"; Clipboard.SetDataObject(cookJs); BaseMsgForm.ShowInfo("复制成功"); diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs index bde1002..64690ca 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs @@ -297,12 +297,16 @@ namespace TemuKJD.KJDForms.AdminForms //cefWebBrowser.Load(shopMainUrl); })); - - var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n"; - while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid) - Thread.Sleep(20); - cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode); + //根据登录的具体店铺设置local storage + if (!string.IsNullOrEmpty(shop.ShopId)) + { + var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n"; + while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid) + Thread.Sleep(20); + cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode); + } + //不是登录的话就此返回 if (openType != EnumOpenType.login) { Invoke(new Action(() => diff --git a/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs b/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs index 9f7bc3f..62d52d3 100644 --- a/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs +++ b/TEMUKJD/KJDForms/AdminForms/ShopBrowserObject.cs @@ -44,6 +44,11 @@ namespace TemuKJD.KJDForms.AdminForms var prodId1 = prodId; string success_err_msg = ""; var html = ProductQuery(shop1, prodId1.ToString()); + + var testHtml1 = GetHtml.UrlEncodeUtf8(html); + var testHtml2 = GetHtml.UrlDecode(testHtml1); + testHtml1 = HttpUtility.UrlEncode(html, Encoding.UTF8); + testHtml2 = HttpUtility.UrlDecode(testHtml1); if (!html.Contains("\"success\":true") || !html.Contains("\"result\"")) { OnInfoReceived("商品获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg")); @@ -88,7 +93,7 @@ namespace TemuKJD.KJDForms.AdminForms if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { string msg = "选品商品保存失败!请检查网络连接:" + - BaseRegex.GetStringJson(ref html, "msg").Replace("'", "\\'").Replace("\"","\\\""); + BaseRegex.GetStringJson(ref html, "msg"); OnInfoReceived(msg); } else diff --git a/TEMUKJD/KJDForms/BaseForms/BaseMsgForm.cs b/TEMUKJD/KJDForms/BaseForms/BaseMsgForm.cs index d649b4a..680f5e4 100644 --- a/TEMUKJD/KJDForms/BaseForms/BaseMsgForm.cs +++ b/TEMUKJD/KJDForms/BaseForms/BaseMsgForm.cs @@ -26,7 +26,15 @@ namespace TemuKJD.KJDForms.BaseForms string title = string.IsNullOrEmpty(caption) ? "系统提示" : caption; BaseMsgForm msgBox = CreateMsgForm(msg, fl, title); msgBox.picTip.Image = global::TemuKJD.Properties.Resources.BaseMsgInfo; - msgBox.ShowDialog(); + + if (MainForm.instance != null && MainForm.instance.InvokeRequired) + MainForm.instance.Invoke(new Action(() => + { + msgBox.ShowDialog(); + })); + else + msgBox.ShowDialog(); + return msgBox; } @@ -48,7 +56,13 @@ namespace TemuKJD.KJDForms.BaseForms string title = string.IsNullOrEmpty(caption) ? "系统错误" : caption; BaseMsgForm msgBox = CreateMsgForm(msg, fl, title); msgBox.picTip.Image = global::TemuKJD.Properties.Resources.BaseMsgErr; - msgBox.ShowDialog(); + if (MainForm.instance != null && MainForm.instance.InvokeRequired) + MainForm.instance.Invoke(new Action(() => + { + msgBox.ShowDialog(); + })); + else + msgBox.ShowDialog(); return msgBox; } @@ -67,7 +81,13 @@ namespace TemuKJD.KJDForms.BaseForms { msgBox.Width = (int)FormLevel.LARGE; } - msgBox.ShowDialog(); + if (MainForm.instance != null && MainForm.instance.InvokeRequired) + MainForm.instance.Invoke(new Action(() => + { + msgBox.ShowDialog(); + })); + else + msgBox.ShowDialog(); return msgBox; } diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.Designer.cs index d3aed7f..b3e4057 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.Designer.cs @@ -93,7 +93,7 @@ // pictureBox1 // this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.pictureBox1.Location = new System.Drawing.Point(113, 22); + this.pictureBox1.Location = new System.Drawing.Point(116, 22); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(136, 136); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -103,7 +103,7 @@ // lblSkcId // this.lblSkcId.AutoSize = true; - this.lblSkcId.Location = new System.Drawing.Point(87, 237); + this.lblSkcId.Location = new System.Drawing.Point(87, 205); this.lblSkcId.Name = "lblSkcId"; this.lblSkcId.Size = new System.Drawing.Size(56, 17); this.lblSkcId.TabIndex = 388; @@ -112,7 +112,7 @@ // lblSPUId // this.lblSPUId.AutoSize = true; - this.lblSPUId.Location = new System.Drawing.Point(87, 206); + this.lblSPUId.Location = new System.Drawing.Point(87, 174); this.lblSPUId.Name = "lblSPUId"; this.lblSPUId.Size = new System.Drawing.Size(56, 17); this.lblSPUId.TabIndex = 387; @@ -150,7 +150,7 @@ // // lblProductTitle // - this.lblProductTitle.Location = new System.Drawing.Point(87, 175); + this.lblProductTitle.Location = new System.Drawing.Point(87, 236); this.lblProductTitle.Name = "lblProductTitle"; this.lblProductTitle.Size = new System.Drawing.Size(242, 17); this.lblProductTitle.TabIndex = 0; @@ -180,8 +180,8 @@ this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "DbProductEditNotesForm"; - this.Text = "选品备注"; - this.TitleText = "选品备注"; + this.Text = "编辑商品备注"; + this.TitleText = "编辑商品备注"; this.Load += new System.EventHandler(this.ProductSelectListForm_Load); this.Controls.SetChildIndex(this.panel2, 0); this.panel2.ResumeLayout(false); diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.cs index 13a6466..b5b01d5 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductEditNotesForm.cs @@ -50,7 +50,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { - BaseMsgForm.ShowError("商品备注编辑失败,请重试!" + BaseRegex.GetStringJson(ref html, "ref")); + BaseMsgForm.ShowError("商品备注编辑失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); } else { diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.Designer.cs index 4f1ebed..c9214e2 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.Designer.cs @@ -51,6 +51,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvDbProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.col_db_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_product_name = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -59,12 +61,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.col_skc_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_cat_name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.con_ext_code = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colAddTimes = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_notes = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_edit = new System.Windows.Forms.DataGridViewLinkColumn(); this.col_delete = new System.Windows.Forms.DataGridViewLinkColumn(); this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn(); - this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -325,6 +326,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.col_skc_id, this.col_cat_name, this.con_ext_code, + this.colAddTimes, this.col_notes, this.col_edit, this.col_delete, @@ -338,6 +340,29 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.dgvDbProduct.TabIndex = 6; this.dgvDbProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellContentClick); // + // ucSplitPage1 + // + this.ucSplitPage1.CurrentPage = 1; + this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; + this.ucSplitPage1.Location = new System.Drawing.Point(916, 0); + this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); + this.ucSplitPage1.Name = "ucSplitPage1"; + this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); + this.ucSplitPage1.Size = new System.Drawing.Size(362, 25); + this.ucSplitPage1.TabIndex = 6; + this.ucSplitPage1.TotalPage = 1; + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(1278, 25); + this.statusBar.TabIndex = 5; + // // colSelect // this.colSelect.FillWeight = 26F; @@ -395,6 +420,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.con_ext_code.Name = "con_ext_code"; this.con_ext_code.ReadOnly = true; // + // colAddTimes + // + this.colAddTimes.FillWeight = 52F; + this.colAddTimes.HeaderText = "认领次数"; + this.colAddTimes.Name = "colAddTimes"; + this.colAddTimes.ReadOnly = true; + // // col_notes // this.col_notes.HeaderText = "备注"; @@ -403,7 +435,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms // // col_edit // - this.col_edit.FillWeight = 40F; + this.col_edit.FillWeight = 52F; this.col_edit.HeaderText = "编辑备注"; this.col_edit.Name = "col_edit"; this.col_edit.ReadOnly = true; @@ -426,29 +458,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.col_select_product.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.col_select_product.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; // - // ucSplitPage1 - // - this.ucSplitPage1.CurrentPage = 1; - this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; - this.ucSplitPage1.Location = new System.Drawing.Point(916, 0); - this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); - this.ucSplitPage1.Name = "ucSplitPage1"; - this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.ucSplitPage1.Size = new System.Drawing.Size(362, 25); - this.ucSplitPage1.TabIndex = 6; - this.ucSplitPage1.TotalPage = 1; - // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, 0); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(1278, 25); - this.statusBar.TabIndex = 5; - // // DbProductListForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -508,6 +517,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms private System.Windows.Forms.DataGridViewTextBoxColumn col_skc_id; private System.Windows.Forms.DataGridViewTextBoxColumn col_cat_name; private System.Windows.Forms.DataGridViewTextBoxColumn con_ext_code; + private System.Windows.Forms.DataGridViewTextBoxColumn colAddTimes; private System.Windows.Forms.DataGridViewTextBoxColumn col_notes; private System.Windows.Forms.DataGridViewLinkColumn col_edit; private System.Windows.Forms.DataGridViewLinkColumn col_delete; diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs index 8910529..788572d 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.cs @@ -38,7 +38,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms private void ProductListForm_Load(object sender, EventArgs e) { - if (BaseClass.SaLevel == 1 && shop == null) // 管理员且不是选品状态 + if (BaseClass.SaLevel == 1 && shop == null) // 一级管理员且不是选品状态 { this.dgvDbProduct.Columns["col_delete"].Visible = true; this.dgvDbProduct.Columns["col_edit"].Visible = true; @@ -57,10 +57,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms btnSelect.Visible = false; this.dgvDbProduct.Columns["col_select_product"].Visible = false; + this.dgvDbProduct.Columns["colAddTimes"].Visible = false; if (shop != null) { btnSelect.Visible = true; this.dgvDbProduct.Columns["col_select_product"].Visible = true; + this.dgvDbProduct.Columns["colAddTimes"].Visible = true; } this.ucSplitPage1.PageChange += UcSplitPage1_PageChange; @@ -102,16 +104,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms foreach (var prod in lstTemuDbProduct) { Image image = null; - try - { - using (Stream stream = WebRequest.Create(prod.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) - { - image = Image.FromStream(stream); - } - } - catch (Exception ex) - { - } + string imgUrl = prod?.main_img?.Replace("https", "http"); + string rst = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out rst); + if (!string.IsNullOrEmpty(rst)) + BaseMsgForm.ShowError(rst); + Invoke(new Action(() => { int rowIndex = this.dgvDbProduct.Rows.Add( @@ -123,6 +122,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms prod.skc_id, prod.cat_name, prod.ext_code, + prod.select_count, prod.notes, "编辑", "删除", @@ -145,6 +145,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms pageCount = 1; var url = BaseClass.BuildObjString("product/get_product_list"); + if(shop!=null && shop.DbId.ParseToInt()!=0 ) + url = BaseClass.BuildObjString("product/get_product_list"); var data = ""; Invoke(new Action(() => @@ -158,6 +160,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms "&search_cat=" + txtCat.Text.Trim() + "&search_ext_code=" + txtExtCode.Text.Trim() + "&search_prod_name=" + txtProdName.Text.Trim(); + if (shop != null && !string.IsNullOrEmpty(shop.ShopId)) + { + data += "&get_select_count=true"; + data += "&select_shop_id=" + shop.ShopId; + } + })); var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -166,7 +174,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { - BaseMsgForm.ShowError("获取商品列表失败,请重试!" + BaseRegex.GetStringJson(ref html, "ref")); + BaseMsgForm.ShowError("获取商品列表失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); return list; } @@ -310,6 +318,14 @@ namespace TemuKJD.KJDForms.ProductSelectForms } else { + + prod.select_count++; + Invoke(new Action(() => + { + var row = this.dgvDbProduct.Rows.Cast().FirstOrDefault(r => r.Cells["col_db_id"].Value.ParseToInt() == prod.id); + if (row != null) + row.Cells["colAddTimes"].Value = prod.select_count; + })); shop.AddProductRemaining = shop.AddProductRemaining - 1; } } diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.resx b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.resx index 2e8c56c..2657229 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.resx +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductListForm.resx @@ -141,6 +141,9 @@ True + + True + True diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs index 556d012..7835623 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.Designer.cs @@ -66,6 +66,7 @@ this.colInShop = new System.Windows.Forms.DataGridViewLinkColumn(); this.colLogin = new System.Windows.Forms.DataGridViewLinkColumn(); this.colImportCookies = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colCopyCookies = new System.Windows.Forms.DataGridViewLinkColumn(); this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colSkcId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn(); @@ -73,9 +74,11 @@ this.colProductCat = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colDraftId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colDraftId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colMdyTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubSa = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colEditNotes = new System.Windows.Forms.DataGridViewLinkColumn(); this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn(); this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -406,6 +409,7 @@ this.colInShop, this.colLogin, this.colImportCookies, + this.colCopyCookies, this.colSpuId, this.colSkcId, this.colProductSkcPic, @@ -416,6 +420,8 @@ this.colDraftId, this.colMdyTime, this.colSubSa, + this.colNotes, + this.colEditNotes, this.ColDelete, this.colOpResult}); this.dgvSelectProduct.Dock = System.Windows.Forms.DockStyle.Fill; @@ -425,7 +431,7 @@ this.dgvSelectProduct.RowHeadersWidth = 51; this.dgvSelectProduct.RowTemplate.Height = 23; this.dgvSelectProduct.Size = new System.Drawing.Size(1430, 552); - this.dgvSelectProduct.TabIndex = 188; + this.dgvSelectProduct.TabIndex = 189; this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick); // // ucSplitPage1 @@ -454,7 +460,6 @@ // colSelect // this.colSelect.HeaderText = "选择"; - this.colSelect.MinimumWidth = 6; this.colSelect.Name = "colSelect"; this.colSelect.ReadOnly = true; this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; @@ -464,7 +469,6 @@ // colSelectId // this.colSelectId.HeaderText = "认领Id"; - this.colSelectId.MinimumWidth = 6; this.colSelectId.Name = "colSelectId"; this.colSelectId.ReadOnly = true; this.colSelectId.Visible = false; @@ -473,15 +477,13 @@ // colSupplierId // this.colSupplierId.HeaderText = "店铺Id"; - this.colSupplierId.MinimumWidth = 6; this.colSupplierId.Name = "colSupplierId"; this.colSupplierId.ReadOnly = true; - this.colSupplierId.Width = 125; + this.colSupplierId.Width = 120; // // colSupplierName // this.colSupplierName.HeaderText = "店铺名称"; - this.colSupplierName.MinimumWidth = 6; this.colSupplierName.Name = "colSupplierName"; this.colSupplierName.ReadOnly = true; this.colSupplierName.Width = 110; @@ -489,18 +491,16 @@ // colInShop // this.colInShop.HeaderText = "进店"; - this.colInShop.MinimumWidth = 6; this.colInShop.Name = "colInShop"; this.colInShop.ReadOnly = true; - this.colInShop.Width = 45; + this.colInShop.Width = 38; // // colLogin // this.colLogin.HeaderText = "登录"; - this.colLogin.MinimumWidth = 6; this.colLogin.Name = "colLogin"; this.colLogin.ReadOnly = true; - this.colLogin.Width = 45; + this.colLogin.Width = 38; // // colImportCookies // @@ -511,32 +511,38 @@ this.colImportCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.colImportCookies.Width = 85; // + // colCopyCookies + // + this.colCopyCookies.HeaderText = "复制Cookies"; + this.colCopyCookies.Name = "colCopyCookies"; + this.colCopyCookies.ReadOnly = true; + this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCopyCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCopyCookies.Width = 85; + // // colSpuId // this.colSpuId.HeaderText = "商品SPU"; - this.colSpuId.MinimumWidth = 6; this.colSpuId.Name = "colSpuId"; this.colSpuId.ReadOnly = true; this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSpuId.Width = 90; + this.colSpuId.Width = 86; // // colSkcId // this.colSkcId.FillWeight = 150F; this.colSkcId.HeaderText = "商品SKC"; - this.colSkcId.MinimumWidth = 6; this.colSkcId.Name = "colSkcId"; this.colSkcId.ReadOnly = true; this.colSkcId.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colSkcId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSkcId.Width = 80; + this.colSkcId.Width = 90; // // colProductSkcPic // this.colProductSkcPic.HeaderText = "Skc图片"; this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.colProductSkcPic.MinimumWidth = 6; this.colProductSkcPic.Name = "colProductSkcPic"; this.colProductSkcPic.ReadOnly = true; this.colProductSkcPic.Width = 60; @@ -544,15 +550,13 @@ // colProductName // this.colProductName.HeaderText = "商品标题"; - this.colProductName.MinimumWidth = 6; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; - this.colProductName.Width = 260; + this.colProductName.Width = 200; // // colProductCat // this.colProductCat.HeaderText = "商品类目"; - this.colProductCat.MinimumWidth = 6; this.colProductCat.Name = "colProductCat"; this.colProductCat.ReadOnly = true; this.colProductCat.Width = 90; @@ -560,7 +564,6 @@ // colExtCode // this.colExtCode.HeaderText = "商品货号"; - this.colExtCode.MinimumWidth = 6; this.colExtCode.Name = "colExtCode"; this.colExtCode.ReadOnly = true; this.colExtCode.Width = 125; @@ -568,28 +571,25 @@ // colStatus // this.colStatus.HeaderText = "状态"; - this.colStatus.MinimumWidth = 6; this.colStatus.Name = "colStatus"; this.colStatus.ReadOnly = true; - this.colStatus.Width = 80; + this.colStatus.Width = 45; // // colDraftId // this.colDraftId.HeaderText = "草稿箱Id"; - this.colDraftId.MinimumWidth = 6; this.colDraftId.Name = "colDraftId"; this.colDraftId.ReadOnly = true; this.colDraftId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colDraftId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.colDraftId.Width = 125; + this.colDraftId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colDraftId.Width = 88; // // colMdyTime // this.colMdyTime.HeaderText = "上传时间"; - this.colMdyTime.MinimumWidth = 6; this.colMdyTime.Name = "colMdyTime"; this.colMdyTime.ReadOnly = true; - this.colMdyTime.Width = 120; + this.colMdyTime.Width = 95; // // colSubSa // @@ -597,10 +597,24 @@ this.colSubSa.Name = "colSubSa"; this.colSubSa.ReadOnly = true; // + // colNotes + // + this.colNotes.HeaderText = "备注"; + this.colNotes.Name = "colNotes"; + this.colNotes.ReadOnly = true; + // + // colEditNotes + // + this.colEditNotes.HeaderText = "编辑备注"; + this.colEditNotes.Name = "colEditNotes"; + this.colEditNotes.ReadOnly = true; + this.colEditNotes.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colEditNotes.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colEditNotes.Width = 70; + // // ColDelete // this.ColDelete.HeaderText = "删除"; - this.ColDelete.MinimumWidth = 6; this.ColDelete.Name = "ColDelete"; this.ColDelete.ReadOnly = true; this.ColDelete.Visible = false; @@ -609,7 +623,6 @@ // colOpResult // this.colOpResult.HeaderText = "操作结果"; - this.colOpResult.MinimumWidth = 6; this.colOpResult.Name = "colOpResult"; this.colOpResult.ReadOnly = true; this.colOpResult.Width = 150; @@ -666,11 +679,11 @@ private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox txtShopId; private System.Windows.Forms.Label label6; - private UserComponent.DataGridViewEx dgvSelectProduct; private System.Windows.Forms.ComboBox cmbStatus; private System.Windows.Forms.Label label8; private UserControls.ButtonEx btnSetSubSa; private UserComponent.UcCheckBox chkNoSubSa; + private UserComponent.DataGridViewEx dgvSelectProduct; private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; @@ -678,6 +691,7 @@ private System.Windows.Forms.DataGridViewLinkColumn colInShop; private System.Windows.Forms.DataGridViewLinkColumn colLogin; private System.Windows.Forms.DataGridViewLinkColumn colImportCookies; + private System.Windows.Forms.DataGridViewLinkColumn colCopyCookies; private System.Windows.Forms.DataGridViewLinkColumn colSpuId; private System.Windows.Forms.DataGridViewLinkColumn colSkcId; private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; @@ -685,9 +699,11 @@ private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat; private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode; private System.Windows.Forms.DataGridViewTextBoxColumn colStatus; - private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId; + private System.Windows.Forms.DataGridViewLinkColumn colDraftId; private System.Windows.Forms.DataGridViewTextBoxColumn colMdyTime; private System.Windows.Forms.DataGridViewTextBoxColumn colSubSa; + private System.Windows.Forms.DataGridViewTextBoxColumn colNotes; + private System.Windows.Forms.DataGridViewLinkColumn colEditNotes; private System.Windows.Forms.DataGridViewLinkColumn ColDelete; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; } diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs index 796b51a..8ca9541 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.cs @@ -72,6 +72,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms public void SearchDbProdSelect(int page) { + shopLst.Clear(); + if (InvokeRequired) { Invoke(new Action(() => @@ -97,19 +99,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms foreach (var prodSelect in lstAdminTemuDBProductSelect) { Image image = null; - try - { - if (!string.IsNullOrEmpty(prodSelect?.main_img)) - { - using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) - { - image = Image.FromStream(stream); - } - } - } - catch (Exception ex) - { - } + string imgUrl = prodSelect?.main_img?.Replace("https", "http"); + string rst = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out rst); + if (!string.IsNullOrEmpty(rst)) + BaseMsgForm.ShowError(rst); + Invoke(new Action(() => { int rowIndex = this.dgvSelectProduct.Rows.Add( @@ -120,6 +116,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms "进店", "登录", "导入Cookies", + "复制Cookies", prodSelect.spu_id, prodSelect.skc_id, image,//prod.main_img, @@ -128,8 +125,10 @@ namespace TemuKJD.KJDForms.ProductSelectForms prodSelect.ext_code, prodSelect.status, prodSelect.draft_id, - prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yyyy/MM/dd HH:mm:ss"), + prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yy/MM/dd HH:mm"), prodSelect.operate_sub_sa_name == "" ? "-" : prodSelect.operate_sub_sa_name, + prodSelect.notes, + "编辑", "删除", ""); @@ -222,7 +221,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms return; string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText; var dbId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSelectId"].Value.ParseToString(); - var dbProduct = lstAdminTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == dbId); + var dbSelectProduct = lstAdminTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == dbId); var shopId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString(); var draftId = dgvSelectProduct.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString(); @@ -234,9 +233,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms //DeleteProduct(dbId); break; case "编辑备注": - //DbProductEditNotesForm editForm = new DbProductEditNotesForm(dbProduct); - //editForm.ShowDialog(); - //dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes; + ProductSelectEditNotesForm editForm = new ProductSelectEditNotesForm(dbSelectProduct); + editForm.ShowDialog(); + dgvSelectProduct.Rows[e.RowIndex].Cells["colNotes"].Value = dbSelectProduct.notes; break; case "认领": //Task.Run(() => { SelectProduct(new TemuDBProduct[] { dbProduct }); }); @@ -244,13 +243,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms case "草稿箱Id": if (!string.IsNullOrEmpty(draftId)) { - //var shop = GetShop(shopId); - //AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); - //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + - // draftId + "&from=productDraftList"; - //adminLoginForm.openType = EnumOpenType.manage; - //adminLoginForm.WindowState = FormWindowState.Maximized; - //adminLoginForm.ShowDialog(); + var shop = GetShop(shopId); + AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); + adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + + draftId + "&from=productDraftList"; + adminLoginForm.openType = EnumOpenType.manage; + adminLoginForm.WindowState = FormWindowState.Maximized; + adminLoginForm.ShowDialog(); } break; case "进店": @@ -282,6 +281,34 @@ namespace TemuKJD.KJDForms.ProductSelectForms updateCookieForm.ShowDialog(); } break; + case "复制Cookies": + { + var shop = GetShop(shopId); + string cookJs = ""; + foreach (var shopCook in shop.Cookies.Split(';')) + { + var cookie = shopCook.Trim(); + if (cookie.StartsWith("mc-pc-cookie-captcha-token=")) + continue; + //if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp")) + cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';"; + } + foreach (var shopCook in shop.Cookies.Split(';')) + { + var cookie = shopCook.Trim(); + if (cookie.StartsWith("mc-pc-cookie-captcha-token=")) + continue; + if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp")) + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.kuajingmaihuo.com;';"; + else + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=seller.kuajingmaihuo.com;';"; + } + cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');"; + cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)"; + Clipboard.SetDataObject(cookJs); + BaseMsgForm.ShowInfo("复制成功"); + } + break; case "": dgvSelectProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvSelectProduct.Rows[e.RowIndex].Cells["colSelect"].Value; break; diff --git a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx index 2077b2e..d2cf3d7 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx +++ b/TEMUKJD/KJDForms/ProductSelectForms/DbProductSelectListManageForm.resx @@ -138,6 +138,9 @@ True + + True + True @@ -165,6 +168,12 @@ True + + True + + + True + True diff --git a/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.Designer.cs new file mode 100644 index 0000000..aa23cb1 --- /dev/null +++ b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.Designer.cs @@ -0,0 +1,229 @@ +namespace TemuKJD.KJDForms.ProductSelectForms +{ + partial class ProductSelectEditNotesForm + { + /// + /// 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProductSelectEditNotesForm)); + this.panel2 = new System.Windows.Forms.Panel(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label8 = new System.Windows.Forms.Label(); + this.txtNotes = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.btnOk = new TemuKJD.UserControls.ButtonEx(); + this.label4 = new System.Windows.Forms.Label(); + this.txtShopName = new System.Windows.Forms.TextBox(); + this.txtProdName = new System.Windows.Forms.TextBox(); + this.txtSpu = new System.Windows.Forms.TextBox(); + this.txtSkc = new System.Windows.Forms.TextBox(); + this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.White; + this.panel2.Controls.Add(this.txtSkc); + this.panel2.Controls.Add(this.txtSpu); + this.panel2.Controls.Add(this.txtProdName); + this.panel2.Controls.Add(this.txtShopName); + this.panel2.Controls.Add(this.label4); + this.panel2.Controls.Add(this.label3); + this.panel2.Controls.Add(this.label2); + this.panel2.Controls.Add(this.label1); + this.panel2.Controls.Add(this.pictureBox1); + this.panel2.Controls.Add(this.label8); + this.panel2.Controls.Add(this.txtNotes); + this.panel2.Controls.Add(this.btnOk); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(1, 33); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(365, 477); + this.panel2.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(27, 183); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(56, 17); + this.label3.TabIndex = 392; + this.label3.Text = "商品标题"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(27, 249); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(56, 17); + this.label2.TabIndex = 391; + this.label2.Text = " SKC ID"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(27, 216); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(56, 17); + this.label1.TabIndex = 390; + this.label1.Text = " SPU ID"; + // + // pictureBox1 + // + this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.pictureBox1.Location = new System.Drawing.Point(115, 22); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(136, 136); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 389; + this.pictureBox1.TabStop = false; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(28, 314); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(56, 17); + this.label8.TabIndex = 386; + this.label8.Text = " 备注"; + // + // txtNotes + // + // + // + // + this.txtNotes.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.txtNotes.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.txtNotes.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.txtNotes.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.txtNotes.Border.Class = "CrumbBarBackgroundKey"; + this.txtNotes.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.txtNotes.Border.PaddingBottom = 2; + this.txtNotes.Border.PaddingLeft = 2; + this.txtNotes.Border.PaddingRight = 2; + this.txtNotes.Border.PaddingTop = 2; + this.txtNotes.Location = new System.Drawing.Point(90, 312); + this.txtNotes.Multiline = true; + this.txtNotes.Name = "txtNotes"; + this.txtNotes.Size = new System.Drawing.Size(239, 94); + this.txtNotes.TabIndex = 385; + // + // btnOk + // + this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnOk.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOk.ForeColor = System.Drawing.Color.White; + this.btnOk.Location = new System.Drawing.Point(274, 416); + this.btnOk.Margin = new System.Windows.Forms.Padding(2); + this.btnOk.Name = "btnOk"; + this.btnOk.Size = new System.Drawing.Size(55, 26); + this.btnOk.TabIndex = 372; + this.btnOk.Text = "提交"; + this.btnOk.UseVisualStyleBackColor = false; + this.btnOk.Click += new System.EventHandler(this.btnOk_Click); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(27, 282); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(56, 17); + this.label4.TabIndex = 394; + this.label4.Text = "上传店铺"; + // + // textBox1 + // + this.txtShopName.Location = new System.Drawing.Point(90, 279); + this.txtShopName.Name = "textBox1"; + this.txtShopName.ReadOnly = true; + this.txtShopName.Size = new System.Drawing.Size(239, 23); + this.txtShopName.TabIndex = 395; + // + // txtProdName + // + this.txtProdName.Location = new System.Drawing.Point(90, 180); + this.txtProdName.Name = "txtProdName"; + this.txtProdName.ReadOnly = true; + this.txtProdName.Size = new System.Drawing.Size(239, 23); + this.txtProdName.TabIndex = 396; + // + // txtSpu + // + this.txtSpu.Location = new System.Drawing.Point(90, 213); + this.txtSpu.Name = "txtSpu"; + this.txtSpu.ReadOnly = true; + this.txtSpu.Size = new System.Drawing.Size(239, 23); + this.txtSpu.TabIndex = 397; + // + // txtSkc + // + this.txtSkc.Location = new System.Drawing.Point(90, 246); + this.txtSkc.Name = "txtSkc"; + this.txtSkc.ReadOnly = true; + this.txtSkc.Size = new System.Drawing.Size(239, 23); + this.txtSkc.TabIndex = 398; + // + // ProductSelectEditNotesForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(367, 511); + this.Controls.Add(this.panel2); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "ProductSelectEditNotesForm"; + this.Text = "编辑上传备注"; + this.TitleText = "编辑上传备注"; + this.Load += new System.EventHandler(this.ProductSelectListForm_Load); + this.Controls.SetChildIndex(this.panel2, 0); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel2; + private UserControls.ButtonEx btnOk; + private System.Windows.Forms.Label label8; + private DevComponents.DotNetBar.Controls.TextBoxX txtNotes; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtSkc; + private System.Windows.Forms.TextBox txtSpu; + private System.Windows.Forms.TextBox txtProdName; + private System.Windows.Forms.TextBox txtShopName; + } +} \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.cs new file mode 100644 index 0000000..27c6774 --- /dev/null +++ b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.cs @@ -0,0 +1,79 @@ +using AllBase.Helper; +using AllBase.Model.Result; +using TemuKJD.KJDForms.BaseForms; +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; +using AllBase; +using Work; + +namespace TemuKJD.KJDForms.ProductSelectForms +{ + public enum SetProductSelectNotesType + { + DbProduct, + ThirdProduct, + } + public partial class ProductSelectEditNotesForm : LRBaseForm + { + TemuDBProductSelect dbProd = null; + SetProductSelectNotesType selectNotesType; + + public ProductSelectEditNotesForm(TemuDBProductSelect prod, SetProductSelectNotesType notesType= SetProductSelectNotesType.DbProduct) + { + InitializeComponent(); + + dbProd = prod; + selectNotesType = notesType; + } + + private void ProductSelectListForm_Load(object sender, EventArgs e) + { + if (dbProd != null) + { + txtProdName.Text = dbProd.product_name; + txtSkc.Text = dbProd.skc_id; + txtSpu.Text = dbProd.spu_id; + txtShopName.Text = dbProd.shop_account; + this.pictureBox1.ImageLocation = dbProd.main_img.Replace("https", "http"); + this.txtNotes.Text = dbProd.notes; + } + } + + private void btnOk_Click(object sender, EventArgs e) + { + var url = ""; + if (selectNotesType == SetProductSelectNotesType.DbProduct) + url = BaseClass.BuildObjString("product/mdy_product_select_notes"); + else + url = BaseClass.BuildObjString("product_third/mdy_product_select_notes"); + var data = UserLogin.GetSignaturex() + + "&db_id=" + dbProd.id + "¬es=" + this.txtNotes.Text.Trim(); + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + { + BaseMsgForm.ShowError("上传备注编辑失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg")); + } + else + { + dbProd.notes = this.txtNotes.Text.Trim(); + this.Close(); + } + } + + private void lblSPUId_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.resx b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.resx new file mode 100644 index 0000000..c963c3c --- /dev/null +++ b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectEditNotesForm.resx @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAgIAQYAAAAABoKAAAFgAAACgAAACAAAAAAAEAAAEABAAAAAAAACgAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8AAAAAAAAAAAAAAAAABEZmbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMZmZkQAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAZszMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMxmAAAAAAAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMxkAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzGQAAAAAAAAAAAAAAAAAAAbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMYAAAAAAAAAAAAAAAAARszMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAABszMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAAAAAGzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAAAAbMzMzMzMzMzMzMzMzM + zMzMzMzMzMx3d4iIiIiIiIh3fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAABszMzMzMzMzMzM + zMzMzMzMzMzHeIiIiIj/////////iIiIiId8zMzMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAAAGzMzMzMzM + zMzMzMzMzMzMzMeIiI/////////////////////4iIh8zMzMzMzMzMzMzMzMzMzMzMxgAAAAAAAATMzM + zMzMzMzMzMzMzMzMzHiI////////////////////////////iIfMzMzMzMzMzMzMzMzMzMzMxAAAAAAA + AGzMzMzMzMzMzMzMzMzMx3iP///////////////////////////////4iHzMzMzMzMzMzMzMzMzMzMYA + AAAAAAbMzMzMzMzMzMzMzMzMx3iP//////////////////////////////////+IfMzMzMzMzMzMzMzM + zMzMYAAAAABMzMzMzMzMzMzMzMzMx3iP/////////////////////////////////////4h8zMzMzMzM + zMzMzMzMzMQAAAAAbMzMzMzMzMzMzMzMzHiP////////////////////////////////////////h3zM + zMzMzMzMzMzMzMzGAAAABMzMzMzMzMzMzMzMzHiP//////////////////////////////////////// + //iHzMzMzMzMzMzMzMzMzEAAAAbMzMzMzMzMzMzMzMeI//////////////////////////////////// + ////////+IfMzMzMzMzMzMzMzMxgAABMzMzMzMzMzMzMzMx4//////////////////////////////// + //////////////+IfMzMzMzMzMzMzMzMxAAAbMzMzMzMzMzMzMzHj/////////////////////////// + /////////////////////4fMzMzMzMzMzMzMzMYAAMzMzMzMzMzMzMzMeP////////////////////// + ///////////////////////////4fMzMzMzMzMzMzMzMAAbMzMzMzMzMzMzMx4////////////////// + /////////////////////////////////4fMzMzMzMzMzMzMzGAGzMzMzMzMzMzMzHj///////////// + ///////////////////////////////////////4fMzMzMzMzMzMzMxgDMzMzMzMzMzMzMyI//////// + /////////////////////////////////////////////4zMzMzMzMzMzMzMwEzMzMzMzMzMzMzHj/// + //////////////////////////////////////////////////+HzMzMzMzMzMzMzMRszMzMzMzMzMzM + eP//////////////////////////////////////////////////////+HzMzMzMzMzMzMzGbMzMzMzM + zMzMzHj///////////////////////////////////////////////////////+MzMzMzMzMzMzMxmzM + zMzMzMzMzMyP////+IiP////////////////////////////////////////+I//////h8zMzMzMzMzM + zMZszMzMzMzMzMzHj////4iIiI//////////////////////////////////////+IiIj/////jMzMzM + zMzMzMzGbMzMzMzMzMzMyP////iIiIiI/////////////////////////////////////4iIiIj////4 + fMzMzMzMzMzMxszMzMzMzMzMzHj////4iIiIiP////////////////////////////////////+IiIiI + j////4zMzMzMzMzMzMbMzMzMzMzMzMx4////iIiIiIj////////////////////////////////////4 + iIiIiI////+HzMzMzMzMzMzMzMzMzMzMzMzMj////4iIiIiI//////////////+IiP//iI////////// + ////+IiIiIiP////h8zMzMzMzMzMzMzMzMzMzMzMzI/////4iIiIiP/////////////4d3eIiIeIj/// + //////////+IiIiIj/////jMzMzMzMzMzMzMzMzMzMzMzMyP////+IiIiIj/////////////iIiId3eI + iI//////////////iIiIiI/////4zMzMzMzMzMzMzMzMzMzMzMzHj/////+IiIiP/////////////4// + /4d4j/+P//////////////iIiIj/////+MzMzMzMzMzMzMzMzMzMzMzMx4//////+IiP//////////// + ///////4j///////////////////iIiP//////jMzMzMzMzMzMzMzMzMzMzMzMeP//////////+IiIj/ + ///////////////////////////////////////////4fMzMzMzMzMzMzMzMzMzMzMzH//////////+H + fMx8eP//////////////////////////iId3iP//////////+HzMzMzMzMzMzMzMzMzMzMzMyP////// + ///4fMzHh8eP////////////////////////+MzMzMd4//////////h8zMzMzMzMzMzMzMzMzMzMzMf/ + ////////+MzMePjMeP///////////////////////4zMzMeHx4/////////4fMzMzMzMzMzMzMzMzMzM + zMzH/////////4fMd3eHzMeP//////////////////////iMzMzIiHx4////////+HzMzMzMzMzMzMzM + zMzMzMzMx/////////+Hx4iIfMzMj//////////////////////4h3d8x4h8yP////////jMzMzMzMzM + zMzMzMzMzMzMzMeP////////+HiP+IfMzI//////////////////////+HiIiHd3zHj////////4zMzM + zMzMzMzMzMzMzMzMzMzHj/////////h4//+HzMeP//////////////////////h4//h8zMyP//////// + +MzMzMzMzMzMzMzMzMzMzMzMzI/////////4iP//h8x4///////////////////////4j//4fMzHj/// + //////jMzMzMzMzMzMzMzMzMzMzMzMyP///////4iIiP+IfHj///////////////////////+Ij/+HzM + eP/////////4zMzMzMzMzMzMzMzMzMzMzMzMj///////iIiIiIh3eP////////////////////////+I + j4h8x3iI////////h8zMzMzMzMzMzMzMzMzMzMzMzH//////+Hj///iIiI////////////////////// + /////4iId4iIiIj//////4zMzMzMzMzMzMzMzMzMzMzMzMx4//////iP////iP////////////////// + /////////////4iP//iI//////+MzMzMzMzMzMzMzMzMzMzMzMzMyP//////////+I////////////// + ///////////////////4eP//iP//////jMzMzMzMzMzMzMzMzMzMzMzMzMj///////////iP//////// + /////////////////////////4j/////////+HzMzMzMzMzMzMzMzMzMzMzMzMzHj/////////////// + //////////////////////////////+I//////////jMzMzMzMzMzMzMzMzMzMzMzMzMzI////////// + //////////////////////////////////////////////+HzMzMzMzMzMzMzMzMzMzMzMzMzMyP//// + ////////////////////////////////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzM + eP///////////////////////////////////////////////////////4zMzMzMzMzMzMzMzMzMzMzM + zMzMzMj///////////////////////////////////////////////////////h8zMzMzMzMzMzMzMzM + zMzMzMzMzMzHj//////////////////////////////////////////////////////4zMzMzMzMzMzM + zMzMzMzMzMzMzMzMzI//////////////////////////////////////////////////////h8zMzMzM + zMzMzMzMzMzMzMzMzMzMzMx4////////////////////////////////////////////////////+HzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMyI////+I//////////////////////////////////////////// + //h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP////+Ij///////////////////////////////////// + //////+HzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP////+IiIiIj//////////////////////////4 + ////iI/////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMiP/////4iIiP////////////////////// + ////+IiIiIj/////iHzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiP////////////////////////// + ///////////4iIj//////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiP//////////////////// + //////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiP////////////// + //////////////////////////////+HzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHj///////// + ///////////////////////////////////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP//// + ////////////////////////////////////////+MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzI + j/////////////////////////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMeP//////////////////////////////////////////////h8zMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMx4////////+I//////////////////////////////////////jMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMeP///////4iIj///////////////////////////iP///////4fMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMx4////////iIiIiP///////////////////////4iIiP///////4zMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMj///////+IiIiIiI////////////////////+IiIiIj///////+HzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMx4////////iIiIiIj////////////////////4iIiIiIj/////// + +MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMj///////+IiIiIiI////////////////////+IiIiIiI// + //////h8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx4////////iIiIiIiP////////////////////iIiI + iIiI///////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMj///////+IiIiIiIj/////iIiIiIiIj///// + /4iIiIiIiP///////4zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx4////////iIiIiIiI/////4zMzMzMzM + j/////+IiIiIiIiP//////+HzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP//////+IiIiIiIj/////+MzM + zMzMzI//////+IiIiIiIj///////+MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzI////////iIiIiIiI//// + //jMzMzMzMyP//////iIiIiIiIj///////jMzMzMzMzMzMzMzMzMzMzMzMzMzMzMeP///////4iIiIiI + iP/////4zMzMzMzMj//////4iIiIiIiI///////4fMzMzMzMzMzMzMzMzMzMzMzMzMzMzI////////iI + iIiIiI//////+MzMzMzMzI//////+IiIiIiIiP///////4zMzMzMzMzMzMzMzMzMzMzMzMzMzMyP//// + ///4iIiIiIiP//////fMzMzMzMyP//////+IiIiIiIj///////+MzMzMzMzMzMzMzMzMzMzMzMzMzMzH + j///////+IiIiIiI//////+HzMzMzMzMeP//////iIiIiIiIj///////jMzMzMzMzMzMzMzMzMzMzMzM + zMzMyP////////iIiIiIiP//////jMzMzMzMzHj///////iIiIiIiI///////4fMzMzMzMzMzMzMzMzM + zMzMzMzMzMj///////+IiIiIiI///////4zMzMzMzMzI///////4iIiIiIiI///////3zMzMzMzMzMzM + zMzMzMzMzMzMzMzI////////iIiIiIiP//////+MzMzMzMzMyP//////+IiIiIiIiP//////+MzMzMzM + zMzMzMzMzMzMzMzMzMzMeP///////4iIiIiIj///////jMzMzMzMzMj///////+IiIiIiIj///////jM + zMzMzMzMzMzMzMzMzMzMzMzMzI////////+IiIiIiP//////+HzMzMzMzMzHj///////iIiIiIiI//// + ///4zMzMzMzMzMzMzMzMzMzMzMzMzMyP////////iIiIiI////////jMzMzMzMzMzI///////4iIiIiI + iI//////+MzMzMzMzMzMzMzMzMzMzMzMzMzMj////////4iIiIiP///////4zMzMzMzMzMyP///////4 + iIiIiIiP//////jMzMzMzMzMzMzMzMzMzMzMzMzMzI////////+IiIiI////////h8zMzMzMzMzMeP// + /////4iIiIiIj//////4fMzMzMzMzMzMzMzMzMzMzMzMzMyP////////iIiIj////////4fMzMzMzMzM + zHj///////+IiIiIiI//////+HzMzMzMzMzMzMzMzMzMzMzMzMzHj/////////iIiP////////+MzMzM + zMzMzMzI////////+IiIiIiP//////h8zMzMzMzMzMzMxmzMzMzMzMzMx4/////////4iP/////////4 + fMzMzMzMzMzMx4////////+IiIiIj//////4fMzMzMzMzMzMzMZszMzMzMzMzMeP//////////////// + ////+MzMzMzMzMzMzMyP////////iIiIiP//////+HzMzMzMzMzMzMzGbMzMzMzMzMzH//////////// + //////////fMzMzMzMzMzMzMeP////////iIiIj///////98zMzMzMzMzMzMxmzMzMzMzMzMyP////// + //////////////+HzMzMzMzMzMzMzHj/////////+IiP////////jMzMzMzMzMzMzMZszMzMzMzMzMj/ + ////////////////////jMzMzMzMzMzMzMzIj////////////////////4zMzMzMzMzMzMzGTMzMzMzM + zMzH////////////////////+HzMzMzMzMzMzMzMx4////////////////////+MzMzMzMzMzMzMxAzM + zMzMzMzMx/////////////////////jMzMzMzMzMzMzMzMyI///////////////////4fMzMzMzMzMzM + zMAGzMzMzMzMzMeP//////////////////+HzMzMzMzMzMzMzMzMeP//////////////////+HzMzMzM + zMzMzMxgBszMzMzMzMzHj//////////////////4fMzMzMzMzMzMzMzMzMeP//////////////////h8 + zMzMzMzMzMzMYADMzMzMzMzMzI//////////////////+HzMzMzMzMzMzMzMzMzHj/////////////// + ///4zMzMzMzMzMzMzAAAbMzMzMzMzMyP/////////////////4fMzMzMzMzMzMzMzMzMzHj///////// + ////////+MzMzMzMzMzMzMYAAEzMzMzMzMzMj/////////////////+MzMzMzMzMzMzMzMzMzMzIj/// + /////////////4fMzMzMzMzMzMzEAAAGzMzMzMzMzHj////////////////4fMzMzMzMzMzMzMzMzMzM + x4////////////////+MzMzMzMzMzMzMYAAABMzMzMzMzMx4////////////////h8zMzMzMzMzMzMzM + zMzMzMx4///////////////4fMzMzMzMzMzMzEAAAABszMzMzMzMx4//////////////+HzMzMzMzMzM + zMzMzMzMzMzMx4//////////////+MzMzMzMzMzMzMYAAAAATMzMzMzMzMyP/////////////4fMzMzM + zMzMzMzMzMzMzMzMzMeI/////////////4fMzMzMzMzMzMzEAAAAAAbMzMzMzMzMeP////////////h8 + zMzMzMzMzMzMzMzMzMzMzMzMeI////////////h8zMzMzMzMzMzMYAAAAAAAbMzMzMzMzMeP//////// + //iHzMzMzMzMzMzMzMzMzMzMzMzMzMyI//////////+HzMzMzMzMzMzMxgAAAAAAAEzMzMzMzMzMeP// + //////iHfMzMzMzMzMzMzMzMzMzMzMzMzMzMx4/////////4fMzMzMzMzMzMzMQAAAAAAAAGzMzMzMzM + zMeI//////iHfMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx4j//////4h8zMzMzMzMzMzMxgAAAAAAAAAGzM + zMzMzMzMx4iIiIiHzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzHiIj/+Ih3zMzMzMzMzMzMzGAAAAAAAA + AAAGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMx3iId8zMzMzMzMzMzMzMYAAA + AAAAAAAAAGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + xgAAAAAAAAAAAAAGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzGAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzGQAAAAAAAAAAAAAAAAAbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMYAAAAAAAAAAAAAAAAAAARszMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAABGzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAAAAAEbMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMZAAAAAAAAAAAAAAAAAAAAAAAAAAABmzMzMzMzMzMzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMzGYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARGZmzMzMzMzMzMzMzM + zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMZmZEAAAAAAAAAAAAAAAAD////+AAAAAAAAAAD/////////AAAA + AAAAAAAAAP//////+AAAAAAAAAAAAAAf/////+AAAAAAAAAAAAAAB/////+AAAAAAAAAAAAAAAH////+ + AAAAAAAAAAAAAAAAf////AAAAAAAAAAAAAAAAD////AAAAAAAAAAAAAAAAAP///gAAAAAAAAAAAAAAAA + B///wAAAAAAAAAAAAAAAAAP//4AAAAAAAAAAAAAAAAAB//8AAAAAAAAAAAAAAAAAAP/+AAAAAAAAAAAA + AAAAAAB//gAAAAAAAAAAAAAAAAAAf/wAAAAAAAAAAAAAAAAAAD/4AAAAAAAAAAAAAAAAAAAf+AAAAAAA + AAAAAAAAAAAAH/AAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAAAAAAAAAP4AAAAAAAAAAAAAAAAAAAB+AA + AAAAAAAAAAAAAAAAAAfAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAA + AAOAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAA + AAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAABAAAAAAAA + AAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAA + AAGAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAA + AAAAAAABgAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAADwAAAAAAA + AAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAfgAAAAAAAAAAAAAAAAAAAH8AAAAAAAAAAAAAAAAAAAD/AA + AAAAAAAAAAAAAAAAAA/4AAAAAAAAAAAAAAAAAAAf+AAAAAAAAAAAAAAAAAAAH/wAAAAAAAAAAAAAAAAA + AD/+AAAAAAAAAAAAAAAAAAB//gAAAAAAAAAAAAAAAAAAf/8AAAAAAAAAAAAAAAAAAP//gAAAAAAAAAAA + AAAAAAH//8AAAAAAAAAAAAAAAAAD///gAAAAAAAAAAAAAAAAB///8AAAAAAAAAAAAAAAAA////wAAAAA + AAAAAAAAAAA////+AAAAAAAAAAAAAAAAf////4AAAAAAAAAAAAAAAf/////gAAAAAAAAAAAAAAf///// + +AAAAAAAAAAAAAAf//////8AAAAAAAAAAAAA/////////gAAAAAAAAAAf////w== + + + \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.Designer.cs b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.Designer.cs index 1dba52b..b6d5b8d 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.Designer.cs @@ -40,8 +40,8 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.colSubSaId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubUserName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubSaName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.btnOk = new TemuKJD.UserControls.ButtonEx(); this.ucCheckBox1 = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.btnOk = new TemuKJD.UserControls.ButtonEx(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -145,6 +145,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.colSubSaName.ReadOnly = true; this.colSubSaName.Width = 150; // + // ucCheckBox1 + // + this.ucCheckBox1.AutoSize = true; + this.ucCheckBox1.Checked = true; + this.ucCheckBox1.CheckState = System.Windows.Forms.CheckState.Checked; + this.ucCheckBox1.Location = new System.Drawing.Point(5, 8); + this.ucCheckBox1.Name = "ucCheckBox1"; + this.ucCheckBox1.Size = new System.Drawing.Size(300, 16); + this.ucCheckBox1.TabIndex = 375; + this.ucCheckBox1.Text = "同店铺下的其他商品(限待上传)也分配给该二级超管"; + this.ucCheckBox1.UseVisualStyleBackColor = true; + // // btnOk // this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -162,26 +174,14 @@ namespace TemuKJD.KJDForms.ProductSelectForms this.btnOk.UseVisualStyleBackColor = false; this.btnOk.Click += new System.EventHandler(this.btnOk_Click); // - // ucCheckBox1 - // - this.ucCheckBox1.AutoSize = true; - this.ucCheckBox1.Checked = true; - this.ucCheckBox1.CheckState = System.Windows.Forms.CheckState.Checked; - this.ucCheckBox1.Location = new System.Drawing.Point(5, 8); - this.ucCheckBox1.Name = "ucCheckBox1"; - this.ucCheckBox1.Size = new System.Drawing.Size(240, 16); - this.ucCheckBox1.TabIndex = 375; - this.ucCheckBox1.Text = "同店铺下的其他商品也分配给该二级超管"; - this.ucCheckBox1.UseVisualStyleBackColor = true; - // - // DbProductSelectListSubSaForm + // ProductSelectSetSubSaForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(393, 540); this.Controls.Add(this.panel2); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "DbProductSelectListSubSaForm"; + this.Name = "ProductSelectSetSubSaForm"; this.Text = "指定二级超管"; this.TitleText = "指定二级超管"; this.Load += new System.EventHandler(this.DbProductSelectListSubSaForm_Load); diff --git a/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.cs index 08c9eb4..212b45f 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/ProductSelectSetSubSaForm.cs @@ -41,23 +41,46 @@ namespace TemuKJD.KJDForms.ProductSelectForms } private void btnOk_Click(object sender, EventArgs e) + { + var msg = SetSubSa(false); + if (!string.IsNullOrEmpty(msg)) + { + BaseMsgForm.ShowError(msg); + return; + } + if (this.ucCheckBox1.Checked) + { + msg = SetSubSa(true); + if (!string.IsNullOrEmpty(msg)) + { + BaseMsgForm.ShowError(msg); + return; + } + } + this.Close(); + } + + string SetSubSa(bool isShopAllSameSaCheck=false) { var selectRow = this.dgvSaUser.Rows.Cast().FirstOrDefault(r => r.Cells["colSelect"]?.Value.ParseToBool() == true); if (selectRow == null) { - BaseMsgForm.ShowError("请选择要分配的二级管理员!"); - return; + return "请选择要分配的二级管理员!"; } var sub_sa = selectRow.Cells["colSubSaName"].Value.ParseToString(); StringBuilder data = new StringBuilder(); data.Append(UserLogin.GetSignaturex()); - if (ucCheckBox1.Checked) - data.Append("&shop_id=" + string.Join(",", lstShopSelectId)); - else - data.Append("&db_id=" + string.Join(",", lstProductSelectId)); data.Append("&operate_sub_sa_name=" + sub_sa); - data.Append("&status=待上传"); + if (isShopAllSameSaCheck) + { + data.Append("&shop_id=" + string.Join(",", lstShopSelectId)); + data.Append("&status=待上传"); + } + else + { + data.Append("&db_id=" + string.Join(",", lstProductSelectId)); + } string url = ""; if (setSubSaType == SetSubSaType.DbProduct) url = BaseClass.BuildObjString("product/set_select_product_sub_sa"); @@ -68,19 +91,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms { if (html.Contains("\"code\":200")) { - OnSaveComplete(ucCheckBox1.Checked, sub_sa); - this.Close(); + OnSaveComplete(isShopAllSameSaCheck, sub_sa); + return ""; } else { var msg = BaseRegex.GetStringJson(ref html, "msg"); if (string.IsNullOrEmpty(msg)) msg = html; - BaseMsgForm.ShowError(msg, "错误"); + return "发生错误:" + msg; } } - else - BaseMsgForm.ShowError("未知错误,请重试!", "错误"); + return "未知错误,请重试!"; } private void DbProductSelectListSubSaForm_Load(object sender, EventArgs e) diff --git a/TEMUKJD/KJDForms/ProductSelectForms/UserSelectDbProductForm.cs b/TEMUKJD/KJDForms/ProductSelectForms/UserSelectDbProductForm.cs index 48bf515..9df0416 100644 --- a/TEMUKJD/KJDForms/ProductSelectForms/UserSelectDbProductForm.cs +++ b/TEMUKJD/KJDForms/ProductSelectForms/UserSelectDbProductForm.cs @@ -11,6 +11,7 @@ using System.Drawing; using System.IO; using System.Linq; using System.Net; +using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -223,16 +224,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms foreach (var prodSelect in lstTemuDBProductSelect) { Image image = null; - try - { - using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) - { - image = Image.FromStream(stream); - } - } - catch (Exception ex) - { - } + string imgUrl = prodSelect?.main_img?.Replace("https", "http"); + string rst = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out rst); + if (!string.IsNullOrEmpty(rst)) + BaseMsgForm.ShowError(rst); + Invoke(new Action(() => { int rowIndex = this.dgvSelectProduct.Rows.Add( @@ -263,7 +261,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms }); } - public List GetSelectProductList(out int pageCount, int page = 1, int pageSize = 50) { var lstShopId = dgvShop.Rows.Cast().Where(row @@ -353,9 +350,6 @@ namespace TemuKJD.KJDForms.ProductSelectForms } break; case "编辑备注": - //DbProductEditNotesForm editForm = new DbProductEditNotesForm(dbProduct); - //editForm.ShowDialog(); - //dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes; break; case "草稿箱Id": //if (!string.IsNullOrEmpty(draftId) && shop != null) diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs index 075050f..dbf6e6a 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs @@ -33,7 +33,6 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProductThirdSelectListManageForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.chkNoSubSa = new TemuKJD.UserComponent.UcCheckBox(this.components); this.btnSetSubSa = new TemuKJD.UserControls.ButtonEx(); this.cmbStatus = new System.Windows.Forms.ComboBox(); this.label8 = new System.Windows.Forms.Label(); @@ -54,9 +53,12 @@ this.label3 = new System.Windows.Forms.Label(); this.txtCat = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); + this.chkNoSubSa = new TemuKJD.UserComponent.UcCheckBox(this.components); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSelectId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -64,6 +66,7 @@ this.colInShop = new System.Windows.Forms.DataGridViewLinkColumn(); this.colLogin = new System.Windows.Forms.DataGridViewLinkColumn(); this.colImportCookies = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colCopyCookies = new System.Windows.Forms.DataGridViewLinkColumn(); this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colSkcId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn(); @@ -71,13 +74,13 @@ this.colProductCat = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colDraftId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colDraftId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colMdyTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSubSa = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colEditNotes = new System.Windows.Forms.DataGridViewLinkColumn(); this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn(); this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -130,16 +133,6 @@ this.splitContainer1.SplitterDistance = 53; this.splitContainer1.TabIndex = 2; // - // chkNoSubSa - // - this.chkNoSubSa.AutoSize = true; - this.chkNoSubSa.Location = new System.Drawing.Point(1167, 17); - this.chkNoSubSa.Name = "chkNoSubSa"; - this.chkNoSubSa.Size = new System.Drawing.Size(123, 21); - this.chkNoSubSa.TabIndex = 467; - this.chkNoSubSa.Text = "仅显示未分配超管"; - this.chkNoSubSa.UseVisualStyleBackColor = true; - // // btnSetSubSa // this.btnSetSubSa.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -348,6 +341,16 @@ this.label2.TabIndex = 426; this.label2.Text = "类目:"; // + // chkNoSubSa + // + this.chkNoSubSa.AutoSize = true; + this.chkNoSubSa.Location = new System.Drawing.Point(1167, 17); + this.chkNoSubSa.Name = "chkNoSubSa"; + this.chkNoSubSa.Size = new System.Drawing.Size(123, 21); + this.chkNoSubSa.TabIndex = 467; + this.chkNoSubSa.Text = "仅显示未分配超管"; + this.chkNoSubSa.UseVisualStyleBackColor = true; + // // splitContainer2 // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; @@ -406,6 +409,7 @@ this.colInShop, this.colLogin, this.colImportCookies, + this.colCopyCookies, this.colSpuId, this.colSkcId, this.colProductSkcPic, @@ -416,6 +420,8 @@ this.colDraftId, this.colMdyTime, this.colSubSa, + this.colNotes, + this.colEditNotes, this.ColDelete, this.colOpResult}); this.dgvSelectProduct.Dock = System.Windows.Forms.DockStyle.Fill; @@ -425,172 +431,9 @@ this.dgvSelectProduct.RowHeadersWidth = 51; this.dgvSelectProduct.RowTemplate.Height = 23; this.dgvSelectProduct.Size = new System.Drawing.Size(1430, 552); - this.dgvSelectProduct.TabIndex = 188; + this.dgvSelectProduct.TabIndex = 190; this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick); // - // colSelect - // - this.colSelect.HeaderText = "选择"; - this.colSelect.MinimumWidth = 6; - this.colSelect.Name = "colSelect"; - this.colSelect.ReadOnly = true; - this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSelect.Width = 30; - // - // colSelectId - // - this.colSelectId.HeaderText = "认领Id"; - this.colSelectId.MinimumWidth = 6; - this.colSelectId.Name = "colSelectId"; - this.colSelectId.ReadOnly = true; - this.colSelectId.Visible = false; - this.colSelectId.Width = 125; - // - // colSupplierId - // - this.colSupplierId.HeaderText = "店铺Id"; - this.colSupplierId.MinimumWidth = 6; - this.colSupplierId.Name = "colSupplierId"; - this.colSupplierId.ReadOnly = true; - this.colSupplierId.Width = 125; - // - // colSupplierName - // - this.colSupplierName.HeaderText = "店铺名称"; - this.colSupplierName.MinimumWidth = 6; - this.colSupplierName.Name = "colSupplierName"; - this.colSupplierName.ReadOnly = true; - this.colSupplierName.Width = 110; - // - // colInShop - // - this.colInShop.HeaderText = "进店"; - this.colInShop.MinimumWidth = 6; - this.colInShop.Name = "colInShop"; - this.colInShop.ReadOnly = true; - this.colInShop.Width = 45; - // - // colLogin - // - this.colLogin.HeaderText = "登录"; - this.colLogin.MinimumWidth = 6; - this.colLogin.Name = "colLogin"; - this.colLogin.ReadOnly = true; - this.colLogin.Width = 45; - // - // colImportCookies - // - this.colImportCookies.HeaderText = "导入Cookies"; - this.colImportCookies.Name = "colImportCookies"; - this.colImportCookies.ReadOnly = true; - this.colImportCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colImportCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colImportCookies.Width = 85; - // - // colSpuId - // - this.colSpuId.HeaderText = "商品SPU"; - this.colSpuId.MinimumWidth = 6; - this.colSpuId.Name = "colSpuId"; - this.colSpuId.ReadOnly = true; - this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSpuId.Width = 90; - // - // colSkcId - // - this.colSkcId.FillWeight = 150F; - this.colSkcId.HeaderText = "商品SKC"; - this.colSkcId.MinimumWidth = 6; - this.colSkcId.Name = "colSkcId"; - this.colSkcId.ReadOnly = true; - this.colSkcId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSkcId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSkcId.Width = 80; - // - // colProductSkcPic - // - this.colProductSkcPic.HeaderText = "Skc图片"; - this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.colProductSkcPic.MinimumWidth = 6; - this.colProductSkcPic.Name = "colProductSkcPic"; - this.colProductSkcPic.ReadOnly = true; - this.colProductSkcPic.Width = 60; - // - // colProductName - // - this.colProductName.HeaderText = "商品标题"; - this.colProductName.MinimumWidth = 6; - this.colProductName.Name = "colProductName"; - this.colProductName.ReadOnly = true; - this.colProductName.Width = 260; - // - // colProductCat - // - this.colProductCat.HeaderText = "商品类目"; - this.colProductCat.MinimumWidth = 6; - this.colProductCat.Name = "colProductCat"; - this.colProductCat.ReadOnly = true; - this.colProductCat.Width = 90; - // - // colExtCode - // - this.colExtCode.HeaderText = "商品货号"; - this.colExtCode.MinimumWidth = 6; - this.colExtCode.Name = "colExtCode"; - this.colExtCode.ReadOnly = true; - this.colExtCode.Width = 125; - // - // colStatus - // - this.colStatus.HeaderText = "状态"; - this.colStatus.MinimumWidth = 6; - this.colStatus.Name = "colStatus"; - this.colStatus.ReadOnly = true; - this.colStatus.Width = 80; - // - // colDraftId - // - this.colDraftId.HeaderText = "草稿箱Id"; - this.colDraftId.MinimumWidth = 6; - this.colDraftId.Name = "colDraftId"; - this.colDraftId.ReadOnly = true; - this.colDraftId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colDraftId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.colDraftId.Width = 125; - // - // colMdyTime - // - this.colMdyTime.HeaderText = "上传时间"; - this.colMdyTime.MinimumWidth = 6; - this.colMdyTime.Name = "colMdyTime"; - this.colMdyTime.ReadOnly = true; - this.colMdyTime.Width = 120; - // - // colSubSa - // - this.colSubSa.HeaderText = "二级超管"; - this.colSubSa.Name = "colSubSa"; - this.colSubSa.ReadOnly = true; - // - // ColDelete - // - this.ColDelete.HeaderText = "删除"; - this.ColDelete.MinimumWidth = 6; - this.ColDelete.Name = "ColDelete"; - this.ColDelete.ReadOnly = true; - this.ColDelete.Visible = false; - this.ColDelete.Width = 125; - // - // colOpResult - // - this.colOpResult.HeaderText = "操作结果"; - this.colOpResult.MinimumWidth = 6; - this.colOpResult.Name = "colOpResult"; - this.colOpResult.ReadOnly = true; - this.colOpResult.Width = 150; - // // ucSplitPage1 // this.ucSplitPage1.CurrentPage = 1; @@ -614,6 +457,176 @@ this.statusBar.Size = new System.Drawing.Size(1438, 25); this.statusBar.TabIndex = 5; // + // colSelect + // + this.colSelect.HeaderText = "选择"; + this.colSelect.Name = "colSelect"; + this.colSelect.ReadOnly = true; + this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSelect.Width = 30; + // + // colSelectId + // + this.colSelectId.HeaderText = "认领Id"; + this.colSelectId.Name = "colSelectId"; + this.colSelectId.ReadOnly = true; + this.colSelectId.Visible = false; + this.colSelectId.Width = 125; + // + // colSupplierId + // + this.colSupplierId.HeaderText = "店铺Id"; + this.colSupplierId.Name = "colSupplierId"; + this.colSupplierId.ReadOnly = true; + this.colSupplierId.Width = 120; + // + // colSupplierName + // + this.colSupplierName.HeaderText = "店铺名称"; + this.colSupplierName.Name = "colSupplierName"; + this.colSupplierName.ReadOnly = true; + this.colSupplierName.Width = 110; + // + // colInShop + // + this.colInShop.HeaderText = "进店"; + this.colInShop.Name = "colInShop"; + this.colInShop.ReadOnly = true; + this.colInShop.Width = 38; + // + // colLogin + // + this.colLogin.HeaderText = "登录"; + this.colLogin.Name = "colLogin"; + this.colLogin.ReadOnly = true; + this.colLogin.Width = 38; + // + // colImportCookies + // + this.colImportCookies.HeaderText = "导入Cookies"; + this.colImportCookies.Name = "colImportCookies"; + this.colImportCookies.ReadOnly = true; + this.colImportCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colImportCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colImportCookies.Width = 85; + // + // colCopyCookies + // + this.colCopyCookies.HeaderText = "复制Cookies"; + this.colCopyCookies.Name = "colCopyCookies"; + this.colCopyCookies.ReadOnly = true; + this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCopyCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCopyCookies.Width = 85; + // + // colSpuId + // + this.colSpuId.HeaderText = "商品SPU"; + this.colSpuId.Name = "colSpuId"; + this.colSpuId.ReadOnly = true; + this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSpuId.Width = 86; + // + // colSkcId + // + this.colSkcId.FillWeight = 150F; + this.colSkcId.HeaderText = "商品SKC"; + this.colSkcId.Name = "colSkcId"; + this.colSkcId.ReadOnly = true; + this.colSkcId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSkcId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSkcId.Width = 90; + // + // colProductSkcPic + // + this.colProductSkcPic.HeaderText = "Skc图片"; + this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.colProductSkcPic.Name = "colProductSkcPic"; + this.colProductSkcPic.ReadOnly = true; + this.colProductSkcPic.Width = 60; + // + // colProductName + // + this.colProductName.HeaderText = "商品标题"; + this.colProductName.Name = "colProductName"; + this.colProductName.ReadOnly = true; + this.colProductName.Width = 200; + // + // colProductCat + // + this.colProductCat.HeaderText = "商品类目"; + this.colProductCat.Name = "colProductCat"; + this.colProductCat.ReadOnly = true; + this.colProductCat.Width = 90; + // + // colExtCode + // + this.colExtCode.HeaderText = "商品货号"; + this.colExtCode.Name = "colExtCode"; + this.colExtCode.ReadOnly = true; + this.colExtCode.Width = 125; + // + // colStatus + // + this.colStatus.HeaderText = "状态"; + this.colStatus.Name = "colStatus"; + this.colStatus.ReadOnly = true; + this.colStatus.Width = 45; + // + // colDraftId + // + this.colDraftId.HeaderText = "草稿箱Id"; + this.colDraftId.Name = "colDraftId"; + this.colDraftId.ReadOnly = true; + this.colDraftId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colDraftId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colDraftId.Width = 88; + // + // colMdyTime + // + this.colMdyTime.HeaderText = "上传时间"; + this.colMdyTime.Name = "colMdyTime"; + this.colMdyTime.ReadOnly = true; + this.colMdyTime.Width = 95; + // + // colSubSa + // + this.colSubSa.HeaderText = "二级超管"; + this.colSubSa.Name = "colSubSa"; + this.colSubSa.ReadOnly = true; + // + // colNotes + // + this.colNotes.HeaderText = "备注"; + this.colNotes.Name = "colNotes"; + this.colNotes.ReadOnly = true; + // + // colEditNotes + // + this.colEditNotes.HeaderText = "编辑备注"; + this.colEditNotes.Name = "colEditNotes"; + this.colEditNotes.ReadOnly = true; + this.colEditNotes.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colEditNotes.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colEditNotes.Width = 70; + // + // ColDelete + // + this.ColDelete.HeaderText = "删除"; + this.ColDelete.Name = "ColDelete"; + this.ColDelete.ReadOnly = true; + this.ColDelete.Visible = false; + this.ColDelete.Width = 125; + // + // colOpResult + // + this.colOpResult.HeaderText = "操作结果"; + this.colOpResult.Name = "colOpResult"; + this.colOpResult.ReadOnly = true; + this.colOpResult.Width = 150; + // // ProductThirdSelectListManageForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -666,11 +679,11 @@ private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox txtShopId; private System.Windows.Forms.Label label6; - private UserComponent.DataGridViewEx dgvSelectProduct; private System.Windows.Forms.ComboBox cmbStatus; private System.Windows.Forms.Label label8; private UserControls.ButtonEx btnSetSubSa; private UserComponent.UcCheckBox chkNoSubSa; + private UserComponent.DataGridViewEx dgvSelectProduct; private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; @@ -678,6 +691,7 @@ private System.Windows.Forms.DataGridViewLinkColumn colInShop; private System.Windows.Forms.DataGridViewLinkColumn colLogin; private System.Windows.Forms.DataGridViewLinkColumn colImportCookies; + private System.Windows.Forms.DataGridViewLinkColumn colCopyCookies; private System.Windows.Forms.DataGridViewLinkColumn colSpuId; private System.Windows.Forms.DataGridViewLinkColumn colSkcId; private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; @@ -685,9 +699,11 @@ private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat; private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode; private System.Windows.Forms.DataGridViewTextBoxColumn colStatus; - private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId; + private System.Windows.Forms.DataGridViewLinkColumn colDraftId; private System.Windows.Forms.DataGridViewTextBoxColumn colMdyTime; private System.Windows.Forms.DataGridViewTextBoxColumn colSubSa; + private System.Windows.Forms.DataGridViewTextBoxColumn colNotes; + private System.Windows.Forms.DataGridViewLinkColumn colEditNotes; private System.Windows.Forms.DataGridViewLinkColumn ColDelete; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; } diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs index 035a3d7..883a6c2 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs @@ -22,6 +22,7 @@ using System.Threading; using TemuKJD.KJDForms.AdminForms; using TemuKJD.KJDForms.ShopForms; using TemuKJD.KJDForms.ProductSelectForms; +using System.Text.RegularExpressions; namespace TemuKJD.KJDForms.ProductThirdSelectForms { @@ -73,6 +74,8 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms public void SearchDbProdSelect(int page) { + shopLst.Clear(); + if (InvokeRequired) { Invoke(new Action(() => @@ -98,19 +101,13 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms foreach (var prodSelect in lstAdminTemuDBProductSelect) { Image image = null; - try - { - if (!string.IsNullOrEmpty(prodSelect?.main_img)) - { - using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) - { - image = Image.FromStream(stream); - } - } - } - catch (Exception ex) - { - } + string imgUrl = prodSelect?.main_img?.Replace("https", "http"); + string rst = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out rst); + if (!string.IsNullOrEmpty(rst)) + BaseMsgForm.ShowError(rst); + Invoke(new Action(() => { int rowIndex = this.dgvSelectProduct.Rows.Add( @@ -121,6 +118,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms "进店", "登录", "导入Cookies", + "复制Cookies", prodSelect.spu_id, prodSelect.skc_id, image,//prod.main_img, @@ -129,8 +127,10 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms prodSelect.ext_code, prodSelect.status, prodSelect.draft_id, - prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yyyy/MM/dd HH:mm:ss"), + prodSelect.status == "待上传" ? "-" : prodSelect.mdy_time.ToString("yy/MM/dd HH:mm"), prodSelect.operate_sub_sa_name == "" ? "-" : prodSelect.operate_sub_sa_name, + prodSelect.notes, + "编辑", "删除", ""); @@ -223,7 +223,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms return; string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText; var dbId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSelectId"].Value.ParseToString(); - var dbProduct = lstAdminTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == dbId); + var dbSelectProduct = lstAdminTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == dbId); var shopId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString(); var draftId = dgvSelectProduct.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString(); @@ -235,9 +235,9 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms //DeleteProduct(dbId); break; case "编辑备注": - //DbProductEditNotesForm editForm = new DbProductEditNotesForm(dbProduct); - //editForm.ShowDialog(); - //dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes; + ProductSelectEditNotesForm editForm = new ProductSelectEditNotesForm(dbSelectProduct, SetProductSelectNotesType.ThirdProduct); + editForm.ShowDialog(); + dgvSelectProduct.Rows[e.RowIndex].Cells["colNotes"].Value = dbSelectProduct.notes; break; case "认领": //Task.Run(() => { SelectProduct(new TemuDBProduct[] { dbProduct }); }); @@ -245,13 +245,13 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms case "草稿箱Id": if (!string.IsNullOrEmpty(draftId)) { - //var shop = GetShop(shopId); - //AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); - //adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + - // draftId + "&from=productDraftList"; - //adminLoginForm.openType = EnumOpenType.manage; - //adminLoginForm.WindowState = FormWindowState.Maximized; - //adminLoginForm.ShowDialog(); + var shop = GetShop(shopId); + AdminShopLoginForm adminLoginForm = new AdminShopLoginForm(shop); + adminLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" + + draftId + "&from=productDraftList"; + adminLoginForm.openType = EnumOpenType.manage; + adminLoginForm.WindowState = FormWindowState.Maximized; + adminLoginForm.ShowDialog(); } break; case "进店": @@ -283,6 +283,34 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms updateCookieForm.ShowDialog(); } break; + case "复制Cookies": + { + var shop = GetShop(shopId); + string cookJs = ""; + foreach (var shopCook in shop.Cookies.Split(';')) + { + var cookie = shopCook.Trim(); + if (cookie.StartsWith("mc-pc-cookie-captcha-token=")) + continue; + //if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp")) + cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';"; + } + foreach (var shopCook in shop.Cookies.Split(';')) + { + var cookie = shopCook.Trim(); + if (cookie.StartsWith("mc-pc-cookie-captcha-token=")) + continue; + if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp")) + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.kuajingmaihuo.com;';"; + else + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=seller.kuajingmaihuo.com;';"; + } + cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');"; + cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)"; + Clipboard.SetDataObject(cookJs); + BaseMsgForm.ShowInfo("复制成功"); + } + break; case "": dgvSelectProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvSelectProduct.Rows[e.RowIndex].Cells["colSelect"].Value; break; @@ -438,8 +466,17 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms var result = ""; try { - var prodDetailStr = GetHtml.UrlDecode(temuDBProd.product_json); - var productDetail = JsonHelper.DeserializeJsonToObject(prodDetailStr); + var prodDetailJson = GetHtml.UrlDecode(temuDBProd.product_json); + //‌错误原因‌:JSON反序列化时出现Bad JSON escape sequence错误,通常由字符串中包含非法转义字符或特殊字符导致。 + // JSON标准要求反斜杠\后必须紧跟bfrnt/(如\n、\t等),否则会触发异常。 ‌ + //‌解决方案‌:通过正则表达式替换字符串中的非法转义序列。 + //string pattern = @"(\\[^bfrnt\\/'\""])"; //两个\后一个会被转义 + //var prodDetailJsonReplace = Regex.Replace(prodDetailJson, pattern, "\\$1"); + string pattern = @"([^\\])(\\[^bfrnt\\/'\""])"; + var prodDetailJsonReplace = Regex.Replace(prodDetailJson, pattern, "$1\\$2"); + string pattern2 = @"([^\\,:""{\[])(""[^,:""}\]])";//希伯来文中的引号转义在数据库中有时候会丢失,回来发现了给配上\符号 + var prodDetailJsonReplace2 = Regex.Replace(prodDetailJsonReplace, pattern2, "$1\\$2"); + var productDetail = JsonHelper.DeserializeJsonToObject(prodDetailJsonReplace2); result = UploadProduct(shop, productDetail, temuDBProd.size_json); //将商品上传至草稿箱 if (result.Contains("登录过期")) diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx index 2077b2e..d2cf3d7 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.resx @@ -138,6 +138,9 @@ True + + True + True @@ -165,6 +168,12 @@ True + + True + + + True + True diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/UserSelectThirdProductForm.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/UserSelectThirdProductForm.cs index 1332940..7b2f796 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/UserSelectThirdProductForm.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/UserSelectThirdProductForm.cs @@ -223,16 +223,13 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms foreach (var prodSelect in lstTemuDBProductSelect) { Image image = null; - try - { - using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) - { - image = Image.FromStream(stream); - } - } - catch (Exception ex) - { - } + string imgUrl = prodSelect?.main_img?.Replace("https", "http"); + string rst = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out rst); + if (!string.IsNullOrEmpty(rst)) + BaseMsgForm.ShowError(rst); + Invoke(new Action(() => { int rowIndex = this.dgvSelectProduct.Rows.Add( @@ -354,9 +351,6 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms } break; case "编辑备注": - //DbProductEditNotesForm editForm = new DbProductEditNotesForm(dbProduct); - //editForm.ShowDialog(); - //dgvDbProduct.Rows[e.RowIndex].Cells["col_notes"].Value = dbProduct.notes; break; case "草稿箱Id": //if (!string.IsNullOrEmpty(draftId) && shop != null) diff --git a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs index 43b6261..f9b4894 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopListForm.cs @@ -874,6 +874,7 @@ namespace TemuKJD.KJDForms.ShopForms else cookJs += "\r\ndocument.cookie='" + cookie + "; domain=seller.kuajingmaihuo.com;';"; } + cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');"; cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)"; Clipboard.SetDataObject(cookJs); BaseMsgForm.ShowInfo("复制成功"); diff --git a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs index 1f373c9..bc91b17 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs @@ -312,6 +312,16 @@ namespace TemuKJD.KJDForms.ShopForms //cefWebBrowser.Load(shopMainUrl); })); + //根据登录的具体店铺设置local storage + if (!string.IsNullOrEmpty(shop.ShopId)) + { + var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n"; + while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid) + Thread.Sleep(20); + cefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode); + } + + //不是登录的话就此返回 if (openType != EnumOpenType.login) { Invoke(new Action(() => diff --git a/TEMUKJD/MainForm.cs b/TEMUKJD/MainForm.cs index dfa0b90..68b4c05 100644 --- a/TEMUKJD/MainForm.cs +++ b/TEMUKJD/MainForm.cs @@ -46,6 +46,7 @@ namespace TemuKJD public partial class MainForm : BaseForm { public static string sCurrentModule = string.Empty; + public static MainForm instance; private Point mouseOffset;//记录鼠标指针的坐标 private bool isMouseDown;//记录鼠标左键是否按下 @@ -139,6 +140,7 @@ namespace TemuKJD { InitializeComponent(); + instance = this; this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); } diff --git a/Update/Update/MainForm.cs b/Update/Update/MainForm.cs index cafa314..f6613ce 100644 --- a/Update/Update/MainForm.cs +++ b/Update/Update/MainForm.cs @@ -104,26 +104,56 @@ namespace Update Thread.Sleep(10); } + string error = ""; // 替换旧文件 foreach (string filePath in Directory.GetFiles(upTempPath)) { - string fileName = filePath.Substring(filePath.LastIndexOf("\\") + 1); - File.Copy(upTempPath + "\\" + fileName, mainPath + "\\" + fileName, true); - Thread.Sleep(10); + if (!string.IsNullOrEmpty(error)) + break; + try + { + string fileName = filePath.Substring(filePath.LastIndexOf("\\") + 1); + File.Copy(upTempPath + "\\" + fileName, mainPath + "\\" + fileName, true); + Thread.Sleep(10); + } + catch (Exception ex) + { + error = "发生错误:\r\n" + ex.Message + "\r\n请关闭升级窗口重试!"; + Invoke(new Action(() => + { + lblMessage.Text = error; + })); + } } foreach (string dirPath in Directory.GetDirectories(upTempPath)) { - string fileName = dirPath.Substring(dirPath.LastIndexOf("\\") + 1); - CopyDirectory(upTempPath + "\\" + fileName, mainPath + "\\" + fileName); - Thread.Sleep(10); + if (!string.IsNullOrEmpty(error)) + break; + try + { + string fileName = dirPath.Substring(dirPath.LastIndexOf("\\") + 1); + CopyDirectory(upTempPath + "\\" + fileName, mainPath + "\\" + fileName); + Thread.Sleep(10); + } + catch (Exception ex) + { + error = "发生错误:\r\n" + ex.Message + "\r\n请关闭升级窗口重试!"; + Invoke(new Action(() => + { + lblMessage.Text = error; + })); + } } Thread.Sleep(50); Invoke(new Action(() => { - progressBar1.Value = 100; - lblMessage.Text = "升级完成,点击确定重启程序"; - btnOk.Enabled = true; + if (string.IsNullOrEmpty(error)) + { + progressBar1.Value = 100; + lblMessage.Text = "升级完成,点击确定重启程序"; + btnOk.Enabled = true; + } })); } else diff --git a/Update/Update/MainForm.designer.cs b/Update/Update/MainForm.designer.cs index 895b062..5656c39 100644 --- a/Update/Update/MainForm.designer.cs +++ b/Update/Update/MainForm.designer.cs @@ -43,22 +43,25 @@ namespace Update // // lblMessage // - this.lblMessage.Location = new System.Drawing.Point(14, 8); + this.lblMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblMessage.Location = new System.Drawing.Point(14, 33); this.lblMessage.Name = "lblMessage"; - this.lblMessage.Size = new System.Drawing.Size(224, 69); + this.lblMessage.Size = new System.Drawing.Size(327, 98); this.lblMessage.TabIndex = 0; this.lblMessage.Text = "发现新版本,即将为您升级!"; this.lblMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // btnOk // + this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnOk.BackColor = System.Drawing.Color.Blue; this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand; this.btnOk.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnOk.Font = new System.Drawing.Font("微软雅黑", 11F); this.btnOk.ForeColor = System.Drawing.Color.White; - this.btnOk.Location = new System.Drawing.Point(129, 127); + this.btnOk.Location = new System.Drawing.Point(232, 177); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(109, 30); this.btnOk.TabIndex = 9; @@ -74,7 +77,7 @@ namespace Update this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 11F); this.btnCancel.ForeColor = System.Drawing.Color.Blue; - this.btnCancel.Location = new System.Drawing.Point(14, 127); + this.btnCancel.Location = new System.Drawing.Point(14, 177); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(109, 30); this.btnCancel.TabIndex = 10; @@ -89,9 +92,9 @@ namespace Update this.panel1.BackColor = System.Drawing.Color.Blue; this.panel1.Controls.Add(this.btnClose); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; - this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Location = new System.Drawing.Point(2, 2); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(256, 24); + this.panel1.Size = new System.Drawing.Size(355, 24); this.panel1.TabIndex = 11; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); @@ -99,12 +102,13 @@ namespace Update // // btnClose // + this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnClose.Cursor = System.Windows.Forms.Cursors.Hand; this.btnClose.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnClose.Font = new System.Drawing.Font("微软雅黑", 11F); this.btnClose.ForeColor = System.Drawing.Color.White; - this.btnClose.Location = new System.Drawing.Point(238, -5); + this.btnClose.Location = new System.Drawing.Point(339, -5); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(17, 28); this.btnClose.TabIndex = 11; @@ -120,16 +124,19 @@ namespace Update this.panel2.Controls.Add(this.lblMessage); this.panel2.Controls.Add(this.btnOk); this.panel2.Controls.Add(this.btnCancel); - this.panel2.Location = new System.Drawing.Point(2, 24); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(2, 2); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(252, 170); + this.panel2.Size = new System.Drawing.Size(355, 221); this.panel2.TabIndex = 12; // // progressBar1 // - this.progressBar1.Location = new System.Drawing.Point(14, 85); + this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.progressBar1.Location = new System.Drawing.Point(14, 139); this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(224, 23); + this.progressBar1.Size = new System.Drawing.Size(327, 23); this.progressBar1.TabIndex = 11; this.progressBar1.Visible = false; // @@ -137,13 +144,14 @@ namespace Update // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); - this.ClientSize = new System.Drawing.Size(256, 196); + this.ClientSize = new System.Drawing.Size(359, 225); this.Controls.Add(this.panel1); this.Controls.Add(this.panel2); this.Font = new System.Drawing.Font("微软雅黑", 10F); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "MainForm"; + this.Padding = new System.Windows.Forms.Padding(2); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MessageForm"; this.Paint += new System.Windows.Forms.PaintEventHandler(this.MessageForm_Paint);