1代理改名字 2代理管理功能 3订单流水统计功能(方便报税) 4 商品预售界面-商品改价支持加减乘除四种模式

This commit is contained in:
wule committed 2026-07-18 18:29:06 +08:00
1 parent 457a8acee6
commit ba502650ab
69 files changed
+27720 -720

No files matched your search

@@ -655,18 +655,45 @@ namespace KJD_Web.BLL.BXX
string tableName = GetProductTableName(inputData);
string sql = "";
List<string> forceIndex = new List<string>() { };
if (!isDetail)
{
if (!search_prod_name.IsNullOrEmpty() || !search_prod_name_in.IsNullOrEmpty())
forceIndex.Add("index_product_name");
if (!search_spu.IsNullOrEmpty())
forceIndex.Add("index_spu_id");
if (!search_skc.IsNullOrEmpty())
forceIndex.Add("index_skc_id");
if (!search_secret_spu_ids.IsNullOrEmpty())
forceIndex.Add("index_secret_spu_id");
if (min_view_uv > 0)
forceIndex.Add("index_view_uv");
if (!search_group.IsNullOrEmpty())
forceIndex.Add("index_group");
if (!from_shop_id.IsNullOrEmpty())
forceIndex.Add("index_from_shop_id");
if (!from_shop_name.IsNullOrEmpty())
forceIndex.Add("index_from_shop_name");
//if (!add_user_name.IsNullOrEmpty())
// forceIndex.Add("index_add_user_name");
if (!forceIndex.Contains("index_view_uv"))
forceIndex.Add("index_sort_add_time");
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
sql = " select count(*) from " + tableName + " p ";
//sql += " LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
if (forceIndex.Count > 0)
sql += " FORCE INDEX(" + string.Join(",", forceIndex) + ")";
sql += " WHERE p.is_del=0";
string where = "";
if (!string.IsNullOrEmpty(from_shop_id))
where += " and p.from_shop_id ='" + from_shop_id + "'";
where += " and p.from_shop_id='" + from_shop_id + "'";
if (!string.IsNullOrEmpty(from_shop_name))
where += " and p.from_shop_name ='" + from_shop_name + "'";
where += " and p.from_shop_name='" + from_shop_name + "'";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and p.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(search_secret_spu_ids))
@@ -675,6 +702,8 @@ namespace KJD_Web.BLL.BXX
where += " and p.ext_code in ('" + string.Join("','", ext_code_in.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) + "')";
if (!string.IsNullOrEmpty(product_get_type))
where += " and p.product_get_type in ('" + product_get_type.Replace(",", "','") + "')";
else
where += " and p.product_get_type in ('厂商直采','1688厂家','1688外部数据','微信小店','微信店采','母店采集','机会商品','以图搜品','多多外部数据')";
if (!string.IsNullOrEmpty(wx_safe_status))
where += " and p.wx_safe_status in ('" + wx_safe_status.Replace(",", "','") + "')";
if (!string.IsNullOrEmpty(special_prod_type)/* && special_prod_type != "普通商品,爆款数据"*/)
@@ -760,11 +789,11 @@ namespace KJD_Web.BLL.BXX
}
if (!where.Contains("send_to_out_server"))
{
//where += " and p.send_to_out_server IN (0,1,127)";
where += " and p.send_to_out_server IN (0,1,2,127)";
}
if (!where.Contains("distribution_set"))
{
//where += " and p.distribution_set IN (0,1,2,127)";
where += " and p.distribution_set IN (0,1,2,127)";
}
if (!string.IsNullOrEmpty(real_coid))
@@ -794,10 +823,18 @@ namespace KJD_Web.BLL.BXX
{
where += " and p.ban_wx=" + ban_wx;
}
else
{
where += " and p.ban_wx in (0,1)";
}
if (ban_pdd != null)
{
where += " and p.ban_pdd=" + ban_pdd;
}
else
{
where += " and p.ban_pdd in (0,1)";
}
if (min_view_uv != null)
{
where += " and p.view_uv>=" + min_view_uv;
@@ -807,6 +844,11 @@ namespace KJD_Web.BLL.BXX
add_user_name = "'" + string.Join("','", add_user_name.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.add_user_name in (" + add_user_name + ")";
}
else
{
// 目前客户端即使是自有库查详情的时候也有没传 todo 每次查询都传参,或者就不管,详情会命中其他索引
//where += " and p.add_user_name='admin'";
}
if (no_fission_words)
{
where += " and (fission_words='' or fission_words IS NULL)";
@@ -816,12 +858,14 @@ namespace KJD_Web.BLL.BXX
where += " and fission_words LIKE '" + fission_words + "%'";
}
sql += where;
var count = 0;
if (isDetail || is_not_count)
count = 1;
else
{
count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
}
DataTable dt;
if (count == 0)
@@ -830,6 +874,35 @@ namespace KJD_Web.BLL.BXX
}
else
{
sql = " SELECT p.id " +
" FROM " + tableName + " p";
if (forceIndex.Count > 0)
sql += " FORCE INDEX(" + string.Join(",", forceIndex) + ")";
sql += " WHERE p.is_del=0";
//where子句
sql += where;
if (sort_field == "view_uv")
sql += " order by p.view_uv desc, p.add_time desc";
else
sql += " order by p.add_time desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
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()));
if (string.IsNullOrEmpty(db_ids))
{
mySql.Close();
return "{\"code\":200,\"data\":[],\"count\":" + 0 + "}";
}
if (isDetail)
sql = " SELECT p.*" +
" from " + tableName + " p" +
@@ -841,14 +914,8 @@ namespace KJD_Web.BLL.BXX
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation,p.view_uv,p.add_user_name" +
" FROM " + tableName + " p" +
" WHERE p.is_del=0";
//where子句
sql += where;
if (sort_field == "view_uv")
sql += " order by p.view_uv desc, p.id desc";
else
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
sql += " and id in (" + db_ids + ")";
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
@@ -1327,6 +1394,10 @@ namespace KJD_Web.BLL.BXX
add_user_name = "'" + string.Join("','", add_user_name.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.add_user_name in (" + add_user_name + ")";
}
else
{
where += " and p.add_user_name='admin'";
}
sql += where;
sql += " ORDER BY id DESC";
@@ -1718,11 +1789,12 @@ namespace KJD_Web.BLL.BXX
if (!string.IsNullOrEmpty(product_get_type))
{
where1 = " and p.product_get_type in ('" + product_get_type.Replace(",", "','") + "')";
//where1 = " and ((product_get_type = '多多外部数据') OR (product_get_type = '微信小店') OR (product_get_type = '微信店采' AND wx_safe_status = '安全商品')) ";
if (is学员数据)
{
// 多多外部数据20% 微信小店数据30% 微信店采50%
//where2 = " and (RAND() < 0.066 AND product_get_type = '多多外部数据' OR RAND() < 0.3 AND product_get_type = '微信小店' OR RAND() <= 1 AND product_get_type = '微信店采') ";
where2 = " and (RAND() < 0.055 AND product_get_type = '多多外部数据' OR RAND() < 0.39 AND product_get_type = '微信小店' OR RAND() <= 1 AND product_get_type = '微信店采') ";
where2 = " and ((RAND() < 0.055 AND product_get_type = '多多外部数据') OR (RAND() < 0.39 AND product_get_type = '微信小店') OR (RAND() <= 1 AND product_get_type = '微信店采' AND wx_safe_status = '安全商品')) ";
}
where += where1;
}