1812 lines
96 KiB
C#
1812 lines
96 KiB
C#
using StoreHub.KJDWebService.Models;
|
||
using StoreHub.Framework.Repositorys;
|
||
using Microsoft.Extensions.Configuration;
|
||
using StoreHub.KJDWebService.Commons;
|
||
using MySql.Data.MySqlClient;
|
||
using NaiBa.Util.Extension;
|
||
using Newtonsoft.Json.Linq;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Diagnostics;
|
||
using System.Linq;
|
||
|
||
namespace StoreHub.KJDWebService.Services
|
||
{
|
||
public class ProductService : ServiceBase
|
||
{
|
||
public ProductService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
|
||
{
|
||
}
|
||
public string AddProduct(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\":50000,\"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"))?.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 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"))?.Replace("'", "\\'");
|
||
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"))?.Replace("'", "\\'");
|
||
string original_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "original_json"))?.Replace("'", "\\'");
|
||
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img"))?.Replace("'", "\\'");
|
||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
|
||
string product_get_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_get_type"))?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(product_get_type))
|
||
product_get_type = "0";
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "";
|
||
|
||
sql = "insert into kjd.product (spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,original_json,notes,product_get_type,add_time,mdy_time) " +
|
||
"values ('" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" +
|
||
ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + original_json + "','" + notes + "','" +
|
||
product_get_type + "','" +
|
||
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\":\"输入为空\"}";
|
||
}
|
||
|
||
public string GetProductGroupList(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(100);
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
|
||
string sql = "select count(distinct p.group) from kjd.product p where p.is_del=0";
|
||
|
||
var count = mySql.ExecuteRowCount(sql);
|
||
|
||
DataTable dt;
|
||
if (count == 0)
|
||
{
|
||
dt = new DataTable();
|
||
}
|
||
else
|
||
{
|
||
sql = "select distinct p.group from kjd.product p where p.is_del=0";
|
||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||
dt = mySql.ExecuteDataTable(sql);
|
||
}
|
||
|
||
mySql.Close();
|
||
if (dt != null)
|
||
{
|
||
try
|
||
{
|
||
List<string> groupNameLst = new List<string>();
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
var group = row["group"].ToString();
|
||
groupNameLst.Add(group);
|
||
}
|
||
var data = JsonUtils.SerializeObjectToString(groupNameLst);
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string GetProductList(string inputData, bool isDetail = false)
|
||
{
|
||
DateTime timeCalc = DateTime.Now;
|
||
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 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 search_group = RegexUtils.GetStringQuery(ref inputData, "search_group")?.Replace("'", "\\'");
|
||
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_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 sort_field = RegexUtils.GetStringQuery(ref inputData, "sort_field")?.Replace("'", "\\'");
|
||
var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'");
|
||
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level").ParseToInt();
|
||
if (string.IsNullOrEmpty(product_get_type)) // 母店采集0或前端直采1
|
||
product_get_type = "0";
|
||
if (sa_level != 1 && product_get_type.ToLower() == "all")
|
||
product_get_type = "0,1";
|
||
|
||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
|
||
string sql = "SELECT COUNT(id) FROM kjd.product p WHERE p.is_del=0";
|
||
|
||
string where = "";
|
||
if (!isDetail && product_get_type != "all") // 详情必须从列表页面进入,不用限制
|
||
where += " AND p.product_get_type in (" + product_get_type + ")";
|
||
if (!string.IsNullOrEmpty(search_db_ids))
|
||
where += " AND p.id in (" + search_db_ids + ")";
|
||
if (!string.IsNullOrWhiteSpace(search_group))
|
||
where += " AND p.group = '" + search_group + "'";
|
||
if (!string.IsNullOrWhiteSpace(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))
|
||
where += " AND p.cat_name like '%" + search_cat + "%'";
|
||
if (!string.IsNullOrWhiteSpace(search_ext_code))
|
||
{
|
||
if (search_ext_code.Contains(","))
|
||
where += " AND p.ext_code in ('" + search_ext_code.Replace(",", "','") + "')";
|
||
else
|
||
where += " AND p.ext_code like '%" + search_ext_code + "%'";
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(search_prod_name))
|
||
where += " AND p.product_name like '%" + search_prod_name + "%'";
|
||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||
where += " AND p.notes like '%" + search_notes + "%'";
|
||
sql += where;
|
||
|
||
var count = mySql.ExecuteRowCount(sql);
|
||
|
||
DataTable dt;
|
||
if (count == 0)
|
||
{
|
||
dt = new DataTable();
|
||
}
|
||
else
|
||
{
|
||
if (isDetail)
|
||
sql = "SELECT * from kjd.product p where p.is_del=0";
|
||
else if (string.IsNullOrEmpty(get_select_count))
|
||
sql = "SELECT p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes,p.group," +
|
||
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.product_get_type," +
|
||
"p.cost_price,p.delivery_fee,p.mark_fee" +
|
||
" FROM kjd.product p" +
|
||
" WHERE p.is_del=0";
|
||
else // 统计单店认领次数
|
||
{
|
||
sql = "SELECT p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes,p.group," +
|
||
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.product_get_type," +
|
||
"p.cost_price,delivery_fee,p.mark_fee" +
|
||
",COUNT(s.id) AS select_count" +
|
||
" FROM kjd.product p" +
|
||
" LEFT JOIN (" +
|
||
" SELECT id,out_product_id,shop_id FROM kjd.product_select WHERE shop_id='" + select_shop_id + "'";
|
||
for (int year = Math.Max(2026, DateTime.Now.AddYears(-3).Year); year <= DateTime.Now.Year; year++)
|
||
{
|
||
sql += "UNION ALL SELECT id,out_product_id,shop_id FROM kjd_yearly.product_select_" + year + " WHERE shop_id='" + select_shop_id + "'";
|
||
}
|
||
sql += ") s" +
|
||
" ON s.out_product_id=p.id AND s.shop_id='" + select_shop_id + "'" +
|
||
" WHERE p.is_del=0";
|
||
}
|
||
|
||
//sql += "SELECT * FROM " + tableName + l_spu_map_table_id + " where draft_id=" + in_draft_id_list[i];
|
||
|
||
//where子句
|
||
sql += where;
|
||
|
||
if (!isDetail && !string.IsNullOrEmpty(get_select_count))
|
||
sql += " GROUP BY p.id";
|
||
if (sort_field == "select_total_count")
|
||
sql += " ORDER BY p.select_total_count desc, p.id desc";
|
||
else
|
||
sql += " ORDER BY p.add_time 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(),
|
||
group = row["group"].ToString(),
|
||
select_total_count = row["select_total_count"].ParseToInt(),
|
||
fission_words = row["fission_words"].ParseToString(),
|
||
head_words = row["head_words"].ParseToString(),
|
||
end_words = row["end_words"].ParseToString(),
|
||
cost_price = row["cost_price"].ParseToString(),
|
||
delivery_fee = row["delivery_fee"].ParseToString(),
|
||
mark_fee = row["mark_fee"].ParseToString(),
|
||
product_get_type = row["product_get_type"].ParseToInt(), //0母店采集 1前端直采
|
||
};
|
||
if (isDetail)
|
||
{
|
||
prod.product_json = row["product_json"].ToString();
|
||
prod.size_json = row["size_json"].ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(get_select_count))
|
||
{
|
||
prod.select_count = row["select_count"].ParseToInt();
|
||
}
|
||
productLst.Add(prod);
|
||
}
|
||
var data = JsonUtils.SerializeObjectToString(productLst);
|
||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string DelDbProd(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
//string sql = "delete from kjd.product where id='" + id + "'";
|
||
string sql = "update kjd.product set is_del=1 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 = 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 = "ConnKJD";
|
||
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 MdyDBProduct(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("'", "\\'");
|
||
var product_name = RegexUtils.GetStringQuery(ref inputData, "product_name")?.Replace("'", "\\'");
|
||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
|
||
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
|
||
|
||
string group = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group"))?.Replace("'", "\\'");
|
||
string fission_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_words"))?.Replace("'", "\\'");
|
||
string head_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "head_words"))?.Replace("'", "\\'");
|
||
string end_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "end_words"))?.Replace("'", "\\'");
|
||
string cost_price = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cost_price"))?.Replace("'", "\\'");
|
||
string delivery_fee = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "delivery_fee"))?.Replace("'", "\\'");
|
||
string mark_fee = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "mark_fee"))?.Replace("'", "\\'");
|
||
|
||
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"))?.Replace("'", "\\'");
|
||
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"))?.Replace("'", "\\'");
|
||
|
||
string original_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "original_json"))?.Replace("'", "\\'");
|
||
|
||
if (string.IsNullOrEmpty(id))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有指定商品\"}";
|
||
}
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "update kjd.product set";
|
||
if (product_name != null)
|
||
sql += " product_name='" + product_name + "',";
|
||
if (notes != null)
|
||
sql += " notes='" + notes + "',";
|
||
if (group != null)
|
||
sql += " kjd.product.group='" + group + "',";
|
||
if (ext_code != null)
|
||
sql += " ext_code='" + ext_code + "',";
|
||
if (fission_words != null)
|
||
sql += " fission_words='" + fission_words + "',";
|
||
if (head_words != null)
|
||
sql += " head_words='" + head_words + "',";
|
||
if (end_words != null)
|
||
sql += " end_words='" + end_words + "',";
|
||
if (cost_price != null)
|
||
sql += " cost_price='" + cost_price + "',";
|
||
if (delivery_fee != null)
|
||
sql += " delivery_fee='" + delivery_fee + "',";
|
||
if (mark_fee != null)
|
||
sql += " mark_fee='" + mark_fee + "',";
|
||
if (product_json != null)
|
||
sql += " product_json='" + product_json + "',";
|
||
if (size_json != null)
|
||
sql += " size_json='" + size_json + "',";
|
||
if (original_json != null)
|
||
sql += " original_json='" + original_json + "',";
|
||
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 = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||
if (time1 != EncrypUtil.Encryption(time))
|
||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||
|
||
var out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id")?.Replace("'", "\\'");
|
||
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
|
||
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account")?.Replace("'", "\\'");
|
||
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name")?.Replace("'", "\\'");
|
||
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name")?.Replace("'", "\\'");
|
||
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
|
||
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
|
||
var add_product_remaining = RegexUtils.GetStringQuery(ref inputData, "add_product_remaining").ParseToInt();
|
||
var add_fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_fission_product_name").ParseToString())?.Replace("'", "\\'");
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
if (string.IsNullOrEmpty(shop_id))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
|
||
}
|
||
|
||
DateTime addTime = DateTime.Now;
|
||
string addTimeStr = addTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||
string dbName = "kjd";
|
||
if (addTime.Year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
|
||
bool is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||
string tableName;
|
||
if (!is_client_jit)
|
||
tableName = dbName + ".product_select";
|
||
else
|
||
tableName = dbName + ".jit_product_select";
|
||
|
||
if (addTime.Year >= 2026)
|
||
tableName += "_" + addTime.Year;
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
|
||
string sql = "";
|
||
if (add_product_remaining > 0) // add_product_remaining 为空或为0表示商品直传,不消耗次数
|
||
{
|
||
sql = "select * from kjd.shop_add_prod_count where shop_id='" + shop_id + "';";
|
||
var dt = mySql.ExecuteDataTable(sql);
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
{
|
||
mySql.Close();
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
}
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
add_product_remaining = dt.Rows[0]["add_product_remaining"].ParseToInt();
|
||
if (add_product_remaining <= 0)
|
||
{
|
||
mySql.Close();
|
||
return "{\"code\":501,\"msg\":\"本月商品认领限额已用完,请下个月再操作!\"}";
|
||
}
|
||
}
|
||
}
|
||
|
||
sql = "INSERT INTO " + tableName +
|
||
" (out_product_Id,shop_id,shop_account,user_name,sub_user_name,notes,status,fission_product_name,add_time,mdy_time) VALUES" +
|
||
" ('" + out_product_Id + "','" + shop_id + "','" + shop_account + "','" + user_name + "','" + sub_user_name + "','" +
|
||
notes + "','" + status + "','" + add_fission_product_name + "','" +
|
||
addTimeStr + "','" +
|
||
addTimeStr + "');";
|
||
if (add_product_remaining > 0) // add_product_remaining 为空或为0表示商品直传,不消耗次数
|
||
{
|
||
add_product_remaining = add_product_remaining - 1;
|
||
sql += "\r\n";
|
||
//sql += "UPDATE kjd.shop SET add_product_remaining=" + add_product_remaining + " WHERE shop_id='" + shop_id + "';";
|
||
sql += "UPDATE kjd.product SET select_total_count=select_total_count+1 WHERE id=" + out_product_Id + ";";
|
||
sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" +
|
||
"ON DUPLICATE KEY UPDATE add_product_remaining=add_product_remaining-1";
|
||
}
|
||
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 MdyUserSelectProductStatus(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 select_db_id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id")?.Replace("'", "\\'");
|
||
var up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
|
||
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
|
||
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
|
||
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
|
||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||
if (select_add_time == null)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"当前软件版本不支持该操作,请升级软件。\"}";
|
||
}
|
||
|
||
long l_draft_id = draft_id.ParseToLong();
|
||
long l_spu_map_table_id = l_draft_id % 128;
|
||
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "";
|
||
|
||
// 使用事务一次提交多个sql操作
|
||
//sql += "set @@autocommit=0;\r\n";
|
||
sql += "START TRANSACTION;\r\n";
|
||
if (!string.IsNullOrEmpty(up_spu_id) && !string.IsNullOrEmpty(draft_id))
|
||
{
|
||
sql += "INSERT INTO kjd_map.spu_map_" + l_spu_map_table_id +
|
||
" (draft_id,from_spu_id,shop_id) VALUES(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');\r\n";
|
||
|
||
if (!select_add_time.HasValue || select_add_time.Value.Year < 2026)
|
||
{
|
||
if (!is_client_jit)
|
||
{
|
||
sql += "INSERT INTO kjd_map.product_select_map_" + l_select_map_table_id +
|
||
" (product_id,product_select_db_id,shop_id) VALUES(" + draft_id + "," + select_db_id + ",'" + shop_id + "');\r\n";
|
||
}
|
||
else
|
||
{
|
||
sql += "INSERT INTO kjd_map.jit_product_select_map_" + l_select_map_table_id +
|
||
" (product_id,product_select_db_id,shop_id) VALUES(" + draft_id + "," + select_db_id + ",'" + shop_id + "');\r\n";
|
||
}
|
||
}
|
||
else //(select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||
{
|
||
string select_type;
|
||
if (!is_client_jit)
|
||
select_type = "normal";
|
||
else
|
||
select_type = "jit";
|
||
sql += "INSERT INTO kjd_map_yearly.product_select_map_" + select_add_time.Value.Year +
|
||
"(product_select_db_id,product_id,shop_id,select_type) VALUES" +
|
||
"(" + select_db_id + ",'" + draft_id + "','" + shop_id + "','" + select_type + "');\r\n";
|
||
}
|
||
}
|
||
|
||
string dbName = "kjd";
|
||
if (select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
string tableName;
|
||
if (!is_client_jit)
|
||
tableName = dbName + ".product_select";
|
||
else
|
||
tableName = dbName + ".jit_product_select";
|
||
if (select_add_time.HasValue && select_add_time.Value.Year >= 2026)
|
||
tableName += "_" + select_add_time.Value.Year;
|
||
|
||
sql += "update " + tableName + " set";
|
||
if (draft_id != null)
|
||
sql += " draft_id='" + draft_id + "',";
|
||
if (status != null)
|
||
sql += " status='" + status + "',";
|
||
if (status == "已上传")
|
||
sql += " add_times=add_times+1,";
|
||
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
|
||
sql = sql.TrimEnd(',');
|
||
sql += " WHERE id=" + select_db_id + ";\r\n";
|
||
var rst = mySql.ExecuteNonQuery(sql);
|
||
string errMsg = mySql.Message;
|
||
if (string.IsNullOrEmpty(errMsg))
|
||
sql = "COMMIT;";
|
||
else
|
||
sql = "ROLLBACK;";
|
||
mySql.ExecuteNonQuery(sql);
|
||
mySql.Close();
|
||
if (rst)
|
||
{
|
||
return "{\"code\":200,\"msg\":\"success\"}";
|
||
}
|
||
else
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
|
||
}
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string GetUserSelectProductList(string inputData, bool isAdmin = false)
|
||
{
|
||
DateTime timeCalc = DateTime.Now;
|
||
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("'", "\\'");
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "\\'");
|
||
var search_shop_id = RegexUtils.GetStringQuery(ref inputData, "search_shop_id")?.Replace("'", "\\'");
|
||
var search_shop_account = RegexUtils.GetStringQuery(ref inputData, "search_shop_account")?.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 search_user_notes = RegexUtils.GetStringQuery(ref inputData, "search_user_notes")?.Replace("'", "\\'");
|
||
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
|
||
var search_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "search_sub_sa_name")?.Replace("'", "\\'");
|
||
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
|
||
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
|
||
|
||
var search_end_time = RegexUtils.GetStringJson(ref inputData, "search_end_time")?.ParseToDateTimeNullable();
|
||
if (search_end_time == null || search_end_time.Value > DateTime.Now.Date.AddDays(1)) search_end_time = DateTime.Now.Date.AddDays(1);
|
||
var search_start_time = RegexUtils.GetStringJson(ref inputData, "search_start_time")?.ParseToDateTimeNullable();
|
||
if (search_start_time == null || search_start_time.Value >= search_end_time.Value) search_start_time = search_end_time.Value.AddMonths(-6);
|
||
int startTableId = Math.Max(2025, search_start_time.Value.Year);
|
||
int endTableId = Math.Max(2025, search_end_time.Value.Year);
|
||
|
||
var no_sub_sa = RegexUtils.GetStringQuery(ref inputData, "no_sub_sa")?.Replace("'", "\\'");
|
||
|
||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||
|
||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
|
||
string sql = "SELECT count(s.id) from (";
|
||
for (int year = search_start_time.Value.Year; year <= search_end_time.Value.Year; year++)
|
||
{
|
||
string dbName = "kjd";
|
||
if (year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
string tableName;
|
||
if (!is_client_jit)
|
||
tableName = dbName + ".product_select";
|
||
else
|
||
tableName = dbName + ".jit_product_select";
|
||
|
||
if (year >= 2026)
|
||
tableName += "_" + year;
|
||
if (year > search_start_time.Value.Year)
|
||
sql += " UNION ALL";
|
||
sql += " SELECT * FROM " + tableName;
|
||
}
|
||
sql += ") s " +
|
||
"LEFT JOIN kjd.product p ON s.out_product_id=p.id " +
|
||
"LEFT JOIN kjd.user u ON s.operate_sub_sa_name=u.user_name " +
|
||
"WHERE s.add_time BETWEEN '" + search_start_time.Value.ToString("yyyy-MM-dd") + "' AND '" + search_end_time.Value.ToString("yyyy-MM-dd") + "' ";
|
||
|
||
string where = "";
|
||
if (!isAdmin || is_client_jit)
|
||
where += " AND (s.user_name='" + user_name + "' or s.sub_user_name like '%" + user_name + "%')";
|
||
if (!string.IsNullOrEmpty(operate_sub_sa_name))
|
||
{
|
||
where += " AND s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
|
||
}
|
||
if (no_sub_sa == "true")
|
||
where += " AND s.operate_sub_sa_name IS null";
|
||
if (!string.IsNullOrEmpty(search_db_ids))
|
||
where += " AND s.id IN (" + search_db_ids + ")";
|
||
if (!string.IsNullOrEmpty(shop_ids))
|
||
where += " AND s.shop_id IN ('" + string.Join("','", shop_ids.Split(new char[] { '\"', '\'', ' ', ',' }, StringSplitOptions.RemoveEmptyEntries)) + "')";
|
||
if (!string.IsNullOrWhiteSpace(status))
|
||
where += " AND s.status = '" + status + "'";
|
||
if (!string.IsNullOrWhiteSpace(search_shop_id))
|
||
where += " AND s.shop_id LIKE '%" + search_shop_id + "%'";
|
||
if (!string.IsNullOrWhiteSpace(search_shop_account))
|
||
where += " AND s.shop_account LIKE '%" + search_shop_account + "%'";
|
||
if (!string.IsNullOrWhiteSpace(search_notes))
|
||
{
|
||
//核价成功 重复 核价成功(重复)
|
||
if (search_notes == "无备注")
|
||
where += " AND s.notes = ''";
|
||
else if (search_notes == "重复")
|
||
where += " AND s.notes LIKE '重复%' AND s.notes NOT LIKE '核价成功%' AND s.notes not LIKE '核价通过%'";
|
||
else if (search_notes == "核价成功")
|
||
where += " AND (s.notes LIKE '核价成功%' OR s.notes LIKE '核价通过%') AND s.notes not LIKE '重复%'";
|
||
else if (search_notes == "核价成功(重复)")
|
||
where += " AND (s.notes LIKE '核价成功%' OR s.notes LIKE '核价通过%') AND s.notes LIKE '重复%'";
|
||
else
|
||
where += " AND s.notes LIKE '%" + search_notes + "%'";
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(search_user_notes))
|
||
where += " AND s.user_notes LIKE '%" + search_user_notes + "%'";
|
||
|
||
where += " AND p.is_del=0";
|
||
if (!string.IsNullOrWhiteSpace(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))
|
||
where += " AND p.cat_name LIKE '%" + search_cat + "%'";
|
||
if (!string.IsNullOrWhiteSpace(search_ext_code))
|
||
where += " AND p.ext_code LIKE '%" + search_ext_code + "%'";
|
||
if (!string.IsNullOrWhiteSpace(search_prod_name))
|
||
where += " AND p.product_name LIKE '%" + search_prod_name + "%'";
|
||
if (!string.IsNullOrEmpty(search_sub_sa_name))
|
||
{
|
||
where += " AND (s.operate_sub_sa_name LIKE '%" + search_sub_sa_name + "%'";
|
||
where += " OR u.nick_name LIKE '%" + operate_sub_sa_name + "%')";
|
||
}
|
||
|
||
sql += where;
|
||
|
||
var count = mySql.ExecuteRowCount(sql);
|
||
|
||
DataTable dt;
|
||
if (count == 0)
|
||
{
|
||
dt = new DataTable();
|
||
}
|
||
else
|
||
{
|
||
//if (isDetail)
|
||
//sql = "SELECT * FROM " + tableName + " where 1=1";
|
||
//else
|
||
sql = "SELECT s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
|
||
"s.sub_user_name,s.notes,s.user_notes,s.status,s.draft_id,s.add_times,s.add_time,s.mdy_time," +
|
||
"s.fission_product_name,s.operate_sub_sa_name,s.add_sub_sa_time," +
|
||
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img," +
|
||
"p.product_get_type,u.nick_name as operate_sub_sa_nick " +
|
||
" FROM (";
|
||
for (int year = search_start_time.Value.Year; year <= search_end_time.Value.Year; year++)
|
||
{
|
||
string dbName = "kjd";
|
||
if (year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
string tableName;
|
||
if (!is_client_jit)
|
||
tableName = dbName + ".product_select";
|
||
else
|
||
tableName = dbName + ".jit_product_select";
|
||
|
||
if (year >= 2026)
|
||
tableName += "_" + year;
|
||
if (year > search_start_time.Value.Year)
|
||
sql += " UNION ALL";
|
||
sql += " SELECT * FROM " + tableName;
|
||
}
|
||
sql += ") s" +
|
||
" LEFT JOIN kjd.product p ON s.out_product_id=p.id" +
|
||
" LEFT join kjd.user u ON u.user_name=s.operate_sub_sa_name" +
|
||
" WHERE 1=1";
|
||
|
||
sql += where; // where子句
|
||
|
||
sql += " ORDER BY add_time desc";
|
||
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||
dt = mySql.ExecuteDataTable(sql);
|
||
}
|
||
|
||
mySql.Close();
|
||
if (dt != null)
|
||
{
|
||
try
|
||
{
|
||
List<ProductSelectResultParam> productLst = new List<ProductSelectResultParam>();
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
|
||
{
|
||
id = row["id"].ParseToLong(),
|
||
out_product_Id = row["out_product_Id"].ParseToString(),
|
||
shop_account = row["shop_account"].ParseToString(),
|
||
shop_id = row["shop_id"].ParseToString(),
|
||
status = row["status"].ParseToString(),
|
||
sub_user_name = row["sub_user_name"].ParseToString(),
|
||
user_name = row["user_name"].ParseToString(),
|
||
cat_id = row["cat_id"].ParseToString(),
|
||
cat_name = row["cat_name"].ParseToString(),
|
||
product_name = row["product_name"].ParseToString(),
|
||
main_img = row["main_img"].ParseToString(),
|
||
ext_code = row["ext_code"].ParseToString(),
|
||
add_time = Convert.ToDateTime(row["add_time"]),
|
||
mdy_time = Convert.ToDateTime(row["mdy_time"]),
|
||
notes = row["notes"].ParseToString(),
|
||
draft_id = row["draft_id"].ParseToString(),
|
||
add_times = row["add_times"].ParseToInt(),
|
||
skc_id = row["skc_id"].ToString(),
|
||
spu_id = row["spu_id"].ToString(),
|
||
operate_sub_sa_name = row["operate_sub_sa_name"].ToString(),
|
||
operate_sub_sa_nick = row["operate_sub_sa_nick"].ToString(),
|
||
fission_product_name = row["fission_product_name"].ToString(),
|
||
user_notes = row["user_notes"].ToString(),
|
||
product_get_type = row["product_get_type"].ParseToInt(),
|
||
//product_json = row["product_json"].ToString(),
|
||
//size_json = row["size_json"].ToString(),
|
||
};
|
||
prodSelect.add_sub_sa_time = row["add_sub_sa_time"] as DateTime?;
|
||
productLst.Add(prodSelect);
|
||
}
|
||
var data = JsonUtils.SerializeObjectToString(productLst);
|
||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string DelSelectProd(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||
if (select_add_time == null)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"当前软件版本不支持该操作,请升级软件。\"}";
|
||
}
|
||
|
||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||
string dbName = "kjd";
|
||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
string tableName;
|
||
if (!is_client_jit)
|
||
tableName = dbName + ".product_select";
|
||
else
|
||
tableName = dbName + ".jit_product_select";
|
||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||
tableName += "_" + select_add_time.Value.Year;
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "delete from " + tableName + " 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\":\"输入为空\"}";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置上传商品的二级超管
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string SetSelectProductSubSa(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
var db_ids = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
|
||
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
|
||
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
|
||
var db_id_infos = RegexUtils.GetStringQuery(ref inputData, "db_id_infos")?.Replace("'", "\\'");
|
||
|
||
if (operate_sub_sa_name == null)
|
||
{
|
||
return "{\"code\":50002,\"msg\":\"未选择任何二级超管\"}";
|
||
}
|
||
if (string.IsNullOrEmpty(db_ids) && string.IsNullOrEmpty(shop_ids))
|
||
{
|
||
return "{\"code\":50002,\"msg\":\"未选择任何待设置对象\"}";
|
||
}
|
||
|
||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||
if (select_add_time == null && db_id_infos == null && db_ids == null)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"当前软件版本不支持该操作,请升级软件。\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "";
|
||
bool rst = false;
|
||
|
||
if (!string.IsNullOrEmpty(db_ids))
|
||
{
|
||
sql = "UPDATE kjd.product_select SET";
|
||
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
|
||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||
sql += " WHERE id IN (" + db_ids + ")";
|
||
if (!string.IsNullOrEmpty(status))
|
||
sql += " AND status='" + status + "';";
|
||
|
||
rst = mySql.ExecuteNonQuery(sql);
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
{
|
||
mySql.Close();
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
}
|
||
}
|
||
else if (!string.IsNullOrEmpty(shop_ids))
|
||
{
|
||
List<int> yearLst = new List<int>() { 2025 };
|
||
if (select_add_time != null)
|
||
{
|
||
yearLst.Clear();
|
||
yearLst.Add(select_add_time.Value.Year);
|
||
yearLst.Add(select_add_time.Value.AddMonths(-6).Year);
|
||
yearLst = yearLst.Distinct().ToList();
|
||
}
|
||
foreach (int year in yearLst)
|
||
{
|
||
string dbName = "kjd";
|
||
if (year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
string tableName = dbName + ".product_select";
|
||
if (year >= 2026)
|
||
tableName += "_" + year;
|
||
|
||
sql = "UPDATE " + tableName + " SET";
|
||
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
|
||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||
sql += " WHERE shop_id in ('" + shop_ids.Replace(",", "','") + "')";
|
||
if (!string.IsNullOrEmpty(status))
|
||
sql += " AND status='" + status + "';";
|
||
|
||
rst = mySql.ExecuteNonQuery(sql);
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
{
|
||
mySql.Close();
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
}
|
||
}
|
||
}
|
||
else if (!string.IsNullOrEmpty(db_id_infos))
|
||
{
|
||
try
|
||
{
|
||
JArray jArr = JArray.Parse(db_id_infos);
|
||
foreach (JObject jObj in jArr)
|
||
{
|
||
var year = jObj["year"].ParseToInt();
|
||
var dbIds = jObj["db_ids"].ParseToString();
|
||
|
||
string dbName = "kjd";
|
||
if (year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
string tableName = dbName + ".product_select";
|
||
if (year >= 2026)
|
||
tableName += "_" + year;
|
||
|
||
sql = "UPDATE " + tableName + " SET";
|
||
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
|
||
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||
sql += " WHERE id IN (" + dbIds + ")";
|
||
if (!string.IsNullOrEmpty(status))
|
||
sql += " AND status='" + status + "';";
|
||
|
||
rst = mySql.ExecuteNonQuery(sql);
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
{
|
||
mySql.Close();
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
mySql.Close();
|
||
return "{\"code\":50004,\"msg\":\"" + ex.Message + "\"}";
|
||
}
|
||
}
|
||
mySql.Close();
|
||
return "{\"code\":200,\"msg\":\"success\"}";
|
||
}
|
||
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");
|
||
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
|
||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
|
||
string user_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "user_notes"));
|
||
string fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_product_name"));
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||
if (select_add_time == null)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"当前软件版本不支持该操作,请升级软件。\"}";
|
||
}
|
||
|
||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||
string dbName = "kjd";
|
||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||
dbName = "kjd_yearly";
|
||
string tableName;
|
||
if (!is_client_jit)
|
||
tableName = dbName + ".product_select";
|
||
else
|
||
tableName = dbName + ".jit_product_select";
|
||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||
tableName += "_" + select_add_time.Value.Year;
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "update " + tableName + " set";
|
||
if (notes != null)
|
||
sql += " notes=@notes,";
|
||
if (user_notes != null)
|
||
sql += " user_notes=@user_notes,";
|
||
if (fission_product_name != null)
|
||
sql += " fission_product_name=@fission_product_name,";
|
||
sql = sql.TrimEnd(',');
|
||
sql += " where id=@db_id;";
|
||
|
||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int64, ParameterName = "@db_id", Value = db_id, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@fission_product_name", Value = fission_product_name, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@user_notes", Value = user_notes, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
|
||
|
||
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
|
||
mySql.Close();
|
||
if (rst)
|
||
{
|
||
return "{\"code\":200,\"msg\":\"success\"}";
|
||
}
|
||
else
|
||
{
|
||
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
|
||
}
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string GetSelectProdDbIdMapDraftIdList(string inputData, bool isDetail = false)
|
||
{
|
||
DateTime timeCalc = DateTime.Now;
|
||
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 password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":50001,\"msg\":\"用户为空\"}";
|
||
}
|
||
|
||
var select_db_id = RegexUtils.GetStringQuery(ref inputData, "select_db_id")?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(select_db_id))
|
||
{
|
||
return "{\"code\":50002,\"msg\":\"未选择选品数据\"}";
|
||
}
|
||
|
||
var select_add_time = RegexUtils.GetStringQuery(ref inputData, "select_add_time")?.Replace("'", "\\'").ParseToDateTimeNullable();
|
||
if (select_add_time == null)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"当前软件版本不支持该操作,请升级软件。\"}";
|
||
}
|
||
|
||
var is_client_jit = RegexUtils.GetStringQuery(ref inputData, "is_client_jit")?.ParseToBool() == true;
|
||
string dbName = "kjd_map";
|
||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||
dbName = "kjd_map_yearly";
|
||
string tableName;
|
||
if (!is_client_jit || (select_add_time != null && select_add_time.Value.Year >= 2026)) // 2026年以后的数据在新表,不带jit
|
||
tableName = dbName + ".product_select_map_";
|
||
else
|
||
tableName = dbName + ".jit_product_select_map_";
|
||
|
||
if (select_add_time != null && select_add_time.Value.Year >= 2026)
|
||
tableName += select_add_time.Value.Year;
|
||
else
|
||
{
|
||
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
|
||
tableName += +l_select_map_table_id;
|
||
}
|
||
|
||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
|
||
string sql = "SELECT COUNT(id) FROM " + tableName + " where 1=1";
|
||
|
||
string where = " and product_select_db_id=" + select_db_id;
|
||
if (select_add_time != null && select_add_time.Value.Year >= 2026) // 2026年以后的数据在新表
|
||
where += " AND select_type='" + (!is_client_jit ? "normal" : "jit") + "'";
|
||
|
||
sql += where;
|
||
|
||
var count = mySql.ExecuteRowCount(sql);
|
||
|
||
DataTable dt;
|
||
if (count == 0)
|
||
{
|
||
dt = new DataTable();
|
||
}
|
||
else
|
||
{
|
||
sql = "SELECT * FROM " + tableName + " where 1=1";
|
||
//where子句
|
||
sql += where;
|
||
sql += " ORDER BY add_time desc";
|
||
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||
dt = mySql.ExecuteDataTable(sql);
|
||
}
|
||
|
||
mySql.Close();
|
||
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
if (dt != null)
|
||
{
|
||
try
|
||
{
|
||
List<DBProdDbIdMapProductIdResultParam> dbIdMapProductIdLst = new List<DBProdDbIdMapProductIdResultParam>();
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
DBProdDbIdMapProductIdResultParam dbIdMapProductId = new DBProdDbIdMapProductIdResultParam
|
||
{
|
||
id = row["id"].ParseToLong(),
|
||
product_select_db_id = row["product_select_db_id"].ParseToLong(),
|
||
product_id = row["product_id"].ParseToLong(),
|
||
shop_id = row["shop_id"].ParseToLong(),
|
||
add_time = Convert.ToDateTime(row["add_time"]),
|
||
};
|
||
dbIdMapProductIdLst.Add(dbIdMapProductId);
|
||
}
|
||
var data = JsonUtils.SerializeObjectToString(dbIdMapProductIdLst);
|
||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
return "{\"code\":500,\"msg\":\"查询结果为空!\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
|
||
public string GetSelectProdMapUpSpuIdList(string inputData, bool isDetail = false)
|
||
{
|
||
DateTime timeCalc = DateTime.Now;
|
||
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 password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":50001,\"msg\":\"用户为空\"}";
|
||
}
|
||
|
||
var in_draft_ids = RegexUtils.GetStringQuery(ref inputData, "in_draft_ids")?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(in_draft_ids))
|
||
{
|
||
return "{\"code\":50002,\"msg\":\"未选择选品数据\"}";
|
||
}
|
||
var in_draft_id_list = in_draft_ids.Split(new string[] { " ", ",", "," }, StringSplitOptions.RemoveEmptyEntries);
|
||
if (in_draft_id_list.Count() <= 0)
|
||
{
|
||
return "{\"code\":50003,\"msg\":\"未选择选品数据\"}";
|
||
}
|
||
string tableName = "kjd_map.spu_map_"; // kjd pdd jit 都在一套表
|
||
long l_spu_map_table_id = 0;
|
||
|
||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
|
||
string sql = "";
|
||
sql += "SELECT combined_query.*, p.cost_price, p.delivery_fee, p.mark_fee FROM (";
|
||
for (int i = 0; i < in_draft_id_list.Count() && i < 200; i++)
|
||
{
|
||
if (i > 0)
|
||
sql += " UNION ALL ";
|
||
l_spu_map_table_id = in_draft_id_list[i].ParseToLong() % 128;
|
||
sql += "select * from " + tableName + l_spu_map_table_id + " where draft_id=" + in_draft_id_list[i];
|
||
}
|
||
sql += ") AS combined_query left join product p ON combined_query.from_spu_id=p.spu_id";
|
||
sql += " ORDER BY add_time desc";
|
||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||
DataTable dt = mySql.ExecuteDataTable(sql);
|
||
|
||
mySql.Close();
|
||
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
if (dt != null)
|
||
{
|
||
try
|
||
{
|
||
List<DBProdDraftIdMapUpSpuIdResultParam> draftIdMapUpSpuIdLst = new List<DBProdDraftIdMapUpSpuIdResultParam>();
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
DBProdDraftIdMapUpSpuIdResultParam draftIdMapUpSpuId = new DBProdDraftIdMapUpSpuIdResultParam
|
||
{
|
||
id = row["id"].ParseToLong(),
|
||
draft_id = row["draft_id"].ParseToLong(),
|
||
from_spu_id = row["from_spu_id"].ParseToLong(),
|
||
shop_id = row["shop_id"].ParseToLong(),
|
||
add_time = Convert.ToDateTime(row["add_time"]),
|
||
cost_price = row["cost_price"].IsNullOrEmpty() ? new decimal?() : row["cost_price"].ParseToDecimal(),
|
||
delivery_fee = row["delivery_fee"].IsNullOrEmpty() ? new decimal?() : row["delivery_fee"].ParseToDecimal(),
|
||
mark_fee = row["mark_fee"].IsNullOrEmpty() ? new decimal?() : row["mark_fee"].ParseToDecimal(),
|
||
};
|
||
draftIdMapUpSpuIdLst.Add(draftIdMapUpSpuId);
|
||
}
|
||
var data = JsonUtils.SerializeObjectToString(draftIdMapUpSpuIdLst);
|
||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + -1 + ",\"seconds\":" + seconds + "}";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
return "{\"code\":500,\"msg\":\"查询结果为空!\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string AddSkuImg(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\":50000,\"msg\":\"校验失败\"}";
|
||
|
||
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
|
||
string img_md5 = RegexUtils.GetStringQuery(ref inputData, "img_md5");
|
||
string img_base64 = RegexUtils.GetStringQuery(ref inputData, "img_base64");
|
||
string product_id = RegexUtils.GetStringQuery(ref inputData, "product_id");
|
||
string spec_id = RegexUtils.GetStringQuery(ref inputData, "spec_id");
|
||
string spec_name = RegexUtils.GetStringQuery(ref inputData, "spec_name");
|
||
string original_img_url = RegexUtils.GetStringQuery(ref inputData, "original_img_url");
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
int img_base64_db_id = 0;
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "";
|
||
|
||
sql = "select id from kjd.sku_img_base64 where img_md5='" + img_md5 + "';";
|
||
var nRst = 0L;
|
||
var rst = mySql.ExecuteFirstInt(sql).ParseToLong();
|
||
if (rst <= 0)
|
||
{
|
||
sql = "insert into kjd.sku_img_base64 (img_md5,img_base64) " +
|
||
"values ('" + img_md5 + "','" + img_base64 + "');";
|
||
rst = mySql.ExecuteInsertId(sql);
|
||
}
|
||
if (rst > 0)
|
||
{
|
||
img_base64_db_id = (int)rst;
|
||
sql = "insert kjd.sku_img (img_base64_db_id,product_id,spec_id,spec_name,original_img_url) " +
|
||
"values (" + img_base64_db_id + ",'" + product_id + "','" + spec_id + "','" + spec_name + "','" + original_img_url + "');";
|
||
nRst = mySql.ExecuteInsertId(sql);
|
||
}
|
||
mySql.Close();
|
||
if (nRst > 0)
|
||
{
|
||
return "{\"code\":200,\"msg\":\"success\",\"sku_img_id\":" + nRst + ",\"sku_img_Base64_id\":" + img_base64_db_id + "}";
|
||
}
|
||
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string DelSkuImg(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\":50000,\"msg\":\"校验失败\"}";
|
||
|
||
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
|
||
int img_id = RegexUtils.GetStringQuery(ref inputData, "img_id").ParseToInt();
|
||
int img_base64_id = RegexUtils.GetStringQuery(ref inputData, "img_base64_id").ParseToInt();
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
if (img_id == 0 || img_base64_id == 0)
|
||
{
|
||
return "{\"code\":501,\"msg\":\"图片编号或者图片数据编号为空\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "";
|
||
|
||
sql = "delete from kjd.sku_img where id=" + img_id + ";";
|
||
var bRst = mySql.ExecuteNonQuery(sql);
|
||
if (!bRst)
|
||
{
|
||
mySql.Close();
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
}
|
||
sql = "select id from kjd.sku_img where img_base64_db_id=" + img_base64_id + " limit 1;";
|
||
var nRst = mySql.ExecuteRowCount(sql);
|
||
//如果已无对图片的引用,则删除原图片
|
||
if (nRst == 0)
|
||
{
|
||
sql = "delete from kjd.sku_img_base64 where id=" + img_base64_id + ";";
|
||
mySql.ExecuteNonQuery(sql);
|
||
}
|
||
mySql.Close();
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
return "{\"code\":200,\"msg\":\"success\"}";
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string GetSkuImgList(string inputData, bool isDetail = 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 password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
var search_db_id = RegexUtils.GetStringQuery(ref inputData, "search_db_id")?.Replace("'", "\\'");
|
||
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
|
||
var search_product_id = RegexUtils.GetStringQuery(ref inputData, "search_product_id")?.Replace("'", "\\'");
|
||
var search_spec_id = RegexUtils.GetStringQuery(ref inputData, "search_spec_id")?.Replace("'", "\\'");
|
||
var search_original_img_url = RegexUtils.GetStringQuery(ref inputData, "search_original_img_url")?.Replace("'", "\\'");
|
||
|
||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
|
||
bool is_random = RegexUtils.GetStringQuery(ref inputData, "is_random").ParseToBool();
|
||
if (is_random)
|
||
{
|
||
page_size = 3;
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
|
||
string sql = "select count(id) from kjd.sku_img s where 1=1";
|
||
|
||
string where = "";
|
||
//if (!string.IsNullOrWhiteSpace(search_db_id))
|
||
// where += " and s.id like '%" + search_db_id + "%'";
|
||
//if (!string.IsNullOrWhiteSpace(search_product_id))
|
||
// where += " and s.product_id like '%" + search_product_id + "%'";
|
||
//if (!string.IsNullOrWhiteSpace(search_spec_id))
|
||
// where += " and s.spec_id like '%" + search_spec_id + "%'";
|
||
//if (!string.IsNullOrWhiteSpace(search_original_img_url))
|
||
// where += " and s.original_img_url like '%" + search_original_img_url + "%'";
|
||
if (!string.IsNullOrWhiteSpace(search_db_id))
|
||
where += " and s.id = '" + search_db_id + "'";
|
||
if (!string.IsNullOrWhiteSpace(search_product_id))
|
||
where += " and s.product_id = '" + search_product_id + "'";
|
||
if (!string.IsNullOrWhiteSpace(search_spec_id))
|
||
where += " and s.spec_id = '" + search_spec_id + "'";
|
||
if (!string.IsNullOrWhiteSpace(search_original_img_url))
|
||
where += " and s.original_img_url = '" + search_original_img_url + "'";
|
||
if (!string.IsNullOrEmpty(search_db_ids))
|
||
where += " and s.id in (" + search_db_ids + ")";
|
||
sql += where;
|
||
|
||
var count = mySql.ExecuteRowCount(sql);
|
||
|
||
DataTable dt;
|
||
if (count == 0)
|
||
{
|
||
dt = new DataTable();
|
||
}
|
||
else
|
||
{
|
||
sql = "select s.*,b.img_md5,b.use_count,b.img_base64,b.img_url,b.mdy_time base64_mdy_time from kjd.sku_img s left join kjd.sku_img_base64 b on " +
|
||
"s.img_base64_db_id = b.id where 1=1";
|
||
|
||
//where子句
|
||
sql += where;
|
||
|
||
if (is_random)
|
||
sql += " ORDER BY RAND(),s.add_time desc";
|
||
else
|
||
sql += " ORDER BY s.add_time desc";
|
||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||
dt = mySql.ExecuteDataTable(sql);
|
||
}
|
||
mySql.Close();
|
||
if (!string.IsNullOrEmpty(mySql.Message))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
|
||
if (dt != null)
|
||
{
|
||
try
|
||
{
|
||
List<SkuImgResult> skuImgLst = new List<SkuImgResult>();
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
SkuImgResult img = new SkuImgResult
|
||
{
|
||
id = row["id"].ParseToInt(),
|
||
img_base64 = row["img_base64"].ParseToString(),
|
||
img_base64_db_id = row["img_base64_db_id"].ParseToInt(),
|
||
img_md5 = row["img_md5"].ParseToString(),
|
||
img_url = row["img_url"].ParseToString(),
|
||
original_img_url = row["original_img_url"].ParseToString(),
|
||
add_time = Convert.ToDateTime(row["add_time"]),
|
||
mdy_time = Convert.ToDateTime(row["mdy_time"]),
|
||
base64_mdy_time = Convert.ToDateTime(row["base64_mdy_time"]),
|
||
product_id = row["product_id"].ParseToString(),
|
||
spec_id = row["spec_id"].ParseToString(),
|
||
spec_name = row["spec_name"].ParseToString(),
|
||
use_count = row["use_count"].ParseToInt(),
|
||
};
|
||
if(img.base64_mdy_time.AddDays(3) < DateTime.Now)
|
||
{
|
||
// 每过3天返回给客户端空图,让客户端重传base64图片
|
||
img.img_url = "";
|
||
}
|
||
else if (is_random && !string.IsNullOrWhiteSpace(img.img_url))
|
||
{
|
||
// (仅上货)3天内返回给客户端图片链接同时不传base64图片
|
||
img.img_base64 = "";
|
||
}
|
||
//if (isDetail)
|
||
//{
|
||
// img.img_base64 = row["img_base64"].ToString();
|
||
//}
|
||
skuImgLst.Add(img);
|
||
}
|
||
var data = JsonUtils.SerializeObjectToString(skuImgLst);
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||
}
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
|
||
public string MdyBase64ImgUrl(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||
var img_url = RegexUtils.GetStringQuery(ref inputData, "img_url")?.Replace("'", "\\'");
|
||
if(string.IsNullOrEmpty(id) || string.IsNullOrEmpty(img_url))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"保存失败:缺少图片编号或图片路径\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "update kjd.sku_img_base64 set img_url=\'" + img_url + "\' 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 MdyBase64ImgUseCount(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||
var ids = RegexUtils.GetStringQuery(ref inputData, "db_ids")?.Replace("'", "\\'");
|
||
if (string.IsNullOrEmpty(ids))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"保存失败:缺少图片编号\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "update kjd.sku_img_base64 set use_count=use_count+1 where id in (" + ids + ");";
|
||
|
||
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 AddCateSizeWeightConfig(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\":50000,\"msg\":\"校验失败\"}";
|
||
|
||
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
|
||
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
|
||
string min_len = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minLen"))?.Replace("'", "\\'");
|
||
string max_len = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxLen"))?.Replace("'", "\\'");
|
||
string min_width = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minWidth"))?.Replace("'", "\\'");
|
||
string max_width = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxWidth"))?.Replace("'", "\\'");
|
||
string min_height = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minHeight"))?.Replace("'", "\\'");
|
||
string max_height = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxHeight"))?.Replace("'", "\\'");
|
||
string min_weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minWeight"))?.Replace("'", "\\'");
|
||
string max_weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxWeight"))?.Replace("'", "\\'");
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "";
|
||
|
||
sql = "insert into kjd.cate_size_weight_config (cat_id,min_len,max_len,min_width,max_width,min_height,max_height,min_weight,max_weight) " +
|
||
"values ('" + cat_id + "'," + min_len + "," + max_len + "," + min_width + "," + max_width + "," +
|
||
min_height + "," + max_height + "," + min_weight + "," + max_weight + ");";
|
||
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 GetCateSizeWeightConfig(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\":50000,\"msg\":\"校验失败\"}";
|
||
|
||
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
|
||
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
|
||
string min_len = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minLen"))?.Replace("'", "\\'");
|
||
string max_len = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxLen"))?.Replace("'", "\\'");
|
||
string min_width = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minWidth"))?.Replace("'", "\\'");
|
||
string max_width = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxWidth"))?.Replace("'", "\\'");
|
||
string min_height = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minHeight"))?.Replace("'", "\\'");
|
||
string max_height = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxHeight"))?.Replace("'", "\\'");
|
||
string min_weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "minWeight"))?.Replace("'", "\\'");
|
||
string max_weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "maxWeight"))?.Replace("'", "\\'");
|
||
|
||
if (string.IsNullOrEmpty(user_name))
|
||
{
|
||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||
}
|
||
|
||
string conn = "ConnKJD";
|
||
MysqlUtils mySql = new MysqlUtils(conn);
|
||
string sql = "";
|
||
|
||
sql = "select * from kjd.cate_size_weight_config where cat_id='" + cat_id + "';";
|
||
var dt = mySql.ExecuteDataTable(sql);
|
||
mySql.Close();
|
||
if (dt != null)
|
||
{
|
||
if(dt.Rows.Count > 0)
|
||
{
|
||
var row = dt.Rows[0];
|
||
int id = row["id"].ParseToInt();
|
||
string catId = row["cat_id"].ParseToString();
|
||
int minLen = row["min_len"].ParseToInt();
|
||
int maxLen = row["max_len"].ParseToInt();
|
||
int minWidth = row["min_width"].ParseToInt();
|
||
int maxWidth = row["max_width"].ParseToInt();
|
||
int minHeight = row["min_height"].ParseToInt();
|
||
int maxHeight = row["max_height"].ParseToInt();
|
||
int minWeight = row["min_weight"].ParseToInt();
|
||
int maxWeight = row["max_weight"].ParseToInt();
|
||
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":{\"catId\":\"" + catId + "\"," +
|
||
"\"minLen\":" + minLen + ",\"maxLen\":" + maxLen + "," +
|
||
"\"minWidth\":" + minWidth + ",\"maxWidth\":" + maxWidth + "," +
|
||
"\"minHeight\":" + minHeight + ",\"maxHeight\":" + maxHeight + "," +
|
||
"\"minWeight\":" + minWeight + ",\"maxWeight\":" + maxWeight + "}}";
|
||
}
|
||
else
|
||
return "{\"code\":200,\"msg\":\"success\",\"data\":null}";
|
||
}
|
||
else
|
||
{
|
||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||
}
|
||
}
|
||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/*
|
||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "spu_id", Value = spu_id, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "skc_id", Value = skc_id, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "cat_id", Value = cat_id, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "cat_name", Value = cat_name, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_name", Value = product_name, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "ext_code", Value = ext_code, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "main_img", Value = main_img, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = product_json, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "size_json", Value = size_json, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "notes", Value = notes.ParseToString(), });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_md5", Value = product_md5, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "add_time", Value = add_time, });
|
||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "mdy_time", Value = mdy_time, });
|
||
rst = mySql.ExecuteInsertId(sql, paramLst.ToArray());*/
|
||
|
||
|
||
|
||
|