优化web查询 新增学员数据 尝试64位软件

This commit is contained in:
wule committed 2026-07-01 20:24:18 +08:00
1 parent 30beb00fc4
commit caba307ed1
44 files changed
+738 -1769

No files matched your search

@@ -80,7 +80,7 @@ namespace KJD_Web.BLL.BXX
}
if (add_user_name != null && add_user_name != "admin")
{
Thread.Sleep(2000);
Thread.Sleep(1000);
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
@@ -89,6 +89,8 @@ namespace KJD_Web.BLL.BXX
if (add_user_name != null && add_user_name != "admin")
{
sql = "select count(*) from bxx.product where is_del=0 and add_user_name='" + add_user_name + "'";
var count = mySql.ExecuteRowCount(sql);
if (!string.IsNullOrEmpty(mySql.Message) || count > 100000)
@@ -121,7 +123,12 @@ namespace KJD_Web.BLL.BXX
sql = "INSERT INTO bxx.product(";
sql += "from_shop_id,from_shop_name,offline_supplier_id,offline_supplier_name,spu_id,skc_id,real_coid,real_spu_id,main_cat_id,main_cat_name,cat_id,";
sql += "cat_name,price_text,product_name,ext_code,main_img,product_json,size_json,notes,product_get_type,sale_count,sale_count_text,special_prod_type,";
sql += "cat_name,price_text,product_name,ext_code,main_img,product_json,size_json,notes,product_get_type,";
if (sale_count != null)
{
sql += "sale_count,";
}
sql += "sale_count_text,special_prod_type,";
sql += "distribution_set,ban_wx,ban_pdd,add_time,mdy_time,";
if (add_user_name != null)
sql += "add_user_name,";
@@ -133,8 +140,12 @@ namespace KJD_Web.BLL.BXX
sql += ") ";
sql += "values ('" + from_shop_id + "','" + from_shop_name + "','" + offline_supplier_id + "','" + offline_supplier_name + "','" + spu_id + "','" +
skc_id + "','" + real_coid + "','" + real_spu_id + "','" + main_cat_id + "','" + main_cat_name + "','" + cat_id + "','" + cat_name + "','" +
price_text + "','" + product_name + "','" + ext_code + "','" + main_img + "',@product_json,@size_json,'" + notes + "','" + product_get_type + "','" +
sale_count + "','" + sale_count_text + "','" + special_prod_type + "'," + distribution_set.ParseToInt() + "," + ban_wx + "," + ban_pdd + ",";
price_text + "','" + product_name + "','" + ext_code + "','" + main_img + "',@product_json,@size_json,'" + notes + "','" + product_get_type + "',";
if (sale_count != null)
{
sql += "'" + sale_count + "',";
}
sql += "'" + sale_count_text + "','" + special_prod_type + "'," + distribution_set.ParseToInt() + "," + ban_wx + "," + ban_pdd + ",";
sql += "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql += "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
if (add_user_name != null)
@@ -594,11 +605,10 @@ namespace KJD_Web.BLL.BXX
var wx_safe_status = RegexUtils.GetStringQuery(ref inputData, "wx_safe_status")?.Replace("'", "\\'");
var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'");
if (special_prod_type.IsNullOrEmpty())
special_prod_type = "普通商品,书籍";
special_prod_type = "普通商品";
var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'");
var has_wx_cat = RegexUtils.GetStringQuery(ref inputData, "has_wx_cat")?.Replace("'", "\\'");
var send_to_out_server = RegexUtils.GetStringQuery(ref inputData, "send_to_out_server")?.Replace("'", "\\'");
var has_send_to_out_server = RegexUtils.GetStringQuery(ref inputData, "has_send_to_out_server")?.Replace("'", "\\'");
var real_coid = RegexUtils.GetStringQuery(ref inputData, "real_coid")?.Replace("'", "\\'");
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
var problem_prod_data = RegexUtils.GetStringQuery(ref inputData, "problem_prod_data")?.Replace("'", "\\'");
@@ -622,14 +632,11 @@ namespace KJD_Web.BLL.BXX
List<MySqlParameter> paramLst = new List<MySqlParameter>();
string sql = " select count(*) from bxx.product p ";
//if (!string.IsNullOrEmpty(wx_safe_status))
// sql += " FORCE INDEX (index_wx_safe_status) ";
//sql += " LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
sql += " WHERE p.is_del=0";
string where = "";
//where += " AND (b.ban_wx IS NULL OR b.ban_wx=0)";
if (!string.IsNullOrEmpty(from_shop_id))
where += " and p.from_shop_id ='" + from_shop_id + "'";
if (!string.IsNullOrEmpty(from_shop_name))
@@ -644,21 +651,7 @@ namespace KJD_Web.BLL.BXX
where += " and p.product_get_type in ('" + product_get_type.Replace(",", "','") + "')";
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)/* && special_prod_type != "普通商品,书籍,爆款数据"*/)
if (!string.IsNullOrEmpty(special_prod_type)/* && special_prod_type != "普通商品,爆款数据"*/)
where += " and p.special_prod_type in ('" + special_prod_type.Replace(",", "','") + "')";
if (!string.IsNullOrWhiteSpace(search_spu))
@@ -669,13 +662,13 @@ namespace KJD_Web.BLL.BXX
where += " and p.spu_id like '" + search_spu + "%'";
}
if (!string.IsNullOrWhiteSpace(search_skc))
where += " and p.skc_id like '%" + search_skc + "%'";
where += " and p.skc_id like '" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
where += " and p.cat_name like '%" + search_cat + "%'";
where += " and p.cat_name like '" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_cat1))
where += " and p.main_cat_name like '%" + search_cat1 + "%'";
where += " and p.main_cat_name like '" + search_cat1 + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like '%" + search_ext_code + "%'";
where += " and p.ext_code like '" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
{
var searchProdNameWords = search_prod_name.Split(new string[] { ",", ",", ";", ";", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
@@ -701,10 +694,10 @@ namespace KJD_Web.BLL.BXX
if (search_group == "无分组")
where += " and (p.group is null or p.group = '')";
else
where += " and p.group like '%" + search_group + "%'";
where += " and p.group like '" + search_group + "%'";
}
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like '%" + search_notes + "%'";
where += " and p.notes like '" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(wx_cat_1))
where += " and p.wx_cat_1 in (" + wx_cat_1 + ")";
@@ -717,25 +710,13 @@ namespace KJD_Web.BLL.BXX
if (!string.IsNullOrEmpty(has_wx_cat))
{
//if (has_wx_cat.ToLower() == "true")
// where += " and wx_cat_leaf is NOT NULL and wx_cat_3 IS NOT NULL";
//else
// where += " and (wx_cat_leaf is NULL OR wx_cat_3 IS NULL)";
if (has_wx_cat.ToLower() == "true")
where += " and wx_cat_3 IS NOT NULL";
where += " and p.wx_cat_3 >= 0";
else
where += " and wx_cat_3 IS NULL";
where += " and p.wx_cat_3 IS NULL";
}
if (!string.IsNullOrEmpty(send_to_out_server))
where += " and send_to_out_server=" + send_to_out_server;
else if (!string.IsNullOrEmpty(has_send_to_out_server))
{
if (has_send_to_out_server.ToLower() == "true")
where += " and send_to_out_server=1";
else
where += " and send_to_out_server!=1";
}
where += " and p.send_to_out_server in (" + send_to_out_server + ")";
// 供应商货源是否已完成初始设置
if (!string.IsNullOrEmpty(is_supplier_prod_ok))
{
@@ -744,17 +725,26 @@ namespace KJD_Web.BLL.BXX
//else
// where += " and (wx_cat_leaf IS NULL or send_to_out_server=0 or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)";
if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "是" || is_supplier_prod_ok == "已设置")
where += " and wx_cat_leaf IS NOT NULL and send_to_out_server IN (1,127) and distribution_set IN (1,127)";
where += " and p.wx_cat_3 IS NOT NULL and p.send_to_out_server IN (1,127) and p.distribution_set IN (1,127)";
else
where += " and (wx_cat_leaf IS NULL or send_to_out_server NOT IN (1,127) or distribution_set NOT IN (1,127))";
where += " and (p.wx_cat_3 IS NULL or p.send_to_out_server NOT IN (1,127) or p.distribution_set NOT IN (1,127))";
}
if (!where.Contains("send_to_out_server"))
{
//where += " and p.send_to_out_server IN (0,1,127)";
}
if (!where.Contains("distribution_set"))
{
//where += " and p.distribution_set IN (0,1,2,127)";
}
if (!string.IsNullOrEmpty(real_coid))
{
where += " and real_coid='" + real_coid + "'";
where += " and p.real_coid='" + real_coid + "'";
}
if (!string.IsNullOrEmpty(has_wx_format))
{
where += " and has_wx_format='" + has_wx_format + "'";
where += " and p.has_wx_format='" + has_wx_format + "'";
}
if (!string.IsNullOrEmpty(problem_prod_data))
{
@@ -798,11 +788,6 @@ namespace KJD_Web.BLL.BXX
}
sql += where;
if (sql.Contains("15288888888"))
{
}
var count = 0;
if (isDetail || is_not_count)
count = 1;
@@ -818,54 +803,19 @@ namespace KJD_Web.BLL.BXX
{
if (isDetail)
sql = " SELECT p.*" +
//" ,s.img_base64" +
//" ,s.img_url" +
//" ,e.ext_code_price" +
" from bxx.product p" +
//" LEFT JOIN bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
//" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
" where p.is_del=0";
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,p.group," +
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" 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" +
//" ,s.img_url," +
//" e.ext_code_price" +
" FROM bxx.product p " +
//" LEFT JOIN bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
//" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
" where p.is_del=0";
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,p.sku_img_replace_id,p.group," +
" p.main_img,p.notes,p.add_time,p.mdy_time,p.fission_words,p.head_words,p.end_words,p.group," +
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" 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" +
//" ,s.img_url" +
//" ,e.ext_code_price," +
//" COUNT(se.id) AS select_count" +
" FROM bxx.product p" +
//" LEFT JOIN bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
//" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
//" LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " +
" WHERE p.is_del=0";
//where子句
sql += where;
if (sql.Contains("15288888888"))
{
}
if (!isDetail && !string.IsNullOrEmpty(get_select_count))
sql += " group by p.id";
if (sort_field == "select_total_count")
sql += " order by p.select_total_count desc, p.id desc";
else if (sort_field == "view_uv")
if (sort_field == "view_uv")
sql += " order by p.view_uv desc, p.id desc";
else
sql += " order by p.id desc";
@@ -907,12 +857,10 @@ namespace KJD_Web.BLL.BXX
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
group = row["group"].ToString(),
select_total_count = row["select_total_count"].ParseToInt(),
//select_total_count = row["select_total_count"].ParseToInt(),
end_words = row["end_words"].ParseToString(),
fission_words = row["fission_words"].ParseToString(),
head_words = row["head_words"].ParseToString(),
sku_img_replace_id = row["sku_img_replace_id"].ParseToInt(),
//sku_img_replace_url = row["img_url"].ToString(),
product_get_type_text = row["product_get_type"].ToString(),
view_uv = row["view_uv"].ParseToNullableInt(),
sale_count = row["sale_count"].ParseToInt(),
@@ -936,8 +884,6 @@ namespace KJD_Web.BLL.BXX
prod.sku_secret_json = row["sku_secret_json"].ToString();
prod.fission_imgs = row["fission_imgs"].ToString();
prod.has_wx_format = row["has_wx_format"].ParseToNullableString(); // 微信回采
//prod.sku_img_replace_base64 = row["img_base64"].ToString();
//prod.sku_img_replace_url = row["img_url"].ToString();
prod.wx_img_map_json = row["wx_img_map_json"].ToString();
problem_prod_data = row["problem_prod_data"].IsNullOrEmpty() ? null : row["problem_prod_data"].ParseToString();
@@ -1733,11 +1679,18 @@ namespace KJD_Web.BLL.BXX
var wx_cat_1 = RegexUtils.GetStringQuery(ref inputData, "wx_cat_1")?.Replace("'", "\\'");
var wx_cat_2 = RegexUtils.GetStringQuery(ref inputData, "wx_cat_2")?.Replace("'", "\\'");
var wx_cat_3 = RegexUtils.GetStringQuery(ref inputData, "wx_cat_3")?.Replace("'", "\\'");
var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'");
var wx_safe_status = RegexUtils.GetStringQuery(ref inputData, "wx_safe_status")?.Replace("'", "\\'");
var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'");
if (special_prod_type.IsNullOrEmpty())
special_prod_type = "普通商品,书籍";
special_prod_type = "普通商品";
var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'");
var is学员数据 = false;
if (product_get_type == "学员数据")
{
is学员数据 = true;
product_get_type = "多多外部数据,微信小店,微信店采";
special_prod_type = "普通商品,爆款数据";
}
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") == "true"; // 不计数
var prod_count = RegexUtils.GetStringQuery(ref inputData, "prod_count").ParseToInt();
@@ -1747,6 +1700,8 @@ namespace KJD_Web.BLL.BXX
var ban_wx = RegexUtils.GetStringQuery(ref inputData, "ban_wx")?.Replace("'", "\\'");
var ban_pdd = RegexUtils.GetStringQuery(ref inputData, "ban_pdd")?.Replace("'", "\\'");
var add_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
if (is学员数据)
add_user_name = "admin";
var no_fission_words = RegexUtils.GetStringQuery(ref inputData, "no_fission_words").ParseToBool(); // 未裂变标题
var fission_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_words"))?.Replace("'", "\\'");
@@ -1806,22 +1761,37 @@ namespace KJD_Web.BLL.BXX
{
where += " and p.wx_cat_3 in (" + wx_cat_3 + ")";
}
string where1 = "";
string where2 = "";
if (!string.IsNullOrEmpty(product_get_type))
where += " and p.product_get_type in ('" + product_get_type.Replace(",", "','") + "')";
{
where1 = " and p.product_get_type in ('" + product_get_type.Replace(",", "','") + "')";
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 = '微信店采') ";
}
where += where1;
}
if (!string.IsNullOrEmpty(wx_safe_status))
where += " and p.wx_safe_status in ('" + wx_safe_status.Replace(",", "','") + "')";
//if (!string.IsNullOrEmpty(special_prod_type)) // 普通商品 爆款数据
// where += " and p.special_prod_type ='" + special_prod_type + "'";
if (!string.IsNullOrEmpty(special_prod_type)/* && special_prod_type != "普通商品,书籍,爆款数据"*/)
if (!string.IsNullOrEmpty(special_prod_type)/* && special_prod_type != "普通商品,爆款数据"*/)
where += " and p.special_prod_type in ('" + special_prod_type.Replace(",", "','") + "')";
// 供应商货源是否已完成初始设置
if (!string.IsNullOrEmpty(is_supplier_prod_ok))
{
if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "是" || is_supplier_prod_ok == "已设置")
where += " AND wx_cat_leaf IS NOT NULL AND send_to_out_server IN (1,127) and distribution_set IN (1,127)";
where += " AND wx_cat_leaf > 0 AND send_to_out_server IN (1,127) and distribution_set IN (1,127)";
else
where += " AND (wx_cat_leaf IS NULL OR send_to_out_server NOT IN (1,127) OR distribution_set NOT IN (1,127))";
}
else
{
where += " AND send_to_out_server IN (0,1,127) and distribution_set IN (0,1,2,127)";
}
if (!add_days_less.IsNullOrZero())
{
where += " and add_time > '" + DateTime.Now.AddDays(-add_days_less.ParseToInt()).ToString("yyyy-MM-dd") + "'";
@@ -1838,10 +1808,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 (!string.IsNullOrEmpty(add_user_name))
{
add_user_name = "'" + string.Join("','", add_user_name.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
@@ -1857,11 +1835,13 @@ namespace KJD_Web.BLL.BXX
}
sql += where;
int count = prod_count;
int count = prod_count;
if (product_get_type == "厂商直采" && count > 1000)
count = (count / 2.0).ParseToInt();
if (is学员数据 && count >= 450)
count = (count / 3.0).ParseToInt();
if (!is_not_count)
{
{
count = mySql.ExecuteRowCount(sql);
Thread.Sleep(1500);
}
@@ -1873,6 +1853,11 @@ namespace KJD_Web.BLL.BXX
}
else
{
if (is学员数据)
{
where = where.Replace(where1, where2);
}
sql = " SELECT p.id" +
" FROM bxx.product p" +
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid OR p.real_coid=b.coid)" +
@@ -1956,6 +1941,8 @@ namespace KJD_Web.BLL.BXX
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
if (product_get_type == "厂商直采" && count > 500)
count = (count * 2.0).ParseToInt();
if (is学员数据 && count >= 150)
count = (count * 3.0).ParseToInt();
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
}
catch (Exception ex)
@@ -2264,7 +2251,6 @@ namespace KJD_Web.BLL.BXX
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string img_md5 = RegexUtils.GetStringQuery(ref inputData, "img_md5");
string img_base64 = RegexUtils.GetStringQuery(ref inputData, "img_base64");
//string product_db_id = RegexUtils.GetStringQuery(ref inputData, "product_db_id");
string img_url = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "img_url"));
string img_type = RegexUtils.GetStringQuery(ref inputData, "img_type")?.Replace("'", "\\'");
string img_group = RegexUtils.GetStringQuery(ref inputData, "img_group")?.Replace("'", "\\'");
@@ -2274,7 +2260,6 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
//int sku_img_replace_id = 0;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
@@ -2290,10 +2275,6 @@ namespace KJD_Web.BLL.BXX
}
if (rst > 0)
{
//sku_img_replace_id = (int)rst;
//sql = "update bxx.product set sku_img_replace_id= "+ sku_img_replace_id + " where id=" + product_db_id + ";";
//bRst = mySql.ExecuteNonQuery(sql);
bRst = true;
}
mySql.Close();
@@ -2307,40 +2288,6 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyProdSkuImgReplaceId(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string product_db_id = RegexUtils.GetStringQuery(ref inputData, "product_db_id");
string img_db_id = RegexUtils.GetStringQuery(ref inputData, "img_db_id");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "update bxx.product set sku_img_replace_id= " + img_db_id + " where id=" + product_db_id + ";";
var bRst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (bRst)
return "{\"code\":200,\"msg\":\"success\"}";
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdySkuImgReplace(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -2450,473 +2397,6 @@ namespace KJD_Web.BLL.BXX
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 添加用户选择商品
/// </summary>
/// <param name="inputData"></param>
/// <param name="isAdmin"></param>
/// <returns></returns>
public string AddUserSelectProduct(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account")?.Replace("'", "\\'");
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name")?.Replace("'", "\\'");
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_product_remaining = RegexUtils.GetStringQuery(ref inputData, "add_product_remaining").ParseToInt();
var add_fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_fission_product_name").ParseToString())?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into bxx.product_select " +
"(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 + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
if (add_product_remaining > 0)
{
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.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 + ")" +
"ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)";
}
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyUserSelectProductStatus(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id")?.Replace("'", "\\'");
var up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
long l_draft_id = draft_id.ParseToLong();
long l_spu_map_table_id = l_draft_id % 128;
long l_select_map_table_id = id.ParseToLong() % 64;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
// 使用事务一次提交多个sql操作
//sql += "set @@autocommit=0;\r\n";
sql += "START TRANSACTION;\r\n";
if (!string.IsNullOrEmpty(up_spu_id) && !string.IsNullOrEmpty(draft_id))
{
sql += "insert into kjd_map.spu_map_" + l_spu_map_table_id +
" (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');\r\n";
// temu商品反复上传后记录一件选品商品上传的所有DraftId记录,pdd不需要
//sql += "insert into kjd_map.product_select_map_" + l_select_map_table_id +
// " (product_id,product_select_db_id,shop_id) values(" + draft_id + "," + id + ",'" + shop_id + "');\r\n";
}
sql += "update bxx.product_select set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
if (status != null)
sql += " status='" + status + "',";
if (status == "已上传")
sql += " add_times=add_times+1,";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";\r\n";
var rst = mySql.ExecuteNonQuery(sql);
string errMsg = mySql.Message;
if (string.IsNullOrEmpty(errMsg))
sql = "COMMIT;";
else
sql = "ROLLBACK;";
mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetUserSelectProductList(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "\\'");
var search_shop_id = RegexUtils.GetStringQuery(ref inputData, "search_shop_id")?.Replace("'", "\\'");
var search_shop_account = RegexUtils.GetStringQuery(ref inputData, "search_shop_account")?.Replace("'", "\\'");
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
var search_cat1 = RegexUtils.GetStringQuery(ref inputData, "search_cat1")?.Replace("'", "\\'");
var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_user_notes = RegexUtils.GetStringQuery(ref inputData, "search_user_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var search_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "search_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var no_sub_sa = RegexUtils.GetStringQuery(ref inputData, "no_sub_sa")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(s.id) from bxx.product_select s " +
"left join bxx.product p on s.out_product_id=p.id " +
"left join bxx.user u on s.operate_sub_sa_name=u.user_name " +
"where 1=1";
string where = "";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(operate_sub_sa_name))
{
where += " and s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
}
if (no_sub_sa == "true")
where += " and s.operate_sub_sa_name is null";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
where += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
where += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
where += " and s.shop_account like '%" + search_shop_account + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
{
//核价成功 重复 核价成功(重复)
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 '%核价通过%'";
else if (search_notes == "核价成功")
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 '%重复%'";
else
where += " and s.notes like '%" + search_notes + "%'";
}
if (!string.IsNullOrWhiteSpace(search_user_notes))
where += " and s.user_notes like '%" + search_user_notes + "%'";
where += " and p.id_del=0";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
where += " and p.skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat1))
where += " and p.main_cat_name like '%" + search_cat1 + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
where += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and p.product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrEmpty(search_sub_sa_name))
{
where += " and (s.operate_sub_sa_name like '%" + search_sub_sa_name + "%'";
where += " or u.nick_name like '%" + operate_sub_sa_name + "%')";
}
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
//if (isDetail)
//sql = "select * from bxx.product_select where 1=1";
//else
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
"s.sub_user_name,s.notes,s.user_notes,s.status,s.draft_id,s.add_times,s.add_time,s.mdy_time," +
"s.fission_product_name,s.operate_sub_sa_name,s.add_sub_sa_time," +
"p.from_shop_id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.group" +
"u.nick_name as operate_sub_sa_nick " +
"from bxx.product_select s left join bxx.product p on s.out_product_id=p.id " +
"left join bxx.user u on u.user_name=s.operate_sub_sa_name " +
"where 1=1";
sql += where; // where子句
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductSelectResultParam> productLst = new List<ProductSelectResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
{
id = row["id"].ParseToInt(),
out_product_Id = row["out_product_Id"].ParseToString(),
shop_account = row["shop_account"].ParseToString(),
shop_id = row["shop_id"].ParseToString(),
status = row["status"].ParseToString(),
sub_user_name = row["sub_user_name"].ParseToString(),
user_name = row["user_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
product_name = row["product_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
group = row["group"].ToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ParseToString(),
draft_id = row["draft_id"].ParseToString(),
add_times = row["add_times"].ParseToInt(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
operate_sub_sa_name = row["operate_sub_sa_name"].ToString(),
operate_sub_sa_nick = row["operate_sub_sa_nick"].ToString(),
fission_product_name = row["fission_product_name"].ToString(),
user_notes = row["user_notes"].ToString(),
from_shop_id = row["from_shop_id"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
prodSelect.add_sub_sa_time = row["add_sub_sa_time"] as DateTime?;
productLst.Add(prodSelect);
}
var data = JsonUtils.SerializeObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelSelectProd(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id))
{
return "{\"code\":500,\"msg\":\"删除失败:请指定要删除的数据!\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.product_select where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 设置上传商品的二级超管
/// </summary>
/// <returns></returns>
public string SetSelectProductSubSa(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
}
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(shop_id))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.product_select set";
if (operate_sub_sa_name != null)
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
if (!string.IsNullOrEmpty(id))
sql += " where id in (" + id + ")";
else if (!string.IsNullOrEmpty(shop_id))
sql += " where shop_id in ('" + shop_id.Replace(",","','") + "')";
else
sql += " where 1=2";
if(!string.IsNullOrEmpty(status))
sql += " and status='" + status + "';";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyProductSelectNotes(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string user_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "user_notes"));
string fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_product_name"));
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.product_select set";
if (notes != null)
sql += " notes=@notes,";
if (user_notes != null)
sql += " user_notes=@user_notes,";
if (fission_product_name != null)
sql += " fission_product_name=@fission_product_name,";
sql = sql.TrimEnd(',');
sql += " where id=@id;";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@id", Value = id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@fission_product_name", Value = fission_product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@user_notes", Value = user_notes, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WxApiGetWxAllCate(string inputData)
{
@@ -72,6 +72,12 @@ namespace KJD_Web.BLL
var UpdateExeChk = System.Configuration.ConfigurationManager.ConnectionStrings["UpdateExeChk"].ConnectionString;
var LowVersion = System.Configuration.ConfigurationManager.ConnectionStrings["LowVersion"].ConnectionString;
int MaxVersion = 999999;
//if (version <= 1198)
// MaxVersion = 1198;
if (version <= 1159)
MaxVersion = 1159;
if (version > LowVersion.ParseToInt())
{
if (path != null)
@@ -86,7 +92,7 @@ namespace KJD_Web.BLL
foreach (var f in file)
{
var v = Path.GetFileName(f).Replace("Update29wx", "").Replace(".zip", "").ParseToInt();
if (v > versionTmp && v <= serverVersion.ParseToInt())
if (v > versionTmp && v <= serverVersion.ParseToInt() && v <= MaxVersion)
{
versionTmp = v;
}
@@ -105,7 +111,7 @@ namespace KJD_Web.BLL
foreach (var f in file)
{
var v = Path.GetFileName(f).Replace("Update29pdd", "").Replace(".zip", "").ParseToInt();
if (v > versionTmp && v <= serverVersion.ParseToInt())
if (v > versionTmp && v <= serverVersion.ParseToInt() && v <= MaxVersion)
{
versionTmp = v;
}
@@ -124,8 +130,8 @@ namespace KJD_Web.BLL
}
}
if (serverVersion.ParseToInt() > 1159)
serverVersion = 1159.ToString();
if (serverVersion.ParseToInt() > MaxVersion)
serverVersion = MaxVersion.ParseToString();
return "{\"code\":200,\"msg\":\"success\",\"next_version\":" + serverVersion + ",\"exe_check\":\"" + UpdateExeChk +
"\",\"exe_address\":\"" + UpdateExe + "\",\"file_address\":\"" + UpdateNewUrl + "Update" + serverVersion + ".zip\"}";
}
@@ -781,5 +781,49 @@ namespace KJD_Web.BLL.WXXD
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 修改中转仓订单信息,临时补救
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string WXUpdateErpAllocatedOrderNo(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var timeCalc = DateTime.Now;
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
string out_order_no = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "out_order_no"))?.Replace("'", "\\'");
string pre_allocated_order_no = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "pre_allocated_order_no"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(out_order_no))
return "{\"code\":500,\"msg\":\"订单外部ID信息不能为空\"}";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
var count = -1;
sql = " update `erp`.`oms_wei_external_procurement_log` set ";
if (!string.IsNullOrEmpty(pre_allocated_order_no))
sql += " pre_allocated_order_no=" + pre_allocated_order_no + ",";
sql = sql.TrimEnd(',');
sql += " where out_order_no = '" + out_order_no + "';";
count = mySql.ExecuteAffectedRows(sql);
mySql.Close();
if (!string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"affected_rows\":" + count + "}";
}
return "{\"code\":200,\"msg\":\"success\",\"affected_rows\":" + count + "}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -23,163 +23,6 @@ namespace KJD_Web.BLL.WXXD
public string WXGetPDDProductList(string inputData, bool isDetail = false)
{
return new BLL.BXX.BXXProductManage().GetProductList(inputData, isDetail);
//if (!string.IsNullOrEmpty(inputData))
//{
// var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
// string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
// if (time1 != EncrypUtil.Encryption(time))
// return "{\"code\":50000,\"msg\":\"校验失败\"}";
// var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'","\\'");
// var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
// var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
// var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
// var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
// var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
// var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
// var search_group = RegexUtils.GetStringQuery(ref inputData, "search_group")?.Replace("'", "\\'");
// var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
// var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
// var get_select_count = RegexUtils.GetStringQuery(ref inputData, "get_select_count")?.Replace("'", "\\'");
// var select_shop_id = RegexUtils.GetStringQuery(ref inputData, "select_shop_id")?.Replace("'", "\\'");
// var from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id")?.Replace("'", "\\'");
// var sort_field = RegexUtils.GetStringQuery(ref inputData, "sort_field")?.Replace("'", "\\'");
// int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
// int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
// string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
// MysqlUtils mySql = new MysqlUtils(conn);
// string sql = "select count(id) from bxx.product p where p.is_del=0";
// string where = "";
// if (!string.IsNullOrWhiteSpace(search_spu))
// where += " and p.spu_id like '%" + search_spu + "%'";
// if (!string.IsNullOrWhiteSpace(search_skc))
// where += " and p.skc_id like '%" + search_skc + "%'";
// if (!string.IsNullOrWhiteSpace(search_cat))
// where += " and p.cat_name like '%" + search_cat + "%'";
// if (!string.IsNullOrWhiteSpace(search_ext_code))
// where += " and p.ext_code like '%" + search_ext_code + "%'";
// if (!string.IsNullOrWhiteSpace(search_prod_name))
// where += " and p.product_name like '%" + search_prod_name + "%'";
// if (!string.IsNullOrWhiteSpace(search_group))
// where += " and p.group like '%" + search_group + "%'";
// if (!string.IsNullOrWhiteSpace(search_notes))
// where += " and p.notes like '%" + search_notes + "%'";
// if (!string.IsNullOrEmpty(from_shop_id))
// where += " and p.from_shop_id ='" + from_shop_id + "'";
// if (!string.IsNullOrEmpty(search_db_ids))
// where += " and p.id in (" + search_db_ids + ")";
// sql += where;
// var count = mySql.ExecuteRowCount(sql);
// DataTable dt;
// if (count == 0)
// {
// dt = new DataTable();
// }
// else
// {
// if (isDetail)
// sql = "select p.*,s.img_base64,s.img_url,e.ext_code_price from bxx.product p" +
// " left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
// " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
// " where p.is_del=0";
// 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,p.group,p.product_get_type,s.img_url,e.ext_code_price" +
// " FROM bxx.product p " +
// " left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
// " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
// " where p.is_del=0";
// 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,p.sku_img_replace_id,p.group,p.product_get_type,s.img_url,COUNT(se.id) AS select_count," +
// " e.ext_code_price" +
// " FROM bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " +
// " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
// " WHERE p.is_del=0";
// //where子句
// sql += where;
// if (!isDetail && !string.IsNullOrEmpty(get_select_count))
// sql += " group by p.id";
// if (sort_field == "select_total_count")
// sql += " order by p.select_total_count desc, p.id desc";
// else
// sql += " order by p.id desc";
// sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
// dt = mySql.ExecuteDataTable(sql);
// }
// mySql.Close();
// if (dt != null)
// {
// try
// {
// List<DBProductResultParam> productLst = new List<DBProductResultParam>();
// foreach (DataRow row in dt.Rows)
// {
// DBProductResultParam prod = new DBProductResultParam
// {
// id = Convert.ToInt32(row["id"]),
// from_shop_id = row["from_shop_id"].ToString(),
// skc_id = row["skc_id"].ToString(),
// spu_id = row["spu_id"].ToString(),
// cat_id = row["cat_id"].ToString(),
// cat_name = row["cat_name"].ToString(),
// product_name = row["product_name"].ToString(),
// main_img = row["main_img"].ToString(),
// ext_code = row["ext_code"].ToString(),
// ext_code_price = row["ext_code_price"].IsNullOrEmpty() ? new int?() : row["ext_code_price"].ParseToInt(),
// price_text = row["price_text"].ToString(),
// //product_json = row["product_json"].ToString(),
// //size_json = row["size_json"].ToString(),
// add_time = Convert.ToDateTime(row["add_time"]),
// mdy_time = Convert.ToDateTime(row["mdy_time"]),
// notes = row["notes"].ToString(),
// group = row["group"].ToString(),
// select_total_count = row["select_total_count"].ParseToInt(),
// end_words = row["end_words"].ParseToString(),
// fission_words = row["fission_words"].ParseToString(),
// head_words = row["head_words"].ParseToString(),
// sku_img_replace_id = row["sku_img_replace_id"].ParseToInt(),
// sku_img_replace_url = row["img_url"].ToString(),
// product_get_type_text = row["product_get_type"].ToString(),
// };
// if (isDetail)
// {
// prod.product_json = row["product_json"].ToString();
// prod.size_json = row["size_json"].ToString();
// prod.sku_edit_json = row["sku_edit_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))
// {
// prod.select_count = row["select_count"].ParseToInt();
// }
// productLst.Add(prod);
// }
// var data = JsonUtils.SerializerObjectToString(productLst);
// return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
// }
// catch (Exception ex)
// {
// return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
// }
// }
// else
// {
// return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
// }
//}
//return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXGetPDDProductGroups(string inputData)
@@ -325,18 +325,6 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void mdy_prod_sku_img_replace_id()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdyProdSkuImgReplaceId(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_sku_img_replace()
{
@@ -385,91 +373,6 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void add_user_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().AddUserSelectProduct(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_user_select_product_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdyUserSelectProductStatus(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetUserSelectProductList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void admin_get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetUserSelectProductList(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void del_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().DelSelectProd(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void set_select_product_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().SetSelectProductSubSa(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_product_select_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdyProductSelectNotes(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_wx_tokens()
{
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
@@ -71,9 +71,9 @@ namespace KJD_Web.Model
/// </summary>
public string sku_secret_json { get; set; }
public string wx_img_map_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 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; }
@@ -128,7 +128,7 @@ namespace KJD_Web
}
/// <summary>
/// 获取中转仓订单信息
/// 修改中转仓物流信息
/// </summary>
[WebMethod]
public void wx_update_erp_order_express()
@@ -138,6 +138,20 @@ namespace KJD_Web
var result = jsontext;
result = new WXOrderManage().WXUpdateErpOrderExpress(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
/// <summary>
/// 修改中转仓取号状态
/// </summary>
[WebMethod]
public void wx_update_erp_allocated_order_no()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXOrderManage().WXUpdateErpAllocatedOrderNo(jsontext);
Context.Response.Write(result);
Context.Response.End();
}