1选品数据库及库存上传相关功能 2修复部分商品详情信息特殊符号导致无法上传问题

This commit is contained in:
wule committed 2025-07-24 15:40:39 +08:00
1 parent adf75f9fc1
commit 281cf2e338
38 files changed
+1496 -440

No files matched your search

@@ -1,6 +1,7 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI.Common;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
@@ -43,14 +44,21 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
var json_sign = RegexUtils.GetStringJson(ref product_json, "signedImageUrl"); // 取商品json数据里不同签名的部分
var product_md5 = EncrypUtil.GetMd5(product_json.Replace(json_sign, "") + size_json);
sql = "select id from kjd.third_product where product_md5='" + product_md5 + "'";
var rst = mySql.ExecuteFirstInt(sql).ParseToLong();
if (rst <= 0)
{
sql = "insert into kjd.third_product (spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,add_time,mdy_time) " +
"values ('" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" +
ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteInsertId(sql);
mySql.Close();
sql = "insert into kjd.third_product (spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,product_md5,add_time,mdy_time) " +
"values ('" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" +
ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" + product_md5 + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
rst = mySql.ExecuteInsertId(sql);
mySql.Close();
}
if (rst > 0)
{
return "{\"code\":200,\"msg\":\"success\",\"id\":" + rst + "}";
@@ -587,5 +595,45 @@ namespace KJD_Web.BLL
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyProductSelectNotes(string inputData, bool isAdmin = 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("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.third_product_select set";
if (notes != null)
sql += " notes='" + notes + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}