二级超管账户相关功能

This commit is contained in:
wule committed 2025-07-21 19:07:43 +08:00
1 parent deb84144cf
commit 0740da277c
35 files changed
+2130 -295

No files matched your search

+80 -28
View File
@@ -24,12 +24,11 @@ namespace KJD_Web.BLL
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_id = RegexUtils.GetStringQuery(ref inputData, "search_id");
var search_name = RegexUtils.GetStringQuery(ref inputData, "search_name");
var s_page = RegexUtils.GetStringQuery(ref inputData, "page");
int page = 0;
int.TryParse(s_page, out page);
var s_page_size = RegexUtils.GetStringQuery(ref inputData, "page_size");
int page_size;
int.TryParse(s_page_size, out page_size);
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
if (page_size == 0)
page_size = 50;
int r2 = 0;
@@ -39,20 +38,27 @@ namespace KJD_Web.BLL
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd.shop where 1=1";
//where子句
string where = "";
if (isAdmin)
sql += " and (cookie='' or shop_id!='')";
where += " and (cookie='' or shop_id!='')";
if (!isAdmin)
sql += " and (user_name='" + user_name + "' or sub_user_name='" + user_name + "')";
where += " and (user_name='" + user_name + "' or sub_user_name='" + user_name + "')";
if (!string.IsNullOrWhiteSpace(operate_sub_sa_name))
where += " and operate_sub_sa_name='" + operate_sub_sa_name + "'";
if (!string.IsNullOrWhiteSpace(search_user_name))
sql += " and user_name like '%" + search_user_name + "%'";
where += " and user_name like '%" + search_user_name + "%'";
if (!string.IsNullOrWhiteSpace(search_login_name))
sql += " and login_name like '%" + search_login_name + "%'";
where += " and login_name like '%" + search_login_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and notes like '%" + search_notes + "%'";
where += " and notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_id))
sql += " and shop_id like '%" + search_id + "%'";
where += " and shop_id like '%" + search_id + "%'";
if (!string.IsNullOrWhiteSpace(search_name))
sql += " and shop_account like '%" + search_name + "%'";
where += " and shop_account like '%" + search_name + "%'";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
@@ -63,22 +69,11 @@ namespace KJD_Web.BLL
else
{
sql = "select id,login_name,login_pass,cookie,shop_id,shop_account,sub_user_name,user_name,company_name,notes,login_status," +
" add_product_remaining,add_product_month" +
" add_product_remaining,add_product_month,add_time,mdy_time,add_sub_sa_time,operate_sub_sa_name" +
" from kjd.shop where 1=1";
if (isAdmin)
sql += " and (cookie='' or shop_id!='')";
if (!isAdmin)
sql += " and (user_name='" + user_name + "' or sub_user_name='" + user_name + "')";
if (!string.IsNullOrWhiteSpace(search_user_name))
sql += " and user_name like '%" + search_user_name + "%'";
if (!string.IsNullOrWhiteSpace(search_login_name))
sql += " and login_name like '%" + search_login_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_id))
sql += " and shop_id like '%" + search_id + "%'";
if (!string.IsNullOrWhiteSpace(search_name))
sql += " and shop_account like '%" + search_name + "%'";
sql += where; // where 子句
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
@@ -105,6 +100,8 @@ namespace KJD_Web.BLL
login_status = row["login_status"].ToString(),
add_product_remaining = row["add_product_remaining"].ParseToInt(),
add_product_month = row["add_product_month"].ParseToInt(),
operate_sub_sa_name = row["operate_sub_sa_name"] as string,
};
shopList.Add(shop);
}
@@ -428,5 +425,60 @@ namespace KJD_Web.BLL
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
/// <summary>
/// 设置店铺的二级超管
/// </summary>
/// <returns></returns>
public string SetShopSubSa(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 id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var login_name = RegexUtils.GetStringQuery(ref inputData, "shop_login_name")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(login_name))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.shop set";
if (operate_sub_sa_name != null)
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
if (!string.IsNullOrEmpty(id))
sql += " where id in (" + id + ")";
else if (!string.IsNullOrEmpty(login_name))
sql += " where login_name in ('" + login_name.Replace(",", "','") + "')";
else
sql += " where 1=2";
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\":\"输入为空\"}";
}
}
}