二级超管账户相关功能

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

+108 -56
View File
@@ -192,8 +192,8 @@ namespace KJD_Web.BLL
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
@@ -221,9 +221,9 @@ namespace KJD_Web.BLL
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
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))
{
@@ -262,13 +262,13 @@ namespace KJD_Web.BLL
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name");
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes");
var status = RegexUtils.GetStringQuery(ref inputData, "status");
var out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account")?.Replace("'", "\\'");
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name")?.Replace("'", "\\'");
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_product_remaining = RegexUtils.GetStringQuery(ref inputData, "add_product_remaining").ParseToInt();
if (string.IsNullOrEmpty(user_name))
@@ -317,10 +317,10 @@ namespace KJD_Web.BLL
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id");
var status = RegexUtils.GetStringQuery(ref inputData, "status");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
@@ -374,6 +374,9 @@ namespace KJD_Web.BLL
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var no_sub_sa = RegexUtils.GetStringQuery(ref inputData, "no_sub_sa")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -383,30 +386,39 @@ namespace KJD_Web.BLL
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 where = "";
if (!isAdmin)
sql += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
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))
sql += " and s.id in (" + search_db_ids + ")";
where += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
sql += " and s.shop_id in (" + shop_ids + ")";
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
sql += " and s.status = '" + status + "'";
where += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
sql += " and s.shop_id like '%" + search_shop_id + "%'";
where += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
sql += " and s.shop_account like '%" + search_shop_account + "%'";
where += " and s.shop_account like '%" + search_shop_account + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and s.notes like '%" + search_notes + "%'";
where += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
sql += " and p.spu_id like '%" + search_spu + "%'";
where += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
sql += " and p.skc_id like '%" + search_skc + "%'";
where += " and p.skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
sql += " and p.cat_name like '%" + search_cat + "%'";
where += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
sql += " and p.ext_code like '%" + search_ext_code + "%'";
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
sql += " and p.product_name like '%" + search_prod_name + "%'";
where += " and p.product_name like '%" + search_prod_name + "%'";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
@@ -421,32 +433,12 @@ namespace KJD_Web.BLL
//else
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";
if (!isAdmin)
sql += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(search_db_ids))
sql += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
sql += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
sql += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
sql += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
sql += " and s.shop_account like '%" + search_shop_account + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
sql += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
sql += " and p.skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
sql += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
sql += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
sql += " and p.product_name like '%" + search_prod_name + "%'";
sql += where; // where子句
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
@@ -481,10 +473,12 @@ 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()
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
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 + "}";
@@ -511,8 +505,8 @@ namespace KJD_Web.BLL
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
@@ -535,5 +529,63 @@ namespace KJD_Web.BLL
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 设置上传商品的二级超管
/// </summary>
/// <returns></returns>
public string SetSelectProductSubSa(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 shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(shop_id))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.product_select 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(shop_id))
sql += " where shop_id in ('" + shop_id.Replace(",","','") + "')";
else
sql += " where 1=2";
if(!string.IsNullOrEmpty(status))
sql += " and status='" + status + "';";
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\":\"输入为空\"}";
}
}
}
+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\":\"输入为空\"}";
}
}
}
+68 -46
View File
@@ -1,5 +1,6 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
@@ -17,8 +18,8 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -43,8 +44,10 @@ namespace KJD_Web.BLL
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
company_name = row["company_name"].ToString(),
is_sa = Convert.ToInt32(row["is_sa"]),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
};
if (string.IsNullOrEmpty(user.company_name))
{
user.company_name = "-";
@@ -62,15 +65,15 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"));
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"));
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"));
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "company"));
var notes = RegexUtils.GetStringQuery(ref inputData, "notes");
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "company"))?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -153,14 +156,15 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var id = RegexUtils.GetStringQuery(ref inputData, "id");
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"));
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"));
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"));
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id");
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -182,6 +186,8 @@ namespace KJD_Web.BLL
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
@@ -226,10 +232,11 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id");
var search = RegexUtils.GetStringQuery(ref inputData, "search");
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var search = RegexUtils.GetStringQuery(ref inputData, "search")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -238,7 +245,9 @@ namespace KJD_Web.BLL
//string sql = "select * from kjd.user where group_id=3";
string sql = "select * from kjd.user where 1=1";
if (!string.IsNullOrEmpty(group_id))
sql+=" and group_id=" + group_id + " ";
sql += " and group_id=" + group_id;
if (!string.IsNullOrEmpty(sa_level))
sql += " and sa_level=" + sa_level;
if (!string.IsNullOrEmpty(search))
sql += " and (user_name like '%" + search +
"%' or nick_name like '%" + search +
@@ -265,6 +274,8 @@ namespace KJD_Web.BLL
parent_user_name = row["parent_user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
};
if (string.IsNullOrEmpty(user.mobile))
{
@@ -283,14 +294,15 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"));
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"));
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"));
var password = RegexUtils.GetStringQuery(ref inputData, "add_password");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"));
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'"); ;
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -305,9 +317,9 @@ namespace KJD_Web.BLL
return "{\"code\":500,\"msg\":\"用户名已存在\"}";
}
sql = "insert into kjd.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,add_time,mdy_time) " +
sql = "insert into kjd.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,sa_level,add_time,mdy_time) " +
"values ('" + nick_name + "','" + user_name + "','" + mobile + "','" + password + "','" + card_id + "','" +
group_id + "','" + company_name + "','" + notes + "','" +
group_id + "','" + company_name + "','" + notes + "'," + sa_level + ",'" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
@@ -324,14 +336,16 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var id = RegexUtils.GetStringQuery(ref inputData, "id");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"));
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"));
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"));
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"));
var password = RegexUtils.GetStringQuery(ref inputData, "add_password");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id");
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -355,6 +369,10 @@ namespace KJD_Web.BLL
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
if (!string.IsNullOrEmpty(sa_level))
sql += " sa_level=" + sa_level + ",";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
@@ -364,6 +382,10 @@ namespace KJD_Web.BLL
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
@@ -372,9 +394,9 @@ namespace KJD_Web.BLL
public string ChangePassword(string inputData)
{
var userName = RegexUtils.GetStringJson(ref inputData, "user_name");
var password = RegexUtils.GetStringJson(ref inputData, "password");
var newPassword = RegexUtils.GetStringJson(ref inputData, "new_password");
var userName = RegexUtils.GetStringJson(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringJson(ref inputData, "password")?.Replace("'", "\\'");
var newPassword = RegexUtils.GetStringJson(ref inputData, "new_password")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
@@ -23,6 +23,8 @@ namespace KJD_Web.Model
public int add_times { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string operate_sub_sa_name { get; set; }
public DateTime? add_sub_sa_time { get; set; }
#region 外键连接属性
@@ -23,5 +23,7 @@ namespace KJD_Web.Model.ShopModel
public string login_status { get; set; }
public int add_product_remaining { get; set; }
public int add_product_month { get; set; }
public string operate_sub_sa_name { get; set; }
}
}
@@ -34,7 +34,19 @@ namespace KJD_Web.Model
public string card_id { get; set; }
public int is_sa { get; set; }
private int _is_sa = 0;
public int is_sa
{
get { return Math.Max(_sa_level, _is_sa); }
set { _is_sa = value; }
}
private int _sa_level = 0;
public int sa_level
{
get { return Math.Max(_sa_level, _is_sa); }
set { _sa_level = value; }
}
public DateTime add_time { get; set; }
@@ -181,5 +181,17 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void set_select_product_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductManage().SetSelectProductSubSa(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}
@@ -168,5 +168,17 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void set_shop_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().SetShopSubSa(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}
@@ -21,6 +21,9 @@ namespace NaiBa.Util.Extension
/// <returns></returns>
public static long ParseToLong(this object obj)
{
if (obj == null)
return 0L;
try
{
string str = obj.ParseToString();
@@ -44,6 +47,9 @@ namespace NaiBa.Util.Extension
/// <returns></returns>
public static long ParseToLong(this string str, long defaultValue)
{
if (str == null)
return defaultValue;
try
{
return long.Parse(str);
@@ -63,6 +69,9 @@ namespace NaiBa.Util.Extension
/// <returns></returns>
public static int ParseToInt(this object str)
{
if (str == null)
return 0;
try
{
return Convert.ToInt32(str);