产品库手动更新sku下架情况

This commit is contained in:
wule committed 2026-02-26 11:56:00 +08:00
1 parent 1b2b6bb553
commit 30efe8fccb
25 files changed
+2214 -490

No files matched your search

@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Security;
@@ -450,7 +451,7 @@ namespace KJD_Web.BLL.WXXD
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select id from wxxd_product_shop_map.product_shop_map_" + index.ParseToString().PadLeft(4, '0') +
" where up_secret_spu_id='" + up_secret_spu_id + "'and shop_id='" + shop_id + "'";
" where up_secret_spu_id='" + up_secret_spu_id + "' and shop_id='" + shop_id + "';";
DataTable dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message) || dt == null || dt.Rows == null)
@@ -481,6 +482,104 @@ namespace KJD_Web.BLL.WXXD
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXGetSecretSpuIdShopIdMapList(string inputData)
{
var 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 up_secret_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_secret_spu_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(up_secret_spu_id))
{
return "{\"code\":500,\"msg\":\"缺少商品编号1\"}";
}
var index = RegexUtils.GetStringQuery(ref inputData, "index").ParseToNullableLong();
if (index == null)
index = up_secret_spu_id.ParseToLong() % 1024;
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var is_not_count = (RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'")).ParseToBool();
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
int count = 0;
string sql = "";
if (!is_not_count)
{
sql = "select count(*) from wxxd_product_shop_map.product_shop_map_" + index.ParseToString().PadLeft(4, '0') +
" where up_secret_spu_id='" + up_secret_spu_id;
if (!shop_id.IsNullOrEmpty())
sql += "' and shop_id='" + shop_id + "'";
sql += ";";
count = mySql.ExecuteRowCount(sql);
Thread.Sleep(100);
}
DataTable dt;
if (count == 0 && !is_not_count)
{
dt = new DataTable();
}
else
{
sql = "select * from wxxd_product_shop_map.product_shop_map_" + index.ParseToString().PadLeft(4, '0') +
" where up_secret_spu_id='" + up_secret_spu_id;
if (!shop_id.IsNullOrEmpty())
sql += "' and shop_id='" + shop_id + "'";
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) || dt == null)
{
Thread.Sleep(1000);
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
if (dt != null)
{
try
{
List<WxProdSecretSpuIdShopIdMapParam> prodSecretIdMapLst = new List<WxProdSecretSpuIdShopIdMapParam>();
foreach (DataRow row in dt.Rows)
{
WxProdSecretSpuIdShopIdMapParam idMap = new WxProdSecretSpuIdShopIdMapParam
{
id = Convert.ToInt32(row["id"]),
up_secret_spu_id = row["up_secret_spu_id"].ToString(),
up_spu_id = row["up_spu_id"].ToString(),
shop_id = row["shop_id"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
//mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
prodSecretIdMapLst.Add(idMap);
}
var data = JsonUtils.SerializerObjectToString(prodSecretIdMapLst);
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 WXAddMdyAfterSale(string inputData)
{
if (!string.IsNullOrEmpty(inputData))