优化了微店商品上传 优化pdd买手读单

This commit is contained in:
wule committed 2026-04-15 21:04:37 +08:00
1 parent 6c4f16b897
commit f360688c43
62 files changed
+5620 -1432

No files matched your search

@@ -149,6 +149,7 @@ namespace KJD_Web.BLL.BXX
string sku_secret_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_secret_json"))?.Replace("'", "\\'");
string wx_img_map_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_img_map_json"))?.Replace("'", "\\'");
string problem_prod_data = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "problem_prod_data"))?.Replace("'", "\\'");
string is_relation = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "is_relation"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
@@ -226,6 +227,8 @@ namespace KJD_Web.BLL.BXX
sql += " p.wx_img_map_json=@wx_img_map_json,";
if (!problem_prod_data.IsNullOrEmpty())
sql += " p.problem_prod_data=" + problem_prod_data + ",";
if (!is_relation.IsNullOrEmpty())
sql += " p.is_relation=" + is_relation + ",";
sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where spu_id='" + spu_id + "';";
@@ -471,6 +474,7 @@ namespace KJD_Web.BLL.BXX
var real_coid = RegexUtils.GetStringQuery(ref inputData, "real_coid")?.Replace("'", "\\'");
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
var problem_prod_data = RegexUtils.GetStringQuery(ref inputData, "problem_prod_data")?.Replace("'", "\\'");
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation")?.Replace("'", "\\'");
var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'");
@@ -517,7 +521,8 @@ namespace KJD_Web.BLL.BXX
where += " and p.special_prod_type ='" + special_prod_type + "'";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and p.spu_id like '%" + 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 + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
@@ -599,6 +604,10 @@ namespace KJD_Web.BLL.BXX
else
where += " and p.problem_prod_data='" + problem_prod_data + "'";
}
if (!string.IsNullOrEmpty(is_relation))
{
where += " and p.is_relation=" + is_relation;
}
if (start_time != null && end_time != null)
{
where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'";
@@ -627,7 +636,7 @@ namespace KJD_Web.BLL.BXX
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name," +
" p.main_img,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group," +
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id," +
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," +
" s.img_url,e.ext_code_price" +
" FROM bxx.product p " +
" left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
@@ -637,7 +646,7 @@ namespace KJD_Web.BLL.BXX
sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name," +
" p.main_img,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group," +
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id," +
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," +
" s.img_url,COUNT(se.id) AS select_count,e.ext_code_price" +
" FROM bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " +
" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
@@ -707,6 +716,7 @@ namespace KJD_Web.BLL.BXX
secret_spu_id = row["secret_spu_id"].IsNullOrEmpty() ? null : row["secret_spu_id"].ParseToString(),
real_coid = row["real_coid"].IsNullOrEmpty() ? null : row["real_coid"].ParseToString(),
real_spu_id = row["real_spu_id"].IsNullOrEmpty() ? null : row["real_spu_id"].ParseToString(),
is_relation = row["is_relation"].ParseToInt(),
};
if (isDetail)
{
@@ -1362,10 +1372,11 @@ namespace KJD_Web.BLL.BXX
var wx_safe_status = RegexUtils.GetStringQuery(ref inputData, "wx_safe_status")?.Replace("'", "\\'");
var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'");
var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'");
var is_not_count = (RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'")).ParseToBool();
var prod_count = (RegexUtils.GetStringQuery(ref inputData, "prod_count")?.Replace("'", "\\'")).ParseToInt();
var add_days_less = RegexUtils.GetStringQuery(ref inputData, "add_days_less")?.Replace("'", "\\'").ParseToNullableInt();
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'").ParseToString();
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count").ParseToBool(); // 不计数
var prod_count = RegexUtils.GetStringQuery(ref inputData, "prod_count").ParseToInt();
var add_days_less = RegexUtils.GetStringQuery(ref inputData, "add_days_less").ParseToNullableInt();
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation").ParseToNullableInt();
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -1439,6 +1450,10 @@ namespace KJD_Web.BLL.BXX
{
where += " and has_wx_format = '" + has_wx_format + "'";
}
if (is_relation != null)
{
where += " and is_relation = " + is_relation;
}
sql += where;
int count = prod_count;
@@ -1480,7 +1495,7 @@ namespace KJD_Web.BLL.BXX
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.product_get_type," +
" p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3,p.send_to_out_server," +
" p.wx_cat_leaf" +
" p.wx_cat_leaf,p.is_relation" +
" from bxx.product p where p.is_del=0";
//where子句
//sql += where;
@@ -1528,6 +1543,7 @@ namespace KJD_Web.BLL.BXX
wx_safe_status = row["wx_safe_status"].ToString(),
special_prod_type = row["special_prod_type"].ToString(),
send_to_out_server = row["send_to_out_server"].ParseToInt(),
is_relation = row["is_relation"].ParseToInt(),
};
productLst.Add(prod);
}
@@ -2996,6 +3012,11 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 随机工厂商品
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string GetRandomCompanyProductConfig(string inputData)
{
var timeCalc = DateTime.Now;
@@ -3043,6 +3064,131 @@ namespace KJD_Web.BLL.BXX
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddRelation(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 up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(up_spu_id))
{
return "{\"code\":500,\"msg\":\"缺少上家编号\"}";
}
var index = RegexUtils.GetStringQuery(ref inputData, "index").ParseToNullableLong();
if (index == null)
index = Math.Abs(up_spu_id.GetHashCode()) % 128;
var up_goods_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "up_goods_name"));
if (string.IsNullOrEmpty(up_goods_name))
{
return "{\"code\":500,\"msg\":\"缺少上家商品名称\"}";
}
var from_site = RegexUtils.GetStringQuery(ref inputData, "from_site")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(from_site))
{
return "{\"code\":500,\"msg\":\"缺少关联商品平台\"}";
}
var goods_id = RegexUtils.GetStringQuery(ref inputData, "goods_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(goods_id))
{
return "{\"code\":500,\"msg\":\"缺少关联商品编号\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"缺少关联店铺编号\"}";
}
var price_max = RegexUtils.GetStringQuery(ref inputData, "price_max")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(price_max))
{
return "{\"code\":500,\"msg\":\"缺少关联最高价格\"}";
}
var price_min = RegexUtils.GetStringQuery(ref inputData, "price_min")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(price_min))
{
return "{\"code\":500,\"msg\":\"缺少关联最低价格\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into bxx_relation.out_prod_relation_" + index.ParseToString().PadLeft(4, '0') +
" (up_spu_id,up_goods_name,from_site,goods_id,shop_id,price_min,price_max) " +
" values ('" + up_spu_id + "',@up_goods_name,'" + from_site + "','" +
goods_id + "'," + shop_id + "," + price_min + "," + price_max + ");";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@up_goods_name", Value = up_goods_name, });
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (mySql.Message.IsNullOrEmpty())
{
return "{\"code\":200,\"msg\":\"成功\"}";
}
else
{
return "{\"code\":500,\"msg\":\"失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetRelation(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 up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(up_spu_id))
{
return "{\"code\":500,\"msg\":\"缺少来源商品编号\"}";
}
var index = RegexUtils.GetStringQuery(ref inputData, "index").ParseToNullableLong();
if (index == null)
index = Math.Abs(up_spu_id.GetHashCode()) % 128;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from bxx_relation.out_prod_relation_" + index.ParseToString().PadLeft(4, '0') +
" where up_spu_id='" + up_spu_id + "' limit 20;";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (mySql.Message.IsNullOrEmpty())
{
JArray jArr = new JArray();
foreach (DataRow row in dt.Rows)
{
JObject jObj = new JObject();
jObj["id"] = row["id"].ParseToInt();
jObj["up_spu_id"] = row["up_spu_id"].ToString();
jObj["up_goods_name"] = row["up_goods_name"].ToString();
jObj["from_site"] = row["from_site"].ToString();
jObj["goods_id"] = row["goods_id"].ToString();
jObj["shop_id"] = row["shop_id"].ToString();
jObj["price_min"] = row["price_min"].ParseToInt();
jObj["price_max"] = row["price_max"].ParseToInt();
jObj["add_time"] = row["add_time"].ParseToString().ParseToDateTime();
jArr.Add(jObj);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(jArr, jsonSetting);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + jArr.Count + "}";
}
else
{
return "{\"code\":500,\"msg\":\"失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}