1优化店铺查询 2数据库上传次数统计优化

This commit is contained in:
wule committed 2026-01-05 21:14:45 +08:00
1 parent ed5aec05ca
commit ba5dfe3264
18 files changed
+414 -186

No files matched your search

@@ -1123,7 +1123,7 @@ namespace KJD_Web.BLL.BXX
{
add_product_remaining = add_product_remaining - 1;
sql += "\r\n";
sql += "update bxx.shop set add_product_remaining=" + add_product_remaining + " where shop_id='" + shop_id + "';";
//sql += "update bxx.shop set add_product_remaining=" + add_product_remaining + " where shop_id='" + shop_id + "';";
sql += "update bxx.product set select_total_count=select_total_count+1 where id=" + out_product_Id + ";";
//sql += "update bxx.shop_add_prod_count set add_product_remaining=" + add_product_remaining + " where shop_id='" + shop_id + "';";
sql += "INSERT INTO bxx.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" +
@@ -505,17 +505,39 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "INSERT INTO " + tableName +
string sql = "";
if (add_product_remaining > 0) // add_product_remaining 为空或为0表示商品直传,不消耗次数
{
sql = "select * from kjd.shop_add_prod_count where shop_id='" + shop_id + "';";
var dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message))
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
if (dt != null && dt.Rows.Count > 0)
{
add_product_remaining = dt.Rows[0]["add_product_remaining"].ParseToInt();
if (add_product_remaining <= 0)
{
mySql.Close();
return "{\"code\":501,\"msg\":\"本月商品认领限额已用完,请下个月再操作!\"}";
}
}
}
sql = "INSERT INTO " + tableName +
" (out_product_Id,shop_id,shop_account,user_name,sub_user_name,notes,status,fission_product_name,add_time,mdy_time) VALUES" +
" ('" + out_product_Id + "','" + shop_id + "','" + shop_account + "','" + user_name + "','" + sub_user_name + "','" +
notes + "','" + status + "','" + add_fission_product_name + "','" +
addTimeStr + "','" +
addTimeStr + "');";
if (add_product_remaining > 0)
if (add_product_remaining > 0) // add_product_remaining 为空或为0表示商品直传,不消耗次数
{
add_product_remaining = add_product_remaining - 1;
sql += "\r\n";
sql += "UPDATE kjd.shop SET add_product_remaining=" + add_product_remaining + " WHERE shop_id='" + shop_id + "';";
//sql += "UPDATE kjd.shop SET add_product_remaining=" + add_product_remaining + " WHERE shop_id='" + shop_id + "';";
sql += "UPDATE kjd.product SET select_total_count=select_total_count+1 WHERE id=" + out_product_Id + ";";
sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" +
"ON DUPLICATE KEY UPDATE add_product_remaining=add_product_remaining-1";
@@ -420,17 +420,39 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "INSERT INTO " + tableName +
string sql = "";
if (add_product_remaining > 0) // add_product_remaining 为空或为0表示商品直传,不消耗次数
{
sql = "select * from kjd.shop_add_prod_count where shop_id='" + shop_id + "';";
var dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message))
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
if (dt != null && dt.Rows.Count > 0)
{
add_product_remaining = dt.Rows[0]["add_product_remaining"].ParseToInt();
if (add_product_remaining <= 0)
{
mySql.Close();
return "{\"code\":501,\"msg\":\"本月商品认领限额已用完,请下个月再操作!\"}";
}
}
}
sql = "INSERT INTO " + tableName +
" (out_product_Id,shop_id,shop_account,user_name,sub_user_name,notes,status,add_time,mdy_time) VALUES" +
" ('" + out_product_Id + "','" + shop_id + "','" + shop_account + "','" + user_name + "','" + sub_user_name + "','" +
notes + "','" + status + "','" +
addTimeStr + "','" +
addTimeStr + "');";
if (add_product_remaining > 0)
if (add_product_remaining > 0) // add_product_remaining 为空或为0表示商品直传,不消耗次数
{
add_product_remaining = add_product_remaining - 1;
sql += "\r\n";
sql += "UPDATE kjd.shop SET add_product_remaining=" + add_product_remaining + " where shop_id='" + shop_id + "';";
//sql += "UPDATE kjd.shop SET add_product_remaining=" + add_product_remaining + " where shop_id='" + shop_id + "';";
sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" +
"ON DUPLICATE KEY UPDATE add_product_remaining=add_product_remaining-1";
}
@@ -627,16 +649,16 @@ namespace KJD_Web.BLL
if (search_notes == "无备注")
where += " and s.notes = ''";
else if (search_notes == "重复")
where += " and s.notes like '%重复%' and s.notes not like '%核价成功%' and s.notes not like '%核价通过%'";
where += " and s.notes like '重复%' and s.notes not like '核价成功%' and s.notes not like '核价通过%'";
else if (search_notes == "核价成功")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes not like '%重复%'";
where += " and (s.notes like '核价成功%' or s.notes like '核价通过%') and s.notes not like '重复%'";
else if (search_notes == "核价成功(重复)")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes like '%重复%'";
where += " and (s.notes like '核价成功%' or s.notes like '核价通过%') and s.notes like '重复%'";
else
where += " and s.notes like '%" + search_notes + "%'";
where += " and s.notes like '" + search_notes + "%'";
}
if (!string.IsNullOrWhiteSpace(search_user_notes))
where += " and s.user_notes like '%" + search_user_notes + "%'";
where += " and s.user_notes like '" + search_user_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
@@ -698,7 +720,7 @@ namespace KJD_Web.BLL
sql += where; // where子句
sql += " order by add_time desc";
sql += " order by s.add_time desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
@@ -131,7 +131,7 @@ namespace KJD_Web.BLL
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
login_status2 = row["login_status2"].ToString(),
add_product_remaining = row["add_remaining"].ParseToInt(),
add_product_remaining = Math.Max(0, row["add_remaining"].ParseToInt()),
add_product_month = row["add_month"].ParseToInt(),
operate_sub_sa_name = row["operate_sub_sa_name"].ParseToString(),
ad_cookie = row["ad_cookie"].ParseToString(),
@@ -200,7 +200,7 @@ namespace KJD_Web.BLL
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string SubSaGetSelectProdShop(string inputData)
public string SubSaGetSelectProdShop(string inputData) // 废弃
{
if (!string.IsNullOrEmpty(inputData))
{
@@ -309,7 +309,7 @@ namespace KJD_Web.BLL
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
login_status2 = row["login_status2"].ToString(),
add_product_remaining = row["add_remaining"].ParseToInt(),
add_product_remaining = Math.Max(0, row["add_remaining"].ParseToInt()),
add_product_month = row["add_month"].ParseToInt(),
operate_sub_sa_name = row["operate_sub_sa_name"].ParseToString(),
ad_cookie = row["ad_cookie"].ParseToString(),