diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 1137c1a..82d6a23 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 1027; + public static int VersionCount = 1028; //public static int VersionCount = 613; /// diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index 16ab8a0..0bdbae8 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -1,4 +1,5 @@ -using KJD_Web.Model; +using KJD_Web.BLL.WXXD; +using KJD_Web.Model; using KJD_Web.Model.ShopModel; using KJD_Web.Utils; using MySql.Data.MySqlClient; @@ -72,15 +73,37 @@ namespace KJD_Web.BLL.BXX string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); string sql = ""; + + int ban_wx = 0; + int ban_pdd = 0; + if (product_get_type == "厂商直采") + { + if (real_coid != null) + sql = "select ban_wx,ban_pdd from bxx.jst_supplier_ban_platform where coid=" + real_coid; + else if (skc_id != null) + sql = "select ban_wx,ban_pdd from bxx.jst_supplier_ban_platform where coid=" + skc_id; + var dtr = mySql.ExecuteDataTableRow(sql); + if (!string.IsNullOrEmpty(mySql.Message)) + { + mySql.Close(); + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}"; + } + else if (dtr != null) + { + ban_wx = dtr["ban_wx"].ParseToInt(); + ban_pdd = dtr["ban_pdd"].ParseToInt(); + } + } + sql = "insert into "; sql += "bxx.product "; sql += "(from_shop_id,from_shop_name,offline_supplier_id,offline_supplier_name,spu_id,skc_id,real_coid,real_spu_id,main_cat_id,main_cat_name,cat_id," + "cat_name,price_text,product_name,ext_code,main_img,product_json,size_json,notes,product_get_type,sale_count,sale_count_text,special_prod_type," + - "distribution_set,add_time,mdy_time) " + + "distribution_set,ban_wx,ban_pdd,add_time,mdy_time) " + "values ('" + from_shop_id + "','" + from_shop_name + "','" + offline_supplier_id + "','" + offline_supplier_name + "','" + spu_id + "','" + skc_id + "','" + real_coid + "','" + real_spu_id + "','" + main_cat_id + "','" + main_cat_name + "','" + cat_id + "','" + cat_name + "','" + price_text + "','" + product_name + "','" + ext_code + "','" + main_img + "',@product_json,@size_json,'" + notes + "','" + product_get_type + "','" + - sale_count + "','" + sale_count_text + "','" + special_prod_type + "'," + distribution_set.ParseToInt() + ",'" + + sale_count + "','" + sale_count_text + "','" + special_prod_type + "'," + distribution_set.ParseToInt() + "," + ban_wx + "," + ban_pdd + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');"; @@ -477,6 +500,8 @@ namespace KJD_Web.BLL.BXX var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation")?.Replace("'", "\\'"); var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'"); var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'"); + var ban_wx = RegexUtils.GetStringQuery(ref inputData, "ban_wx")?.Replace("'", "\\'"); + var ban_pdd = RegexUtils.GetStringQuery(ref inputData, "ban_pdd")?.Replace("'", "\\'"); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -486,9 +511,13 @@ namespace KJD_Web.BLL.BXX List paramLst = new List(); - string sql = "select count(*) from bxx.product p FORCE INDEX (f_wx_safe_status) where p.is_del=0"; + string sql = " select count(*) from bxx.product p " + + " FORCE INDEX (f_wx_safe_status) " + + //" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" + + " WHERE p.is_del=0"; string where = ""; + //where += " AND (b.ban_wx IS NULL OR b.ban_wx=0)"; if (!string.IsNullOrEmpty(from_shop_id)) where += " and p.from_shop_id ='" + from_shop_id + "'"; if (!string.IsNullOrEmpty(from_shop_name)) @@ -621,6 +650,14 @@ namespace KJD_Web.BLL.BXX { where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'"; } + if (ban_wx != null) + { + where += " and p.ban_wx=" + ban_wx; + } + if (ban_pdd != null) + { + where += " and p.ban_pdd=" + ban_pdd; + } sql += where; var count = 0; @@ -637,9 +674,10 @@ namespace KJD_Web.BLL.BXX else { if (isDetail) - sql = "select p.*,s.img_base64,s.img_url,e.ext_code_price from bxx.product p" + - " left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" + + sql = " SELECT p.*,s.img_base64,s.img_url,e.ext_code_price from bxx.product p" + + " LEFT JOIN bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" + " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" + + //" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" + " where p.is_del=0"; else if (string.IsNullOrEmpty(get_select_count)) sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name," + @@ -648,8 +686,9 @@ namespace KJD_Web.BLL.BXX " p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," + " s.img_url,e.ext_code_price" + " FROM bxx.product p " + - " left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" + + " LEFT JOIN bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" + " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" + + //" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" + " where p.is_del=0"; else sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name," + @@ -657,8 +696,10 @@ namespace KJD_Web.BLL.BXX " p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," + " p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," + " s.img_url,COUNT(se.id) AS select_count,e.ext_code_price" + - " FROM bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " + + " FROM bxx.product p" + + " LEFT JOIN bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " + " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" + + //" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" + " WHERE p.is_del=0"; //where子句 @@ -1389,6 +1430,8 @@ namespace KJD_Web.BLL.BXX var add_days_less = RegexUtils.GetStringQuery(ref inputData, "add_days_less").ParseToNullableInt(); var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'"); var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation").ParseToNullableInt(); + var ban_wx = RegexUtils.GetStringQuery(ref inputData, "ban_wx")?.Replace("'", "\\'"); + var ban_pdd = RegexUtils.GetStringQuery(ref inputData, "ban_pdd")?.Replace("'", "\\'"); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -1396,9 +1439,14 @@ namespace KJD_Web.BLL.BXX string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); - string sql = "select count(*) from bxx.product p FORCE INDEX (f_wx_safe_status) where p.is_del=0"; + string sql = " SELECT count(*)" + + " FROM bxx.product p" + + " FORCE INDEX (f_wx_safe_status)" + + //" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" + + " WHERE p.is_del=0"; string where = ""; + //where += " AND (b.ban_wx IS NULL OR b.ban_wx=0)"; if (!string.IsNullOrEmpty(in_ext_codes)) { in_ext_codes = "'" + string.Join("','", in_ext_codes.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'"; @@ -1466,11 +1514,19 @@ namespace KJD_Web.BLL.BXX { where += " and is_relation = " + is_relation; } + if (ban_wx != null) + { + where += " and p.ban_wx=" + ban_wx; + } + if (ban_pdd != null) + { + where += " and p.ban_pdd=" + ban_pdd; + } sql += where; int count = prod_count; - if (product_get_type == "厂商直采" && count > 1250) - count = (count / 2.5).ParseToInt(); + if (product_get_type == "厂商直采" && count > 1000) + count = (count / 2.0).ParseToInt(); if (!is_not_count) { count = mySql.ExecuteRowCount(sql); @@ -1484,8 +1540,10 @@ namespace KJD_Web.BLL.BXX } else { - sql = "select p.id" + - " from bxx.product p where p.is_del=0"; + sql = " SELECT p.id" + + " FROM bxx.product p" + + //" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid OR p.real_coid=b.coid)" + + " WHERE p.is_del=0"; //where子句 sql += where; @@ -1504,7 +1562,7 @@ namespace KJD_Web.BLL.BXX } var db_ids = string.Join(",", dt.Rows.Cast().Select(r => r["id"].ParseToInt()).OrderBy(x => RandomUtils.GetId(10000000)).Take(page_size)); - sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," + + sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," + " p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.product_get_type," + " p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3,p.send_to_out_server," + " p.wx_cat_leaf,p.is_relation" + @@ -1563,7 +1621,7 @@ namespace KJD_Web.BLL.BXX var data = JsonUtils.SerializeObjectToString(productLst, jsonSetting); var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000"); if (product_get_type == "厂商直采" && count > 500) - count = (count * 2.5).ParseToInt(); + count = (count * 2.0).ParseToInt(); return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}"; } catch (Exception ex) @@ -3201,6 +3259,265 @@ namespace KJD_Web.BLL.BXX } return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + + public string AddMdyJstProductBan(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"校验失败\"}"; + + // 软件用户名 + string coid = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "coid"))?.Replace("'", "\\'"); + int? ban_wx = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ban_wx"))?.ParseToNullableInt(); + int? ban_pdd = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ban_pdd"))?.ParseToNullableInt(); + // 收件人 + string user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "receiver"))?.Replace("'", "\\'"); + if (string.IsNullOrEmpty(coid)) + return "{\"code\":500,\"msg\":\"缺少供应商编号\"}"; + if (ban_wx == null) + return "{\"code\":500,\"msg\":\"缺少设置值\"}"; + if (ban_pdd == null) + return "{\"code\":500,\"msg\":\"缺少设置值\"}"; + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn, true); + + string sql = "SELECT 1 FROM `bxx`.`jst_supplier_ban_platform` where coid='" + coid + "'"; + string where = ""; + sql += where; + var exist = mySql.ExecuteFirstInt(sql); + if (!mySql.Message.IsNullOrEmpty()) + { + mySql.RollBack(); + mySql.Close(); + return "{\"code\":501,\"msg\":\"" + mySql.Message + "\"}"; + } + + if (exist == 0) + { + sql = " INSERT INTO `bxx`.`jst_supplier_ban_platform` (coid,ban_wx,ban_pdd)" + + " VALUES (@coid,@ban_wx,@ban_pdd);"; + } + else + { + sql = "UPDATE `bxx`.`jst_supplier_ban_platform` SET "; + if (ban_wx != null) + sql += " ban_wx=@ban_wx,"; + if (ban_pdd != null) + sql += " ban_pdd=@ban_pdd,"; + sql = sql.TrimEnd(','); + sql += " WHERE coid=@coid;"; + } + + List paramLst = new List(); + paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "coid", Value = coid, }); + paramLst.Add(new MySqlParameter() { DbType = DbType.Int16, ParameterName = "ban_wx", Value = ban_wx, }); + paramLst.Add(new MySqlParameter() { DbType = DbType.Int16, ParameterName = "ban_pdd", Value = ban_pdd, }); + var rowCnt = mySql.ExecuteAffectedRows(sql, paramLst.ToArray()); + if (!string.IsNullOrEmpty(mySql.Message)) + { + mySql.RollBack(); + mySql.Close(); + return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}"; + } + + sql = "UPDATE `bxx`.`product` SET "; + if (ban_wx != null) + sql += " ban_wx=@ban_wx,"; + if (ban_pdd != null) + sql += " ban_pdd=@ban_pdd,"; + sql = sql.TrimEnd(','); + sql += " WHERE (real_coid=@coid or skc_id=@coid) AND product_get_type='厂商直采';"; + rowCnt = mySql.ExecuteAffectedRows(sql, paramLst.ToArray()); + if (!string.IsNullOrEmpty(mySql.Message)) + { + mySql.RollBack(); + mySql.Close(); + return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}"; + } + + mySql.Commit(); + mySql.Close(); + return "{\"code\":200,\"msg\":\"success\",\"data\":\"\"}"; + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + + public string GetJstProductCoidList(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + var timeCalc = DateTime.Now; + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"校验失败\"}"; + + int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); + int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200); + string coids = RegexUtils.GetStringQuery(ref inputData, "coids")?.Replace("'", "\\'"); + string not_count = RegexUtils.GetStringQuery(ref inputData, "not_count")?.Replace("'", "\\'"); + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + + string sql = ""; + var count = -1; + + //sql = " SELECT COUNT(*) FROM" + + // " (SELECT skc_id as coid FROM bxx.product WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM bxx.product WHERE product_get_type='厂商直采') as coids" + + // " WHERE 1=1 AND coids.coid != ''"; + sql = "select count(*) FROM (SELECT DISTINCT coids.*,a.after_sale_json,p.from_shop_name,b.ban_wx,b.ban_pdd" + + " FROM (SELECT skc_id as coid FROM bxx.product WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM bxx.product WHERE product_get_type='厂商直采') as coids" + + " LEFT JOIN wxxd.after_sale as a ON coids.coid=a.coid AND a.is_del = 0" + + " LEFT JOIN bxx.product p ON coids.coid=p.skc_id" + + " LEFT JOIN bxx.jst_supplier_ban_platform b ON coids.coid=b.coid" + + " WHERE 1=1 AND coids.coid != ''"; + string where = ""; + if (coids != null) + where += " AND coids.coid IN ('" + coids.Replace(",", "','") + "')"; + sql += where; + sql += ") as cnt"; + sql += ";"; + + if (not_count != "true") + count = mySql.ExecuteRowCount(sql); + + DataTable dt; + if (count == 0) + { + dt = new DataTable(); + } + else + { + sql = " SELECT DISTINCT coids.*,a.after_sale_json,p.from_shop_name,b.ban_wx,b.ban_pdd" + + " FROM (SELECT skc_id as coid FROM bxx.product WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM bxx.product WHERE product_get_type='厂商直采') as coids" + + " LEFT JOIN wxxd.after_sale as a ON coids.coid=a.coid AND a.is_del = 0" + + " LEFT JOIN bxx.product p ON coids.coid=p.skc_id" + + " LEFT JOIN bxx.jst_supplier_ban_platform b ON coids.coid=b.coid" + + " WHERE 1=1 AND coids.coid != ''"; + sql += where; + //sql += " ORDER BY coid DESC"; + //sql += " ORDER BY coid ASC"; + sql += " LIMIT " + Math.Max(0, page - 1) * page_size + "," + page_size + ";"; + dt = mySql.ExecuteDataTable(sql); + if (!string.IsNullOrEmpty(mySql.Message)) + { + mySql.Close(); + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + } + mySql.Close(); + + if (dt != null) + { + try + { + List coidLst = new List(); + foreach (DataRow row in dt.Rows) + { + var jObj = new JObject(); + var afterSaleJson = row["after_sale_json"].ParseToString(); + var supplier_name = row["from_shop_name"].ParseToString(); + if (string.IsNullOrEmpty(supplier_name)) + supplier_name = RegexUtils.GetStringJson(ref afterSaleJson, "name"); + coidLst.Add(jObj); + jObj["coid"] = row["coid"].ParseToString(); + jObj["supplier_name"] = supplier_name; + jObj["ban_wx"] = row["ban_wx"].ParseToInt(); + jObj["ban_pdd"] = row["ban_pdd"].ParseToInt(); + } + JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; + var data = JsonUtils.SerializeObjectToString(coidLst, jsonSetting); + var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000"); + return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}"; + } + catch (Exception ex) + { + return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + } + else + { + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + + public string GetJstProductBanPlatformList(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + var timeCalc = DateTime.Now; + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"校验失败\"}"; + + int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); + int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200); + string coids = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'"); + string not_count = RegexUtils.GetStringQuery(ref inputData, "not_count")?.Replace("'", "\\'"); + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + + string sql = ""; + var count = -1; + + sql = "SELECT count(*) FROM `bxx`.`jst_supplier_ban_platform` where 1=1"; + string where = ""; + if (coids != null) + where += " AND coid IN ('" + coids.Replace(",", "','") + "')"; + sql += where; + sql += ";"; + + if (not_count != "true") + count = mySql.ExecuteRowCount(sql); + + DataTable dt; + if (count == 0) + { + dt = new DataTable(); + } + else + { + sql = "SELECT * FROM `bxx`.`jst_supplier_ban_platform` WHERE 1=1"; + sql += where; + sql += " ORDER BY id DESC LIMIT " + Math.Max(0, page - 1) * page_size + "," + page_size + ";"; + dt = mySql.ExecuteDataTable(sql); + } + mySql.Close(); + + if (dt != null) + { + try + { + List supplierBanPlatformLst = new List(); + foreach (DataRow row in dt.Rows) + { + var jObj = new JObject(); + supplierBanPlatformLst.Add(jObj); + jObj["id"] = row["id"].ParseToInt(); + jObj["coid"] = row["coid"].ParseToString(); + jObj["ban_wx"] = row["ban_wx"].ParseToInt(); + jObj["ban_pdd"] = row["ban_pdd"].ParseToInt(); + } + JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; + var data = JsonUtils.SerializeObjectToString(supplierBanPlatformLst, jsonSetting); + var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000"); + return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}"; + } + catch (Exception ex) + { + return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + } + else + { + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } } } diff --git a/KJDService/KJD_WebService/BLL/WXXD/WXShopManage.cs b/KJDService/KJD_WebService/BLL/WXXD/WXShopManage.cs index e1327b5..2131e42 100644 --- a/KJDService/KJD_WebService/BLL/WXXD/WXShopManage.cs +++ b/KJDService/KJD_WebService/BLL/WXXD/WXShopManage.cs @@ -804,15 +804,15 @@ namespace KJD_Web.BLL.WXXD string tel_number = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "tel_number"))?.Replace("'", "\\'"); // 收件人 string user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "receiver"))?.Replace("'", "\\'"); - if (string.IsNullOrEmpty("user_id")) + if (string.IsNullOrEmpty(user_id)) return "{\"code\":500,\"msg\":\"缺少用户编号\"}"; - if (string.IsNullOrEmpty("after_sale_json")) + if (string.IsNullOrEmpty(shop_id)) return "{\"code\":500,\"msg\":\"缺少店铺编号\"}"; - if (string.IsNullOrEmpty("province_name") || string.IsNullOrEmpty("city_name") || string.IsNullOrEmpty("county_name") || string.IsNullOrEmpty("detail_info")) + if (string.IsNullOrEmpty(province_name) || string.IsNullOrEmpty(city_name) || string.IsNullOrEmpty(county_name) || string.IsNullOrEmpty(detail_info)) return "{\"code\":500,\"msg\":\"省市区或详细地址不完整\"}"; - if (string.IsNullOrEmpty("user_name")) + if (string.IsNullOrEmpty(user_name)) return "{\"code\":500,\"msg\":\"缺少收件人\"}"; - if (string.IsNullOrEmpty("tel_number")) + if (string.IsNullOrEmpty(tel_number)) return "{\"code\":500,\"msg\":\"缺少收件人电话\"}"; string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; diff --git a/KJDService/KJD_WebService/BXXProductService.asmx.cs b/KJDService/KJD_WebService/BXXProductService.asmx.cs index f948978..52fd8d9 100644 --- a/KJDService/KJD_WebService/BXXProductService.asmx.cs +++ b/KJDService/KJD_WebService/BXXProductService.asmx.cs @@ -568,5 +568,40 @@ namespace KJD_Web Context.Response.Write(result); Context.Response.End(); } + + [WebMethod] + public void add_mdy_jst_product_ban() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXProductManage().AddMdyJstProductBan(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + [WebMethod] + public void get_jst_product_coid_list() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXProductManage().GetJstProductCoidList(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + [WebMethod] + public void get_jst_product_ban_platform_list() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXProductManage().GetJstProductBanPlatformList(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + //GetJstProductCoidList } } diff --git a/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.Designer.cs index 38ccf9a..4bced86 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.Designer.cs @@ -29,6 +29,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -36,6 +37,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(JstBanPlatformForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.chkBanPdd = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.chkBanWx = new TemuKJD.UserComponent.UcCheckBox(this.components); + this.btnSetBan = new DevComponents.DotNetBar.PanelEx(); this.txtCoid = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.btnEmpty = new DevComponents.DotNetBar.PanelEx(); @@ -74,6 +78,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.chkBanPdd); + this.splitContainer1.Panel1.Controls.Add(this.chkBanWx); + this.splitContainer1.Panel1.Controls.Add(this.btnSetBan); this.splitContainer1.Panel1.Controls.Add(this.txtCoid); this.splitContainer1.Panel1.Controls.Add(this.label7); this.splitContainer1.Panel1.Controls.Add(this.btnEmpty); @@ -83,13 +90,56 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); this.splitContainer1.Size = new System.Drawing.Size(1438, 686); - this.splitContainer1.SplitterDistance = 110; + this.splitContainer1.SplitterDistance = 69; this.splitContainer1.TabIndex = 1; // + // chkBanPdd + // + this.chkBanPdd.AutoSize = true; + this.chkBanPdd.Location = new System.Drawing.Point(668, 24); + this.chkBanPdd.Name = "chkBanPdd"; + this.chkBanPdd.Size = new System.Drawing.Size(87, 21); + this.chkBanPdd.TabIndex = 1041; + this.chkBanPdd.Text = "拼多多禁售"; + this.chkBanPdd.UseVisualStyleBackColor = true; + // + // chkBanWx + // + this.chkBanWx.AutoSize = true; + this.chkBanWx.Location = new System.Drawing.Point(588, 24); + this.chkBanWx.Name = "chkBanWx"; + this.chkBanWx.Size = new System.Drawing.Size(75, 21); + this.chkBanWx.TabIndex = 1040; + this.chkBanWx.Text = "微信禁售"; + this.chkBanWx.UseVisualStyleBackColor = true; + // + // btnSetBan + // + this.btnSetBan.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSetBan.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSetBan.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSetBan.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSetBan.Location = new System.Drawing.Point(760, 23); + this.btnSetBan.Name = "btnSetBan"; + this.btnSetBan.Size = new System.Drawing.Size(103, 23); + this.btnSetBan.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSetBan.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSetBan.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSetBan.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSetBan.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSetBan.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSetBan.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSetBan.Style.GradientAngle = 90; + this.btnSetBan.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSetBan.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSetBan.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSetBan.TabIndex = 1039; + this.btnSetBan.Text = "批量设置禁售"; + this.btnSetBan.Click += new System.EventHandler(this.btnSetBan_Click); + // // txtCoid // - this.txtCoid.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtCoid.Location = new System.Drawing.Point(102, 22); + this.txtCoid.Location = new System.Drawing.Point(102, 21); this.txtCoid.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.txtCoid.Name = "txtCoid"; this.txtCoid.Size = new System.Drawing.Size(243, 23); @@ -97,9 +147,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // label7 // - this.label7.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(31, 25); + this.label7.Location = new System.Drawing.Point(31, 24); this.label7.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(81, 17); @@ -108,11 +157,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // btnEmpty // - this.btnEmpty.Anchor = System.Windows.Forms.AnchorStyles.Left; this.btnEmpty.CanvasColor = System.Drawing.SystemColors.Control; this.btnEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnEmpty.DisabledBackColor = System.Drawing.Color.Empty; - this.btnEmpty.Location = new System.Drawing.Point(403, 22); + this.btnEmpty.Location = new System.Drawing.Point(403, 21); this.btnEmpty.Name = "btnEmpty"; this.btnEmpty.Size = new System.Drawing.Size(46, 23); this.btnEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -133,12 +181,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // btnSearchCoid // - this.btnSearchCoid.Anchor = System.Windows.Forms.AnchorStyles.Left; this.btnSearchCoid.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnSearchCoid.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSearchCoid.DisabledBackColor = System.Drawing.Color.Empty; this.btnSearchCoid.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSearchCoid.Location = new System.Drawing.Point(351, 22); + this.btnSearchCoid.Location = new System.Drawing.Point(351, 21); this.btnSearchCoid.Name = "btnSearchCoid"; this.btnSearchCoid.Size = new System.Drawing.Size(46, 23); this.btnSearchCoid.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -174,15 +221,15 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1); this.splitContainer2.Panel2.Controls.Add(this.statusBar); - this.splitContainer2.Size = new System.Drawing.Size(1438, 572); - this.splitContainer2.SplitterDistance = 543; + this.splitContainer2.Size = new System.Drawing.Size(1438, 613); + this.splitContainer2.SplitterDistance = 584; this.splitContainer2.TabIndex = 0; // // pbLoading // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(694, 246); + this.pbLoading.Location = new System.Drawing.Point(694, 267); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -221,7 +268,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.dgvBanPlatform.Name = "dgvBanPlatform"; this.dgvBanPlatform.ReadOnly = true; this.dgvBanPlatform.RowTemplate.Height = 23; - this.dgvBanPlatform.Size = new System.Drawing.Size(1430, 543); + this.dgvBanPlatform.Size = new System.Drawing.Size(1430, 584); this.dgvBanPlatform.TabIndex = 6; this.dgvBanPlatform.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellClick); this.dgvBanPlatform.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellContentClick); @@ -349,5 +396,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.DataGridViewTextBoxColumn colBanWx; private System.Windows.Forms.DataGridViewTextBoxColumn colBanPdd; private System.Windows.Forms.DataGridViewTextBoxColumn colOpreateResult; + private UserComponent.UcCheckBox chkBanPdd; + private UserComponent.UcCheckBox chkBanWx; + private DevComponents.DotNetBar.PanelEx btnSetBan; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.cs index 5dc9baf..f2a2fe5 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/JstBanPlatformForm.cs @@ -36,7 +36,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms ShopLoginInfo shop = null; public CancellationTokenSource cancellationTokenSource { get; set; } = new CancellationTokenSource(); - ConcurrentList lstTemuDbProduct = new ConcurrentList(); + ConcurrentList lstBanPlatformInfo = new ConcurrentList(); ConcurrentList lstTitleReplaceText = new ConcurrentList(); public JstBanPlatformForm() @@ -72,14 +72,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms { this.pbLoading.Visible = true; this.dgvBanPlatform.Rows.Clear(); - lstTemuDbProduct.Clear(); + lstBanPlatformInfo.Clear(); })); } else { this.pbLoading.Visible = true; this.dgvBanPlatform.Rows.Clear(); - lstTemuDbProduct.Clear(); + lstBanPlatformInfo.Clear(); } Task.Run(() => { @@ -87,28 +87,29 @@ namespace TemuKJD.PDDForms.ProductSelectForms int pageSize = 100; decimal seconds; Invoke(new Action(() => { pageSize = this.ucSplitPage1.PageSize; })); - var list = GetProductList(out pageCount, out seconds, page, pageSize); - lstTemuDbProduct.AddRange(list); + var list = GetCoidNameList(out pageCount, out seconds, page, pageSize); + lstBanPlatformInfo.AddRange(list); this.ucSplitPage1.TotalPage = pageCount; - // 获取Bitmap的Graphics对象 - foreach (var prod in lstTemuDbProduct) + foreach (var banInfo in lstBanPlatformInfo) { Invoke(new Action(() => { int rowIndex = this.dgvBanPlatform.Rows.Add( false, - prod.id, - prod.from_shop_id, - prod.from_shop_name, - prod.product_name, - prod.sku_img_replace_url, - DataGridViewExtension.defaultBitmap, - (prod.spu_id).Trim(), - prod.skc_id - ); + //banInfo.id, + banInfo.coid, + banInfo.supplier_name, + banInfo.ban_wx == 1 ? "是" : "否", + banInfo.ban_pdd == 1 ? "是" : "否", + "" + ); - dgvBanPlatform.Rows[rowIndex].Height = 50; + var row = dgvBanPlatform.Rows[rowIndex]; + row.Height = 50; + + row.Cells["colBanWx"].Style.BackColor = banInfo.ban_wx == 1 ? Color.Yellow : row.Cells["colCoid"].Style.BackColor; + row.Cells["colBanPdd"].Style.BackColor = banInfo.ban_pdd == 1 ? Color.Yellow : row.Cells["colCoid"].Style.BackColor; })); } @@ -123,20 +124,21 @@ namespace TemuKJD.PDDForms.ProductSelectForms }); } - public List GetProductList(out int pageCount, out decimal seconds, int page = 1, int pageSize = 200) + public List GetCoidNameList(out int pageCount, out decimal seconds, int page = 1, int pageSize = 200) { - List list = new List(); + List list = new List(); pageCount = 1; seconds = 0; - var url = BaseClass.BuildPDDObjString("product/get_ban_platform_list"); + var url = BaseClass.BuildPDDObjString("product/get_jst_product_coid_list"); var data = ""; Invoke(new Action(() => { data = UserLogin.GetSignaturex() + "&page=" + page + - "&page_size=" + pageSize + - "&coids=" + txtCoid.Text.Trim(); + "&page_size=" + pageSize; + if (!string.IsNullOrEmpty(txtCoid.Text.Trim())) + data += "&coids=" + txtCoid.Text.Trim(); })); var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -164,12 +166,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms try { - list = JsonHelper.DeserializeJsonToList(sProd); + list = JsonHelper.DeserializeJsonToList(sProd); return list; } catch (Exception ex) { - return new List(); + return new List(); } } @@ -200,8 +202,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms if (e.ColumnIndex < 0 || e.RowIndex < 0) return; string headerText = dgvBanPlatform.Columns[e.ColumnIndex].HeaderText; - var dbId = dgvBanPlatform.Rows[e.RowIndex].Cells["col_db_id"].Value.ParseToString(); - var dbProduct = lstTemuDbProduct.FirstOrDefault(p => p.id.ToString() == dbId); + var coid = dgvBanPlatform.Rows[e.RowIndex].Cells["colCoid"].Value.ParseToString(); + var banInfo = lstBanPlatformInfo.FirstOrDefault(p => p.coid == coid); switch (headerText) { @@ -218,30 +220,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms if (e.ColumnIndex < 0 || e.RowIndex < 0) return; string headerText = dgvBanPlatform.Columns[e.ColumnIndex].HeaderText; - var dbId = dgvBanPlatform.Rows[e.RowIndex].Cells["col_db_id"].Value.ParseToString(); - var dbProduct = lstTemuDbProduct.FirstOrDefault(p => p.id.ToString() == dbId); + var coid = dgvBanPlatform.Rows[e.RowIndex].Cells["colCoid"].Value.ParseToString(); + var banInfo = lstBanPlatformInfo.FirstOrDefault(p => p.coid == coid); switch (headerText) { - case "资料编码/真实上家": - try - { - string url = ""; - if (string.IsNullOrEmpty(dbProduct.real_spu_id) || string.IsNullOrEmpty(dbProduct.real_coid)) - url = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + dbProduct.spu_id + "?itemCoId=" + dbProduct.skc_id + "&noBack=true"; - else - url = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + dbProduct.real_spu_id + "?itemCoId=" + dbProduct.real_coid + "&noBack=true"; - Process.Start(new ProcessStartInfo(url) - { - UseShellExecute = true - }); - } - catch - { - // 可能需要手动指定浏览器路径 - Process.Start(new ProcessStartInfo("https://www.baidu.com") { UseShellExecute = true }); - } - break; case "": dgvBanPlatform.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvBanPlatform.Rows[e.RowIndex].Cells["colSelect"].Value; break; @@ -252,24 +235,24 @@ namespace TemuKJD.PDDForms.ProductSelectForms private void DeleteProduct(string dbId, bool isUpdate = true) { - var url = BaseClass.BuildPDDObjString("product/del_db_product"); - var data = UserLogin.GetSignaturex() + - "&db_id=" + dbId; - 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")); - return; - } - else - { - if (isUpdate) - SearchBanPlatForm(this.ucSplitPage1.CurrentPage); - } + //var url = BaseClass.BuildPDDObjString("product/del_db_product"); + //var data = UserLogin.GetSignaturex() + + // "&db_id=" + dbId; + //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")); + // return; + //} + //else + //{ + // if (isUpdate) + // SearchBanPlatForm(this.ucSplitPage1.CurrentPage); + //} } private void dgvDbProduct_Scroll(object sender, ScrollEventArgs e) @@ -305,5 +288,78 @@ namespace TemuKJD.PDDForms.ProductSelectForms //} } + private void btnSetBan_Click(object sender, EventArgs e) + { + var banCoids = this.dgvBanPlatform.Rows.Cast().Where(s=>s.Cells["colSelect"].Value.ParseToBool() == true) + .Select(s => s.Cells["colCoid"].Value.ParseToString()).Distinct().ToList(); + if (banCoids.Count == 0) + { + BaseMsgForm.ShowError("请选择供应商"); + return; + } + + this.pbLoading.Visible = true; + Task.Run(() => + { + foreach (var coid in banCoids) + { + var BanWx = chkBanWx.Checked ? 1 : 0; + var BanPdd = chkBanPdd.Checked ? 1 : 0; + + var url = BaseClass.BuildPDDObjString("product/add_mdy_jst_product_ban"); + var data = ""; + Invoke(new Action(() => + { + data = UserLogin.GetSignaturex() + + "&coid=" + coid + + "&ban_wx=" + BanWx + + "&ban_pdd=" + BanPdd; + })); + 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")) + { + Invoke(new Action(() => + { + var rows = this.dgvBanPlatform.Rows.Cast().Where(r => r.Cells["colCoid"].Value.ParseToString() == coid); + foreach (var row in rows) + { + row.Cells["colOpreateResult"].Value = "设置失败 " + BaseRegex.GetStringJson(ref html, "msg"); + } + })); + } + else + { + Invoke(new Action(() => + { + var rows = this.dgvBanPlatform.Rows.Cast().Where(r => r.Cells["colCoid"].Value.ParseToString() == coid); + foreach (var row in rows) + { + row.Cells["colOpreateResult"].Value = "设置成功"; + row.Cells["colBanWx"].Value = BanWx == 1 ? "是" : "否"; + row.Cells["colBanPdd"].Value = BanPdd == 1 ? "是" : "否"; + row.Cells["colBanWx"].Style.BackColor = BanWx == 1 ? Color.Yellow : row.Cells["colCoid"].Style.BackColor; + row.Cells["colBanPdd"].Style.BackColor = BanPdd == 1 ? Color.Yellow : row.Cells["colCoid"].Style.BackColor; + } + })); + } + } + Invoke(new Action(() => + { + pbLoading.Visible = false; + })); + }); + } } + + public class BanPlatformInfo + { + public int id { get; set; } + public string coid { get; set; } + public string supplier_name { get; set; } + public int ban_wx { get; set; } + public int ban_pdd { get; set; } + } + } diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs index d59a893..ccfd99b 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs @@ -772,7 +772,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "", "是", "否"}); - this.cmbPddRelation.Location = new System.Drawing.Point(743, 7); + this.cmbPddRelation.Location = new System.Drawing.Point(743, 5); this.cmbPddRelation.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbPddRelation.Name = "cmbPddRelation"; this.cmbPddRelation.Size = new System.Drawing.Size(47, 25); @@ -827,7 +827,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbCat2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbCat2.FormattingEnabled = true; - this.cmbCat2.Location = new System.Drawing.Point(278, 75); + this.cmbCat2.Location = new System.Drawing.Point(278, 77); this.cmbCat2.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbCat2.Name = "cmbCat2"; this.cmbCat2.Size = new System.Drawing.Size(46, 25); @@ -912,7 +912,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "机会商品", "以图搜品", "外部数据"}); - this.cmbSourceType.Location = new System.Drawing.Point(278, 40); + this.cmbSourceType.Location = new System.Drawing.Point(278, 42); this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbSourceType.Name = "cmbSourceType"; this.cmbSourceType.Size = new System.Drawing.Size(46, 25); @@ -958,7 +958,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "", "是", "否"}); - this.cmbWxCat.Location = new System.Drawing.Point(622, 5); + this.cmbWxCat.Location = new System.Drawing.Point(622, 7); this.cmbWxCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbWxCat.Name = "cmbWxCat"; this.cmbWxCat.Size = new System.Drawing.Size(47, 25); @@ -980,7 +980,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.cmbSort.Items.AddRange(new object[] { "入库时间", "认领总数"}); - this.cmbSort.Location = new System.Drawing.Point(381, 40); + this.cmbSort.Location = new System.Drawing.Point(381, 42); this.cmbSort.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbSort.Name = "cmbSort"; this.cmbSort.Size = new System.Drawing.Size(46, 25); @@ -1056,7 +1056,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbGroupFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbGroupFilter.FormattingEnabled = true; - this.cmbGroupFilter.Location = new System.Drawing.Point(175, 40); + this.cmbGroupFilter.Location = new System.Drawing.Point(175, 42); this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbGroupFilter.Name = "cmbGroupFilter"; this.cmbGroupFilter.Size = new System.Drawing.Size(46, 25); @@ -1071,7 +1071,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "是", "否", "导出未拉回"}); - this.cmbExportToOutServer.Location = new System.Drawing.Point(622, 40); + this.cmbExportToOutServer.Location = new System.Drawing.Point(622, 42); this.cmbExportToOutServer.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbExportToOutServer.Name = "cmbExportToOutServer"; this.cmbExportToOutServer.Size = new System.Drawing.Size(47, 25); @@ -1107,7 +1107,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "安全商品", "违规商品", "未校验"}); - this.cmbWxSafe.Location = new System.Drawing.Point(501, 40); + this.cmbWxSafe.Location = new System.Drawing.Point(501, 42); this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbWxSafe.Name = "cmbWxSafe"; this.cmbWxSafe.Size = new System.Drawing.Size(47, 25); @@ -1149,7 +1149,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbCat1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbCat1.FormattingEnabled = true; - this.cmbCat1.Location = new System.Drawing.Point(175, 75); + this.cmbCat1.Location = new System.Drawing.Point(175, 77); this.cmbCat1.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbCat1.Name = "cmbCat1"; this.cmbCat1.Size = new System.Drawing.Size(46, 25); @@ -1171,7 +1171,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbCat3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbCat3.FormattingEnabled = true; - this.cmbCat3.Location = new System.Drawing.Point(381, 75); + this.cmbCat3.Location = new System.Drawing.Point(381, 77); this.cmbCat3.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbCat3.Name = "cmbCat3"; this.cmbCat3.Size = new System.Drawing.Size(46, 25); @@ -1268,7 +1268,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "是", "否", "修复回传未拉回"}); - this.cmbHasReturn.Location = new System.Drawing.Point(743, 40); + this.cmbHasReturn.Location = new System.Drawing.Point(743, 42); this.cmbHasReturn.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbHasReturn.Name = "cmbHasReturn"; this.cmbHasReturn.Size = new System.Drawing.Size(47, 25); diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs b/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs index cae3cfb..8aeef02 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminForm.Designer.cs @@ -36,9 +36,10 @@ System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("1688厂家采集"); System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("随机厂商商品"); System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("地址管理"); - System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("图片工具"); - System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("运单管理"); - System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] { + System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("设置禁售"); + System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("图片工具"); + System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("运单管理"); + System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] { treeNode1, treeNode2, treeNode3, @@ -48,7 +49,8 @@ treeNode7, treeNode8, treeNode9, - treeNode10}); + treeNode10, + treeNode11}); this.panel1 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); @@ -155,14 +157,16 @@ treeNode7.Text = "随机厂商商品"; treeNode8.Name = "地址管理"; treeNode8.Text = "地址管理"; - treeNode9.Name = "图片工具"; - treeNode9.Text = "图片工具"; - treeNode10.Name = "运单管理"; - treeNode10.Text = "运单管理"; - treeNode11.Name = "超级权限管理"; - treeNode11.Text = "超级权限管理"; + treeNode9.Name = "设置禁售"; + treeNode9.Text = "设置禁售"; + treeNode10.Name = "图片工具"; + treeNode10.Text = "图片工具"; + treeNode11.Name = "运单管理"; + treeNode11.Text = "运单管理"; + treeNode12.Name = "超级权限管理"; + treeNode12.Text = "超级权限管理"; this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode11}); + treeNode12}); this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); this.tv.Size = new System.Drawing.Size(140, 446); this.tv.TabIndex = 1; diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs b/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs index e01666f..90a5e48 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminForm.cs @@ -28,6 +28,7 @@ namespace TemuKJD.WXForms.AdminForms public Lazy getAddressForm = new Lazy(); public Lazy randomComProductForm = new Lazy(); public Lazy waybillManageForm = new Lazy(); + public Lazy banPlatformForm = new Lazy(); public WXAdminForm() { @@ -101,6 +102,9 @@ namespace TemuKJD.WXForms.AdminForms case "地址管理": SetForm(getAddressForm.Value); break; + case "设置禁售": + SetForm(banPlatformForm.Value); + break; case "图片工具": SetForm(imgToolForm.Value); break; diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index fda6838..25998c1 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -1050,7 +1050,7 @@ namespace TemuKJD.WXForms.ProductForms KJDDBProduct kjdDbProd = selectProd.kjdDbProduct; string errStr = ""; if (kjdDbProd == null) - kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString(), out errStr, true); + kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString(), out errStr, true, true); if (kjdDbProd == null || kjdDbProd.id == 0) { if (kjdDbProd?.id == 0) @@ -1221,7 +1221,15 @@ namespace TemuKJD.WXForms.ProductForms })); } - public static KJDDBProduct GetProductDetail(string prodDbId, out string errMsg, bool noViolationProduct = false) + /// + /// + /// + /// + /// + /// 校验违规商品 + /// 校验微信禁售商品 + /// + public static KJDDBProduct GetProductDetail(string prodDbId, out string errMsg, bool noViolationProduct = false, bool noBanWx = false) { errMsg = ""; @@ -1237,6 +1245,8 @@ namespace TemuKJD.WXForms.ProductForms var data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId; if (noViolationProduct) data += "&wx_safe_status=安全商品,未校验"; + if (noBanWx) + data += "&ban_wx=0"; var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) @@ -4395,6 +4405,7 @@ namespace TemuKJD.WXForms.ProductForms data = UserLogin.GetSignaturex() + "&page=" + 1 + "&page_size=" + pageSize; + data += "&ban_wx=0"; if (isNotCount) { data += "&is_not_count=" + true; diff --git a/TEMUKJD/WXForms/ProductForms/WXUserProdListForm.cs b/TEMUKJD/WXForms/ProductForms/WXUserProdListForm.cs index 0afa580..127ef7b 100644 --- a/TEMUKJD/WXForms/ProductForms/WXUserProdListForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXUserProdListForm.cs @@ -341,6 +341,10 @@ namespace TemuKJD.WXForms.ProductForms "&search_group=" + cmbGroupFilter.Text.Trim() + "&search_prod_name=" + txtProdName.Text.Trim() + "&wx_safe_status=" + cmbWxSafe.Text.Trim().Replace("安全+未校验", "安全商品,未校验").Replace("违规商品", ""); + if (BaseClass.MainPath == "weixin") + data += "&ban_wx=0"; + if (BaseClass.MainPath == "binxixi") + data += "&ban_pdd=0"; if (cmbRelation.Text == "否") data += "&is_relation=0"; else if (cmbRelation.Text == "是")