部分功能优化

This commit is contained in:
wule committed 2026-02-11 18:05:45 +08:00
1 parent 60ed59fc05
commit 5eea769672
10 files changed
+443 -96

No files matched your search

@@ -703,6 +703,7 @@ namespace KJD_Web.BLL.BXX
var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'");
var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'");
var is_not_count = (RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'")).ParseToBool();
var prod_count = (RegexUtils.GetStringQuery(ref inputData, "prod_count")?.Replace("'", "\\'")).ParseToInt();
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -766,7 +767,7 @@ namespace KJD_Web.BLL.BXX
}
sql += where;
int count = 0;
int count = prod_count;
if (!is_not_count)
count = mySql.ExecuteRowCount(sql);
@@ -777,24 +778,36 @@ namespace KJD_Web.BLL.BXX
}
else
{
//sql = "select p.id" +
// " from bxx.product p where p.is_del=0";
//sql += where;
//sql += " ORDER BY RAND()";
//sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
//dt = mySql.ExecuteDataTable(sql);
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," +
" p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.product_get_type,p.sale_count,p.sale_count_text," +
" p.fission_words,p.head_words,p.end_words,p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" p.wx_cat_leaf" +
sql = "select p.id" +
" from bxx.product p where p.is_del=0";
//where子句
sql += where;
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;
dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message) || dt == null)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
var db_ids = string.Join(",", dt.Rows.Cast<DataRow>().Select(r => r["id"].ParseToInt()));
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," +
" p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.product_get_type,p.sale_count,p.sale_count_text," +
" p.fission_words,p.head_words,p.end_words,p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" p.wx_cat_leaf" +
" from bxx.product p where p.is_del=0";
//where子句
//sql += where;
sql += " and id in (" + db_ids + ")";
//sql += " ORDER BY RAND()";
//sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
@@ -1917,6 +1930,8 @@ namespace KJD_Web.BLL.BXX
string img_url = RegexUtils.GetStringQuery(ref inputData, "img_url")?.Replace("'", "\\'");
bool is_keep_file = RegexUtils.GetStringQuery(ref inputData, "is_keep_file").ParseToBool();
is_keep_file = System.Configuration.ConfigurationManager.ConnectionStrings["IsKeepBase64UploadImgFile"]?.ConnectionString == "1";
try
{
byte[] imageBytes = Convert.FromBase64String(imgBase64);
@@ -252,6 +252,8 @@ namespace NaiBa.Util.Extension
{
try
{
if (str is null)
return false;
return bool.Parse(str.ToString());
}
catch