From 5ddad5bceb4af6ad8040a6163c493bfb6f607c0e Mon Sep 17 00:00:00 2001 From: chfei Date: Mon, 9 Nov 2026 10:44:24 +0800 Subject: [PATCH] =?UTF-8?q?bxx=20=E6=8E=A7=E5=88=B6=E5=99=A8=20=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=A2=9E=E5=8A=A0=20=E5=AE=89=E5=85=A8=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=90=9C=E7=B4=A2=E5=92=8C=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KJD_WebService/BLL/BXX/BXXProductManage.cs | 15 +++++++++++---- KJD_WebService/Model/DBProductResultParam.cs | 3 ++- .../Utils/Extension/Extension.Convert.cs | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJD_WebService/BLL/BXX/BXXProductManage.cs index e3cc1cd..2ecd75d 100644 --- a/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -673,6 +673,8 @@ namespace KJD_Web.BLL.BXX var max_sale_count_num = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "max_sale_count_num"))?.Replace("'", "\\'"); var min_sale_count_num = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "min_sale_count_num"))?.Replace("'", "\\'"); var is_del = RegexUtils.GetStringQuery(ref inputData, "is_del").ParseToInt(); + //安全状态:0 全部(默认),1 安全,2 违规,3 未检测。 + var safeStatus = RegexUtils.GetStringQuery(ref inputData, "safe_status").ParseToInt(0); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -904,6 +906,10 @@ namespace KJD_Web.BLL.BXX { where += " and p.sale_count_num>=" + min_sale_count_num; } + if (safeStatus > 0) + { + where += (" and p.is_safe " + (safeStatus == 1 ? "=1" : safeStatus == 2 ? "=0" : " is NULL")); + } sql += where; var count = 0; @@ -958,7 +964,7 @@ namespace KJD_Web.BLL.BXX 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.fission_words,p.head_words,p.end_words,p.group," + " p.product_get_type,p.wx_safe_status,p.sale_count_num,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,p.view_uv,p.add_user_name,p.is_del" + + " p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation,p.view_uv,p.add_user_name,p.is_del,p.is_safe" + " FROM " + tableName + " p" + " WHERE p.is_del=" + is_del; @@ -1020,6 +1026,7 @@ namespace KJD_Web.BLL.BXX is_relation = row["is_relation"].ParseToInt(), add_user_name = row["add_user_name"].ParseToString(), is_del = row["is_del"].ParseToNullableInt(), + is_safe = row["is_safe"].ParseToNullableBool(), }; if (isDetail) { @@ -4368,15 +4375,15 @@ namespace KJD_Web.BLL.BXX return "{\"code\":999,\"msg\":\"校验失败\"}"; int id = RegexUtils.GetStringQuery(ref inputData, "id").ParseToInt(); - + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); string sql = ""; var count = -1; - sql = "UPDATE bxx.product set is_safe=1 WHERE id="+id; - + sql = "UPDATE bxx.product set is_safe=1 WHERE id=" + id; + count = mySql.ExecuteAffectedRows(sql); mySql.Close(); diff --git a/KJD_WebService/Model/DBProductResultParam.cs b/KJD_WebService/Model/DBProductResultParam.cs index 860354f..954505c 100644 --- a/KJD_WebService/Model/DBProductResultParam.cs +++ b/KJD_WebService/Model/DBProductResultParam.cs @@ -108,7 +108,8 @@ namespace KJD_Web.Model public int is_relation { get; set; } public string add_user_name { get; set; } public int? is_del { get; set; } - } + public bool? is_safe { get; set; } + } public class KJDDBProduct : DBProductResultParam { diff --git a/Store.Framework/Utils/Extension/Extension.Convert.cs b/Store.Framework/Utils/Extension/Extension.Convert.cs index 8450cd1..06fcfcb 100644 --- a/Store.Framework/Utils/Extension/Extension.Convert.cs +++ b/Store.Framework/Utils/Extension/Extension.Convert.cs @@ -303,6 +303,20 @@ namespace NaiBa.Util.Extension return result; } } + public static bool? ParseToNullableBool(this object str) + { + try + { + // 1. 快速判断:如果为 null 或 DBNull,直接返回 + if (str == null || str == DBNull.Value) + return null; + return bool.Parse(str.ToString()); + } + catch + { + return null; + } + } #endregion #region 转换为float