修改数据库商品表获取表名逻辑
This commit is contained in:
1 parent
b029cfdd92
commit
0b325e7cd8
6 files changed
+114
-234
No files matched your search
@@ -22,6 +22,21 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
public class BXXProductManage
|
||||
{
|
||||
string GetProductTableName(string inputData)
|
||||
{
|
||||
var tableName = "bxx.product";
|
||||
//var add_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
|
||||
//if (add_user_name != null && add_user_name != "admin")
|
||||
//{
|
||||
// var tableId = RegexUtils.GetStringQuery(ref inputData, "table_id").ParseToNullableLong();
|
||||
// if (tableId == null && add_user_name.ParseToNullableLong() is long userIdLong)
|
||||
// tableId = userIdLong % 1024;
|
||||
// if (tableId == null)
|
||||
// tableId = Math.Abs(add_user_name.GetHashCode()) % 1024;
|
||||
// tableName = "pdb.product_" + tableId;
|
||||
//}
|
||||
return tableName;
|
||||
}
|
||||
public string AddProduct(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
@@ -85,13 +100,13 @@ namespace KJD_Web.BLL.BXX
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
if (add_user_name != null && add_user_name != "admin")
|
||||
{
|
||||
|
||||
|
||||
sql = "select count(*) from bxx.product where is_del=0 and add_user_name='" + add_user_name + "'";
|
||||
sql = "select count(*) from " + tableName + " where is_del=0 and add_user_name='" + add_user_name + "'";
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || count > 100000)
|
||||
{
|
||||
@@ -121,7 +136,7 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
}
|
||||
|
||||
sql = "INSERT INTO bxx.product(";
|
||||
sql = "INSERT INTO " + tableName + " (";
|
||||
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,";
|
||||
sql += "cat_name,price_text,product_name,ext_code,main_img,product_json,size_json,notes,product_get_type,";
|
||||
if (sale_count != null)
|
||||
@@ -240,9 +255,11 @@ namespace KJD_Web.BLL.BXX
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
sql = "update bxx.product p set";
|
||||
sql = "update " + tableName + " p set";
|
||||
if (from_shop_id != null)
|
||||
sql += " p.from_shop_id='" + from_shop_id + "',";
|
||||
if (from_shop_name != null)
|
||||
@@ -370,14 +387,16 @@ namespace KJD_Web.BLL.BXX
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
if (!string.IsNullOrEmpty(product_name))
|
||||
sql = "select id,spu_id from bxx.product p where p.product_name='" + product_name + "' and p.wx_safe_status in ('安全商品','未校验');";
|
||||
sql = "select id,spu_id from " + tableName + " p where p.product_name='" + product_name + "' and p.wx_safe_status in ('安全商品','未校验');";
|
||||
else if (!string.IsNullOrEmpty(secret_spu_id))
|
||||
sql = "select id,spu_id from bxx.product p where p.secret_spu_id='" + secret_spu_id + "' and p.wx_safe_status in ('安全商品','未校验');";
|
||||
sql = "select id,spu_id from " + tableName + " p where p.secret_spu_id='" + secret_spu_id + "' and p.wx_safe_status in ('安全商品','未校验');";
|
||||
else
|
||||
sql = "select id,spu_id from bxx.product p where p.spu_id='" + spu_id + "' and p.wx_safe_status in ('安全商品','未校验');";
|
||||
sql = "select id,spu_id from " + tableName + " p where p.spu_id='" + spu_id + "' and p.wx_safe_status in ('安全商品','未校验');";
|
||||
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
@@ -398,7 +417,7 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "update bxx.product p set";
|
||||
sql = "update " + tableName + " p set";
|
||||
if (group != null)
|
||||
sql += " p.group='" + group + "',";
|
||||
if (notes != null)
|
||||
@@ -455,9 +474,11 @@ namespace KJD_Web.BLL.BXX
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
sql = "update bxx.product p set";
|
||||
sql = "update " + tableName + " p set";
|
||||
if (view_uv != null)
|
||||
sql += " p.view_uv=" + view_uv + ",";
|
||||
sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
|
||||
@@ -509,7 +530,10 @@ namespace KJD_Web.BLL.BXX
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select id,spu_id,secret_spu_id from bxx.product p where p.is_del=0";
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
sql = "select id,spu_id,secret_spu_id from " + tableName + " p where p.is_del=0";
|
||||
if (search_secret_spu_ids != null)
|
||||
{
|
||||
sql += " and p.secret_spu_id in ('" + string.Join("','", search_secret_spu_ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) + "')";
|
||||
@@ -629,10 +653,12 @@ namespace KJD_Web.BLL.BXX
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
|
||||
string sql = " select count(*) from bxx.product p ";
|
||||
|
||||
sql = " select count(*) from " + tableName + " p ";
|
||||
//sql += " LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
|
||||
sql += " WHERE p.is_del=0";
|
||||
|
||||
@@ -803,14 +829,14 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
if (isDetail)
|
||||
sql = " SELECT p.*" +
|
||||
" from bxx.product p" +
|
||||
" from " + tableName + " p" +
|
||||
" 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.fission_words,p.head_words,p.end_words,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.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation,p.view_uv,p.add_user_name" +
|
||||
" FROM bxx.product p" +
|
||||
" FROM " + tableName + " p" +
|
||||
" WHERE p.is_del=0";
|
||||
//where子句
|
||||
sql += where;
|
||||
@@ -897,7 +923,7 @@ namespace KJD_Web.BLL.BXX
|
||||
mySql = new MysqlUtils(conn);
|
||||
try
|
||||
{
|
||||
sql = "update bxx.product set secret_spu_id='" + goodsId + "' where spu_id='" + prod.spu_id + "'";
|
||||
sql = "update " + tableName + " set secret_spu_id='" + goodsId + "' where spu_id='" + prod.spu_id + "'";
|
||||
mySql.ExecuteNonQuery(sql);
|
||||
}
|
||||
catch { }
|
||||
@@ -912,7 +938,7 @@ namespace KJD_Web.BLL.BXX
|
||||
JObject jObj = JsonUtils.JObjectParse(prod.product_json);
|
||||
jObj["source_json"] = null;
|
||||
var newProdJson = JsonUtils.SerializeObject(jObj);
|
||||
sql = "update bxx.product set product_json=@product_json where spu_id='" + prod.spu_id + "'";
|
||||
sql = "update " + tableName + " set product_json=@product_json where spu_id='" + prod.spu_id + "'";
|
||||
paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = newProdJson, });
|
||||
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
|
||||
@@ -980,11 +1006,14 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"商品回采数据不能为空\"}";
|
||||
}
|
||||
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
tableName = "bxx.product"; // 回采只支持主库,后续可能删除回采功能
|
||||
string sql = "";
|
||||
|
||||
sql = "INSERT INTO bxx.product_wx_complate (spu_id,coid,secret_spu_id,wx_edit_prod_json) VALUES " +
|
||||
" ('" + spu_id + "','" + coid + "','" + secret_spu_id + "','" + wx_edit_prod_json + "')" +
|
||||
" ON DUPLICATE KEY UPDATE spu_id=VALUES(spu_id),coid=VALUES(coid),wx_edit_prod_json=VALUES(wx_edit_prod_json);";
|
||||
@@ -996,7 +1025,7 @@ namespace KJD_Web.BLL.BXX
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
sql = "UPDATE bxx.product set has_wx_format='1' where secret_spu_id='" + secret_spu_id + "'";
|
||||
sql = "UPDATE " + tableName + " set has_wx_format='1' where secret_spu_id='" + secret_spu_id + "'";
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (!rst || !string.IsNullOrEmpty(mySql.Message))
|
||||
@@ -1449,56 +1478,7 @@ namespace KJD_Web.BLL.BXX
|
||||
|
||||
public string GetProductCates(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 conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "SELECT DISTINCT p.cat_name FROM `bxx`.`product` p where p.is_del=0";
|
||||
|
||||
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["cat_name"].ToString() + ",";
|
||||
}
|
||||
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\":\"输入为空\"}";
|
||||
return "{\"code\":19999,\"msg\":\"接口废弃\"}";
|
||||
}
|
||||
|
||||
public string GetProductMainCates(string inputData)
|
||||
@@ -1519,41 +1499,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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 DISTINCT p.cat_name FROM `bxx`.`product` p where p.is_del=0";
|
||||
//string sql = "SELECT DISTINCT p.main_cat_name FROM `bxx`.`product` p where p.is_del=0";
|
||||
|
||||
//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["main_cat_name"].ToString() + ",";
|
||||
// }
|
||||
// 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\":\"\"}";
|
||||
//}
|
||||
|
||||
// 直接全部返回了
|
||||
// 直接返回全部拼多多一级类目名称及ID
|
||||
var pddCats1Str = "男装,办公设备/耗材/相关服务,文具电教/文化用品/商务用品,3C数码配件,古董文玩/邮币/字画/收藏,影音电器,手机,二手数码,笔记本电脑,数码相机/单反相机/摄像机,智能设备,厨房电器,大家电,生活电器,个人护理保健,网络设备,零食/坚果/特产,咖啡/麦片/冲饮,茶,粮油米面/南北干货/调味品,酒类,保健食品/膳食营养补充食品,传统滋补品,电子元器件市场,摩托车/装备/配件,汽车/用品/配件/改装,水产肉类/新鲜蔬果/熟食,女装/女士精品,新车/二手车,流行男鞋,女鞋,箱包皮具/女包/男包,内衣裤袜,腕表眼镜,服饰配件,本地化生活服务,电影/演出/体育赛事,个性定制/设计服务,购物卡/礼品卡/代金券,婚庆/摄影/摄像服务,教育培训,景点门票/周边游,旅游路线/商品/服务,生活缴费,数字生活娱乐,特价酒店/客栈/公寓旅馆,网络服务/软件,网上营业厅,休闲娱乐,游戏服务/直播,床上用品,电子/电工,基础建材,家居饰品,灯饰光源照明,家装主材,居家布艺,全屋定制,商业/办公家具,特色手工艺,五金工具,住宅家具,电动车/配件/交通工具,户外/登山/旅行野营用品,运动/瑜伽/健身/球类,运动包/户外包/配件,运动服/休闲服,运动鞋,自行车/骑行装备/零配件,OTC药品,精制中药材,隐形眼镜/护理液,奶粉/辅食/营养品/零食,婴童用品,童鞋/婴儿鞋/亲子鞋,童装/婴儿装/亲子装,玩具/童车/益智/积木/模型,孕产妇用品/孕妇装/营养,书籍/杂志/报纸,农机/农具/农膜,畜牧/养殖物资,农用物资,成人用品,宠物/宠物食品及用品,餐饮具,厨房/烹饪用具,收纳整理,家庭/个人清洁工具,居家日用,节庆用品/礼品,烟品/打火机/瑞士军刀,洗护清洁剂/卫生巾/纸/香薰,饰品/流行首饰/摆件/保养鉴定,珠宝/钻石/翡翠/黄金,鲜花园艺/绿植仿真/园林设备,乐器/吉他/钢琴/配件,装修设计/施工/监理,医疗健康服务,处方药,彩妆/香水/美妆工具,美容美体仪器,美发护发/假发,美容护肤/美体/精油,医疗器械,婴童尿裤,汽车服务,交通出行,房地产,模玩/动漫/周边/cos/桌游,音乐/影视/明星/音像,搬运/仓储/物流设备,标准件/零部件/工业耗材,机械设备,清洗/食品/商业设备,橡塑材料及制品,平板电脑/MID,品牌台机/品牌一体机/服务器,DIY电脑,闪存卡/U盘/存储/移动硬盘,电脑硬件/显示器/电脑周边,电玩/配件/游戏/攻略,包装用品,保健用品,特色农产品(非食用),239,2603,2629,2933,5217,5752,5834,5839,5851,5906,5921,5955,6076,6128,6209,6290,6398,6536,6586,6630,6758,6785,6883,7323,7629,7639,8172,8439,8502,8508,8509,8538,8583,8634,8669,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8736,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,11683,11684,11685,11686,11687,11688,11689,13176,13177,13178,14697,14740,14933,14966,15083,15356,15543,16155,16192,16209,16237,16288,16548,16676,16794,16901,16989,17134,17249,17285,17412,17455,17671,17803,18088,18270,18349,18482,18574,18601,18637,18814,19298,20078,20118,20340,20645,21417,22856,22881,22931,22964,22986,24383,24386,24402,24407,24426,24520,24636,24699,27063";
|
||||
var data = pddCats1Str;
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":\"" + data + "\"}";
|
||||
@@ -1708,11 +1654,14 @@ namespace KJD_Web.BLL.BXX
|
||||
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(*)" +
|
||||
" FROM bxx.product p";
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
sql = " SELECT count(*)" + " FROM " + tableName + " p";
|
||||
//if (!string.IsNullOrEmpty(wx_safe_status))
|
||||
// sql += " FORCE INDEX (index_wx_safe_status)";
|
||||
//sql += " LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)"
|
||||
@@ -1859,7 +1808,7 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
|
||||
sql = " SELECT p.id" +
|
||||
" FROM bxx.product p" +
|
||||
" FROM " + tableName + " 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子句
|
||||
@@ -1884,7 +1833,7 @@ namespace KJD_Web.BLL.BXX
|
||||
" p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.product_get_type,fission_words," +
|
||||
" 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" +
|
||||
" from bxx.product p where p.is_del=0";
|
||||
" from " + tableName + " p where p.is_del=0";
|
||||
//where子句
|
||||
//sql += where;
|
||||
sql += " and id in (" + db_ids + ")";
|
||||
@@ -2070,11 +2019,17 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"删除失败:请指定要删除的数据!\"}";
|
||||
}
|
||||
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
//string sql = "delete from bxx.product where id='" + id + "'";
|
||||
string sql = "update bxx.product set is_del=1 where id='" + id + "'";
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
if (tableName != "bxx.product")
|
||||
sql = "delete from " + tableName + " where id='" + id + "'";
|
||||
else
|
||||
sql = "update " + tableName + " set is_del=1 where id='" + id + "'";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
@@ -2088,46 +2043,6 @@ namespace KJD_Web.BLL.BXX
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string MdyProductNotes(string inputData, bool isAdmin = 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 id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
|
||||
|
||||
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.product set";
|
||||
if (notes != null)
|
||||
sql += " notes='" + notes + "',";
|
||||
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>
|
||||
@@ -2175,7 +2090,11 @@ namespace KJD_Web.BLL.BXX
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update bxx.product p set";
|
||||
|
||||
string tableName = GetProductTableName(inputData);
|
||||
string sql = "";
|
||||
|
||||
sql = "update " + tableName + " p set";
|
||||
if (product_name != null)
|
||||
sql += " p.product_name='" + product_name + "',";
|
||||
if (group != null)
|
||||
@@ -3199,20 +3118,21 @@ namespace KJD_Web.BLL.BXX
|
||||
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 tableName = GetProductTableName(inputData);
|
||||
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" +
|
||||
// " (SELECT skc_id as coid FROM " + tableName + " WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM " + tableName + " 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" +
|
||||
" FROM (SELECT skc_id as coid FROM " + tableName + " WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM " + tableName + " 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 AND p.product_get_type='厂商直采'" +
|
||||
" LEFT JOIN " + tableName + " p ON coids.coid=p.skc_id AND p.product_get_type='厂商直采'" +
|
||||
" LEFT JOIN bxx.jst_supplier_ban_platform b ON coids.coid=b.coid" +
|
||||
" WHERE 1=1 AND coids.coid != ''";
|
||||
string where = "";
|
||||
@@ -3233,9 +3153,9 @@ namespace KJD_Web.BLL.BXX
|
||||
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" +
|
||||
" FROM (SELECT skc_id as coid FROM " + tableName + " WHERE product_get_type='厂商直采' UNION SELECT real_coid as coid FROM " + tableName + " 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 AND p.product_get_type='厂商直采'" +
|
||||
" LEFT JOIN " + tableName + " p ON coids.coid=p.skc_id AND p.product_get_type='厂商直采'" +
|
||||
" LEFT JOIN bxx.jst_supplier_ban_platform b ON coids.coid=b.coid" +
|
||||
" WHERE 1=1 AND coids.coid != ''";
|
||||
sql += where;
|
||||
|
||||
@@ -247,46 +247,6 @@ namespace KJD_Web.BLL.BXX
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string MdyProductNotes(string inputData, bool isAdmin = 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 id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
|
||||
|
||||
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.third_product set";
|
||||
if (notes != null)
|
||||
sql += " notes='" + notes + "',";
|
||||
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\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string MdyProductCategory(string inputData, bool isAdmin = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
|
||||
@@ -230,17 +230,17 @@ namespace KJD_Web
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_product_notes()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
//[WebMethod]
|
||||
//public void mdy_product_notes()
|
||||
//{
|
||||
// string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().MdyProductNotes(jsontext);
|
||||
// var result = jsontext;
|
||||
// result = new BXXProductManage().MdyProductNotes(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
// Context.Response.Write(result);
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_db_product()
|
||||
|
||||
@@ -108,17 +108,17 @@ namespace KJD_Web
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_product_notes()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
//[WebMethod]
|
||||
//public void mdy_product_notes()
|
||||
//{
|
||||
// string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductThirdManage().MdyProductNotes(jsontext);
|
||||
// var result = jsontext;
|
||||
// result = new BXXProductThirdManage().MdyProductNotes(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
// Context.Response.Write(result);
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_product_category()
|
||||
|
||||
@@ -120,17 +120,17 @@ namespace KJD_Web
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_product_notes()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
//[WebMethod]
|
||||
//public void mdy_product_notes()
|
||||
//{
|
||||
// string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new ProductManage().MdyProductNotes(jsontext);
|
||||
// var result = jsontext;
|
||||
// result = new ProductManage().MdyProductNotes(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
// Context.Response.Write(result);
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_db_product()
|
||||
|
||||
@@ -132,17 +132,17 @@ namespace KJD_Web
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_product_notes()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
//[WebMethod]
|
||||
//public void mdy_product_notes()
|
||||
//{
|
||||
// string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new ProductThirdManage().MdyProductNotes(jsontext);
|
||||
// var result = jsontext;
|
||||
// result = new ProductThirdManage().MdyProductNotes(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
// Context.Response.Write(result);
|
||||
// Context.Response.End();
|
||||
//}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_product_category()
|
||||
|
||||
Reference in new issue
Block a user