1拼多多商品分组 2拼多多登录逻辑优化

This commit is contained in:
wule committed 2025-10-01 16:05:39 +08:00
1 parent 8fb90422a2
commit 378170ffb5
36 files changed
+4272 -736

No files matched your search

@@ -94,6 +94,7 @@ namespace KJD_Web.BLL.BXX
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"))?.Replace("'", "\\'");
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"))?.Replace("'", "\\'");
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img"))?.Replace("'", "\\'");
string group = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group"))?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
@@ -105,32 +106,34 @@ namespace KJD_Web.BLL.BXX
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "update bxx.product set";
sql = "update bxx.product p set";
if (from_shop_id != null)
sql += " from_shop_id='" + from_shop_id + "',";
sql += " p.from_shop_id='" + from_shop_id + "',";
if (main_cat_id != null)
sql += " main_cat_id='" + main_cat_id + "',";
sql += " p.main_cat_id='" + main_cat_id + "',";
if (main_cat_name != null)
sql += " main_cat_name='" + main_cat_name + "',";
sql += " p.main_cat_name='" + main_cat_name + "',";
if (cat_id != null)
sql += " cat_id='" + cat_id + "',";
sql += " p.cat_id='" + cat_id + "',";
if (cat_name != null)
sql += " cat_name='" + cat_name + "',";
sql += " p.cat_name='" + cat_name + "',";
if (price_text != null)
sql += " price_text='" + price_text + "',";
sql += " p.price_text='" + price_text + "',";
if (product_name != null)
sql += " product_name='" + product_name + "',";
sql += " p.product_name='" + product_name + "',";
if (ext_code != null)
sql += " ext_code='" + ext_code + "',";
sql += " p.ext_code='" + ext_code + "',";
if (main_img != null)
sql += " main_img='" + main_img + "',";
sql += " p.main_img='" + main_img + "',";
if (product_json != null)
sql += " product_json='" + product_json + "',";
sql += " p.product_json='" + product_json + "',";
if (size_json != null)
sql += " size_json='" + size_json + "',";
sql += " p.size_json='" + size_json + "',";
if (group != null)
sql += " p.group='" + group + "',";
if (notes != null)
sql += " notes='" + notes + "',";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql += " p.notes='" + notes + "',";
sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where spu_id='" + spu_id + "';";
var rst = mySql.ExecuteNonQuery(sql);
@@ -163,6 +166,7 @@ namespace KJD_Web.BLL.BXX
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("'", "\\'");
@@ -188,6 +192,8 @@ namespace KJD_Web.BLL.BXX
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(search_db_ids))
@@ -207,10 +213,10 @@ namespace KJD_Web.BLL.BXX
sql = "select p.*,s.img_base64,s.img_url from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where 1=1";
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 from bxx.product p where 1=1";
"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 from bxx.product p where 1=1";
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,COUNT(s.id) AS select_count " +
"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,COUNT(s.id) AS select_count " +
"FROM bxx.product p LEFT JOIN bxx.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "' " +
"WHERE 1=1";
@@ -252,6 +258,7 @@ namespace KJD_Web.BLL.BXX
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(),
@@ -287,6 +294,60 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductGroups(string inputData, bool isDetail = 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\":50001,\"msg\":\"没有用户名\"}";
}
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 DISTINCT p.group FROM `bxx`.`product` p";
string where = "";
sql += where;
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
try
{
string group_data = "";
foreach (DataRow row in dt.Rows)
{
group_data += row["group"].ToString() + ",";
}
var data = group_data.Trim(',');
return "{\"code\":200,\"msg\":\"success\",\"data\":\"" + data + "\"}";
}
catch (Exception ex)
{
return "{\"code\":50002,\"msg\":\"" + ex.Message + "\",\"data\":\"\"}";
}
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 查询商品替换sku
/// </summary>
@@ -388,6 +449,7 @@ namespace KJD_Web.BLL.BXX
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var in_ext_codes = RegexUtils.GetStringQuery(ref inputData, "in_ext_codes")?.Replace("'", "\\'");
var in_groups = RegexUtils.GetStringQuery(ref inputData, "in_groups")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -401,7 +463,12 @@ namespace KJD_Web.BLL.BXX
if (!string.IsNullOrEmpty(in_ext_codes))
{
in_ext_codes = "'" + string.Join("','", in_ext_codes.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and ext_code in (" + in_ext_codes + ")";
where += " and p.ext_code in (" + in_ext_codes + ")";
}
if (!string.IsNullOrEmpty(in_groups))
{
in_groups = "'" + string.Join("','", in_groups.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.group in (" + in_groups + ")";
}
sql += where;
@@ -415,8 +482,9 @@ namespace KJD_Web.BLL.BXX
}
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 from bxx.product p where 1=1";
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.group,p.notes,p.add_time,p.mdy_time,p.select_total_count," +
"p.fission_words,p.head_words,p.end_words from bxx.product p where 1=1";
//where子句
sql += where;
@@ -452,6 +520,7 @@ namespace KJD_Web.BLL.BXX
//size_json = row["size_json"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
group = row["group"].ToString(),
notes = row["notes"].ToString(),
select_total_count = row["select_total_count"].ParseToInt(),
end_words = row["end_words"].ParseToString(),
@@ -560,9 +629,11 @@ namespace KJD_Web.BLL.BXX
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var product_name = RegexUtils.GetStringQuery(ref inputData, "product_name")?.Replace("'", "\\'");
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
string id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string in_db_ids = RegexUtils.GetStringQuery(ref inputData, "in_db_ids")?.Replace("'", "\\'");
string product_name = RegexUtils.GetStringQuery(ref inputData, "product_name")?.Replace("'", "\\'");
string group = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group"))?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
string fission_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_words"))?.Replace("'", "\\'");
@@ -576,21 +647,30 @@ namespace KJD_Web.BLL.BXX
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.product set";
string sql = "update bxx.product p set";
if (product_name != null)
sql += " product_name='" + product_name + "',";
sql += " p.product_name='" + product_name + "',";
if (group != null)
sql += " p.group='" + group + "',";
if (notes != null)
sql += " notes='" + notes + "',";
sql += " p.notes='" + notes + "',";
if (ext_code != null)
sql += " ext_code='" + ext_code + "',";
sql += " p.ext_code='" + ext_code + "',";
if (fission_words != null)
sql += " fission_words='" + fission_words + "',";
sql += " p.fission_words='" + fission_words + "',";
if (head_words != null)
sql += " head_words='" + head_words + "',";
sql += " p.head_words='" + head_words + "',";
if (end_words != null)
sql += " end_words='" + end_words + "',";
sql += " p.end_words='" + end_words + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";";
if (in_db_ids != null)
{
sql += " where id in (" + in_db_ids + ");";
}
else
{
sql += " where id=" + id + ";";
}
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
@@ -942,7 +1022,7 @@ namespace KJD_Web.BLL.BXX
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.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 " +
@@ -976,6 +1056,7 @@ namespace KJD_Web.BLL.BXX
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"]),
@@ -156,6 +156,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void get_product_groups()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetProductGroups(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_sku_img_replace()
{
@@ -31,6 +31,7 @@ namespace KJD_Web.Model
public string main_img { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string group { get; set; }
public string notes { get; set; }
/// <summary>
/// 店铺选品次数
@@ -35,6 +35,7 @@ namespace KJD_Web.Model
public string cat_name { get; set; }
public string change_cat_id { get; set; }
public string change_cat_name { get; set; }
public string group { get; set; }
public string ext_code { get; set; }
public string product_name { get; set; }
public string main_img { get; set; }