支持从机会商品里添加商品到待上传

This commit is contained in:
wule committed 2025-10-10 23:03:24 +08:00
1 parent 5e9bdd1700
commit 8501d39f7f
19 files changed
+1245 -254

No files matched your search

@@ -295,7 +295,7 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductGroups(string inputData, bool isDetail = false)
public string GetProductGroups(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
@@ -349,6 +349,60 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductCates(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\":\"没有用户名\"}";
}
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT DISTINCT p.cat_name FROM `bxx`.`product` p where p.is_del=0";
string where = "";
sql += where;
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
try
{
string group_data = "";
foreach (DataRow row in dt.Rows)
{
group_data += row["cat_name"].ToString() + ",";
}
var data = group_data.Trim(',');
return "{\"code\":200,\"msg\":\"success\",\"data\":\"" + data + "\"}";
}
catch (Exception ex)
{
return "{\"code\":50002,\"msg\":\"" + ex.Message + "\",\"data\":\"\"}";
}
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 查询商品替换sku
/// </summary>
@@ -452,6 +506,7 @@ namespace KJD_Web.BLL.BXX
var in_ext_codes = RegexUtils.GetStringQuery(ref inputData, "in_ext_codes")?.Replace("'", "\\'");
var in_skc_ids = RegexUtils.GetStringQuery(ref inputData, "in_skc_ids")?.Replace("'", "\\'");
var in_groups = RegexUtils.GetStringQuery(ref inputData, "in_groups")?.Replace("'", "\\'");
var in_cates = RegexUtils.GetStringQuery(ref inputData, "in_cates")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -477,6 +532,11 @@ namespace KJD_Web.BLL.BXX
in_groups = "'" + string.Join("','", in_groups.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.group in (" + in_groups + ")";
}
if (!string.IsNullOrEmpty(in_cates))
{
in_cates = "'" + string.Join("','", in_cates.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and (p.cat_name in (" + in_cates + ") or p.main_cat_name in (" + in_cates + "))";
}
sql += where;
@@ -552,6 +612,86 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 随机获取商品(无详情) 随机添加到上传列表所以不需要获取详情
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string GetSkuReplaceImgListRandom(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("'", "\\'");
var in_img_type = RegexUtils.GetStringQuery(ref inputData, "in_img_type")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.sku_img_replace s where 1=1";
string where = "";
if (!string.IsNullOrEmpty(in_img_type))
{
in_img_type = "'" + string.Join("','", in_img_type.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and s.img_type in (" + in_img_type + ")";
}
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select s.img_url from bxx.sku_img_replace s where 1=1";
//where子句
sql += where;
sql += " ORDER BY RAND()";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<string> imgs = new List<string>();
foreach (DataRow row in dt.Rows)
{
imgs.Add(row["img_url"].ToString());
}
var data = JsonUtils.SerializerObjectToString(imgs);
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 DelDbProd(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -771,6 +771,92 @@ namespace KJD_Web.BLL
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetSelectProductMapDraftIdList(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\":50001,\"msg\":\"用户为空\"}";
}
var select_db_id = RegexUtils.GetStringQuery(ref inputData, "select_db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(select_db_id))
{
return "{\"code\":50002,\"msg\":\"未选择选品数据\"}";
}
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd_map.product_select_map_" + l_select_map_table_id + " where 1=1";
string where = " and product_select_db_id=" + select_db_id;
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from kjd_map.product_select_map_" + l_select_map_table_id + " where 1=1";
//where子句
sql += where;
sql += " order by id 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<DBProductSelectMapResultParam> productSelectMapLst = new List<DBProductSelectMapResultParam>();
foreach (DataRow row in dt.Rows)
{
DBProductSelectMapResultParam productSelectMap = new DBProductSelectMapResultParam
{
id = row["id"].ParseToInt(),
product_id = row["product_id"].ParseToLong(),
product_select_db_id = row["product_select_db_id"].ParseToInt(),
shop_id = row["shop_id"].ParseToLong(),
add_time = Convert.ToDateTime(row["add_time"]),
};
productSelectMapLst.Add(productSelectMap);
}
var data = JsonUtils.SerializerObjectToString(productSelectMapLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":500,\"msg\":\"查询结果为空!\",\"data\":[],\"count\":" + 0 + "}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -771,5 +771,91 @@ namespace KJD_Web.BLL
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetSelectProductMapDraftIdList(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\":50001,\"msg\":\"用户为空\"}";
}
var select_db_id = RegexUtils.GetStringQuery(ref inputData, "select_db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(select_db_id))
{
return "{\"code\":50002,\"msg\":\"未选择选品数据\"}";
}
long l_select_map_table_id = select_db_id.ParseToLong() % 64;
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd_map.product_third_select_map_" + l_select_map_table_id + " where 1=1";
string where = " and product_select_db_id=" + select_db_id;
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from kjd_map.product_third_select_map_" + l_select_map_table_id + " where 1=1";
//where子句
sql += where;
sql += " order by id 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<DBProductSelectMapResultParam> productSelectMapLst = new List<DBProductSelectMapResultParam>();
foreach (DataRow row in dt.Rows)
{
DBProductSelectMapResultParam productSelectMap = new DBProductSelectMapResultParam
{
id = row["id"].ParseToInt(),
product_id = row["product_id"].ParseToLong(),
product_select_db_id = row["product_select_db_id"].ParseToInt(),
shop_id = row["shop_id"].ParseToLong(),
add_time = Convert.ToDateTime(row["add_time"]),
};
productSelectMapLst.Add(productSelectMap);
}
var data = JsonUtils.SerializerObjectToString(productSelectMapLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":500,\"msg\":\"查询结果为空!\",\"data\":[],\"count\":" + 0 + "}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -84,6 +84,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void get_sku_replace_img_list_random()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetSkuReplaceImgListRandom(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_product()
{
@@ -168,6 +180,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void get_product_cates()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetProductCates(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_sku_img_replace()
{
@@ -107,6 +107,7 @@
</Compile>
<Compile Include="Model\CommentParam.cs" />
<Compile Include="Model\DBPriceResultParam.cs" />
<Compile Include="Model\DBProductSelectMapResultParam.cs" />
<Compile Include="Model\OrderParam.cs" />
<Compile Include="Model\DBProductResultParam.cs" />
<Compile Include="Model\ProductPurchasePriceResultParam.cs" />
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model
{
public class DBProductSelectMapResultParam
{
public int id { get; set; }
public long product_id { get; set; }
public int product_select_db_id { get; set; }
public long shop_id { get; set; }
public DateTime add_time { get; set; }
}
}
@@ -217,5 +217,17 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_select_product_map_draft_id_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductManage().GetSelectProductMapDraftIdList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}
@@ -217,5 +217,16 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_select_product_map_draft_id_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new ProductThirdManage().GetSelectProductMapDraftIdList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}