商品选品数据库列表 商品选品申请功能 优化cookie存取

This commit is contained in:
wule committed 2025-07-16 19:13:16 +08:00
1 parent a77278c6d1
commit f2135af339
37 files changed
+3221 -296

No files matched your search

+254 -13
View File
@@ -1,8 +1,12 @@
using KJD_Web.Utils;
using KJD_Web.Model;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace KJD_Web.BLL
{
@@ -12,19 +16,23 @@ namespace KJD_Web.BLL
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id");
string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id");
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"));
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"));
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"));
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"));
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img"));
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
//string sss = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"))?.Replace("'", "\\'");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"))?.Replace("'", "\\'");
string product_json = RegexUtils.GetStringQuery(ref inputData, "product_json");
string size_json = RegexUtils.GetStringQuery(ref inputData, "size_json");
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img"))?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
@@ -35,9 +43,9 @@ namespace KJD_Web.BLL
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "insert into kjd.product (spu_id,skc_id,cat_id,cat_name,product_name,product_json,size_json,main_img,notes,add_time,mdy_time) " +
sql = "insert into kjd.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 + "','" +
product_json + "','" + size_json + "','" + main_img + "','" + notes + "','" +
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.ExecuteNonQuery(sql);
@@ -51,7 +59,240 @@ namespace KJD_Web.BLL
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductList(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'","\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
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_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var s_page = RegexUtils.GetStringQuery(ref inputData, "page");
int page = 0;
int.TryParse(s_page, out page);
var s_page_size = RegexUtils.GetStringQuery(ref inputData, "page_size");
int page_size;
int.TryParse(s_page_size, out page_size);
if (page_size == 0)
page_size = 50;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd.product where 1=1";
if (!string.IsNullOrWhiteSpace(search_spu))
sql += " and spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
sql += " and skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
sql += " and cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
sql += " and ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
sql += " and product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and notes like '%" + search_notes + "%'";
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select id,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,notes,add_time,mdy_time from kjd.product where 1=1";
if (!string.IsNullOrWhiteSpace(search_spu))
sql += " and spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
sql += " and skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
sql += " and cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
sql += " and ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
sql += " and product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
sql += " and notes like '%" + search_notes + "%'";
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<DBProductResultParam> productLst = new List<DBProductResultParam>();
foreach (DataRow row in dt.Rows)
{
DBProductResultParam prod = new DBProductResultParam
{
id = Convert.ToInt32(row["id"]),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
cat_id = row["cat_id"].ToString(),
cat_name = row["cat_name"].ToString(),
product_name = row["product_name"].ToString(),
main_img = row["main_img"].ToString(),
ext_code = row["ext_code"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
};
productLst.Add(prod);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":200,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":200,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelDbProd(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.product 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\":\"输入为空\"}";
}
public string MdyProductNotes(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
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.product 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\":\"输入为空\"}";
}
public string AddUserSelectProduct(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":20000,\"msg\":\"校验失败\"}";
var out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name");
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes");
var status = RegexUtils.GetStringQuery(ref inputData, "status");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"店铺信息\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into kjd.product_select (out_product_Id,shop_id,shop_account,user_name,sub_user_name,notes,status,add_time,mdy_time) " +
"values ('" + out_product_Id + "','" + shop_id + "','" + shop_account + "','" + user_name + "','" + sub_user_name + "','" +
notes + "','" + status + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
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\":\"输入为空\"}";
}
}
}
+9 -9
View File
@@ -55,7 +55,7 @@ namespace KJD_Web.BLL
return "{\"code\":1,\"msg\":\"用户名或密码错误\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddSubUser(string inputData)
@@ -97,7 +97,7 @@ namespace KJD_Web.BLL
else
return "{\"code\":200,\"msg\":\"子账户创建成功!\"}";
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetSubUser(string inputData)
@@ -146,7 +146,7 @@ namespace KJD_Web.BLL
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateSubUser(string inputData)
@@ -192,7 +192,7 @@ namespace KJD_Web.BLL
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
@@ -217,9 +217,9 @@ namespace KJD_Web.BLL
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":200,\"msg\":\"删除失败,请稍后重试\"}";
return "{\"code\":500,\"msg\":\"删除失败,请稍后重试\"}";
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetAllUser(string inputData)
@@ -276,7 +276,7 @@ namespace KJD_Web.BLL
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddUser(string inputData)
@@ -317,7 +317,7 @@ namespace KJD_Web.BLL
else
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateUser(string inputData)
@@ -365,7 +365,7 @@ namespace KJD_Web.BLL
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
@@ -93,7 +93,8 @@
</Compile>
<Compile Include="Model\CommentParam.cs" />
<Compile Include="Model\OrderParam.cs" />
<Compile Include="Model\ProductResultParam.cs" />
<Compile Include="Model\DBProductResultParam.cs" />
<Compile Include="Model\ProductSelectResultParam.cs" />
<Compile Include="Model\ShopModel\ShopParam.cs" />
<Compile Include="Model\UserLoginResultParam.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -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>
@@ -5,13 +5,17 @@ using System.Web;
namespace KJD_Web.Model
{
public class ProductResultParam
/// <summary>
/// 选品数据库商品
/// </summary>
public class DBProductResultParam
{
public int id { get; set; }
public string spu_id { get; set; }
public string skc_id { get; set; }
public string cat_id { get; set; }
public string cat_name { get; set; }
public string ext_code { get; set; }
public string product_name { get; set; }
public string product_json { get; set; }
public string size_json { get; set; }
@@ -0,0 +1,25 @@
using KJD_Web.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model
{
/// <summary>
/// 用户选品结果
/// </summary>
public class ProductSelectResultParam
{
public int id { get; set; }
public string out_product_Id { get; set; }
public string shop_id { get; set; }
public string shop_account { get; set; }
public string user_name { get; set; }
public string sub_user_name { get; set; }
public string notes { get; set; }
public string status { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -54,7 +54,7 @@ namespace KJD_Web
string jsontext = GetRequestJsonString();
var result = jsontext;
//result = new ShopManage().GetShop(jsontext);
result = new ProductManage().GetProductList(jsontext);
Context.Response.Write(result);
Context.Response.End();
@@ -73,24 +73,49 @@ namespace KJD_Web
}
[WebMethod]
public void del_product()
public void del_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
//result = new ShopManage().DelShop(jsontext);
result = new ProductManage().DelDbProd(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
//[WebMethod]
//public void mdy_product()
//{
// string jsontext = GetRequestJsonString();
// var result = jsontext;
// //result = new ProductManage().MdyShop(jsontext);
// Context.Response.Write(result);
// Context.Response.End();
//}
[WebMethod]
public void mdy_product()
public void mdy_product_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
//result = new ShopManage().MdyShop(jsontext);
result = new ProductManage().MdyProductNotes(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_user_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductManage().AddUserSelectProduct(jsontext);
Context.Response.Write(result);
Context.Response.End();