店铺优化相关功能

This commit is contained in:
wule committed 2026-04-24 21:48:22 +08:00
1 parent 9805792aed
commit 0e6a927cf2
43 files changed
+3305 -1604

No files matched your search

@@ -22,6 +22,12 @@ namespace KJD_Web.BLL.BXX
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
int r2 = 0;
@@ -50,7 +56,7 @@ namespace KJD_Web.BLL.BXX
//obj1["redirect_uri"] = "http%3A%2F%2Fpo.e57.cn%2Flogin%3Fsource%3Dpdd_code";
obj1["redirect_uri"] = "http%3A%2F%2Fpo.e57.cn%2Flogin%3Fsource%3Dpdd_code_pixiu";
obj1["is_current"] = false;
jArr.Add(obj1);
//jArr.Add(obj1);
JObject obj2 = new JObject();
obj2["describe"] = "小红椒商品管理";
@@ -262,7 +268,13 @@ namespace KJD_Web.BLL.BXX
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_name = RegexUtils.GetStringQuery(ref inputData, "search_name");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
// 特殊处理一下修复客户端店铺导入没有立即登录导致的cookie串的bug
//var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids");
if (shop_ids == "''")
shop_ids = "999999999999999";
shop_ids = shop_ids?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(shop_ids))
{
List<string> shopIdLst = shop_ids.Split(',').ToList();
@@ -763,7 +775,7 @@ namespace KJD_Web.BLL.BXX
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string mall_id = RegexUtils.GetStringQuery(ref inputData, "mall_id");
string shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
string group_name = RegexUtils.GetStringQuery(ref inputData, "group_name");
string group_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group_name"));
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -818,14 +830,14 @@ namespace KJD_Web.BLL.BXX
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
string login_pass = RegexUtils.GetStringQuery(ref inputData, "login_pass");
string sub_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_user_name"));
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
//string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
//string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
string anti_contents = RegexUtils.GetStringQuery(ref inputData, "anti_contents");
string new_shop_id = RegexUtils.GetStringQuery(ref inputData, "new_shop_id");
string old_shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string mall_id = RegexUtils.GetStringQuery(ref inputData, "mall_id");
string shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
string group_name = RegexUtils.GetStringQuery(ref inputData, "group_name");
string group_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group_name"));
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string login_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status"));
@@ -846,10 +858,10 @@ namespace KJD_Web.BLL.BXX
string sql = "update bxx.shop set";
if (login_pass != null)
sql += " login_pass='" + login_pass + "',";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (cookie2 != null)
sql += " cookie2='" + cookie2 + "',";
//if (cookie != null)
// sql += " cookie='" + cookie + "',";
//if (cookie2 != null)
// sql += " cookie2='" + cookie2 + "',";
if (anti_contents != null)
sql += " anti_contents='" + anti_contents + "',";
if (new_shop_id != null)
@@ -929,7 +941,7 @@ namespace KJD_Web.BLL.BXX
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(login_name))
if (string.IsNullOrWhiteSpace(login_name))
{
return "{\"code\":500,\"msg\":\"店铺没有登录名\"}";
}
@@ -96,12 +96,9 @@ namespace KJD_Web.BLL.WXXD
}
else
{
sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.anti_contents,s.openid,s.shop_id,s.shop_account,s.sub_user_name," +
"s.user_name,s.company_name,s.notes,s.group_name,s.login_status,s.login_status2,c.add_product_remaining,c.add_product_month," +
"s.add_time,s.mdy_time,s.add_sub_sa_time,s.operate_sub_sa_name";
//sql += " FROM wxxd.shop s WHERE 1=1";
sql += " FROM wxxd.shop s LEFT JOIN wxxd.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1";
sql = "SELECT s.*,se.expire_time‌ FROM wxxd.shop s" +
" LEFT JOIN wxxd.shop_expire se ON s.shop_id=se.shop_id" +
" WHERE 1=1";
sql += where; // where 子句
sql += " ORDER BY s.id DESC";
@@ -137,6 +134,7 @@ namespace KJD_Web.BLL.WXXD
openid = row["openid"].ParseToString(),
group_name = row["group_name"].ParseToString(),
add_time = row["add_time"].IsNullOrEmpty() ? DateTime.MinValue : Convert.ToDateTime(row["add_time"]),
expire_time = row["expire_time"].IsNullOrEmpty() ? null : (int?)row["expire_time"].ParseToInt(),
};
shopList.Add(shop);
}
@@ -1,5 +1,6 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using Mysqlx.Crud;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
@@ -8,16 +9,32 @@ using System.Linq;
using System.Net;
using System.Reflection;
using System.Web;
using System.Web.Security;
using System.Web.UI.WebControls;
namespace KJD_Web.BLL.WXXD
{
public class WXUserManage
{
public static bool GetSign(string signData)
{
if (string.IsNullOrEmpty(signData)) { return false; }
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref signData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref signData, "code");
if (time1 != EncrypUtil.Encryption(time))
return false;
return true;
}
public string CheckUserLogin(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
@@ -30,8 +47,9 @@ namespace KJD_Web.BLL.WXXD
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from wxxd.user where user_name='"
+ mobile + "' and password='" + password + "'";
string sql = "select u.*,uu.authority as main_authority " +
"FROM wxxd.user u LEFT JOIN wxxd.user uu ON uu.user_name=u.parent_user_name where u.user_name='"
+ mobile + "' and u.password='" + password + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
@@ -52,8 +70,22 @@ namespace KJD_Web.BLL.WXXD
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,
authority = row.Table.Columns.Contains("authority") ? row["authority"].ParseToString() : "",
points = row.Table.Columns.Contains("points") ? row["points"].ParseToInt() : 0,
};
var main_authority = row.Table.Columns.Contains("main_authority") ? row["main_authority"].ParseToString() : "";
// 子账号积分用户权限跟随
if (user.group_id != "3")
{
var userAuthLst = user.authority.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (!main_authority.Contains("积分用户"))
{
user.authority = string.Join(",", userAuthLst.Remove("积分用户"));
}
else if (!user.authority.Contains("积分用户"))
{
user.authority = (user.authority + "," + "积分用户").Trim(',');
}
}
if (string.IsNullOrEmpty(user.company_name))
{
user.company_name = "-";
@@ -71,6 +103,9 @@ namespace KJD_Web.BLL.WXXD
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
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("'", "\\'");
@@ -114,6 +149,9 @@ namespace KJD_Web.BLL.WXXD
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var group = RegexUtils.GetStringQuery(ref inputData, "group");
@@ -164,6 +202,9 @@ namespace KJD_Web.BLL.WXXD
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
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("'", "\\'");
@@ -212,11 +253,13 @@ namespace KJD_Web.BLL.WXXD
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "id");
int r2 = 0;
@@ -243,6 +286,9 @@ namespace KJD_Web.BLL.WXXD
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
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("'", "\\'");
@@ -254,16 +300,17 @@ namespace KJD_Web.BLL.WXXD
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
//string sql = "select * from wxxd.user where group_id=3";
string sql = "select * from wxxd.user where 1=1";
string sql = "select u.*,uu.authority as main_authority from wxxd.user u " +
"LEFT JOIN wxxd.user uu ON uu.user_name=u.parent_user_name WHERE 1=1";
if (!string.IsNullOrEmpty(group_id))
sql += " and group_id=" + group_id;
sql += " and u.group_id=" + group_id;
if (!string.IsNullOrEmpty(sa_level))
sql += " and sa_level=" + sa_level;
sql += " and u.sa_level=" + sa_level;
if (!string.IsNullOrEmpty(search))
sql += " and (user_name like '%" + search +
"%' or nick_name like '%" + search +
"%' or company_name like '%" + search + "%')";
sql += " order by id desc";
sql += " and (u.user_name like '%" + search +
"%' or u.nick_name like '%" + search +
"%' or u.company_name like '%" + search + "%')";
sql += " order by u.id desc";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
@@ -288,7 +335,22 @@ namespace KJD_Web.BLL.WXXD
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,
authority = row.Table.Columns.Contains("authority") ? row["authority"].ParseToString() : "",
points = row.Table.Columns.Contains("points") ? row["points"].ParseToInt() : 0,
};
var main_authority = row.Table.Columns.Contains("main_authority") ? row["main_authority"].ParseToString() : "";
// 子账号积分用户权限跟随
if (user.group_id != "3")
{
var userAuthLst = user.authority.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (!main_authority.Contains("积分用户"))
{
user.authority = string.Join(",", userAuthLst.Remove("积分用户"));
}
else if (!user.authority.Contains("积分用户"))
{
user.authority = (user.authority + "," + "积分用户").Trim(',');
}
}
if (string.IsNullOrEmpty(user.mobile))
{
user.mobile = row["user_name"].ToString();
@@ -306,6 +368,9 @@ namespace KJD_Web.BLL.WXXD
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
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("'", "\\'");
@@ -349,6 +414,9 @@ namespace KJD_Web.BLL.WXXD
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
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("'", "\\'");
@@ -406,14 +474,140 @@ namespace KJD_Web.BLL.WXXD
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateUserPointsTest(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var delta_points = RegexUtils.GetStringQuery(ref inputData, "delta_points")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//sql = "select * from wxxd.user where parent_user_name='"
// + user_name + "'";
sql = "update wxxd.user set";
if (!string.IsNullOrEmpty(delta_points))
sql += " points=points+" + delta_points.ParseToInt() + ",";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 增加或减少用户积分
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string UpdateUserPoints(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "update_user_name"))?.Replace("'", "\\'");
var user_nick = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "update_user_nick"))?.Replace("'", "\\'");
var delta_points = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "delta_points"))?.ParseToInt();
var option_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "option_type"))?.Replace("'", "\\'");
var operator_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "operator_type"))?.Replace("'", "\\'");
var operator_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "operator_name"))?.Replace("'", "\\'");
var shop_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "shop_id"))?.Replace("'", "\\'");
var shop_account = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "shop_account"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name) || string.IsNullOrEmpty(user_nick))
{
return "{\"code\":500,\"msg\":\"充值对象不能为空\"}";
}
if (delta_points.IsNullOrZero())
{
return "{\"code\":500,\"msg\":\"充值金额不合法\"}";
}
if (string.IsNullOrEmpty(option_type) || string.IsNullOrEmpty(operator_type) || string.IsNullOrEmpty(operator_name))
{
return "{\"code\":500,\"msg\":\"操作或操作者信息不合法\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
mySql.Close();
//////string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
//////MysqlUtils mySql = new MysqlUtils(conn);
//////string sql = "";
//////sql += " START TRANSACTION";
//////sql += " SELECT * FROM wxxd.user WHERE user_name='" + user_name + "' FOR UPDATE;";
//////sql += " INSERT INTO wxxd.user_points_record(user_name,user_nick,points,option_type,operator_type,operator_name,shop_id,shop_account)";
//////sql += " VALUES()";
//////sql += " UPDATE wxxd.user SET points = points + delta_points";
////////INSERT INTO TableB(column1, column2)
////////SELECT A.column1, 'some_value' AS column2
////////FROM TableA A
////////WHERE A.value > 100;
//////sql = "select points from wxxd.user where user_name='" + user_name + "'";
//////var rst1 = mySql.ExecuteFirstInt(sql);
//sql = "UPDATE wxxd.user SET";
//if (option_type == "充值")
// sql += " points=points+" + delta_points.ParseToInt() + ",";
//else
// sql += " points=points-" + delta_points.ParseToInt() + ",";
//sql = sql.TrimEnd(',');
//sql += " where id=" + id + "";
//-
//if (!string.IsNullOrEmpty(notes))
// sql += " notes='" + notes + "',";
//if (!string.IsNullOrEmpty(sa_level))
// sql += " sa_level=" + sa_level + ",";
//if (authority != null)
// sql += " authority='" + authority + "',";
//sql = sql.TrimEnd(',');
//sql += " where id=" + id + "";
//var rst = mySql.ExecuteNonQuery(sql);
//mySql.Close();
//if (rst)
//{
// return "{\"code\":200,\"msg\":\"success\"}";
//}
//else
//{
// return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
//}
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string ChangePassword(string inputData)
{
if (!GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
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("'", "\\'");
if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(password) || string.IsNullOrWhiteSpace(newPassword))
{
return "{\"code\":500,\"msg\":\"输入不能为空\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select user_id,password from pepdtp.user where user_id='"
@@ -445,8 +639,16 @@ namespace KJD_Web.BLL.WXXD
}
}
/// <summary>
/// temu退回包裹的密钥
/// </summary>
public string return_package_secret_key { get; set; } = "aaMETt2bPe6YHzZ1ojbC+6wOvgtwehqc6A+/Rz+pCUU=";
/// <summary>
/// temu退回包裹的签名
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string GetPackageSign(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -67,6 +67,7 @@ namespace KJD_Web.Model.ShopModel
/// </summary>
public string ad_login_status { get; set; }
public DateTime? jit_expire_time { get; set; }
public int? expire_time { get; set; }
public DateTime? add_time { get; set; }
}
@@ -62,5 +62,9 @@ namespace KJD_Web.Model
/// 用户的功能操作权限
/// </summary>
public string authority { get; set; }
/// <summary>
/// 用户积分点数
/// </summary>
public int points { get; set; }
}
}
+14 -3
View File
@@ -68,6 +68,11 @@ namespace KJD_Web.Utils
ConnTo();
}
public void BeginTransaction()
{
Conn.BeginTransaction();
}
/// <summary>
/// 去掉SQL中的特殊字符
/// </summary>
@@ -329,9 +334,9 @@ namespace KJD_Web.Utils
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public int ExecuteFirstInt(string SqlString)
public int ExecuteFirstInt(string SqlString, MySqlParameter[] parms = null)
{
string id = ExecuteFirst(SqlString, null);
string id = ExecuteFirst(SqlString, parms);
int i;
int.TryParse(id, out i);
return i;
@@ -659,16 +664,22 @@ namespace KJD_Web.Utils
cmd.CommandTimeout = TimeOut;
}
public MySqlTransaction Transaction { get; set; } = null;
/// <summary>
/// 连接数据库
/// </summary>
private void ConnTo()
private void ConnTo(bool isTransaction = false)
{
Close();
try
{
Conn = new MySqlConnection(ConnString);
Conn.Open();
if (isTransaction)
{
Conn.BeginTransaction();
}
}
catch (Exception e)
{