二级超管账户相关功能

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

+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);