1.Jit客户端功能 2.pdd活动报名新增及优化

This commit is contained in:
wule committed 2025-12-01 10:01:54 +08:00
1 parent e77914bafc
commit 480d8c2cd4
41 files changed
+5136 -2863

No files matched your search

@@ -1093,8 +1093,9 @@ namespace KJD_Web.BLL.BXX
{
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_select_map_" + l_select_map_table_id +
" (product_id,product_select_db_id,shop_id) values(" + draft_id + "," + 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)
@@ -169,6 +169,10 @@ namespace KJD_Web.BLL
sql += " and p.product_get_type=" + product_get_type;
string where = "";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and p.id in (" + search_db_ids + ")";
if (!string.IsNullOrWhiteSpace(search_group))
where += " and p.group = '" + search_group + "'";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
@@ -181,10 +185,6 @@ namespace KJD_Web.BLL
where += " and p.product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_group))
where += " and p.group like '%" + search_group + "%'";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and p.id in (" + search_db_ids + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
@@ -442,7 +442,7 @@ namespace KJD_Web.BLL
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\":\"没有用户名\"}";
@@ -452,12 +452,17 @@ 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";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into kjd.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 + "','" +
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") + "');";
@@ -501,6 +506,13 @@ namespace KJD_Web.BLL
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)
{
tableName = "kjd.jit_product_select";
}
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;
@@ -515,10 +527,18 @@ namespace KJD_Web.BLL
{
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_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.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";
}
else
{
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 kjd.product_select set";
sql += "update " + tableName + " set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
if (status != null)
@@ -583,16 +603,23 @@ namespace KJD_Web.BLL
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";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(s.id) from kjd.product_select s " +
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 where = "";
if (!isAdmin)
if (!isAdmin || is_client_jit)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(operate_sub_sa_name))
{
@@ -656,14 +683,14 @@ namespace KJD_Web.BLL
else
{
//if (isDetail)
//sql = "select * from kjd.product_select 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," +
"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 kjd.product_select s left join kjd.product p on s.out_product_id=p.id " +
"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";
@@ -747,9 +774,16 @@ 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";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.product_select where id='"
string sql = "delete from " + tableName + " where id='"
+ id + "'";
var rst = mySql.ExecuteNonQuery(sql);
@@ -793,9 +827,16 @@ namespace KJD_Web.BLL
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)
{
tableName = "kjd.jit_product_select";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.product_select set";
string sql = "update " + tableName + " 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") + "',";
@@ -842,9 +883,16 @@ 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";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.product_select set";
string sql = "update " + tableName + " set";
if (notes != null)
sql += " notes=@notes,";
if (user_notes != null)
@@ -895,6 +943,14 @@ 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)
{
tableName = "kjd_map.jit_product_select_map_";
}
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
@@ -903,7 +959,7 @@ 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_select_map_" + l_select_map_table_id + " where 1=1";
string sql = "select count(id) from " + tableName + l_select_map_table_id + " where 1=1";
string where = " and product_select_db_id=" + select_db_id;
sql += where;
@@ -916,7 +972,7 @@ namespace KJD_Web.BLL
}
else
{
sql = "select * from kjd_map.product_select_map_" + l_select_map_table_id + " where 1=1";
sql = "select * from " + tableName + l_select_map_table_id + " where 1=1";
//where子句
sql += where;
sql += " order by id desc";
@@ -97,7 +97,7 @@ namespace KJD_Web.BLL
{
sql = "SELECT s.*,c.add_product_remaining add_remaining,c.add_product_month add_month,cc.jit_expire_time FROM kjd.shop s" +
" LEFT JOIN kjd.shop_add_prod_count c ON s.shop_id=c.shop_id" +
" LEFT JOIN (SELECT shop_id, MAX(expire_time) as jit_expire_time FROM kjd.card_code GROUP BY shop_id) cc ON s.shop_id=cc.shop_id" +
" LEFT JOIN (SELECT shop_id, MAX(expire_time) as jit_expire_time FROM kjd.jit_card_code GROUP BY shop_id) cc ON s.shop_id=cc.shop_id" +
" WHERE 1=1";
sql += where; // where 子句
@@ -860,7 +860,7 @@ 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.card_code s WHERE 1=1";
string sql = "SELECT COUNT(s.id) FROM kjd.jit_card_code s WHERE 1=1";
//where子句
string where = "";
@@ -891,7 +891,7 @@ namespace KJD_Web.BLL
}
else
{
sql = "SELECT s.* FROM kjd.card_code s WHERE 1=1";
sql = "SELECT s.* FROM kjd.jit_card_code s WHERE 1=1";
sql += where; // where 子句
@@ -956,7 +956,7 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into kjd.card_code (card_code_id) values ";
string sql = "insert into kjd.jit_card_code (card_code_id) values ";
Random random = new Random(Guid.NewGuid().GetHashCode());
for (int i = 0; i < create_count.ParseToInt(); i++)
{
@@ -1001,7 +1001,7 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.card_code where id in (" + del_ids + ");";
string sql = "delete from kjd.jit_card_code where id in (" + del_ids + ");";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
@@ -1016,6 +1016,95 @@ namespace KJD_Web.BLL
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string ActiveJitCardCode(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 shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var card_code_id = RegexUtils.GetStringQuery(ref inputData, "card_code_id")?.Replace("'", "\\'");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":50002,\"msg\":\"未输入店铺\"}";
}
if (string.IsNullOrEmpty(card_code_id))
{
return "{\"code\":50002,\"msg\":\"未输入卡密\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select card_code_id from kjd.jit_card_code where card_code_id = \'" + card_code_id + "\' and active_time is null;";
var rst = mySql.ExecuteExists(sql);
if (!rst)
{
mySql.Close();
if (string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":500,\"msg\":\"JIT卡密不存在或已激活\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
sql = "select s.shop_id,cc.jit_expire_time from kjd.shop s" +
" LEFT JOIN (SELECT shop_id, MAX(expire_time) as jit_expire_time FROM kjd.jit_card_code GROUP BY shop_id) cc ON s.shop_id=cc.shop_id" +
" where s.shop_id = '" + shop_id + "';";
var dt = mySql.ExecuteDataTable(sql);
if (dt == null || !mySql.Message.IsNullOrEmpty())
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
else if (dt.Rows.Count == 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"店铺不存在\"}";
}
var row = dt.Rows[0];
ShopParam shop = new ShopParam
{
shop_id = row["shop_id"].ToString(),
jit_expire_time = row["jit_expire_time"].IsNullOrEmpty() ? new DateTime?() : Convert.ToDateTime(row["jit_expire_time"]),
};
DateTime activeTime = DateTime.Now;
DateTime expireTime = DateTime.Now.Date.AddMonths(1);
if (shop.jit_expire_time != null && shop.jit_expire_time.Value.Date > DateTime.Now.Date)
expireTime = shop.jit_expire_time.Value.Date.AddMonths(1);
shop.jit_expire_time = expireTime;
sql = "update kjd.jit_card_code set active_time='" + activeTime.ToString("yyyy/MM/dd HH:mm:ss") + "'," +
"expire_time='" + expireTime.ToString("yyyy/MM/dd HH:mm:ss") + "'," +
"shop_id='" + shop_id + "',shop_account='" + shop_account + "'" +
" where card_code_id='" + card_code_id + "';";
rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"expire_time\":\"" + expireTime + "\",\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
private static readonly char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray(); // 增加特殊字符
public static string GenerateCardCode(Random random, int length)
@@ -39,17 +39,17 @@ namespace KJD_Web.BLL
// for (int i = 0; i < 64; i++)
// {
// //sql = @"drop table if exists kjd_map.spu_map_" + i + ";\r\n";
// sql = @"CREATE TABLE IF NOT EXISTS kjd_map.product_third_select_map_" + i + @" (
// sql = @"CREATE TABLE IF NOT EXISTS kjd_map.jit_product_select_map_" + i + @" (
// `id` int NOT NULL AUTO_INCREMENT,
// `product_id` bigint NOT NULL COMMENT '草稿箱/商品Id',
// `product_select_db_id` bigint NOT NULL COMMENT '选品上传数据库Id',
// `shop_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '上传的店铺',
// PRIMARY KEY (`id`)
//) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '上传商品与母店商品spu映射关系';";
//) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '上传商品kjd库Id与商品DraftId映射关系';";
// sql += @"
//ALTER TABLE
// kjd_map.product_third_select_map_" + i + @"
// kjd_map.jit_product_select_map_" + i + @"
//ADD
// COLUMN `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP";
// var rst = mySql.ExecuteNonQuery(sql);
@@ -254,5 +254,18 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
///ActiveJitCardCode
[WebMethod]
public void active_jit_card_code()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ShopManage().ActiveJitCardCode(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}