平台禁售商品设置
This commit is contained in:
1 parent
9a47ecf102
commit
b5ae0fc2f2
11 files changed
+604
-123
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using KJD_Web.Model;
|
||||
using KJD_Web.BLL.WXXD;
|
||||
using KJD_Web.Model;
|
||||
using KJD_Web.Model.ShopModel;
|
||||
using KJD_Web.Utils;
|
||||
using MySql.Data.MySqlClient;
|
||||
@@ -72,15 +73,37 @@ namespace KJD_Web.BLL.BXX
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "";
|
||||
|
||||
int ban_wx = 0;
|
||||
int ban_pdd = 0;
|
||||
if (product_get_type == "厂商直采")
|
||||
{
|
||||
if (real_coid != null)
|
||||
sql = "select ban_wx,ban_pdd from bxx.jst_supplier_ban_platform where coid=" + real_coid;
|
||||
else if (skc_id != null)
|
||||
sql = "select ban_wx,ban_pdd from bxx.jst_supplier_ban_platform where coid=" + skc_id;
|
||||
var dtr = mySql.ExecuteDataTableRow(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
else if (dtr != null)
|
||||
{
|
||||
ban_wx = dtr["ban_wx"].ParseToInt();
|
||||
ban_pdd = dtr["ban_pdd"].ParseToInt();
|
||||
}
|
||||
}
|
||||
|
||||
sql = "insert into ";
|
||||
sql += "bxx.product ";
|
||||
sql += "(from_shop_id,from_shop_name,offline_supplier_id,offline_supplier_name,spu_id,skc_id,real_coid,real_spu_id,main_cat_id,main_cat_name,cat_id," +
|
||||
"cat_name,price_text,product_name,ext_code,main_img,product_json,size_json,notes,product_get_type,sale_count,sale_count_text,special_prod_type," +
|
||||
"distribution_set,add_time,mdy_time) " +
|
||||
"distribution_set,ban_wx,ban_pdd,add_time,mdy_time) " +
|
||||
"values ('" + from_shop_id + "','" + from_shop_name + "','" + offline_supplier_id + "','" + offline_supplier_name + "','" + spu_id + "','" +
|
||||
skc_id + "','" + real_coid + "','" + real_spu_id + "','" + main_cat_id + "','" + main_cat_name + "','" + cat_id + "','" + cat_name + "','" +
|
||||
price_text + "','" + product_name + "','" + ext_code + "','" + main_img + "',@product_json,@size_json,'" + notes + "','" + product_get_type + "','" +
|
||||
sale_count + "','" + sale_count_text + "','" + special_prod_type + "'," + distribution_set.ParseToInt() + ",'" +
|
||||
sale_count + "','" + sale_count_text + "','" + special_prod_type + "'," + distribution_set.ParseToInt() + "," + ban_wx + "," + ban_pdd + ",'" +
|
||||
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
|
||||
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
|
||||
|
||||
@@ -477,6 +500,8 @@ namespace KJD_Web.BLL.BXX
|
||||
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation")?.Replace("'", "\\'");
|
||||
var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
|
||||
var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'");
|
||||
var ban_wx = RegexUtils.GetStringQuery(ref inputData, "ban_wx")?.Replace("'", "\\'");
|
||||
var ban_pdd = RegexUtils.GetStringQuery(ref inputData, "ban_pdd")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
@@ -486,9 +511,13 @@ namespace KJD_Web.BLL.BXX
|
||||
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
|
||||
string sql = "select count(*) from bxx.product p FORCE INDEX (f_wx_safe_status) where p.is_del=0";
|
||||
string sql = " select count(*) from bxx.product p " +
|
||||
" FORCE INDEX (f_wx_safe_status) " +
|
||||
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
|
||||
" WHERE p.is_del=0";
|
||||
|
||||
string where = "";
|
||||
//where += " AND (b.ban_wx IS NULL OR b.ban_wx=0)";
|
||||
if (!string.IsNullOrEmpty(from_shop_id))
|
||||
where += " and p.from_shop_id ='" + from_shop_id + "'";
|
||||
if (!string.IsNullOrEmpty(from_shop_name))
|
||||
@@ -621,6 +650,14 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'";
|
||||
}
|
||||
if (ban_wx != null)
|
||||
{
|
||||
where += " and p.ban_wx=" + ban_wx;
|
||||
}
|
||||
if (ban_pdd != null)
|
||||
{
|
||||
where += " and p.ban_pdd=" + ban_pdd;
|
||||
}
|
||||
sql += where;
|
||||
|
||||
var count = 0;
|
||||
@@ -637,9 +674,10 @@ namespace KJD_Web.BLL.BXX
|
||||
else
|
||||
{
|
||||
if (isDetail)
|
||||
sql = "select p.*,s.img_base64,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" +
|
||||
sql = " SELECT p.*,s.img_base64,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" +
|
||||
" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
|
||||
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
|
||||
" 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," +
|
||||
@@ -648,8 +686,9 @@ namespace KJD_Web.BLL.BXX
|
||||
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," +
|
||||
" 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" +
|
||||
" LEFT JOIN bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
|
||||
" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
|
||||
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
|
||||
" 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," +
|
||||
@@ -657,8 +696,10 @@ namespace KJD_Web.BLL.BXX
|
||||
" 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.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," +
|
||||
" 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 + "' " +
|
||||
" 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" +
|
||||
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
|
||||
" WHERE p.is_del=0";
|
||||
|
||||
//where子句
|
||||
@@ -1389,6 +1430,8 @@ namespace KJD_Web.BLL.BXX
|
||||
var add_days_less = RegexUtils.GetStringQuery(ref inputData, "add_days_less").ParseToNullableInt();
|
||||
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
|
||||
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation").ParseToNullableInt();
|
||||
var ban_wx = RegexUtils.GetStringQuery(ref inputData, "ban_wx")?.Replace("'", "\\'");
|
||||
var ban_pdd = RegexUtils.GetStringQuery(ref inputData, "ban_pdd")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
@@ -1396,9 +1439,14 @@ namespace KJD_Web.BLL.BXX
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select count(*) from bxx.product p FORCE INDEX (f_wx_safe_status) where p.is_del=0";
|
||||
string sql = " SELECT count(*)" +
|
||||
" FROM bxx.product p" +
|
||||
" FORCE INDEX (f_wx_safe_status)" +
|
||||
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
|
||||
" WHERE p.is_del=0";
|
||||
|
||||
string where = "";
|
||||
//where += " AND (b.ban_wx IS NULL OR b.ban_wx=0)";
|
||||
if (!string.IsNullOrEmpty(in_ext_codes))
|
||||
{
|
||||
in_ext_codes = "'" + string.Join("','", in_ext_codes.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'";
|
||||
@@ -1466,11 +1514,19 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
where += " and is_relation = " + is_relation;
|
||||
}
|
||||
if (ban_wx != null)
|
||||
{
|
||||
where += " and p.ban_wx=" + ban_wx;
|
||||
}
|
||||
if (ban_pdd != null)
|
||||
{
|
||||
where += " and p.ban_pdd=" + ban_pdd;
|
||||
}
|
||||
sql += where;
|
||||
|
||||
int count = prod_count;
|
||||
if (product_get_type == "厂商直采" && count > 1250)
|
||||
count = (count / 2.5).ParseToInt();
|
||||
if (product_get_type == "厂商直采" && count > 1000)
|
||||
count = (count / 2.0).ParseToInt();
|
||||
if (!is_not_count)
|
||||
{
|
||||
count = mySql.ExecuteRowCount(sql);
|
||||
@@ -1484,8 +1540,10 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "select p.id" +
|
||||
" from bxx.product p where p.is_del=0";
|
||||
sql = " SELECT p.id" +
|
||||
" FROM bxx.product p" +
|
||||
//" LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid OR p.real_coid=b.coid)" +
|
||||
" WHERE p.is_del=0";
|
||||
//where子句
|
||||
sql += where;
|
||||
|
||||
@@ -1504,7 +1562,7 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
|
||||
var db_ids = string.Join(",", dt.Rows.Cast<DataRow>().Select(r => r["id"].ParseToInt()).OrderBy(x => RandomUtils.GetId(10000000)).Take(page_size));
|
||||
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," +
|
||||
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.group,p.notes,p.add_time,p.mdy_time,p.product_get_type," +
|
||||
" p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3,p.send_to_out_server," +
|
||||
" p.wx_cat_leaf,p.is_relation" +
|
||||
@@ -1563,7 +1621,7 @@ namespace KJD_Web.BLL.BXX
|
||||
var data = JsonUtils.SerializeObjectToString(productLst, jsonSetting);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
if (product_get_type == "厂商直采" && count > 500)
|
||||
count = (count * 2.5).ParseToInt();
|
||||
count = (count * 2.0).ParseToInt();
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -3201,6 +3259,265 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string AddMdyJstProductBan(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
// 软件用户名
|
||||
string coid = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "coid"))?.Replace("'", "\\'");
|
||||
int? ban_wx = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ban_wx"))?.ParseToNullableInt();
|
||||
int? ban_pdd = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ban_pdd"))?.ParseToNullableInt();
|
||||
// 收件人
|
||||
string user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "receiver"))?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(coid))
|
||||
return "{\"code\":500,\"msg\":\"缺少供应商编号\"}";
|
||||
if (ban_wx == null)
|
||||
return "{\"code\":500,\"msg\":\"缺少设置值\"}";
|
||||
if (ban_pdd == null)
|
||||
return "{\"code\":500,\"msg\":\"缺少设置值\"}";
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn, true);
|
||||
|
||||
string sql = "SELECT 1 FROM `bxx`.`jst_supplier_ban_platform` where coid='" + coid + "'";
|
||||
string where = "";
|
||||
sql += where;
|
||||
var exist = mySql.ExecuteFirstInt(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":501,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
if (exist == 0)
|
||||
{
|
||||
sql = " INSERT INTO `bxx`.`jst_supplier_ban_platform` (coid,ban_wx,ban_pdd)" +
|
||||
" VALUES (@coid,@ban_wx,@ban_pdd);";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "UPDATE `bxx`.`jst_supplier_ban_platform` SET ";
|
||||
if (ban_wx != null)
|
||||
sql += " ban_wx=@ban_wx,";
|
||||
if (ban_pdd != null)
|
||||
sql += " ban_pdd=@ban_pdd,";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " 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.Int16, ParameterName = "ban_wx", Value = ban_wx, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int16, ParameterName = "ban_pdd", Value = ban_pdd, });
|
||||
var rowCnt = mySql.ExecuteAffectedRows(sql, paramLst.ToArray());
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
|
||||
}
|
||||
|
||||
sql = "UPDATE `bxx`.`product` SET ";
|
||||
if (ban_wx != null)
|
||||
sql += " ban_wx=@ban_wx,";
|
||||
if (ban_pdd != null)
|
||||
sql += " ban_pdd=@ban_pdd,";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " WHERE (real_coid=@coid or skc_id=@coid) AND product_get_type='厂商直采';";
|
||||
rowCnt = mySql.ExecuteAffectedRows(sql, paramLst.ToArray());
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
|
||||
}
|
||||
|
||||
mySql.Commit();
|
||||
mySql.Close();
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":\"\"}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetJstProductCoidList(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var timeCalc = DateTime.Now;
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
|
||||
string coids = RegexUtils.GetStringQuery(ref inputData, "coids")?.Replace("'", "\\'");
|
||||
string not_count = RegexUtils.GetStringQuery(ref inputData, "not_count")?.Replace("'", "\\'");
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "";
|
||||
var count = -1;
|
||||
|
||||
//sql = " SELECT COUNT(*) FROM" +
|
||||
// " (SELECT skc_id as coid FROM bxx.product WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM bxx.product WHERE product_get_type='厂商直采') as coids" +
|
||||
// " WHERE 1=1 AND coids.coid != ''";
|
||||
sql = "select count(*) FROM (SELECT DISTINCT coids.*,a.after_sale_json,p.from_shop_name,b.ban_wx,b.ban_pdd" +
|
||||
" FROM (SELECT skc_id as coid FROM bxx.product WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM bxx.product WHERE product_get_type='厂商直采') as coids" +
|
||||
" LEFT JOIN wxxd.after_sale as a ON coids.coid=a.coid AND a.is_del = 0" +
|
||||
" LEFT JOIN bxx.product p ON coids.coid=p.skc_id" +
|
||||
" LEFT JOIN bxx.jst_supplier_ban_platform b ON coids.coid=b.coid" +
|
||||
" WHERE 1=1 AND coids.coid != ''";
|
||||
string where = "";
|
||||
if (coids != null)
|
||||
where += " AND coids.coid IN ('" + coids.Replace(",", "','") + "')";
|
||||
sql += where;
|
||||
sql += ") as cnt";
|
||||
sql += ";";
|
||||
|
||||
if (not_count != "true")
|
||||
count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
DataTable dt;
|
||||
if (count == 0)
|
||||
{
|
||||
dt = new DataTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = " SELECT DISTINCT coids.*,a.after_sale_json,p.from_shop_name,b.ban_wx,b.ban_pdd" +
|
||||
" FROM (SELECT skc_id as coid FROM bxx.product WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM bxx.product WHERE product_get_type='厂商直采') as coids" +
|
||||
" LEFT JOIN wxxd.after_sale as a ON coids.coid=a.coid AND a.is_del = 0" +
|
||||
" LEFT JOIN bxx.product p ON coids.coid=p.skc_id" +
|
||||
" LEFT JOIN bxx.jst_supplier_ban_platform b ON coids.coid=b.coid" +
|
||||
" WHERE 1=1 AND coids.coid != ''";
|
||||
sql += where;
|
||||
//sql += " ORDER BY coid DESC";
|
||||
//sql += " ORDER BY coid ASC";
|
||||
sql += " LIMIT " + Math.Max(0, page - 1) * page_size + "," + page_size + ";";
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
}
|
||||
}
|
||||
mySql.Close();
|
||||
|
||||
if (dt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<JObject> coidLst = new List<JObject>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
var jObj = new JObject();
|
||||
var afterSaleJson = row["after_sale_json"].ParseToString();
|
||||
var supplier_name = row["from_shop_name"].ParseToString();
|
||||
if (string.IsNullOrEmpty(supplier_name))
|
||||
supplier_name = RegexUtils.GetStringJson(ref afterSaleJson, "name");
|
||||
coidLst.Add(jObj);
|
||||
jObj["coid"] = row["coid"].ParseToString();
|
||||
jObj["supplier_name"] = supplier_name;
|
||||
jObj["ban_wx"] = row["ban_wx"].ParseToInt();
|
||||
jObj["ban_pdd"] = row["ban_pdd"].ParseToInt();
|
||||
}
|
||||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
var data = JsonUtils.SerializeObjectToString(coidLst, jsonSetting);
|
||||
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 GetJstProductBanPlatformList(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var timeCalc = DateTime.Now;
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
|
||||
string coids = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
|
||||
string not_count = RegexUtils.GetStringQuery(ref inputData, "not_count")?.Replace("'", "\\'");
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "";
|
||||
var count = -1;
|
||||
|
||||
sql = "SELECT count(*) FROM `bxx`.`jst_supplier_ban_platform` where 1=1";
|
||||
string where = "";
|
||||
if (coids != null)
|
||||
where += " AND coid IN ('" + coids.Replace(",", "','") + "')";
|
||||
sql += where;
|
||||
sql += ";";
|
||||
|
||||
if (not_count != "true")
|
||||
count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
DataTable dt;
|
||||
if (count == 0)
|
||||
{
|
||||
dt = new DataTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "SELECT * FROM `bxx`.`jst_supplier_ban_platform` WHERE 1=1";
|
||||
sql += where;
|
||||
sql += " ORDER BY id DESC LIMIT " + Math.Max(0, page - 1) * page_size + "," + page_size + ";";
|
||||
dt = mySql.ExecuteDataTable(sql);
|
||||
}
|
||||
mySql.Close();
|
||||
|
||||
if (dt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<JObject> supplierBanPlatformLst = new List<JObject>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
var jObj = new JObject();
|
||||
supplierBanPlatformLst.Add(jObj);
|
||||
jObj["id"] = row["id"].ParseToInt();
|
||||
jObj["coid"] = row["coid"].ParseToString();
|
||||
jObj["ban_wx"] = row["ban_wx"].ParseToInt();
|
||||
jObj["ban_pdd"] = row["ban_pdd"].ParseToInt();
|
||||
}
|
||||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
var data = JsonUtils.SerializeObjectToString(supplierBanPlatformLst, jsonSetting);
|
||||
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\":\"输入为空\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -804,15 +804,15 @@ namespace KJD_Web.BLL.WXXD
|
||||
string tel_number = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "tel_number"))?.Replace("'", "\\'");
|
||||
// 收件人
|
||||
string user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "receiver"))?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty("user_id"))
|
||||
if (string.IsNullOrEmpty(user_id))
|
||||
return "{\"code\":500,\"msg\":\"缺少用户编号\"}";
|
||||
if (string.IsNullOrEmpty("after_sale_json"))
|
||||
if (string.IsNullOrEmpty(shop_id))
|
||||
return "{\"code\":500,\"msg\":\"缺少店铺编号\"}";
|
||||
if (string.IsNullOrEmpty("province_name") || string.IsNullOrEmpty("city_name") || string.IsNullOrEmpty("county_name") || string.IsNullOrEmpty("detail_info"))
|
||||
if (string.IsNullOrEmpty(province_name) || string.IsNullOrEmpty(city_name) || string.IsNullOrEmpty(county_name) || string.IsNullOrEmpty(detail_info))
|
||||
return "{\"code\":500,\"msg\":\"省市区或详细地址不完整\"}";
|
||||
if (string.IsNullOrEmpty("user_name"))
|
||||
if (string.IsNullOrEmpty(user_name))
|
||||
return "{\"code\":500,\"msg\":\"缺少收件人\"}";
|
||||
if (string.IsNullOrEmpty("tel_number"))
|
||||
if (string.IsNullOrEmpty(tel_number))
|
||||
return "{\"code\":500,\"msg\":\"缺少收件人电话\"}";
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
|
||||
@@ -568,5 +568,40 @@ namespace KJD_Web
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void add_mdy_jst_product_ban()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().AddMdyJstProductBan(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_jst_product_coid_list()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().GetJstProductCoidList(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_jst_product_ban_platform_list()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().GetJstProductBanPlatformList(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
//GetJstProductCoidList
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user