1temu用户选择商品三个表及数据库id映射draftid分表操作 2拼多多读取商品显示总数 3temu可以修改单店备注
This commit is contained in:
1 parent
a61b8786d1
commit
4fd2a4d579
47 files changed
+2146
-1042
No files matched your search
@@ -154,7 +154,7 @@ namespace KJD_Web.BLL.BXX
|
||||
var shopMonthList = shopList.Where(s => s.add_product_month != month);
|
||||
if (shopMonthList.Count() > 0)
|
||||
{
|
||||
int remainCount = 100;
|
||||
int remainCount = 300;
|
||||
var shopMonthIdList = shopMonthList.Select(s => s.id);
|
||||
mySql = new MysqlUtils(conn);
|
||||
string ids = string.Join(",", shopMonthIdList);
|
||||
@@ -332,7 +332,7 @@ namespace KJD_Web.BLL.BXX
|
||||
var shopMonthList = shopList.Where(s => s.add_product_month != month);
|
||||
if (shopMonthList.Count() > 0)
|
||||
{
|
||||
int remainCount = 100;
|
||||
int remainCount = 300;
|
||||
var shopMonthIdList = shopMonthList.Select(s => s.id);
|
||||
mySql = new MysqlUtils(conn);
|
||||
string ids = string.Join(",", shopMonthIdList);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using KJD_Web.Utils;
|
||||
using MySql.Data.MySqlClient;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -156,7 +157,7 @@ namespace KJD_Web.BLL
|
||||
var select_shop_id = RegexUtils.GetStringQuery(ref inputData, "select_shop_id")?.Replace("'", "\\'");
|
||||
var sort_field = RegexUtils.GetStringQuery(ref inputData, "sort_field")?.Replace("'", "\\'");
|
||||
var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(product_get_type))
|
||||
if (string.IsNullOrEmpty(product_get_type)) // 母店采集0或前端直采1
|
||||
product_get_type = "0";
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
@@ -206,12 +207,24 @@ namespace KJD_Web.BLL
|
||||
" FROM kjd.product p" +
|
||||
" WHERE p.is_del=0";
|
||||
else // 统计单店认领次数
|
||||
{
|
||||
sql = "SELECT p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes,p.group," +
|
||||
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.product_get_type," +
|
||||
"p.cost_price,delivery_fee,p.mark_fee" +
|
||||
",COUNT(s.id) AS select_count" +
|
||||
" FROM kjd.product p LEFT JOIN kjd.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "'" +
|
||||
" FROM kjd.product p" +
|
||||
" LEFT JOIN (" +
|
||||
" SELECT id,out_product_id,shop_id FROM kjd.product_select WHERE shop_id='" + select_shop_id + "'";
|
||||
for (int year = Math.Max(2026, DateTime.Now.AddYears(-3).Year); year <= DateTime.Now.Year; year++)
|
||||
{
|
||||
sql += "UNION ALL SELECT id,out_product_id,shop_id FROM kjd_yearly.product_select_" + year + " WHERE shop_id='" + select_shop_id + "'";
|
||||
}
|
||||
sql += ") s" +
|
||||
" ON s.out_product_id=p.id AND s.shop_id='" + select_shop_id + "'" +
|
||||
" WHERE p.is_del=0";
|
||||
}
|
||||
|
||||
//sql += "select * from " + tableName + l_spu_map_table_id + " where draft_id=" + in_draft_id_list[i];
|
||||
|
||||
if (!isDetail && product_get_type != "all") // 详情必须从列表页面进入,不用限制
|
||||
sql += " AND p.product_get_type=" + product_get_type;
|
||||
@@ -224,7 +237,7 @@ namespace KJD_Web.BLL
|
||||
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 += " ORDER BY p.add_time desc";
|
||||
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
}
|
||||
@@ -463,29 +476,38 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
|
||||
}
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit").ParseToBool();
|
||||
string tableName = "kjd.product_select";
|
||||
if (is_client_jit)
|
||||
{
|
||||
tableName = "kjd.jit_product_select";
|
||||
}
|
||||
DateTime addTime = DateTime.Now;
|
||||
string addTimeStr = addTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string dbName = "kjd";
|
||||
if (addTime.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
|
||||
bool is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||||
string tableName;
|
||||
if (!is_client_jit)
|
||||
tableName = dbName + ".product_select";
|
||||
else
|
||||
tableName = dbName + ".jit_product_select";
|
||||
|
||||
if (addTime.Year >= 2026)
|
||||
tableName += "_" + addTime.Year;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string 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" +
|
||||
string 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 + "','" +
|
||||
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
|
||||
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
|
||||
addTimeStr + "','" +
|
||||
addTimeStr + "');";
|
||||
if (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.product set select_total_count=select_total_count+1 where id=" + out_product_Id + ";";
|
||||
//sql += "update kjd.shop_add_prod_count 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=VALUES(add_product_remaining)";
|
||||
"ON DUPLICATE KEY UPDATE add_product_remaining=add_product_remaining-1";
|
||||
}
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
@@ -510,46 +532,73 @@ namespace KJD_Web.BLL
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var select_db_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("'", "\\'");
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit").ParseToBool();
|
||||
string tableName = "kjd.product_select";
|
||||
if (is_client_jit)
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
tableName = "kjd.jit_product_select";
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
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;
|
||||
long l_select_map_table_id = select_db_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";
|
||||
if (is_client_jit)
|
||||
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";
|
||||
|
||||
if (!select_add_time.HasValue || select_add_time.Value.Year < 2026)
|
||||
{
|
||||
sql += "insert into kjd_map.jit_product_select_map_" + l_select_map_table_id +
|
||||
" (product_id,product_select_db_id,shop_id) values(" + draft_id + "," + id + ",'" + shop_id + "');\r\n";
|
||||
if (!is_client_jit)
|
||||
{
|
||||
sql += "INSERT INTO kjd_map.product_select_map_" + l_select_map_table_id +
|
||||
" (product_id,product_select_db_id,shop_id) VALUES(" + draft_id + "," + select_db_id + ",'" + shop_id + "');\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql += "INSERT INTO kjd_map.jit_product_select_map_" + l_select_map_table_id +
|
||||
" (product_id,product_select_db_id,shop_id) VALUES(" + draft_id + "," + select_db_id + ",'" + shop_id + "');\r\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
else //(select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||||
{
|
||||
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";
|
||||
string select_type;
|
||||
if (!is_client_jit)
|
||||
select_type = "normal";
|
||||
else
|
||||
select_type = "jit";
|
||||
sql += "INSERT INTO kjd_map_yearly.product_select_map_" + select_add_time.Value.Year +
|
||||
"(product_select_db_id,product_id,shop_id,select_type) VALUES" +
|
||||
"(" + select_db_id + ",'" + draft_id + "','" + shop_id + "','" + select_type + "');\r\n";
|
||||
}
|
||||
}
|
||||
sql += "update " + tableName + " set";
|
||||
|
||||
string dbName = "kjd";
|
||||
if (select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName;
|
||||
if (!is_client_jit)
|
||||
tableName = dbName + ".product_select";
|
||||
else
|
||||
tableName = dbName + ".jit_product_select";
|
||||
if (select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||||
tableName += "_" + select_add_time.Value.Year;
|
||||
|
||||
sql += "update " + tableName + " set";
|
||||
if (draft_id != null)
|
||||
sql += " draft_id='" + draft_id + "',";
|
||||
if (status != null)
|
||||
@@ -558,7 +607,7 @@ namespace KJD_Web.BLL
|
||||
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";
|
||||
sql += " WHERE id=" + select_db_id + ";\r\n";
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
string errMsg = mySql.Message;
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
@@ -609,77 +658,97 @@ namespace KJD_Web.BLL
|
||||
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
|
||||
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
|
||||
|
||||
var search_end_time = RegexUtils.GetStringJson(ref inputData, "search_end_time")?.ParseToDateTimeNullable();
|
||||
if (search_end_time == null || search_end_time.Value > DateTime.Now.Date.AddDays(1)) search_end_time = DateTime.Now.Date.AddDays(1);
|
||||
var search_start_time = RegexUtils.GetStringJson(ref inputData, "search_start_time")?.ParseToDateTimeNullable();
|
||||
if (search_start_time == null || search_start_time.Value >= search_end_time.Value) search_start_time = search_end_time.Value.AddMonths(-6);
|
||||
int startTableId = Math.Max(2025, search_start_time.Value.Year);
|
||||
int endTableId = Math.Max(2025, search_end_time.Value.Year);
|
||||
|
||||
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);
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit").ParseToBool();
|
||||
string tableName = "kjd.product_select";
|
||||
if (is_client_jit)
|
||||
{
|
||||
tableName = "kjd.jit_product_select";
|
||||
}
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select count(s.id) from " + tableName + " s " +
|
||||
"left join kjd.product p on s.out_product_id=p.id " +
|
||||
"left join kjd.user u on s.operate_sub_sa_name=u.user_name " +
|
||||
"where 1=1";
|
||||
string sql = "SELECT count(s.id) from (";
|
||||
for (int year = search_start_time.Value.Year; year <= search_end_time.Value.Year; year++)
|
||||
{
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName;
|
||||
if (!is_client_jit)
|
||||
tableName = dbName + ".product_select";
|
||||
else
|
||||
tableName = dbName + ".jit_product_select";
|
||||
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
if (year > search_start_time.Value.Year)
|
||||
sql += " UNION ALL";
|
||||
sql += " SELECT * FROM " + tableName;
|
||||
}
|
||||
sql += ") s " +
|
||||
"LEFT JOIN kjd.product p ON s.out_product_id=p.id " +
|
||||
"LEFT JOIN kjd.user u ON s.operate_sub_sa_name=u.user_name " +
|
||||
"WHERE s.add_time BETWEEN '" + search_start_time.Value.ToString("yyyy-MM-dd") + "' AND '" + search_end_time.Value.ToString("yyyy-MM-dd") + "' ";
|
||||
|
||||
string where = "";
|
||||
if (!isAdmin || is_client_jit)
|
||||
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
|
||||
where += " AND (s.user_name='" + user_name + "' or s.sub_user_name='" + user_name + "')";
|
||||
if (!string.IsNullOrEmpty(operate_sub_sa_name))
|
||||
{
|
||||
where += " and s.operate_sub_sa_name = '" + 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";
|
||||
where += " AND s.operate_sub_sa_name IS null";
|
||||
if (!string.IsNullOrEmpty(search_db_ids))
|
||||
where += " and s.id in (" + search_db_ids + ")";
|
||||
where += " AND s.id IN (" + search_db_ids + ")";
|
||||
if (!string.IsNullOrEmpty(shop_ids))
|
||||
where += " and s.shop_id in (" + shop_ids + ")";
|
||||
where += " AND s.shop_id IN ('" + string.Join("','", shop_ids.Split(new char[] { '\"', '\'', ' ', ',' }, StringSplitOptions.RemoveEmptyEntries)) + "')";
|
||||
if (!string.IsNullOrWhiteSpace(status))
|
||||
where += " and s.status = '" + status + "'";
|
||||
where += " AND s.status = '" + status + "'";
|
||||
if (!string.IsNullOrWhiteSpace(search_shop_id))
|
||||
where += " and s.shop_id like '%" + 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 + "%'";
|
||||
where += " AND s.shop_account LIKE '%" + search_shop_account + "%'";
|
||||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||||
{
|
||||
//核价成功 重复 核价成功(重复)
|
||||
if (search_notes == "无备注")
|
||||
where += " and s.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 + "%'";
|
||||
|
||||
where += " and p.is_del=0";
|
||||
where += " AND p.is_del=0";
|
||||
if (!string.IsNullOrWhiteSpace(search_spu))
|
||||
where += " and p.spu_id like '%" + search_spu + "%'";
|
||||
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_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))
|
||||
where += " and p.product_name like '%" + 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 + "%')";
|
||||
where += " AND (s.operate_sub_sa_name LIKE '%" + search_sub_sa_name + "%'";
|
||||
where += " OR u.nick_name LIKE '%" + operate_sub_sa_name + "%')";
|
||||
}
|
||||
|
||||
sql += where;
|
||||
@@ -694,21 +763,40 @@ namespace KJD_Web.BLL
|
||||
else
|
||||
{
|
||||
//if (isDetail)
|
||||
//sql = "select * from " + tableName + " where 1=1";
|
||||
//sql = "SELECT * FROM " + tableName + " where 1=1";
|
||||
//else
|
||||
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
|
||||
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.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img," +
|
||||
"p.product_get_type,u.nick_name as operate_sub_sa_nick " +
|
||||
"from " + tableName + " s left join kjd.product p on s.out_product_id=p.id " +
|
||||
"left join kjd.user u on u.user_name=s.operate_sub_sa_name " +
|
||||
"where 1=1";
|
||||
" FROM (";
|
||||
for (int year = search_start_time.Value.Year; year <= search_end_time.Value.Year; year++)
|
||||
{
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName;
|
||||
if (!is_client_jit)
|
||||
tableName = dbName + ".product_select";
|
||||
else
|
||||
tableName = dbName + ".jit_product_select";
|
||||
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
if (year > search_start_time.Value.Year)
|
||||
sql += " UNION ALL";
|
||||
sql += " SELECT * FROM " + tableName;
|
||||
}
|
||||
sql += ") s" +
|
||||
" LEFT JOIN kjd.product p ON s.out_product_id=p.id" +
|
||||
" LEFT join kjd.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;
|
||||
sql += " ORDER BY add_time desc";
|
||||
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
}
|
||||
|
||||
@@ -722,7 +810,7 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
id = row["id"].ParseToLong(),
|
||||
out_product_Id = row["out_product_Id"].ParseToString(),
|
||||
shop_account = row["shop_account"].ParseToString(),
|
||||
shop_id = row["shop_id"].ParseToString(),
|
||||
@@ -785,13 +873,24 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit").ParseToBool();
|
||||
string tableName = "kjd.product_select";
|
||||
if (is_client_jit)
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
tableName = "kjd.jit_product_select";
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||||
string dbName = "kjd";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName;
|
||||
if (!is_client_jit)
|
||||
tableName = dbName + ".product_select";
|
||||
else
|
||||
tableName = dbName + ".jit_product_select";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
tableName += "_" + select_add_time.Value.Year;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "delete from " + tableName + " where id='"
|
||||
@@ -828,48 +927,122 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
|
||||
var db_ids = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var shop_ids = 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("'", "\\'");
|
||||
var db_id_infos = RegexUtils.GetStringQuery(ref inputData, "db_id_infos")?.Replace("'", "\\'");
|
||||
|
||||
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(shop_id))
|
||||
if (operate_sub_sa_name == null)
|
||||
{
|
||||
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
|
||||
return "{\"code\":50002,\"msg\":\"未选择任何二级超管\"}";
|
||||
}
|
||||
if (string.IsNullOrEmpty(db_ids) && string.IsNullOrEmpty(shop_ids))
|
||||
{
|
||||
return "{\"code\":50002,\"msg\":\"未选择任何待设置对象\"}";
|
||||
}
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit").ParseToBool();
|
||||
string tableName = "kjd.product_select";
|
||||
if (is_client_jit)
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
tableName = "kjd.jit_product_select";
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update " + tableName + " set";
|
||||
if (operate_sub_sa_name != null)
|
||||
string sql = "";
|
||||
bool rst = false;
|
||||
|
||||
if (!string.IsNullOrEmpty(db_ids))
|
||||
{
|
||||
sql = "UPDATE kjd.product_select SET";
|
||||
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);
|
||||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||||
sql += " WHERE id IN (" + db_ids + ")";
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
sql += " AND status='" + status + "';";
|
||||
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(shop_ids))
|
||||
{
|
||||
List<int> yearLst = new List<int>() { 2025 };
|
||||
if (select_add_time != null)
|
||||
{
|
||||
yearLst.Clear();
|
||||
yearLst.Add(select_add_time.Value.Year);
|
||||
yearLst.Add(select_add_time.Value.AddMonths(-6).Year);
|
||||
yearLst = yearLst.Distinct().ToList();
|
||||
}
|
||||
foreach (int year in yearLst)
|
||||
{
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".product_select";
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
|
||||
sql = "UPDATE " + tableName + " SET";
|
||||
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
|
||||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||||
sql += " WHERE shop_id in ('" + shop_ids.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
sql += " AND status='" + status + "';";
|
||||
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(db_id_infos))
|
||||
{
|
||||
try
|
||||
{
|
||||
JArray jArr = JArray.Parse(db_id_infos);
|
||||
foreach (JObject jObj in jArr)
|
||||
{
|
||||
var year = jObj["year"].ParseToInt();
|
||||
var dbIds = jObj["db_ids"].ParseToString();
|
||||
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".product_select";
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
|
||||
sql = "UPDATE " + tableName + " SET";
|
||||
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
|
||||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||||
sql += " WHERE id IN (" + dbIds + ")";
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
sql += " AND status='" + status + "';";
|
||||
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":50004,\"msg\":\"" + ex.Message + "\"}";
|
||||
}
|
||||
}
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
@@ -884,7 +1057,7 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
|
||||
var db_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"));
|
||||
@@ -894,13 +1067,24 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit").ParseToBool();
|
||||
string tableName = "kjd.product_select";
|
||||
if (is_client_jit)
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
tableName = "kjd.jit_product_select";
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||||
string dbName = "kjd";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName;
|
||||
if (!is_client_jit)
|
||||
tableName = dbName + ".product_select";
|
||||
else
|
||||
tableName = dbName + ".jit_product_select";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
tableName += "_" + select_add_time.Value.Year;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update " + tableName + " set";
|
||||
@@ -911,10 +1095,10 @@ namespace KJD_Web.BLL
|
||||
if (fission_product_name != null)
|
||||
sql += " fission_product_name=@fission_product_name,";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where id=@id;";
|
||||
sql += " where id=@db_id;";
|
||||
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@id", Value = id, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int64, ParameterName = "@db_id", Value = db_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, });
|
||||
@@ -955,14 +1139,29 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":50002,\"msg\":\"未选择选品数据\"}";
|
||||
}
|
||||
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit").ParseToBool();
|
||||
string tableName = "kjd_map.product_select_map_";
|
||||
if (is_client_jit)
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
tableName = "kjd_map.jit_product_select_map_";
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
|
||||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||||
string dbName = "kjd_map";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_map_yearly";
|
||||
string tableName;
|
||||
if (!is_client_jit || (select_add_time != null && select_add_time.Value.Year >= 2026)) // 2026年以后的数据在新表,不带jit
|
||||
tableName = dbName + ".product_select_map_";
|
||||
else
|
||||
tableName = dbName + ".jit_product_select_map_";
|
||||
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
tableName += select_add_time.Value.Year;
|
||||
else
|
||||
{
|
||||
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
|
||||
tableName += +l_select_map_table_id;
|
||||
}
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
@@ -970,8 +1169,12 @@ namespace KJD_Web.BLL
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select count(id) from " + tableName + l_select_map_table_id + " where 1=1";
|
||||
string sql = "SELECT COUNT(id) FROM " + tableName + " where 1=1";
|
||||
|
||||
string where = " and product_select_db_id=" + select_db_id;
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026) // 2026年以后的数据在新表
|
||||
where += " AND select_type='" + (!is_client_jit ? "normal" : "jit") + "'";
|
||||
|
||||
sql += where;
|
||||
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
@@ -983,11 +1186,11 @@ namespace KJD_Web.BLL
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "select * from " + tableName + l_select_map_table_id + " where 1=1";
|
||||
sql = "SELECT * FROM " + tableName + " where 1=1";
|
||||
//where子句
|
||||
sql += where;
|
||||
sql += " order by id desc";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
sql += " ORDER BY add_time desc";
|
||||
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
}
|
||||
|
||||
@@ -1006,9 +1209,9 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
DBProdDbIdMapProductIdResultParam dbIdMapProductId = new DBProdDbIdMapProductIdResultParam
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
id = row["id"].ParseToLong(),
|
||||
product_select_db_id = row["product_select_db_id"].ParseToLong(),
|
||||
product_id = row["product_id"].ParseToLong(),
|
||||
product_select_db_id = row["product_select_db_id"].ParseToInt(),
|
||||
shop_id = row["shop_id"].ParseToLong(),
|
||||
add_time = Convert.ToDateTime(row["add_time"]),
|
||||
};
|
||||
@@ -1072,8 +1275,8 @@ namespace KJD_Web.BLL
|
||||
l_spu_map_table_id = in_draft_id_list[i].ParseToLong() % 128;
|
||||
sql += "select * from " + tableName + l_spu_map_table_id + " where draft_id=" + in_draft_id_list[i];
|
||||
}
|
||||
sql += ") AS combined_query left join product p On combined_query.from_spu_id=p.spu_id";
|
||||
sql += " order by add_time desc";
|
||||
sql += ") AS combined_query left join product p ON combined_query.from_spu_id=p.spu_id";
|
||||
sql += " ORDER BY add_time desc";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
DataTable dt = mySql.ExecuteDataTable(sql);
|
||||
|
||||
@@ -1092,7 +1295,7 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
DBProdDraftIdMapUpSpuIdResultParam draftIdMapUpSpuId = new DBProdDraftIdMapUpSpuIdResultParam
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
id = row["id"].ParseToLong(),
|
||||
draft_id = row["draft_id"].ParseToLong(),
|
||||
from_spu_id = row["from_spu_id"].ParseToLong(),
|
||||
shop_id = row["shop_id"].ParseToLong(),
|
||||
@@ -1293,9 +1496,9 @@ namespace KJD_Web.BLL
|
||||
sql += where;
|
||||
|
||||
if (is_random)
|
||||
sql += " ORDER BY RAND(),s.id desc";
|
||||
sql += " ORDER BY RAND(),s.add_time desc";
|
||||
else
|
||||
sql += " order by s.id desc";
|
||||
sql += " ORDER BY s.add_time desc";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using KJD_Web.Utils;
|
||||
using MySql.Data.MySqlClient;
|
||||
using MySqlX.XDevAPI.Common;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -349,22 +350,31 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
|
||||
}
|
||||
|
||||
DateTime addTime = DateTime.Now;
|
||||
string addTimeStr = addTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string dbName = "kjd";
|
||||
if (addTime.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
|
||||
string tableName = dbName + ".third_product_select";
|
||||
if (addTime.Year >= 2026)
|
||||
tableName += "_" + addTime.Year;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "insert into kjd.third_product_select (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 + "','" +
|
||||
string 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 + "','" +
|
||||
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
|
||||
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
|
||||
addTimeStr + "','" +
|
||||
addTimeStr + "');";
|
||||
if (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_add_prod_count 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=VALUES(add_product_remaining)";
|
||||
"ON DUPLICATE KEY UPDATE add_product_remaining=add_product_remaining-1";
|
||||
}
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
@@ -389,31 +399,55 @@ namespace KJD_Web.BLL
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var select_db_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("'", "\\'");
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
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;
|
||||
long l_select_map_table_id = select_db_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";
|
||||
sql += "insert into kjd_map.product_third_select_map_" + l_select_map_table_id +
|
||||
" (product_id,product_select_db_id,shop_id) values(" + draft_id + "," + id + ",'" + shop_id + "');\r\n";
|
||||
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";
|
||||
if (!select_add_time.HasValue || select_add_time.Value.Year < 2026)
|
||||
{
|
||||
sql += "INSERT into kjd_map.product_third_select_map_" + l_select_map_table_id +
|
||||
" (product_id,product_select_db_id,shop_id) VALUES(" + draft_id + "," + select_db_id + ",'" + shop_id + "');\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
string select_type = "third-party";
|
||||
sql += "INSERT INTO kjd_map_yearly.product_select_map_" + select_add_time.Value.Year +
|
||||
"(product_select_db_id,product_id,shop_id,select_type) VALUES" +
|
||||
"(" + select_db_id + ",'" + draft_id + "','" + shop_id + "','" + select_type + "');\r\n";
|
||||
}
|
||||
}
|
||||
sql += "update kjd.third_product_select set";
|
||||
|
||||
string dbName = "kjd";
|
||||
if (select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".third_product_select";
|
||||
if (select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||||
tableName += "_" + select_add_time.Value.Year;
|
||||
|
||||
sql += "update " + tableName + " set";
|
||||
if (draft_id != null)
|
||||
sql += " draft_id='" + draft_id + "',";
|
||||
if (status != null)
|
||||
@@ -422,7 +456,7 @@ namespace KJD_Web.BLL
|
||||
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";
|
||||
sql += " WHERE id=" + select_db_id + ";\r\n";
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
string errMsg = mySql.Message;
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
@@ -473,6 +507,13 @@ namespace KJD_Web.BLL
|
||||
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
|
||||
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
|
||||
|
||||
var search_end_time = RegexUtils.GetStringJson(ref inputData, "search_end_time")?.ParseToDateTimeNullable();
|
||||
if (search_end_time == null || search_end_time.Value > DateTime.Now.Date.AddDays(1)) search_end_time = DateTime.Now.Date.AddDays(1);
|
||||
var search_start_time = RegexUtils.GetStringJson(ref inputData, "search_start_time")?.ParseToDateTimeNullable();
|
||||
if (search_start_time == null || search_start_time.Value >= search_end_time.Value) search_start_time = search_end_time.Value.AddMonths(-6);
|
||||
int startTableId = Math.Max(2025, search_start_time.Value.Year);
|
||||
int endTableId = Math.Max(2025, search_end_time.Value.Year);
|
||||
|
||||
var no_sub_sa = RegexUtils.GetStringQuery(ref inputData, "no_sub_sa")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
@@ -481,14 +522,30 @@ namespace KJD_Web.BLL
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select count(s.id) from kjd.third_product_select s " +
|
||||
"left join kjd.third_product p on s.out_product_id=p.id " +
|
||||
"left join kjd.user u on s.operate_sub_sa_name=u.user_name " +
|
||||
"where 1=1";
|
||||
string sql = "select count(s.id) from (";
|
||||
|
||||
for (int year = search_start_time.Value.Year; year <= search_end_time.Value.Year; year++)
|
||||
{
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".third_product_select";
|
||||
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
if (year > search_start_time.Value.Year)
|
||||
sql += " UNION ALL";
|
||||
sql += " SELECT * FROM " + tableName;
|
||||
}
|
||||
|
||||
sql += ") s " +
|
||||
"LEFT JOIN kjd.third_product p on s.out_product_id=p.id " +
|
||||
"LEFT JOIN kjd.user u on s.operate_sub_sa_name=u.user_name " +
|
||||
"WHERE s.add_time BETWEEN '" + search_start_time.Value.ToString("yyyy-MM-dd") + "' AND '" + search_end_time.Value.ToString("yyyy-MM-dd") + "' ";
|
||||
|
||||
string where = "";
|
||||
if (!isAdmin)
|
||||
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
|
||||
where += " and (s.user_name='" + user_name + "' or s.sub_user_name ='" + user_name + "')";
|
||||
if (!string.IsNullOrEmpty(operate_sub_sa_name))
|
||||
{
|
||||
where += " and s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
|
||||
@@ -555,14 +612,30 @@ namespace KJD_Web.BLL
|
||||
//if (isDetail)
|
||||
//sql = "select * from kjd.third_product_select where 1=1";
|
||||
//else
|
||||
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
|
||||
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.spu_id,p.skc_id,p.cat_id,p.cat_name,p.change_cat_id,p.change_cat_name,p.ext_code,p.product_name,p.main_img," +
|
||||
"u.nick_name as operate_sub_sa_nick " +
|
||||
"from kjd.third_product_select s left join kjd.third_product p on s.out_product_id=p.id " +
|
||||
"left join kjd.user u on u.user_name=s.operate_sub_sa_name " +
|
||||
"where 1=1";
|
||||
"FROM (";
|
||||
|
||||
for (int year = search_start_time.Value.Year; year <= search_end_time.Value.Year; year++)
|
||||
{
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".third_product_select";
|
||||
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
if (year > search_start_time.Value.Year)
|
||||
sql += " UNION ALL";
|
||||
sql += " SELECT * FROM " + tableName;
|
||||
}
|
||||
|
||||
sql += ") s LEFT JOIN kjd.third_product p ON s.out_product_id=p.id " +
|
||||
"LEFT JOIN kjd.user u ON u.user_name=s.operate_sub_sa_name " +
|
||||
"WHERE 1=1";
|
||||
|
||||
sql += where; // where子句
|
||||
|
||||
@@ -581,7 +654,7 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
id = row["id"].ParseToLong(),
|
||||
out_product_Id = row["out_product_Id"].ParseToString(),
|
||||
shop_account = row["shop_account"].ParseToString(),
|
||||
shop_id = row["shop_id"].ParseToString(),
|
||||
@@ -645,9 +718,22 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
string dbName = "kjd";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".third_product_select";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
tableName += "_" + select_add_time.Value.Year;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "delete from kjd.third_product_select where id='"
|
||||
string sql = "delete from " + tableName + " where id='"
|
||||
+ id + "'";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
@@ -681,41 +767,123 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
|
||||
var db_ids = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
var shop_ids = 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("'", "\\'");
|
||||
var db_id_infos = RegexUtils.GetStringQuery(ref inputData, "db_id_infos")?.Replace("'", "\\'");
|
||||
|
||||
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(shop_id))
|
||||
if (operate_sub_sa_name == null)
|
||||
{
|
||||
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
|
||||
return "{\"code\":50002,\"msg\":\"未选择任何二级超管\"}";
|
||||
}
|
||||
if (string.IsNullOrEmpty(db_ids) && string.IsNullOrEmpty(shop_ids) && string.IsNullOrEmpty(db_id_infos))
|
||||
{
|
||||
return "{\"code\":50003,\"msg\":\"未选择任何待设置对象\"}";
|
||||
}
|
||||
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null && db_id_infos == null)
|
||||
{
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update kjd.third_product_select set";
|
||||
if (operate_sub_sa_name != null)
|
||||
|
||||
string sql = "";
|
||||
bool rst = false;
|
||||
|
||||
if (!string.IsNullOrEmpty(db_ids))
|
||||
{
|
||||
sql = "UPDATE kjd.third_product_select SET";
|
||||
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);
|
||||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||||
sql += " WHERE id IN (" + db_ids + ")";
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
sql += " AND status='" + status + "';";
|
||||
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(shop_ids))
|
||||
{
|
||||
List<int> yearLst = new List<int>() { 2025 };
|
||||
if (select_add_time != null)
|
||||
{
|
||||
yearLst.Clear();
|
||||
yearLst.Add(select_add_time.Value.Year);
|
||||
yearLst.Add(select_add_time.Value.AddMonths(-6).Year);
|
||||
yearLst = yearLst.Distinct().ToList();
|
||||
}
|
||||
foreach (int year in yearLst)
|
||||
{
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".third_product_select";
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
|
||||
sql = "UPDATE " + tableName + " SET";
|
||||
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
|
||||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||||
sql += " WHERE shop_id in ('" + shop_ids.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
sql += " AND status='" + status + "';";
|
||||
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(db_id_infos))
|
||||
{
|
||||
try
|
||||
{
|
||||
JArray jArr = JArray.Parse(db_id_infos);
|
||||
foreach (JObject jObj in jArr)
|
||||
{
|
||||
var year = jObj["year"].ParseToInt();
|
||||
var dbIds = jObj["db_ids"].ParseToString();
|
||||
|
||||
string dbName = "kjd";
|
||||
if (year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".third_product_select";
|
||||
if (year >= 2026)
|
||||
tableName += "_" + year;
|
||||
|
||||
sql = "UPDATE " + tableName + " SET";
|
||||
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
|
||||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||||
sql += " WHERE id IN (" + dbIds + ")";
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
sql += " AND status='" + status + "';";
|
||||
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":50004,\"msg\":\"" + ex.Message + "\"}";
|
||||
}
|
||||
}
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
@@ -730,7 +898,7 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
|
||||
var db_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"));
|
||||
@@ -740,9 +908,22 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
string dbName = "kjd";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_yearly";
|
||||
string tableName = dbName + ".third_product_select";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
tableName += "_" + select_add_time.Value.Year;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update kjd.third_product_select set";
|
||||
string sql = "update " + tableName + " set";
|
||||
if (notes != null)
|
||||
sql += " notes=@notes,";
|
||||
if (user_notes != null)
|
||||
@@ -753,7 +934,7 @@ namespace KJD_Web.BLL
|
||||
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.Int64, ParameterName = "@id", Value = db_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, });
|
||||
@@ -793,7 +974,29 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
return "{\"code\":50002,\"msg\":\"未选择选品数据\"}";
|
||||
}
|
||||
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
|
||||
|
||||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||||
if (select_add_time == null)
|
||||
{
|
||||
//return "{\"code\":500,\"msg\":\"旧查询接口已失效,请升级软件。\"}";
|
||||
}
|
||||
|
||||
string dbName = "kjd_map";
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
dbName = "kjd_map_yearly";
|
||||
string tableName;
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026) // 2026年以后的数据在新表
|
||||
tableName = dbName + ".product_select_map_";
|
||||
else
|
||||
tableName = dbName + ".product_third_select_map_";
|
||||
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||||
tableName += select_add_time.Value.Year;
|
||||
else
|
||||
{
|
||||
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
|
||||
tableName += +l_select_map_table_id;
|
||||
}
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
@@ -801,8 +1004,10 @@ namespace KJD_Web.BLL
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select count(id) from kjd_map.product_third_select_map_" + l_select_map_table_id + " where 1=1";
|
||||
string where = " and product_select_db_id=" + select_db_id;
|
||||
string sql = "SELECT COUNT(id) FROM " + tableName + " WHERE 1=1";
|
||||
string where = " AND product_select_db_id=" + select_db_id;
|
||||
if (select_add_time != null && select_add_time.Value.Year >= 2026) // 2026年以后的数据在新表
|
||||
where += " AND select_type='third-party'";
|
||||
sql += where;
|
||||
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
@@ -814,11 +1019,11 @@ namespace KJD_Web.BLL
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "select * from kjd_map.product_third_select_map_" + l_select_map_table_id + " where 1=1";
|
||||
sql = "SELECT * FROM " + tableName + " WHERE 1=1";
|
||||
//where子句
|
||||
sql += where;
|
||||
sql += " order by id desc";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
sql += " ORDER BY add_time desc";
|
||||
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
}
|
||||
|
||||
@@ -837,9 +1042,9 @@ namespace KJD_Web.BLL
|
||||
{
|
||||
DBProdDbIdMapProductIdResultParam dbIdMapProductId = new DBProdDbIdMapProductIdResultParam
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
id = row["id"].ParseToLong(),
|
||||
product_select_db_id = row["product_select_db_id"].ParseToLong(),
|
||||
product_id = row["product_id"].ParseToLong(),
|
||||
product_select_db_id = row["product_select_db_id"].ParseToInt(),
|
||||
shop_id = row["shop_id"].ParseToLong(),
|
||||
add_time = Convert.ToDateTime(row["add_time"]),
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace KJD_Web.Model
|
||||
{
|
||||
public class DBProdDbIdMapProductIdResultParam
|
||||
{
|
||||
public int id { get; set; }
|
||||
public int product_select_db_id { get; set; }
|
||||
public long id { get; set; }
|
||||
public long product_select_db_id { get; set; }
|
||||
public long product_id { get; set; }
|
||||
public long shop_id { get; set; }
|
||||
public DateTime add_time { get; set; }
|
||||
@@ -16,7 +16,7 @@ namespace KJD_Web.Model
|
||||
|
||||
public class DBProdDraftIdMapUpSpuIdResultParam
|
||||
{
|
||||
public int id { get; set; }
|
||||
public long id { get; set; }
|
||||
public long draft_id { get; set; }
|
||||
public long from_spu_id { get; set; }
|
||||
public long shop_id { get; set; }
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace KJD_Web.Model
|
||||
/// </summary>
|
||||
public class ProductSelectResultParam
|
||||
{
|
||||
public int id { get; set; }
|
||||
public long id { get; set; }
|
||||
public string out_product_Id { get; set; }
|
||||
public string shop_id { get; set; }
|
||||
public string shop_account { get; set; }
|
||||
|
||||
@@ -334,6 +334,47 @@ namespace NaiBa.Util.Extension
|
||||
#endregion
|
||||
|
||||
#region 转换为DateTime
|
||||
|
||||
public static DateTime? ParseToDateTimeNullable(this string str)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (str.Contains("-") || str.Contains("/"))
|
||||
{
|
||||
return DateTime.Parse(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
int length = str.Length;
|
||||
switch (length)
|
||||
{
|
||||
case 4:
|
||||
return DateTime.ParseExact(str, "yyyy", System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 6:
|
||||
return DateTime.ParseExact(str, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 8:
|
||||
return DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 10:
|
||||
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 12:
|
||||
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 14:
|
||||
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
|
||||
default:
|
||||
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将string转换为DateTime,若转换失败,则返回日期最小值。不抛出异常。
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user