1选品数据库及库存上传相关功能 2修复部分商品详情信息特殊符号导致无法上传问题

This commit is contained in:
wule committed 2025-07-24 15:40:39 +08:00
1 parent adf75f9fc1
commit 281cf2e338
38 files changed
+1496 -440

No files matched your search

+70 -25
View File
@@ -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\":\"输入为空\"}";
}
}
}