上货后参加20981活动

This commit is contained in:
wule committed 2025-09-23 09:25:31 +08:00
1 parent b868c718f0
commit 4fcfb2875a
25 files changed
+1379 -119

No files matched your search

@@ -1,4 +1,5 @@
using KJD_Web.Model;
using KJD_Web.Model.ShopModel;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using NaiBa.Util.Extension;
@@ -203,20 +204,21 @@ namespace KJD_Web.BLL.BXX
else
{
if (isDetail)
sql = "select * from bxx.product p where 1=1";
sql = "select p.*,s.img_base64 from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where 1=1";
else if (string.IsNullOrEmpty(get_select_count))
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words from bxx.product p where 1=1";
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id from bxx.product p where 1=1";
else
sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,COUNT(s.id) AS select_count " +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,COUNT(s.id) AS select_count " +
"FROM bxx.product p LEFT JOIN bxx.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "' " +
"WHERE 1=1";
//where子句
sql += where;
sql += " group by p.id";
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
@@ -243,7 +245,8 @@ namespace KJD_Web.BLL.BXX
cat_name = row["cat_name"].ToString(),
product_name = row["product_name"].ToString(),
main_img = row["main_img"].ToString(),
ext_code = row["ext_code"].ToString(),
ext_code = row["ext_code"].ToString(),
price_text = row["price_text"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
@@ -253,9 +256,11 @@ namespace KJD_Web.BLL.BXX
end_words = row["end_words"].ParseToString(),
fission_words = row["fission_words"].ParseToString(),
head_words = row["head_words"].ParseToString(),
sku_img_replace_id = row["sku_img_replace_id"].ParseToInt(),
};
if (isDetail)
{
prod.sku_img_replace_base64 = row["img_base64"].ToString();
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
}
@@ -281,6 +286,90 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 查询商品替换sku
/// </summary>
/// <param name="inputData"></param>
/// <param name="isDetail"></param>
/// <returns></returns>
public string GetSkuImgReplaceList(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("'", "\\'");
var sku_img_replace_ids = RegexUtils.GetStringQuery(ref inputData, "sku_img_replace_ids")?.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 p where 1=1";
string where = "";
if (!string.IsNullOrEmpty(sku_img_replace_ids))
where += " and p.id in (" + sku_img_replace_ids + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
if (isDetail)
sql = "select * from bxx.product p left where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<sku_img_replace> skuImgReplaceLst = new List<sku_img_replace>();
foreach (DataRow row in dt.Rows)
{
sku_img_replace skuImgReplace = new sku_img_replace
{
id = Convert.ToInt32(row["id"]),
img_base64 = row["img_base64"].ToString(),
img_md5 = row["img_md5"].ToString(),
};
skuImgReplaceLst.Add(skuImgReplace);
}
var data = JsonUtils.SerializerObjectToString(skuImgReplaceLst);
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 GetProductListRandom(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -452,6 +541,12 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 编辑商品备注信息、货号、头尾词和分词
/// </summary>
/// <param name="inputData"></param>
/// <param name="isAdmin"></param>
/// <returns></returns>
public string MdyDBProduct(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
@@ -507,7 +602,104 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddSkuImgReplace(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_db_id = RegexUtils.GetStringQuery(ref inputData, "product_db_id");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
int sku_img_replace_id = 0;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select id from bxx.sku_img_replace where img_md5='" + img_md5 + "';";
var rst = mySql.ExecuteFirstInt(sql).ParseToLong();
if (rst <= 0)
{
sql = "insert into bxx.sku_img_replace (img_md5,img_base64) " +
"values ('" + img_md5 + "','" + img_base64 + "');";
rst = mySql.ExecuteInsertId(sql);
}
if (rst > 0)
{
sku_img_replace_id = (int)rst;
sql = "update bxx.product set sku_img_replace_id= "+ sku_img_replace_id + " where id=" + product_db_id + ";";
var bRst = mySql.ExecuteNonQuery(sql);
if (bRst)
return "{\"code\":200,\"msg\":\"success\",\"sku_img_replace_id\":" + rst + "}";
}
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdySkuImgReplace(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 img_md5 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "img_md5"));
string img_base64 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "img_base64"));
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 bxx.sku_img_replace set";
if (img_md5 != null)
sql += " img_md5='" + img_md5 + "',";
if (img_base64 != null)
sql += " img_base64='" + img_base64 + "',";
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\":\"输入为空\"}";
}
/// <summary>
/// 添加用户选择商品
/// </summary>
/// <param name="inputData"></param>
/// <param name="isAdmin"></param>
/// <returns></returns>
public string AddUserSelectProduct(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
@@ -133,7 +133,8 @@ namespace KJD_Web.BLL
//where子句
sql += where;
sql += " group by p.id";
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
@@ -156,6 +156,39 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void add_sku_img_replace()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().AddSkuImgReplace(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_sku_img_replace()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdySkuImgReplace(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_sku_img_replace_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetSkuImgReplaceList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_user_select_product()
@@ -112,6 +112,7 @@
<Compile Include="Model\ProductPurchasePriceResultParam.cs" />
<Compile Include="Model\ProductSelectResultParam.cs" />
<Compile Include="Model\ShopModel\ShopParam.cs" />
<Compile Include="Model\ShopModel\sku_img_replace.cs" />
<Compile Include="Model\UserLoginResultParam.cs" />
<Compile Include="BXXPriceService.asmx.cs">
<DependentUpon>BXXPriceService.asmx</DependentUpon>
@@ -25,6 +25,8 @@ namespace KJD_Web.Model
public string product_name { get; set; }
public string product_json { get; set; }
public string size_json { get; set; }
public int sku_img_replace_id { get; set; }
public string sku_img_replace_base64 { get; set; }
public string main_img { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model.ShopModel
{
public class sku_img_replace
{
public int id { get; set; }
public string img_md5 { get; set; }
public string img_base64 { get; set; }
}
}