聚水潭上传微信小店相关逻辑

This commit is contained in:
wule committed 2026-01-29 20:54:17 +08:00
1 parent 625f4d9420
commit b4fa5cacb1
26 files changed
+2570 -487

No files matched your search

@@ -135,6 +135,9 @@ namespace KJD_Web.BLL.BXX
string delivery_fee_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "delivery_fee_set"))?.Replace("'", "\\'");
string after_sale_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "after_sale_set"))?.Replace("'", "\\'");
string distribution_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "distribution_set"))?.Replace("'", "\\'");
string send_to_out_server = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "send_to_out_server"))?.Replace("'", "\\'");
string sku_edit_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_edit_json"))?.Replace("'", "\\'");
string sku_secret_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_secret_json"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
@@ -195,11 +198,17 @@ namespace KJD_Web.BLL.BXX
if (wx_cat_leaf != null)
sql += " p.wx_cat_leaf=" + wx_cat_leaf + ",";
if (delivery_fee_set != null)
sql += " p.delivery_fee_set='" + delivery_fee_set + "',";
sql += " p.delivery_fee_set=" + delivery_fee_set + ",";
if (after_sale_set != null)
sql += " p.after_sale_set='" + after_sale_set + "',";
sql += " p.after_sale_set=" + after_sale_set + ",";
if (distribution_set != null)
sql += " p.distribution_set='" + distribution_set + "',";
sql += " p.distribution_set=" + distribution_set + ",";
if (send_to_out_server != null)
sql += " p.send_to_out_server=" + send_to_out_server + ",";
if (sku_edit_json != null)
sql += " p.sku_edit_json='" + sku_edit_json + "',";
if (sku_secret_json != null)
sql += " p.sku_secret_json=@sku_secret_json,";
sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where spu_id='" + spu_id + "';";
@@ -207,6 +216,7 @@ namespace KJD_Web.BLL.BXX
List<MySqlParameter> paramLst = new List<MySqlParameter>();
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 = "sku_secret_json", Value = sku_secret_json, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
@@ -236,6 +246,7 @@ namespace KJD_Web.BLL.BXX
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_cat1 = RegexUtils.GetStringQuery(ref inputData, "search_cat1")?.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("'", "\\'");
@@ -252,6 +263,8 @@ namespace KJD_Web.BLL.BXX
var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'");
var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'");
var has_wx_cat = RegexUtils.GetStringQuery(ref inputData, "has_wx_cat")?.Replace("'", "\\'");
var send_to_out_server = RegexUtils.GetStringQuery(ref inputData, "send_to_out_server")?.Replace("'", "\\'");
var has_send_to_out_server = RegexUtils.GetStringQuery(ref inputData, "has_send_to_out_server")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -281,6 +294,8 @@ namespace KJD_Web.BLL.BXX
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_cat1))
where += " and p.main_cat_name like '%" + search_cat1 + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
@@ -291,18 +306,31 @@ namespace KJD_Web.BLL.BXX
where += " and p.notes like '%" + search_notes + "%'";
if (!string.IsNullOrEmpty(has_wx_cat))
{
if (has_wx_cat == "true")
if (has_wx_cat.ToLower() == "true")
where += " and wx_cat_leaf is NOT NULL";
else
where += " and wx_cat_leaf is NULL";
}
if (!string.IsNullOrEmpty(send_to_out_server))
where += " and send_to_out_server=" + send_to_out_server;
else if (!string.IsNullOrEmpty(has_send_to_out_server))
{
if (has_send_to_out_server.ToLower() == "true")
where += " and send_to_out_server=1";
else
where += " and send_to_out_server!=1";
}
// 供应商货源是否已完成初始设置
if (!string.IsNullOrEmpty(is_supplier_prod_ok))
{
//if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置")
// where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1";
//else
// where += " and (wx_cat_leaf IS NULL or send_to_out_server=0 or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)";
if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置")
where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1";
where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and distribution_set=1";
else
where += " and (wx_cat_leaf IS NULL or send_to_out_server=0 or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)";
where += " and (wx_cat_leaf IS NULL or send_to_out_server!=1 or distribution_set=0)";
}
sql += where;
@@ -324,7 +352,7 @@ namespace KJD_Web.BLL.BXX
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," +
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" p.wx_cat_leaf," +
" p.wx_cat_leaf,p.send_to_out_server," +
" s.img_url,e.ext_code_price" +
" FROM bxx.product p " +
" left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
@@ -334,7 +362,7 @@ namespace KJD_Web.BLL.BXX
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," +
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" p.wx_cat_leaf" +
" p.wx_cat_leaf,p.send_to_out_server," +
" s.img_url,COUNT(se.id) AS select_count,e.ext_code_price" +
" 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 + "' " +
" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
@@ -398,12 +426,16 @@ namespace KJD_Web.BLL.BXX
sale_count_text = row["sale_count_text"].ToString(),
wx_safe_status = row["wx_safe_status"].ToString(),
special_prod_type = row["special_prod_type"].ToString(),
main_cat_id = row["main_cat_id"].ToString(),
main_cat_name = row["main_cat_name"].ToString(),
send_to_out_server = row["send_to_out_server"].ParseToInt(),
};
if (isDetail)
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
prod.sku_edit_json = row["sku_edit_json"].ToString();
prod.sku_secret_json = row["sku_secret_json"].ToString();
prod.sku_img_replace_base64 = row["img_base64"].ToString();
//prod.sku_img_replace_url = row["img_url"].ToString();
}
@@ -648,6 +680,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_ext_codes = RegexUtils.GetStringQuery(ref inputData, "in_ext_codes")?.Replace("'", "\\'");
var in_spu_ids = RegexUtils.GetStringQuery(ref inputData, "in_spu_ids")?.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("'", "\\'");
@@ -675,6 +708,11 @@ namespace KJD_Web.BLL.BXX
in_skc_ids = "'" + string.Join("','", in_skc_ids.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.skc_id in (" + in_skc_ids + ")";
}
if (!string.IsNullOrEmpty(in_spu_ids))
{
in_spu_ids = "'" + string.Join("','", in_spu_ids.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
where += " and p.spu_id in (" + in_spu_ids + ")";
}
if (!string.IsNullOrEmpty(in_groups))
{
in_groups = "'" + string.Join("','", in_groups.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
@@ -695,9 +733,9 @@ namespace KJD_Web.BLL.BXX
if (!string.IsNullOrEmpty(is_supplier_prod_ok))
{
if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置")
where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1";
where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and distribution_set=1";
else
where += " and (wx_cat_leaf IS NULL or send_to_out_server=0 or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)";
where += " and (wx_cat_leaf IS NULL or send_to_out_server!=1 or distribution_set=0)";
}
sql += where;
@@ -1377,6 +1415,7 @@ namespace KJD_Web.BLL.BXX
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_cat1 = RegexUtils.GetStringQuery(ref inputData, "search_cat1")?.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("'", "\\'");
@@ -1441,6 +1480,8 @@ namespace KJD_Web.BLL.BXX
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_cat1))
where += " and p.main_cat_name like '%" + search_cat1 + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
where += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
@@ -1687,6 +1728,22 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetAfterSale(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\":\"校验失败\"}";
string url = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "get_url"));
string rst = HttpUtils.e57GetResponse(url, "");
return rst;
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetWxTokens(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -1750,8 +1807,8 @@ namespace KJD_Web.BLL.BXX
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetWxAllCate(string inputData)
public string WxApiGetWxAllCate(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
@@ -2,6 +2,7 @@
using KJD_Web.Model.ShopModel;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using Mysqlx.Crud;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
@@ -417,5 +418,131 @@ namespace KJD_Web.BLL.WXXD
return new BXX.BXXProductManage().MdyProduct(inputData);
}
public string WXAddMdyAfterSale(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 coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
string after_sale_json = RegexUtils.GetStringQuery(ref inputData, "after_sale_json")?.Replace("'", "\\'");
if (string.IsNullOrEmpty("coid"))
return "{\"code\":50001,\"msg\":\"没有售后编号\"}";
if (string.IsNullOrEmpty("after_sale_json"))
return "{\"code\":50001,\"msg\":\"没有售后信息\"}";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT * FROM `wxxd`.`after_sale` where coid='" + coid + "'";
string where = "";
sql += where;
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
mySql = new MysqlUtils(conn);
if (dt.Rows.Count == 0)
{
sql = "INSERT INTO `wxxd`.`after_sale` (coid,after_sale_json) VALUES (@coid,@after_sale_json);";
}
else
{
sql = "UPDATE `wxxd`.`after_sale` SET after_sale_json=@after_sale_json WHERE coid=@coid;";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "coid", Value = coid, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "after_sale_json", Value = after_sale_json, });
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":200,\"msg\":\"success\",\"data\":\"\"}";
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
}
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXGetAfterSale(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 coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT * FROM `wxxd`.`after_sale` where coid='" + coid + "'";
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["after_sale_json"].ToString();
break;
}
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\":\"输入为空\"}";
}
}
}