商品活动上传逻辑优化 商品添加缓存查看 商品添加支持按类目筛选

This commit is contained in:
wule committed 2025-09-23 19:33:52 +08:00
1 parent 4fcfb2875a
commit d01d3bc306
12 files changed
+1136 -136

No files matched your search

@@ -204,7 +204,7 @@ namespace KJD_Web.BLL.BXX
else
{
if (isDetail)
sql = "select p.*,s.img_base64 from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where 1=1";
sql = "select p.*,s.img_base64,s.img_url from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where 1=1";
else if (string.IsNullOrEmpty(get_select_count))
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.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id from bxx.product p where 1=1";
@@ -260,9 +260,10 @@ namespace KJD_Web.BLL.BXX
};
if (isDetail)
{
prod.sku_img_replace_base64 = row["img_base64"].ToString();
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
prod.sku_img_replace_base64 = row["img_base64"].ToString();
prod.sku_img_replace_url = row["img_url"].ToString();
}
if (!string.IsNullOrEmpty(get_select_count))
{
@@ -311,11 +312,11 @@ namespace KJD_Web.BLL.BXX
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.sku_img_replace p where 1=1";
string sql = "select count(id) from bxx.sku_img_replace s where 1=1";
string where = "";
if (!string.IsNullOrEmpty(sku_img_replace_ids))
where += " and p.id in (" + sku_img_replace_ids + ")";
where += " and s.id in (" + sku_img_replace_ids + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
@@ -327,13 +328,12 @@ namespace KJD_Web.BLL.BXX
}
else
{
if (isDetail)
sql = "select * from bxx.product p left where 1=1";
sql = "select * from bxx.sku_img_replace s where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " order by s.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
@@ -351,6 +351,7 @@ namespace KJD_Web.BLL.BXX
id = Convert.ToInt32(row["id"]),
img_base64 = row["img_base64"].ToString(),
img_md5 = row["img_md5"].ToString(),
img_url = row["img_url"].ToString(),
};
skuImgReplaceLst.Add(skuImgReplace);
}
@@ -370,6 +371,11 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 随机获取商品(无详情) 随机添加到上传列表所以不需要获取详情
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string GetProductListRandom(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -381,7 +387,7 @@ namespace KJD_Web.BLL.BXX
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var is_detail = RegexUtils.GetStringQuery(ref inputData, "is_detail")?.Replace("'", "\\'");
var in_ext_codes = RegexUtils.GetStringQuery(ref inputData, "in_ext_codes")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -392,6 +398,12 @@ namespace KJD_Web.BLL.BXX
string sql = "select count(id) from bxx.product p where 1=1";
string where = "";
if (!string.IsNullOrEmpty(in_ext_codes))
{
in_ext_codes = "'" + string.Join("','", in_ext_codes.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and ext_code in (" + in_ext_codes + ")";
}
sql += where;
var count = mySql.ExecuteRowCount(sql);
@@ -403,11 +415,8 @@ namespace KJD_Web.BLL.BXX
}
else
{
if (is_detail == "true")
sql = "select * from bxx.product p where 1=1";
else
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.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words from bxx.product p where 1=1";
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.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words from bxx.product p where 1=1";
//where子句
sql += where;
@@ -449,11 +458,6 @@ namespace KJD_Web.BLL.BXX
fission_words = row["fission_words"].ParseToString(),
head_words = row["head_words"].ParseToString(),
};
if (is_detail == "true")
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
}
productLst.Add(prod);
}
var data = JsonUtils.SerializerObjectToString(productLst);
@@ -664,6 +668,7 @@ namespace KJD_Web.BLL.BXX
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string img_md5 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "img_md5"));
string img_base64 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "img_base64"));
string img_url = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "img_url"));
if (string.IsNullOrEmpty(user_name))
{
@@ -677,6 +682,8 @@ namespace KJD_Web.BLL.BXX
sql += " img_md5='" + img_md5 + "',";
if (img_base64 != null)
sql += " img_base64='" + img_base64 + "',";
if (img_url != null)
sql += " img_url='" + img_url + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";";
@@ -27,6 +27,7 @@ namespace KJD_Web.Model
public string size_json { get; set; }
public int sku_img_replace_id { get; set; }
public string sku_img_replace_base64 { get; set; }
public string sku_img_replace_url { get; set; }
public string main_img { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
@@ -10,5 +10,6 @@ namespace KJD_Web.Model.ShopModel
public int id { get; set; }
public string img_md5 { get; set; }
public string img_base64 { get; set; }
public string img_url { get; set; }
}
}