From c2c4c8da1af1d36d41d2e517bbd4bd31a5f0eb34 Mon Sep 17 00:00:00 2001 From: wule Date: Mon, 26 Jan 2026 09:30:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=9C=8D=E5=8A=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BLL/BXX/BXXProductManage.cs | 107 +++++++++++++----- .../Model/DBProductResultParam.cs | 4 + 2 files changed, 83 insertions(+), 28 deletions(-) diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index b2922c0..676493e 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -24,12 +24,15 @@ namespace KJD_Web.BLL.BXX if (time1 != EncrypUtil.Encryption(time)) return "{\"code\":50000,\"msg\":\"校验失败\"}"; - string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name"); - string from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id"); - string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id"); - string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id"); - string price_text = RegexUtils.GetStringQuery(ref inputData, "price_text"); - string main_cat_id = RegexUtils.GetStringQuery(ref inputData, "main_cat_id"); + string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'"); + string from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id")?.Replace("'", "\\'"); + string from_shop_name = RegexUtils.GetStringQuery(ref inputData, "from_shop_name")?.Replace("'", "\\'"); + string offline_supplier_id = RegexUtils.GetStringQuery(ref inputData, "offline_supplier_id")?.Replace("'", "\\'"); + string offline_supplier_name = RegexUtils.GetStringQuery(ref inputData, "offline_supplier_name")?.Replace("'", "\\'"); + string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id")?.Replace("'", "\\'"); + string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id")?.Replace("'", "\\'"); + string price_text = RegexUtils.GetStringQuery(ref inputData, "price_text")?.Replace("'", "\\'"); + string main_cat_id = RegexUtils.GetStringQuery(ref inputData, "main_cat_id")?.Replace("'", "\\'"); string main_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_cat_name"))?.Replace("'", "\\'"); string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id"); string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"))?.Replace("'", "\\'"); @@ -42,6 +45,7 @@ namespace KJD_Web.BLL.BXX string product_get_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_get_type"))?.Replace("'", "\\'"); string sale_count = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count"))?.Replace("'", "\\'"); string sale_count_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count_text"))?.Replace("'", "\\'"); + string distribution_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "distribution_set"))?.Replace("'", "\\'"); string special_prod_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "special_prod_type"))?.Replace("'", "\\'"); if (special_prod_type == null) special_prod_type = "普通商品"; @@ -61,12 +65,13 @@ namespace KJD_Web.BLL.BXX string sql = ""; sql = "insert into "; sql += "bxx.product "; - sql +="(from_shop_id,spu_id,skc_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,add_time,mdy_time) " + - "values ('" + from_shop_id + "','" + spu_id + "','" + skc_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 + "','" + + sql += "(from_shop_id,from_shop_name,offline_supplier_id,offline_supplier_name,spu_id,skc_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) " + + "values ('" + from_shop_id + "','" + from_shop_name + "','" + offline_supplier_id + "','" + offline_supplier_name + "','" + spu_id + "','" + + skc_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() + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');"; var rst = mySql.ExecuteNonQuery(sql); @@ -93,14 +98,17 @@ namespace KJD_Web.BLL.BXX if (time1 != EncrypUtil.Encryption(time)) return "{\"code\":50000,\"msg\":\"校验失败\"}"; - string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name"); - string from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id"); - string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id"); - string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id"); - string price_text = RegexUtils.GetStringQuery(ref inputData, "price_text"); - string main_cat_id = RegexUtils.GetStringQuery(ref inputData, "main_cat_id"); + string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'"); + string from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id")?.Replace("'", "\\'"); + string from_shop_name = RegexUtils.GetStringQuery(ref inputData, "from_shop_name")?.Replace("'", "\\'"); + string offline_supplier_id = RegexUtils.GetStringQuery(ref inputData, "offline_supplier_id")?.Replace("'", "\\'"); + string offline_supplier_name = RegexUtils.GetStringQuery(ref inputData, "offline_supplier_name")?.Replace("'", "\\'"); + string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id")?.Replace("'", "\\'"); + string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id")?.Replace("'", "\\'"); + string price_text = RegexUtils.GetStringQuery(ref inputData, "price_text")?.Replace("'", "\\'"); + string main_cat_id = RegexUtils.GetStringQuery(ref inputData, "main_cat_id")?.Replace("'", "\\'"); string main_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_cat_name"))?.Replace("'", "\\'"); - string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id"); + string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id")?.Replace("'", "\\'"); string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"))?.Replace("'", "\\'"); string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'"); string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"))?.Replace("'", "\\'"); @@ -113,6 +121,10 @@ namespace KJD_Web.BLL.BXX string sale_count_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count_text"))?.Replace("'", "\\'"); string wx_safe_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_safe_status"))?.Replace("'", "\\'"); string special_prod_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "special_prod_type"))?.Replace("'", "\\'"); + string wx_cate = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_cate"))?.Replace("'", "\\'"); + string delivery_fee_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "delivery_fee_set"))?.Replace("'", "\\'"); + string after_sale_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "after_sale_set"))?.Replace("'", "\\'"); + string distribution_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "distribution_set"))?.Replace("'", "\\'"); if (string.IsNullOrEmpty(user_name)) { @@ -126,6 +138,12 @@ namespace KJD_Web.BLL.BXX sql = "update bxx.product p set"; if (from_shop_id != null) sql += " p.from_shop_id='" + from_shop_id + "',"; + if (from_shop_name != null) + sql += " p.from_shop_name='" + from_shop_name + "',"; + if (offline_supplier_id != null) + sql += " p.offline_supplier_id='" + offline_supplier_id + "',"; + if (offline_supplier_name != null) + sql += " p.offline_supplier_name='" + offline_supplier_name + "',"; if (main_cat_id != null) sql += " p.main_cat_id='" + main_cat_id + "',"; if (main_cat_name != null) @@ -158,6 +176,14 @@ namespace KJD_Web.BLL.BXX sql += " p.wx_safe_status='" + wx_safe_status + "',"; if (special_prod_type != null && special_prod_type != "") sql += " p.special_prod_type='" + special_prod_type + "',"; + if (wx_cate != null) + sql += " p.wx_cate='" + wx_cate + "',"; + if (delivery_fee_set != null) + sql += " p.delivery_fee_set='" + delivery_fee_set + "',"; + if (after_sale_set != null) + sql += " p.after_sale_set='" + after_sale_set + "',"; + if (distribution_set != null) + sql += " p.distribution_set='" + distribution_set + "',"; sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"; sql = sql.TrimEnd(','); sql += " where spu_id='" + spu_id + "';"; @@ -198,10 +224,12 @@ namespace KJD_Web.BLL.BXX var get_select_count = RegexUtils.GetStringQuery(ref inputData, "get_select_count")?.Replace("'", "\\'"); var select_shop_id = RegexUtils.GetStringQuery(ref inputData, "select_shop_id")?.Replace("'", "\\'"); var from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id")?.Replace("'", "\\'"); + var from_shop_name = RegexUtils.GetStringQuery(ref inputData, "from_shop_name")?.Replace("'", "\\'"); var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'"); var sort_field = RegexUtils.GetStringQuery(ref inputData, "sort_field")?.Replace("'", "\\'"); var wx_safe_status = RegexUtils.GetStringQuery(ref inputData, "wx_safe_status")?.Replace("'", "\\'"); var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'"); + var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'"); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -214,6 +242,8 @@ namespace KJD_Web.BLL.BXX string where = ""; if (!string.IsNullOrEmpty(from_shop_id)) where += " and p.from_shop_id ='" + from_shop_id + "'"; + if (!string.IsNullOrEmpty(from_shop_name)) + where += " and p.from_shop_name ='" + from_shop_name + "'"; if (!string.IsNullOrEmpty(search_db_ids)) where += " and p.id in (" + search_db_ids + ")"; if (!string.IsNullOrEmpty(product_get_type)) @@ -237,6 +267,14 @@ namespace KJD_Web.BLL.BXX where += " and p.group like '%" + search_group + "%'"; if (!string.IsNullOrWhiteSpace(search_notes)) where += " and p.notes like '%" + search_notes + "%'"; + // 供应商货源是否已完成初始设置 + if (!string.IsNullOrEmpty(is_supplier_prod_ok)) + { + if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置") + where += " and wx_cate!='' and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1"; + else + where += " and (wx_cate='' or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)"; + } sql += where; var count = mySql.ExecuteRowCount(sql); @@ -254,18 +292,19 @@ namespace KJD_Web.BLL.BXX " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" + " 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,p.main_img,p.notes," + - " p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,p.product_get_type,p.wx_safe_status," + - " p.sale_count,p.sale_count_text,p.special_prod_type,s.img_url,e.ext_code_price" + + 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.notes,p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group," + + " 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_cate," + + " 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" + " 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,p.main_img,p.notes," + - " p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,p.product_get_type,p.wx_safe_status," + - " p.sale_count,p.sale_count_text,p.special_prod_type,s.img_url,COUNT(se.id) AS select_count," + - " e.ext_code_price" + + 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.notes,p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group," + + " 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_cate" + + " 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 + "' " + " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" + " WHERE p.is_del=0"; @@ -295,10 +334,14 @@ namespace KJD_Web.BLL.BXX { id = Convert.ToInt32(row["id"]), from_shop_id = row["from_shop_id"].ToString(), + from_shop_name = row["from_shop_name"].ToString(), + //offline_supplier_id = row["offline_supplier_id"].ToString(), + //offline_supplier_name = row["offline_supplier_name"].ToString(), skc_id = row["skc_id"].ToString(), spu_id = row["spu_id"].ToString(), cat_id = row["cat_id"].ToString(), cat_name = row["cat_name"].ToString(), + wx_cate = row["wx_cate"].ToString(), product_name = row["product_name"].ToString(), main_img = row["main_img"].ToString(), ext_code = row["ext_code"].ToString(), @@ -577,6 +620,7 @@ namespace KJD_Web.BLL.BXX var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'"); var wx_safe_status = RegexUtils.GetStringQuery(ref inputData, "wx_safe_status")?.Replace("'", "\\'"); var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'"); + var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'"); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -612,8 +656,15 @@ namespace KJD_Web.BLL.BXX if (!string.IsNullOrEmpty(wx_safe_status)) where += " and p.wx_safe_status ='" + wx_safe_status + "'"; if (!string.IsNullOrEmpty(special_prod_type)) - where += " and p.special_prod_type ='" + special_prod_type + "'"; - + where += " and p.special_prod_type ='" + special_prod_type + "'"; + // 供应商货源是否已完成初始设置 + if (!string.IsNullOrEmpty(is_supplier_prod_ok)) + { + if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置") + where += " and wx_cate!='' and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1"; + else + where += " and (wx_cate='' or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)"; + } sql += where; var count = mySql.ExecuteRowCount(sql); diff --git a/KJDService/KJD_WebService/Model/DBProductResultParam.cs b/KJDService/KJD_WebService/Model/DBProductResultParam.cs index 2772163..c1d2527 100644 --- a/KJDService/KJD_WebService/Model/DBProductResultParam.cs +++ b/KJDService/KJD_WebService/Model/DBProductResultParam.cs @@ -12,12 +12,16 @@ namespace KJD_Web.Model { public int id { get; set; } public string from_shop_id { get; set; } = ""; + public string from_shop_name { get; set; } = ""; + public string offline_supplier_id { get; set; } + public string offline_supplier_name { get; set; } public string spu_id { get; set; } public string skc_id { get; set; } public string main_cat_id { get; set; } public string cat_id { get; set; } public string main_cat_name { get; set; } public string cat_name { get; set; } + public string wx_cate { get; set; } /// /// 母店价格 ///