服务更新支持淘宝关联

This commit is contained in:
wule committed 2026-10-05 09:04:41 +08:00
1 parent be08510a84
commit 1e17b61288
1 file changed
+20 -8
+20 -8
View File
@@ -468,6 +468,9 @@ namespace KJD_Web.BLL.WXXD
string map_skus = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "map_skus"))?.Replace("'", "\\'");
string map_send_address = RegexUtils.GetStringQuery(ref inputData, "map_send_address")?.Replace("'", "\\'");
string transit_warehouse_id = RegexUtils.GetStringQuery(ref inputData, "transit_warehouse_id")?.Replace("'", "\\'");
string platform = RegexUtils.GetStringQuery(ref inputData, "platform")?.Replace("'", "\\'");
if (platform != "tb")
platform = "pdd";
if (string.IsNullOrEmpty(spu_code))
return "{\"code\":500,\"msg\":\"缺少系统商品编号\"}";
@@ -479,7 +482,8 @@ namespace KJD_Web.BLL.WXXD
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT 1 FROM `bxx`.`product_buy_map_skus` where user_name='" + user_name + "' AND spu_code='" + spu_code + "' AND map_goods_id='" + map_goods_id + "'";
string sql = "SELECT 1 FROM `bxx`.`product_buy_map_skus` where user_name='" + user_name + "' AND spu_code='" + spu_code + "' AND map_goods_id='" +
map_goods_id + "' AND platform='" + platform + "'";
string where = "";
sql += where;
var exist = mySql.ExecuteFirstInt(sql);
@@ -491,8 +495,8 @@ namespace KJD_Web.BLL.WXXD
if (exist == 0)
{
sql = " INSERT INTO `bxx`.`product_buy_map_skus` (user_name,spu_code,map_url,map_goods_name,map_goods_id,map_skus,map_send_address,transit_warehouse_id)" +
" VALUES (@user_name,@spu_code,@map_url,@map_goods_name,@map_goods_id,@map_skus,@map_send_address,@transit_warehouse_id);";
sql = " INSERT INTO `bxx`.`product_buy_map_skus` (user_name,spu_code,map_url,map_goods_name,map_goods_id,map_skus,map_send_address,transit_warehouse_id,platform)" +
" VALUES (@user_name,@spu_code,@map_url,@map_goods_name,@map_goods_id,@map_skus,@map_send_address,@transit_warehouse_id,@platform);";
}
else
{
@@ -508,7 +512,7 @@ namespace KJD_Web.BLL.WXXD
if (transit_warehouse_id != null)
sql += " transit_warehouse_id=@transit_warehouse_id,";
sql = sql.TrimEnd(',');
sql += " WHERE user_name=@user_name and spu_code=@spu_code;";
sql += " WHERE user_name=@user_name and spu_code=@spu_code and map_goods_id=@map_goods_id and platform=@platform;";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
@@ -520,6 +524,7 @@ namespace KJD_Web.BLL.WXXD
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "map_skus", Value = map_skus, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "map_send_address", Value = map_send_address, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "transit_warehouse_id", Value = transit_warehouse_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "platform", Value = platform, });
var rows = mySql.ExecuteAffectedRows(sql, paramLst.ToArray());
mySql.Close();
if (string.IsNullOrEmpty(mySql.Message))
@@ -665,6 +670,9 @@ namespace KJD_Web.BLL.WXXD
string map_sku_id = RegexUtils.GetStringQuery(ref inputData, "map_sku_id")?.Replace("'", "\\'");
string map_send_address = RegexUtils.GetStringQuery(ref inputData, "map_send_address")?.Replace("'", "\\'");
string transit_warehouse_id = RegexUtils.GetStringQuery(ref inputData, "transit_warehouse_id")?.Replace("'", "\\'");
string platform = RegexUtils.GetStringQuery(ref inputData, "platform")?.Replace("'", "\\'");
if (platform != "tb")
platform = "pdd";
if (string.IsNullOrEmpty(spu_code) || string.IsNullOrEmpty(sku_code))
return "{\"code\":500,\"msg\":\"缺少系统商品或SKU编号\"}";
@@ -678,7 +686,8 @@ namespace KJD_Web.BLL.WXXD
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT 1 FROM `bxx`.`product_buy_map` where user_name='" + user_name + "' AND spu_code='" + spu_code + "' AND sku_code='" + sku_code + "'";
string sql = "SELECT 1 FROM `bxx`.`product_buy_map` where user_name='" + user_name + "' AND spu_code='" + spu_code + "' AND sku_code='" +
sku_code + "' AND platform='" + platform + "'";
string where = "";
sql += where;
var exist = mySql.ExecuteFirstInt(sql);
@@ -690,8 +699,8 @@ namespace KJD_Web.BLL.WXXD
if (exist == 0)
{
sql = " INSERT INTO `bxx`.`product_buy_map` (user_name,spu_code,sku_code,map_url,map_goods_name,map_spec_name,map_goods_id,map_sku_id,map_send_address,transit_warehouse_id)" +
" VALUES (@user_name,@spu_code,@sku_code,@map_url,@map_goods_name,@map_spec_name,@map_goods_id,@map_sku_id,@map_send_address,@transit_warehouse_id);";
sql = " INSERT INTO `bxx`.`product_buy_map` (user_name,spu_code,sku_code,map_url,map_goods_name,map_spec_name,map_goods_id,map_sku_id,map_send_address,transit_warehouse_id,platform)" +
" VALUES (@user_name,@spu_code,@sku_code,@map_url,@map_goods_name,@map_spec_name,@map_goods_id,@map_sku_id,@map_send_address,@transit_warehouse_id,@platform);";
}
else
{
@@ -710,8 +719,10 @@ namespace KJD_Web.BLL.WXXD
sql += " map_send_address=@map_send_address,";
if (transit_warehouse_id != null)
sql += " transit_warehouse_id=@transit_warehouse_id,";
if (platform != null)
sql += " platform=@platform,";
sql = sql.TrimEnd(',');
sql += " WHERE user_name=@user_name and spu_code=@spu_code and sku_code=@sku_code;";
sql += " WHERE user_name=@user_name and spu_code=@spu_code and sku_code=@sku_code and platform=@platform;";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
@@ -725,6 +736,7 @@ namespace KJD_Web.BLL.WXXD
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "map_sku_id", Value = map_sku_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "map_send_address", Value = map_send_address, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "transit_warehouse_id", Value = transit_warehouse_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "platform", Value = platform, });
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (string.IsNullOrEmpty(mySql.Message))