1服务功能 2用户商品备注并支持下拉框显示

This commit is contained in:
wule committed 2026-07-28 21:12:07 +08:00
1 parent bd3040efa3
commit b4ec400796
33 files changed
+2597 -551

No files matched your search

@@ -1562,6 +1562,193 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductNotes(string inputData)
{
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("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
}
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
var add_user_name = RegexUtils.GetStringQuery(ref inputData, "add_user_name")?.Replace("'", "\\'");
var is_get_detail = RegexUtils.GetStringQuery(ref inputData, "is_get_detail") == "true";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT p.* FROM `bxx`.`product_notes` p where 1=1 ";
string where = "";
if (!string.IsNullOrEmpty(add_user_name))
{
add_user_name = "'" + string.Join("','", add_user_name.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.add_user_name in (" + add_user_name + ")";
}
else
{
where += " and p.add_user_name='admin'";
}
sql += where;
sql += " ORDER BY id DESC";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
try
{
JArray notesArr = new JArray();
string notes_data = "";
foreach (DataRow row in dt.Rows)
{
notes_data += row["notes"].ToString() + ",";
if (is_get_detail)
{
JObject notesObj = new JObject();
notesObj["id"] = row["id"].ParseToLong();
notesObj["notes"] = row["notes"].ParseToString();
notesObj["add_user_name"] = row["add_user_name"].ParseToString();
notesArr.Add(notesObj);
}
}
var data = notes_data.Trim(',');
return "{\"code\":200,\"msg\":\"success\",\"data\":\"" + data + "\",\"notes\":" + JsonUtils.SerializeObject(notesArr) + "}";
}
catch (Exception ex)
{
return "{\"code\":50002,\"msg\":\"" + ex.Message + "\",\"data\":\"\"}";
}
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddProductNotes(string inputData)
{
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("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
}
var add_user_name = RegexUtils.GetStringQuery(ref inputData, "add_user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(add_user_name))
{
add_user_name = "admin";
}
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(notes))
{
return "{\"code\":500,\"msg\":\"未指定要新增的组\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "INSERT IGNORE INTO `bxx`.`product_notes` (notes,add_user_name) VALUES ('" + notes + "','" + add_user_name + "')";
var add_rows = mySql.ExecuteAffectedRows(sql);
mySql.Close();
if (string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":200,\"msg\":\"success\", \"add_rows\":" + add_rows + "}";
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelProductNotes(string inputData)
{
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("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
}
var add_user_name = RegexUtils.GetStringQuery(ref inputData, "add_user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(add_user_name))
{
add_user_name = "admin";
}
var id = RegexUtils.GetStringQuery(ref inputData, "notes_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(notes))
{
return "{\"code\":500,\"msg\":\"未指定要删除的组\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "DELETE FROM `bxx`.`product_notes` p where 1=1";
string where = "";
if (!string.IsNullOrEmpty(id))
{
id = "" + string.Join(",", id.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "";
where += " and p.id in (" + id + ")";
}
if (!string.IsNullOrEmpty(notes))
{
notes = "'" + string.Join("','", notes.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.notes in (" + notes + ")";
}
if (!string.IsNullOrEmpty(add_user_name))
{
add_user_name = "'" + string.Join("','", add_user_name.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.add_user_name in (" + add_user_name + ")";
}
sql += where;
var del_rows = mySql.ExecuteAffectedRows(sql);
mySql.Close();
if (string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":200,\"msg\":\"success\", \"del_rows\":" + del_rows + "}";
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductCates(string inputData)
{
return "{\"code\":19999,\"msg\":\"接口废弃\"}";
@@ -1706,6 +1893,7 @@ namespace KJD_Web.BLL.BXX
var in_spu_ids = RegexUtils.GetStringQuery(ref inputData, "in_spu_ids")?.Replace("'", "\\'");
var in_skc_ids = RegexUtils.GetStringQuery(ref inputData, "in_skc_ids")?.Replace("'", "\\'");
var in_groups = RegexUtils.GetStringQuery(ref inputData, "in_groups")?.Replace("'", "\\'");
var in_notes = RegexUtils.GetStringQuery(ref inputData, "in_notes")?.Replace("'", "\\'");
var product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"))?.Replace("'", "\\'");
var in_cates = RegexUtils.GetStringQuery(ref inputData, "in_cates")?.Replace("'", "\\'");
var wx_cat_1 = RegexUtils.GetStringQuery(ref inputData, "wx_cat_1")?.Replace("'", "\\'");
@@ -1775,6 +1963,11 @@ namespace KJD_Web.BLL.BXX
in_groups = "'" + string.Join("','", in_groups.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.group in (" + in_groups + ")";
}
if (!string.IsNullOrEmpty(in_notes))
{
in_notes = "'" + string.Join("','", in_notes.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.notes in (" + in_notes + ")";
}
if (!string.IsNullOrEmpty(in_cates))
{
in_cates = "'" + string.Join("','", in_cates.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";