1 修复拼多多管理下检测状态错误问题 2 sku替换图片选择,更新功能

This commit is contained in:
wule committed 2025-10-13 18:54:31 +08:00
1 parent caf8ba3fe8
commit 51e1773793
19 files changed
+1740 -193

No files matched your search

@@ -214,11 +214,12 @@ namespace KJD_Web.BLL.BXX
sql = "select p.*,s.img_base64,s.img_url from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where p.is_del=0";
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,p.sku_img_replace_id,p.group from bxx.product p where p.is_del=0";
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,s.img_url from bxx.product p " +
"left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where p.is_del=0";
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,p.sku_img_replace_id,p.group,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 + "' " +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,s.img_url,COUNT(se.id) AS select_count " +
"FROM bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " +
"WHERE p.is_del=0";
//where子句
@@ -265,13 +266,14 @@ namespace KJD_Web.BLL.BXX
fission_words = row["fission_words"].ParseToString(),
head_words = row["head_words"].ParseToString(),
sku_img_replace_id = row["sku_img_replace_id"].ParseToInt(),
sku_img_replace_url = row["img_url"].ToString(),
};
if (isDetail)
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
prod.sku_img_replace_base64 = row["img_base64"].ToString();
prod.sku_img_replace_url = row["img_url"].ToString();
//prod.sku_img_replace_url = row["img_url"].ToString();
}
if (!string.IsNullOrEmpty(get_select_count))
{
@@ -431,7 +433,7 @@ namespace KJD_Web.BLL.BXX
string sql = "select count(id) from bxx.sku_img_replace s where 1=1";
string where = "";
if (!string.IsNullOrEmpty(sku_img_replace_ids))
if (!string.IsNullOrWhiteSpace(sku_img_replace_ids))
where += " and s.id in (" + sku_img_replace_ids + ")";
sql += where;
@@ -449,7 +451,7 @@ namespace KJD_Web.BLL.BXX
//where子句
sql += where;
sql += " order by s.id desc";
sql += " order by s.img_type asc, s.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
@@ -465,10 +467,18 @@ namespace KJD_Web.BLL.BXX
sku_img_replace skuImgReplace = new sku_img_replace
{
id = Convert.ToInt32(row["id"]),
img_base64 = row["img_base64"].ToString(),
//img_base64 = row["img_base64"].ToString(),
img_md5 = row["img_md5"].ToString(),
img_url = row["img_url"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
img_type = row["img_type"].ToString(),
img_group = row["img_group"].ToString(),
};
if (isDetail)
{
skuImgReplace.img_base64 = row["img_base64"].ToString();
}
skuImgReplaceLst.Add(skuImgReplace);
}
var data = JsonUtils.SerializerObjectToString(skuImgReplaceLst);
@@ -629,6 +639,7 @@ namespace KJD_Web.BLL.BXX
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("'", "\\'");
var in_img_group = RegexUtils.GetStringQuery(ref inputData, "in_img_group")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -639,11 +650,22 @@ namespace KJD_Web.BLL.BXX
string sql = "select count(id) from bxx.sku_img_replace s where 1=1";
string where = "";
if (!string.IsNullOrEmpty(in_img_type))
if (!string.IsNullOrWhiteSpace(in_img_type) && !string.IsNullOrWhiteSpace(in_img_group))
{
in_img_type = "'" + string.Join("','", in_img_type.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
in_img_group = "'" + string.Join("','", in_img_group.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and (s.img_type in (" + in_img_type + ") or s.img_group in (" + in_img_group + ")";
}
else if (!string.IsNullOrWhiteSpace(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 + ")";
}
else if (!string.IsNullOrWhiteSpace(in_img_group))
{
in_img_group = "'" + string.Join("','", in_img_group.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and s.img_group in (" + in_img_group + ")";
}
sql += where;
@@ -868,6 +890,7 @@ namespace KJD_Web.BLL.BXX
string sql = "";
sql = "select id from bxx.sku_img_replace where img_md5='" + img_md5 + "';";
var bRst = false;
var rst = mySql.ExecuteFirstInt(sql).ParseToLong();
if (rst <= 0)
{
@@ -880,12 +903,48 @@ namespace KJD_Web.BLL.BXX
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 + "}";
bRst = mySql.ExecuteNonQuery(sql);
}
mySql.Close();
if (bRst)
{
return "{\"code\":200,\"msg\":\"success\",\"sku_img_replace_id\":" + rst + "}";
}
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyProdSkuImgReplaceId(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 product_db_id = RegexUtils.GetStringQuery(ref inputData, "product_db_id");
string img_db_id = RegexUtils.GetStringQuery(ref inputData, "img_db_id");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "update bxx.product set sku_img_replace_id= " + img_db_id + " where id=" + product_db_id + ";";
var bRst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (bRst)
return "{\"code\":200,\"msg\":\"success\"}";
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
@@ -203,6 +203,19 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_prod_sku_img_replace_id()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdyProdSkuImgReplaceId(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_sku_img_replace()
{
@@ -226,6 +239,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void get_sku_img_replace_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetSkuImgReplaceList(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void add_user_select_product()
{
@@ -11,5 +11,9 @@ namespace KJD_Web.Model.ShopModel
public string img_md5 { get; set; }
public string img_base64 { get; set; }
public string img_url { get; set; }
public string img_type { get; set; }
public string img_group { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}