bxx 控制器 商品增加 安全条件搜索和返回

This commit is contained in:
chfei committed 2026-11-09 10:44:24 +08:00
1 parent 0e38a1e31f
commit 5ddad5bceb
3 files changed
+27 -5

No files matched your search

+11 -4
View File
@@ -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 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 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(); 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 = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); 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; 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; sql += where;
var count = 0; 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," + 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.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.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" + " FROM " + tableName + " p" +
" WHERE p.is_del=" + is_del; " WHERE p.is_del=" + is_del;
@@ -1020,6 +1026,7 @@ namespace KJD_Web.BLL.BXX
is_relation = row["is_relation"].ParseToInt(), is_relation = row["is_relation"].ParseToInt(),
add_user_name = row["add_user_name"].ParseToString(), add_user_name = row["add_user_name"].ParseToString(),
is_del = row["is_del"].ParseToNullableInt(), is_del = row["is_del"].ParseToNullableInt(),
is_safe = row["is_safe"].ParseToNullableBool(),
}; };
if (isDetail) if (isDetail)
{ {
@@ -4368,15 +4375,15 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":999,\"msg\":\"校验失败\"}"; return "{\"code\":999,\"msg\":\"校验失败\"}";
int id = RegexUtils.GetStringQuery(ref inputData, "id").ParseToInt(); int id = RegexUtils.GetStringQuery(ref inputData, "id").ParseToInt();
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn); MysqlUtils mySql = new MysqlUtils(conn);
string sql = ""; string sql = "";
var count = -1; 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); count = mySql.ExecuteAffectedRows(sql);
mySql.Close(); mySql.Close();
+2 -1
View File
@@ -108,7 +108,8 @@ namespace KJD_Web.Model
public int is_relation { get; set; } public int is_relation { get; set; }
public string add_user_name { get; set; } public string add_user_name { get; set; }
public int? is_del { get; set; } public int? is_del { get; set; }
} public bool? is_safe { get; set; }
}
public class KJDDBProduct : DBProductResultParam public class KJDDBProduct : DBProductResultParam
{ {
@@ -303,6 +303,20 @@ namespace NaiBa.Util.Extension
return result; 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 #endregion
#region 转换为float #region 转换为float