聚水潭食品类目上传

This commit is contained in:
wule committed 2026-02-23 21:28:09 +08:00
1 parent 7b06707a40
commit 1b2b6bb553
12 files changed
+430 -16

No files matched your search

@@ -115,6 +115,7 @@ namespace KJD_Web.BLL.BXX
string offline_supplier_name = RegexUtils.GetStringQuery(ref inputData, "offline_supplier_name")?.Replace("'", "\\'");
string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id")?.Replace("'", "\\'");
string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id")?.Replace("'", "\\'");
string secret_spu_id = RegexUtils.GetStringQuery(ref inputData, "secret_spu_id")?.Replace("'", "\\'");
string price_text = RegexUtils.GetStringQuery(ref inputData, "price_text")?.Replace("'", "\\'");
string main_cat_id = RegexUtils.GetStringQuery(ref inputData, "main_cat_id")?.Replace("'", "\\'");
string main_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_cat_name"))?.Replace("'", "\\'");
@@ -175,6 +176,8 @@ namespace KJD_Web.BLL.BXX
sql += " p.product_name='" + product_name + "',";
if (ext_code != null)
sql += " p.ext_code='" + ext_code + "',";
if (secret_spu_id != null)
sql += " p.secret_spu_id='" + secret_spu_id + "',";
if (main_img != null)
sql += " p.main_img='" + main_img + "',";
if (product_json != null)
@@ -264,6 +267,7 @@ namespace KJD_Web.BLL.BXX
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 search_secret_spu_ids = RegexUtils.GetStringQuery(ref inputData, "search_secret_spu_ids")?.Replace("'", "\\'");
var get_select_count = RegexUtils.GetStringQuery(ref inputData, "get_select_count")?.Replace("'", "\\'");
var select_shop_id = RegexUtils.GetStringQuery(ref inputData, "select_shop_id")?.Replace("'", "\\'");
var from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id")?.Replace("'", "\\'");
@@ -283,7 +287,7 @@ namespace KJD_Web.BLL.BXX
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(*) from bxx.product p where p.is_del=0";
string sql = "select count(*) from bxx.product p FORCE INDEX (index_wx_safe_status) where p.is_del=0";
string where = "";
if (!string.IsNullOrEmpty(from_shop_id))
@@ -292,6 +296,8 @@ namespace KJD_Web.BLL.BXX
where += " and p.from_shop_name ='" + from_shop_name + "'";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and p.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(search_secret_spu_ids))
where += " and p.secret_spu_id in ('" + string.Join("','", search_secret_spu_ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) + "')";
if (!string.IsNullOrEmpty(product_get_type))
where += " and p.product_get_type ='" + product_get_type + "'";
if (!string.IsNullOrEmpty(wx_safe_status))
@@ -381,7 +387,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.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id," +
" 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" +
@@ -391,7 +397,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.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id," +
" 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" +
@@ -458,6 +464,7 @@ namespace KJD_Web.BLL.BXX
main_cat_id = row["main_cat_id"].ToString(),
main_cat_name = row["main_cat_name"].ToString(),
send_to_out_server = row["send_to_out_server"].ParseToInt(),
secret_spu_id = row["secret_spu_id"].IsNullOrEmpty() ? null : row["secret_spu_id"].ParseToString(),
};
if (isDetail)
{
@@ -468,6 +475,24 @@ namespace KJD_Web.BLL.BXX
prod.sku_img_replace_base64 = row["img_base64"].ToString();
//prod.sku_img_replace_url = row["img_url"].ToString();
prod.wx_img_map_json = row["wx_img_map_json"].ToString();
if(!prod.sku_secret_json.IsNullOrEmpty() && prod.secret_spu_id.IsNullOrEmpty())
{
var secret_json = prod.sku_secret_json;
var goodsId = RegexUtils.GetStringJson(ref secret_json, "goodsId");
prod.secret_spu_id = goodsId;
if (!string.IsNullOrWhiteSpace(goodsId))
{
mySql = new MysqlUtils(conn);
try
{
sql = "update bxx.product set secret_spu_id='" + goodsId + "' where spu_id='" + prod.spu_id + "'";
mySql.ExecuteNonQuery(sql);
}
catch { }
mySql.Close();
}
}
}
if (!string.IsNullOrEmpty(get_select_count))
{
@@ -1,4 +1,5 @@
using KJD_Web.Utils;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -32,6 +33,29 @@ namespace KJD_Web.BLL
public void CreateTable()
{
// string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
// MysqlUtils mySql = new MysqlUtils(conn);
// string sql = "";
// for (int i = 0; i < 1024; i++)
// {
// sql = @"drop table if exists wxxd_product_shop_map.product_shop_map_" + i.ParseToString().PadLeft(4, '0') + ";\r\n";
// sql += @"
//CREATE TABLE wxxd_product_shop_map.product_shop_map_" + i.ParseToString().PadLeft(4, '0') + @" (
// `id` int NOT NULL AUTO_INCREMENT,
// `up_secret_spu_id` varchar(50) NOT NULL COMMENT '加密源商品id信息,此字段为分表依据,对应商品货号字段',
// `up_spu_id` varchar(50) NOT NULL COMMENT '源商品id信息',
// `shop_id` varchar(50) NOT NULL COMMENT '上传到的店铺id',
// `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
// PRIMARY KEY(`id`),
// KEY `index_add_time` (`add_time`) USING BTREE,
// KEY `index_up_secret_spu_id_shop_id` (`up_secret_spu_id`, `shop_id`) USING BTREE
//) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '记录微信商品上传到哪些店铺的信息'";
// var rst = mySql.ExecuteNonQuery(sql);
// }
// mySql.Close();
// string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
// MysqlUtils mySql = new MysqlUtils(conn);
// string sql = "";
@@ -85,9 +109,9 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
//MysqlUtils mySql = new MysqlUtils(conn);
//string sql = "";
// for (int i = 1; i <= 12; i++)
// {
@@ -166,7 +190,7 @@ namespace KJD_Web.BLL
// // sql = "ALTER TABLE\r\n kjd_order.order_code_" + i + " DROP COLUMN `subPurchaseOrderSn`,\r\n DROP COLUMN `jiaTongCode`,\r\n DROP COLUMN `shippingMark​Md5`,\r\n DROP COLUMN `shippingMarkBase64`,\r\n CHANGE COLUMN `barCodeMd5` `fileCodeMd5` varchar (32) NOT NULL,\r\n CHANGE COLUMN `barCodeBase64` `fileCodeBase64` longtext NOT NULL,\r\nMODIFY\r\n COLUMN `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP\r\nAFTER\r\n `fileCodeBase64`,\r\nMODIFY\r\n COLUMN `mdy_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\r\nAFTER\r\n `add_time`,\r\n DROP INDEX `index_subPurchaseOrderSn`,\r\nADD\r\n UNIQUE `index_fileCodeMd5` USING btree (`fileCodeMd5`)";
// var rst = mySql.ExecuteNonQuery(sql);
//}
mySql.Close();
//mySql.Close();
}
}
}
@@ -419,6 +419,67 @@ namespace KJD_Web.BLL.WXXD
return new BXX.BXXProductManage().MdyProduct(inputData);
}
public string WXAddSecretSpuIdShopIdMap(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_secret_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_secret_spu_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(up_secret_spu_id))
{
return "{\"code\":500,\"msg\":\"缺少商品编号1\"}";
}
var index = RegexUtils.GetStringQuery(ref inputData, "index").ParseToNullableLong();
if (index == null)
index = up_secret_spu_id.ParseToLong() % 1024;
var up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(up_spu_id))
{
return "{\"code\":500,\"msg\":\"缺少商品编号2\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"缺少店铺编号\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select id from wxxd_product_shop_map.product_shop_map_" + index.ParseToString().PadLeft(4, '0') +
" where up_secret_spu_id='" + up_secret_spu_id + "'and shop_id='" + shop_id + "'";
DataTable dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message) || dt == null || dt.Rows == null)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"失败:" + mySql.Message + "\"}";
}
if (dt.Rows.Count > 0)
{
mySql.Close();
return "{\"code\":200,\"msg\":\"数据已存在\"}";
}
sql = "insert into wxxd_product_shop_map.product_shop_map_" + index.ParseToString().PadLeft(4, '0') +
" (up_secret_spu_id,up_spu_id,shop_id) " +
" values ('" + up_secret_spu_id + "','" + up_spu_id + "','" + shop_id + "');";
mySql.ExecuteNonQuery(sql);
mySql.Close();
if (mySql.Message.IsNullOrEmpty())
{
return "{\"code\":200,\"msg\":\"成功\"}";
}
else
{
return "{\"code\":500,\"msg\":\"失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXAddMdyAfterSale(string inputData)
{
@@ -548,7 +609,6 @@ namespace KJD_Web.BLL.WXXD
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXAddMdyShippingTemplate(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
@@ -50,6 +50,7 @@ namespace KJD_Web.Model
/// </summary>
public string change_cat_name { get; set; }
public string ext_code { get; set; }
public string secret_spu_id { get; set; }
/// <summary>
/// 拼多多 设置类目价格
/// </summary>
@@ -122,6 +122,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void add_secret_spu_id_shop_id_map()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXProductManage().WXAddSecretSpuIdShopIdMap(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
//WXAddMdyAfterSale
[WebMethod]
public void wx_add_mdy_after_sale()