优化数据库查询 修复自定义控件datagridview图片显示bug

This commit is contained in:
wule committed 2026-02-12 19:21:03 +08:00
1 parent 5eea769672
commit 4038b0390a
10 files changed
+180 -56

No files matched your search

@@ -11,6 +11,7 @@ using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Security;
@@ -249,7 +250,7 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
if (version < 823)
if (version < (System.Configuration.ConfigurationManager.ConnectionStrings["LimitVersion"]?.ConnectionString).ParseToInt())
return "{\"code\":1,\"msg\":\"当前版本过于陈旧,请立即升级新版\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'","\\'");
@@ -295,6 +296,20 @@ namespace KJD_Web.BLL.BXX
where += " and p.product_get_type ='" + product_get_type + "'";
if (!string.IsNullOrEmpty(wx_safe_status))
where += " and p.wx_safe_status in ('" + wx_safe_status.Replace(",", "','") + "')";
//if (!string.IsNullOrEmpty(wx_safe_status))
//{
// where += " and (";
// var index = 0;
// foreach (var status in wx_safe_status.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries))
// {
// index++;
// if (index == 1)
// where += " p.wx_safe_status='" + status + "'";
// else
// where += " or p.wx_safe_status='" + status + "'";
// }
// where += ") ";
//}
if (!string.IsNullOrEmpty(special_prod_type))
where += " and p.special_prod_type ='" + special_prod_type + "'";
@@ -344,7 +359,11 @@ namespace KJD_Web.BLL.BXX
}
sql += where;
var count = mySql.ExecuteRowCount(sql);
var count = 0;
if (isDetail)
count = 1;
else
count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
@@ -769,7 +788,10 @@ namespace KJD_Web.BLL.BXX
int count = prod_count;
if (!is_not_count)
{
count = mySql.ExecuteRowCount(sql);
Thread.Sleep(1500);
}
DataTable dt;
if (count == 0 && !is_not_count)
@@ -783,16 +805,17 @@ namespace KJD_Web.BLL.BXX
//where子句
sql += where;
sql += " ORDER BY RAND()";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
//sql += " ORDER BY RAND()";
//sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
//var limit = RandomUtils.GetId(count - page_size);
//sql += " limit " + limit + "," + page_size;
var limit = RandomUtils.GetId(count - page_size);
sql += " limit " + limit + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message) || dt == null)
{
mySql.Close();
mySql.Close();
Thread.Sleep(1000);
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
@@ -812,6 +835,7 @@ namespace KJD_Web.BLL.BXX
}
mySql.Close();
Thread.Sleep(500);
if (dt != null)
{
try
@@ -20,9 +20,11 @@ namespace KJD_Web.BLL.DYXD
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
if (version < 823)
if (version < (System.Configuration.ConfigurationManager.ConnectionStrings["LimitVersion"]?.ConnectionString).ParseToInt())
return "{\"code\":1,\"msg\":\"当前版本过于陈旧,请立即升级新版\"}";
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
@@ -20,9 +20,11 @@ namespace KJD_Web.BLL.WXXD
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
if (version < 823)
if (version < (System.Configuration.ConfigurationManager.ConnectionStrings["LimitVersion"]?.ConnectionString).ParseToInt())
return "{\"code\":1,\"msg\":\"当前版本过于陈旧,请立即升级新版\"}";
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
+1
View File
@@ -9,6 +9,7 @@
<add name="ConnKJDBAK" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-9s7x16mt.sql.tencentcdb.com';Port=24049;User Id='kjdbak';Password='Temukjd0126';Charset=utf8mb4;"/>
<add name="UpdateVersion" connectionString="525"/>
<add name="LowVersion" connectionString="523"/>
<add name="LimitVersion" connectionString="823"/>
<add name="UpdateExe" connectionString="http://1.13.195.131:9000/Download/Update.exe"/>
<add name="UpdateFiles" connectionString="http://1.13.195.131:9000/Download/Update525.zip"/>
<add name="UpdateExeChk" connectionString="324527ACE5020DCA77D65A5037718B65"/>