1产品数据库认领次数计数 2图片后加载功能 3二级超管显示昵称

This commit is contained in:
wule committed 2025-07-25 19:04:52 +08:00
1 parent dfcf5e8a2c
commit bf7b32fb28
20 files changed
+345 -93

No files matched your search

+28 -8
View File
@@ -83,6 +83,7 @@ namespace KJD_Web.BLL
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("'", "\\'");
var sort_field = RegexUtils.GetStringQuery(ref inputData, "sort_field")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -122,17 +123,20 @@ namespace KJD_Web.BLL
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";
"p.add_time,p.mdy_time,p.select_total_count from kjd.product p where 1=1";
else
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 " +
"p.add_time,p.mdy_time,p.select_total_count,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;
sql += " group by p.id";
sql += " order by p.id desc";
if (sort_field == "select_total_count")
sql += " order by p.select_total_count desc, p.id desc";
else
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
@@ -160,6 +164,7 @@ namespace KJD_Web.BLL
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
select_total_count = row["select_total_count"].ParseToInt(),
};
if (isDetail)
{
@@ -298,6 +303,7 @@ namespace KJD_Web.BLL
add_product_remaining = add_product_remaining - 1;
sql += "\r\n";
sql += "update kjd.shop set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";";
sql += "update kjd.product set select_total_count=select_total_count+1 where id=" + out_product_Id + ";";
//sql += "update kjd.shop_count set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";";
}
var rst = mySql.ExecuteNonQuery(sql);
@@ -379,6 +385,7 @@ 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 search_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "search_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
@@ -390,14 +397,18 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(s.id) from kjd.product_select s left join kjd.product p on s.out_product_id=p.id" +
" where 1=1";
string sql = "select count(s.id) from kjd.product_select s " +
"left join kjd.product p on s.out_product_id=p.id " +
"left join kjd.user u on s.operate_sub_sa_name=u.user_name " +
"where 1=1";
string where = "";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(operate_sub_sa_name))
{
where += " and s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
}
if (no_sub_sa == "true")
where += " and s.operate_sub_sa_name is null";
if (!string.IsNullOrEmpty(search_db_ids))
@@ -422,6 +433,11 @@ namespace KJD_Web.BLL
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and p.product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrEmpty(search_sub_sa_name))
{
where += " and (s.operate_sub_sa_name like '%" + search_sub_sa_name + "%'";
where += " or u.nick_name like '%" + operate_sub_sa_name + "%')";
}
sql += where;
@@ -440,8 +456,11 @@ namespace KJD_Web.BLL
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
"s.sub_user_name,s.notes,s.status,s.draft_id,s.add_times,s.add_time,s.mdy_time," +
"s.operate_sub_sa_name,s.add_sub_sa_time," +
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img " +
"from kjd.product_select s left join kjd.product p on s.out_product_id=p.id where 1=1";
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img," +
"u.nick_name as operate_sub_sa_nick " +
"from kjd.product_select s left join kjd.product p on s.out_product_id=p.id " +
"left join kjd.user u on u.user_name=s.operate_sub_sa_name " +
"where 1=1";
sql += where; // where子句
@@ -479,7 +498,8 @@ namespace KJD_Web.BLL
add_times = row["add_times"].ParseToInt(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
operate_sub_sa_name = row["operate_sub_sa_name"].ToString()
operate_sub_sa_name = row["operate_sub_sa_name"].ToString(),
operate_sub_sa_nick = row["operate_sub_sa_nick"].ToString()
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
@@ -406,6 +406,7 @@ 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 search_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "search_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
@@ -417,14 +418,18 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(s.id) from kjd.third_product_select s left join kjd.third_product p on s.out_product_id=p.id" +
" where 1=1";
string sql = "select count(s.id) from kjd.third_product_select s " +
"left join kjd.third_product p on s.out_product_id=p.id " +
"left join kjd.user u on s.operate_sub_sa_name=u.user_name " +
"where 1=1";
string where = "";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(operate_sub_sa_name))
{
where += " and s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
}
if (no_sub_sa == "true")
where += " and s.operate_sub_sa_name is null";
if (!string.IsNullOrEmpty(search_db_ids))
@@ -449,6 +454,11 @@ namespace KJD_Web.BLL
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and p.product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrEmpty(search_sub_sa_name))
{
where += " and (s.operate_sub_sa_name like '%" + search_sub_sa_name + "%'";
where += " or u.nick_name like '%" + operate_sub_sa_name + "%')";
}
sql += where;
@@ -467,8 +477,11 @@ namespace KJD_Web.BLL
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
"s.sub_user_name,s.notes,s.status,s.draft_id,s.add_times,s.add_time,s.mdy_time," +
"s.operate_sub_sa_name,s.add_sub_sa_time," +
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img " +
"from kjd.third_product_select s left join kjd.third_product p on s.out_product_id=p.id where 1=1";
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img," +
"u.nick_name as operate_sub_sa_nick " +
"from kjd.third_product_select s left join kjd.third_product p on s.out_product_id=p.id " +
"left join kjd.user u on u.user_name=s.operate_sub_sa_name " +
"where 1=1";
sql += where; // where子句
@@ -506,12 +519,13 @@ namespace KJD_Web.BLL
add_times = row["add_times"].ParseToInt(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
operate_sub_sa_name = row["operate_sub_sa_name"].ToString()
operate_sub_sa_name = row["operate_sub_sa_name"].ToString(),
operate_sub_sa_nick = row["operate_sub_sa_nick"].ToString()
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
prodSelect.add_sub_sa_time = row["add_sub_sa_time"] as DateTime?;
productLst.Add(prodSelect);
};
prodSelect.add_sub_sa_time = row["add_sub_sa_time"] as DateTime?;
productLst.Add(prodSelect);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
@@ -23,6 +23,13 @@ namespace KJD_Web.Model
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string notes { get; set; }
/// <summary>
/// 店铺选品次数
/// </summary>
public int select_count { get; set; } = 0;
/// <summary>
/// 被选中的总次数
/// </summary>
public int select_total_count { get; set; }
}
}
@@ -24,6 +24,7 @@ namespace KJD_Web.Model
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string operate_sub_sa_name { get; set; }
public string operate_sub_sa_nick { get; set; }
public DateTime? add_sub_sa_time { get; set; }
#region 外键连接属性