1 bxx相关逻辑 2 店铺活动相关逻辑

This commit is contained in:
wule committed 2025-09-09 19:07:29 +08:00
1 parent fc017993df
commit b44fa2a6c3
35 files changed
+460 -3861

No files matched your search

+8 -2
View File
@@ -27,8 +27,8 @@ namespace AllBase
/// <summary>
/// 版本ID
/// </summary>
public static int VersionCount = 581;
//public static int VersionCount = 581;
public static int VersionCount = 585;
//public static int VersionCount = 585;
/// <summary>
/// 版本号
@@ -719,6 +719,12 @@ namespace AllBase
//return LoginApiUrl + "index.php?obj=" + BaseClass.MainPath + "/" + file;
//http://localhost:8000/user/user_login
//pdd相关操作
if (BaseClass.MainPath == "binxixi")
{
return LoginApiUrl + "/bxx_" + file + "?obj=" + BaseClass.MainPath + "/" + file;
}
return LoginApiUrl + "/" + file+ "?obj=" + BaseClass.MainPath + "/" + file;
}
/// <summary>
+2 -2
View File
@@ -126,7 +126,7 @@ namespace AllBase.Model.Result
/// <summary>
/// 子账户列表(抖店用)
/// </summary>
public List<DouShopSubAccountInfo> ShopSubAccountList { get; } = new List<DouShopSubAccountInfo>();
public List<ShopSubAccountInfo> ShopSubAccountList { get; } = new List<ShopSubAccountInfo>();
public int OnlineProductCount { get; set; } = -1;
public int OfflineProductCount { get; set; } = -1;
@@ -222,7 +222,7 @@ namespace AllBase.Model.Result
public int id { get; set; }
}
public class DouShopSubAccountInfo : SubAccountInfo
public class ShopSubAccountInfo : SubAccountInfo
{
public string shop_login_name { get; set; }
public string sub_user_id { get { return id.ToString(); } set { id = value.ParseToInt(); } }
@@ -1,600 +0,0 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace KJD_Web.BLL
{
public class PriceManage
{
public string AddPrice(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
int original_price = RegexUtils.GetStringQuery(ref inputData, "original_price").ParseToInt();
int markup_times = RegexUtils.GetStringQuery(ref inputData, "markup_times").ParseToInt();
int extra_price = RegexUtils.GetStringQuery(ref inputData, "extra_price").ParseToInt();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(ext_code) from kjd.price_markup where ext_code=@ext_code";
string sql = "insert into kjd.price_markup " +
"(ext_code,original_price,markup_times,extra_price,notes) " +
"values (@ext_code,@original_price,@markup_times,@extra_price,@notes);";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@original_price", Value = original_price, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@markup_times", Value = markup_times, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@extra_price", Value = extra_price, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":502,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetPriceList(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");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
string start_original_price = RegexUtils.GetStringQuery(ref inputData, "start_original_price");
string end_original_price = RegexUtils.GetStringQuery(ref inputData, "end_original_price");
string start_markup_times = RegexUtils.GetStringQuery(ref inputData, "start_markup_times");
string end_markup_times = RegexUtils.GetStringQuery(ref inputData, "end_markup_times");
string start_extra_price = RegexUtils.GetStringQuery(ref inputData, "start_extra_price");
string end_extra_price = RegexUtils.GetStringQuery(ref inputData, "end_extra_price");
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
var search_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_notes"));
var in_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "in_ext_code"));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_ext_code", Value = "%" + search_ext_code + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_notes", Value = "%" + search_notes + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_original_price", Value = start_original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_original_price", Value = end_original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_markup_times", Value = start_markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_markup_times", Value = end_markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_extra_price", Value = start_extra_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_extra_price", Value = end_extra_price.ParseToInt(), });
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = "'" + in_ext_code?.Replace(",", "','") + "'", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = in_ext_code.ParseToString() });
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd.price_markup p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like @search_ext_code";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like @search_notes";
if (!string.IsNullOrWhiteSpace(start_original_price))
where += " and p.original_price >= @start_original_price";
if (!string.IsNullOrWhiteSpace(end_original_price))
where += " and p.original_price <= @end_original_price";
if (!string.IsNullOrWhiteSpace(start_markup_times))
where += " and p.markup_times >= @start_markup_times";
if (!string.IsNullOrWhiteSpace(end_markup_times))
where += " and p.markup_times <= @end_markup_times";
if (!string.IsNullOrWhiteSpace(start_extra_price))
where += " and p.extra_price >= @start_extra_price";
if (!string.IsNullOrWhiteSpace(end_extra_price))
where += " and p.extra_price <= @end_extra_price";
if (!string.IsNullOrEmpty(in_ext_code))
where += " and p.ext_code in ('" + in_ext_code?.Replace(",", "','") + "')";
sql += where;
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from kjd.price_markup p where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<DBPriceResultParam> priceList = new List<DBPriceResultParam>();
foreach (DataRow row in dt.Rows)
{
DBPriceResultParam price = new DBPriceResultParam
{
id = row["id"].ParseToInt(),
extra_price = row["extra_price"].ParseToInt(),
markup_times = row["markup_times"].ParseToInt(),
original_price = row["original_price"].ParseToInt(),
notes = row["notes"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
priceList.Add(price);
}
var data = JsonUtils.SerializerObjectToString(priceList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
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 DelDbPrice(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("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.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 = "delete from kjd.price_markup 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 MdyDBPrice(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");
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
string original_price = RegexUtils.GetStringQuery(ref inputData, "original_price");
string markup_times = RegexUtils.GetStringQuery(ref inputData, "markup_times");
string extra_price = RegexUtils.GetStringQuery(ref inputData, "extra_price");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@original_price", Value = original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@markup_times", Value = markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@extra_price", Value = extra_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@db_id", Value = db_id, });
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(ext_code) from kjd.price_markup where ext_code=@ext_code and id!=@db_id";
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
string sql = "update kjd.price_markup set";
if (notes != null)
sql += " notes=@notes,";
if (ext_code != null)
sql += " ext_code=@ext_code,";
if (original_price != null)
sql += " original_price=@original_price,";
if (markup_times != null)
sql += " markup_times=@markup_times,";
if (extra_price != null)
sql += " extra_price=@extra_price,";
sql = sql.TrimEnd(',');
sql += " where id=@db_id;";
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddPurchasePrice(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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_name = RegexUtils.GetStringQuery(ref inputData, "shop_name");
string spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spu_id")).ParseToString();
string skc_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "skc_id")).ParseToString();
string cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_id")).ParseToString();
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name")).ParseToString();
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name")).ParseToString();
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img")).ParseToString();
string discount = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "discount")).ParseToString();
string price_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "price_text")).ParseToString();
string sku_purchase_price_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_purchase_price_json")).ParseToString();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(spu_id) from kjd.product_purchase_price where spu_id=@spu_id";
string sql = "insert into kjd.product_purchase_price " +
"(shop_id,shop_name,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,discount,price_text,sku_purchase_price_json,notes) " +
"values (@shop_id,@shop_name,@spu_id,@skc_id,@cat_id,@cat_name,@ext_code,@product_name,@main_img,@discount,@price_text,@sku_purchase_price_json,@notes);";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_id", Value = shop_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_name", Value = shop_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@spu_id", Value = spu_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@skc_id", Value = skc_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@discount", Value = discount.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@price_text", Value = price_text, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@sku_purchase_price_json", Value = sku_purchase_price_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":502,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyPurchasePrice(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");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_name = RegexUtils.GetStringQuery(ref inputData, "shop_name");
string cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_id")).ParseToString();
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name")).ParseToString();
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name")).ParseToString();
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img")).ParseToString();
string discount = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "discount")).ParseToString();
string price_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "price_text")).ParseToString();
string sku_purchase_price_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_purchase_price_json")).ParseToString();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@db_id", Value = db_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_id", Value = shop_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_name", Value = shop_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@discount", Value = discount.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@price_text", Value = price_text, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@sku_purchase_price_json", Value = sku_purchase_price_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.product_purchase_price set";
if (shop_id != null)
sql += " shop_id=@shop_id,";
if (shop_name != null)
sql += " shop_name=@shop_name,";
if (cat_id != null)
sql += " cat_id=@cat_id,";
if (cat_name != null)
sql += " cat_name=@cat_name,";
if (ext_code != null)
sql += " ext_code=@ext_code,";
if (product_name != null)
sql += " product_name=@product_name,";
if (main_img != null)
sql += " main_img=@main_img,";
if (discount != null)
sql += " discount=@discount,";
if (price_text != null)
sql += " price_text=@price_text,";
if (sku_purchase_price_json != null)
sql += " sku_purchase_price_json=@sku_purchase_price_json,";
if (notes != null)
sql += " notes=@notes,";
sql = sql.TrimEnd(',');
sql += " where id=@db_id;";
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetPurchasePriceList(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");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var search_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_spu_id"));
var search_skc_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_skc_id"));
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
var search_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_notes"));
var in_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "in_spu_id"));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_spu_id", Value = "%" + search_spu_id + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_skc_id", Value = "%" + search_skc_id + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_ext_code", Value = "%" + search_ext_code + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_notes", Value = "%" + search_notes + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_spu_id", Value = in_spu_id.ParseToString() });
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd.product_purchase_price p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu_id))
where += " and p.spu_id like @search_spu_id";
if (!string.IsNullOrWhiteSpace(search_skc_id))
where += " and p.skc_id like @search_skc_id";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like @search_ext_code";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like @search_notes";
if (!string.IsNullOrEmpty(in_spu_id))
where += " and p.spu_id in ('" + in_spu_id?.Replace(",", "','") + "')";
sql += where;
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from kjd.product_purchase_price p where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductPurchasePriceResultParam> purchasePriceList = new List<ProductPurchasePriceResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductPurchasePriceResultParam price = new ProductPurchasePriceResultParam
{
id = row["id"].ParseToInt(),
shop_id = row["shop_id"].ParseToString(),
shop_name = row["shop_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
discount = row["discount"].ParseToInt(),
price_text = row["price_text"].ParseToString(),
product_name = row["product_name"].ParseToString(),
skc_id = row["skc_id"].ParseToString(),
sku_purchase_price_json = row["sku_purchase_price_json"].ParseToString(),
spu_id = row["spu_id"].ParseToString(),
notes = row["notes"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
purchasePriceList.Add(price);
}
var data = JsonUtils.SerializerObjectToString(purchasePriceList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
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 DelPurchasePrice(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("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.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 = "delete from kjd.product_purchase_price 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\":\"输入为空\"}";
}
}
}
@@ -1,790 +0,0 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace KJD_Web.BLL
{
public class ProductManage
{
public string AddProduct(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 spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id");
string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id");
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"))?.Replace("'", "\\'");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"))?.Replace("'", "\\'");
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"))?.Replace("'", "\\'");
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"))?.Replace("'", "\\'");
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img"))?.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 = "";
sql = "insert into kjd.product (spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,add_time,mdy_time) " +
"values ('" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" +
ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
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 GetProductList(string inputData, bool isDetail = 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 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_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("'", "\\'");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var get_select_count = RegexUtils.GetStringQuery(ref inputData, "get_select_count")?.Replace("'", "\\'");
var select_shop_id = RegexUtils.GetStringQuery(ref inputData, "select_shop_id")?.Replace("'", "\\'");
var sort_field = RegexUtils.GetStringQuery(ref inputData, "sort_field")?.Replace("'", "\\'");
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(id) from kjd.product p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu))
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_cat))
where += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and p.product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like '%" + search_notes + "%'";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and p.id in (" + search_db_ids + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
if (isDetail)
sql = "select * from kjd.product p where 1=1";
else if (string.IsNullOrEmpty(get_select_count))
sql = "select p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,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 from kjd.product p where 1=1";
else
sql = "SELECT p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,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,COUNT(s.id) AS select_count " +
"FROM kjd.product p LEFT JOIN kjd.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "' " +
"WHERE 1=1";
//where子句
sql += where;
sql += " group by p.id";
if (sort_field == "select_total_count")
sql += " order by p.select_total_count desc, p.id desc";
else
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<DBProductResultParam> productLst = new List<DBProductResultParam>();
foreach (DataRow row in dt.Rows)
{
DBProductResultParam prod = new DBProductResultParam
{
id = Convert.ToInt32(row["id"]),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
cat_id = row["cat_id"].ToString(),
cat_name = row["cat_name"].ToString(),
product_name = row["product_name"].ToString(),
main_img = row["main_img"].ToString(),
ext_code = row["ext_code"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
select_total_count = row["select_total_count"].ParseToInt(),
end_words = row["end_words"].ParseToString(),
fission_words = row["fission_words"].ParseToString(),
head_words = row["head_words"].ParseToString(),
};
if (isDetail)
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
}
if (!string.IsNullOrEmpty(get_select_count))
{
prod.select_count = row["select_count"].ParseToInt();
}
productLst.Add(prod);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
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 DelDbProd(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("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.product 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 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 kjd.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 MdyDBProduct(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("'", "\\'");
var product_name = RegexUtils.GetStringQuery(ref inputData, "product_name")?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"))?.Replace("'", "\\'");
string fission_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_words"))?.Replace("'", "\\'");
string head_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "head_words"))?.Replace("'", "\\'");
string end_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "end_words"))?.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 kjd.product set";
if (product_name != null)
sql += " product_name='" + product_name + "',";
if (notes != null)
sql += " notes='" + notes + "',";
if (ext_code != null)
sql += " ext_code='" + ext_code + "',";
if (fission_words != null)
sql += " fission_words='" + fission_words + "',";
if (head_words != null)
sql += " head_words='" + head_words + "',";
if (end_words != null)
sql += " end_words='" + end_words + "',";
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 AddUserSelectProduct(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 out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account")?.Replace("'", "\\'");
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name")?.Replace("'", "\\'");
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_product_remaining = RegexUtils.GetStringQuery(ref inputData, "add_product_remaining").ParseToInt();
var add_fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_fission_product_name").ParseToString())?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into kjd.product_select " +
"(out_product_Id,shop_id,shop_account,user_name,sub_user_name,notes,status,fission_product_name,add_time,mdy_time) values " +
"('" + out_product_Id + "','" + shop_id + "','" + shop_account + "','" + user_name + "','" + sub_user_name + "','" +
notes + "','" + status + "','" + add_fission_product_name + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
if (add_product_remaining > 0)
{
add_product_remaining = add_product_remaining - 1;
sql += "\r\n";
sql += "update kjd.shop set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";";
sql += "update kjd.product set select_total_count=select_total_count+1 where id=" + out_product_Id + ";";
//sql += "update kjd.shop_add_prod_count set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";";
sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" +
"ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)";
}
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 MdyUserSelectProductStatus(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 id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id")?.Replace("'", "\\'");
var up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
long l_draft_id = draft_id.ParseToLong();
long l_spu_map_table_id = l_draft_id % 128;
long l_select_map_table_id = id.ParseToLong() % 64;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
// 使用事务一次提交多个sql操作
//sql += "set @@autocommit=0;\r\n";
sql += "START TRANSACTION;\r\n";
if (!string.IsNullOrEmpty(up_spu_id) && !string.IsNullOrEmpty(draft_id))
{
sql += "insert into kjd_map.spu_map_" + l_spu_map_table_id +
" (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');\r\n";
sql += "insert into kjd_map.product_select_map_" + l_select_map_table_id +
" (product_id,product_select_db_id,shop_id) values(" + draft_id + "," + id + ",'" + shop_id + "');\r\n";
}
sql += "update kjd.product_select set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
if (status != null)
sql += " status='" + status + "',";
if (status == "已上传")
sql += " add_times=add_times+1,";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";\r\n";
var rst = mySql.ExecuteNonQuery(sql);
string errMsg = mySql.Message;
if (string.IsNullOrEmpty(errMsg))
sql = "COMMIT;";
else
sql = "ROLLBACK;";
mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetUserSelectProductList(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("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "\\'");
var search_shop_id = RegexUtils.GetStringQuery(ref inputData, "search_shop_id")?.Replace("'", "\\'");
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_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("'", "\\'");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_user_notes = RegexUtils.GetStringQuery(ref inputData, "search_user_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var search_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "search_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var no_sub_sa = RegexUtils.GetStringQuery(ref inputData, "no_sub_sa")?.Replace("'", "\\'");
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(s.id) from kjd.product_select s " +
"left join kjd.product p on s.out_product_id=p.id " +
"left join kjd.user u on s.operate_sub_sa_name=u.user_name " +
"where 1=1";
string where = "";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(operate_sub_sa_name))
{
where += " and s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
}
if (no_sub_sa == "true")
where += " and s.operate_sub_sa_name is null";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
where += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
where += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
where += " and s.shop_account like '%" + search_shop_account + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
{
//核价成功 重复 核价成功(重复)
if (search_notes == "无备注")
where += " and s.notes = ''";
else if (search_notes == "重复")
where += " and s.notes like '%重复%' and s.notes not like '%核价成功%' and s.notes not like '%核价通过%'";
else if (search_notes == "核价成功")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes not like '%重复%'";
else if (search_notes == "核价成功(重复)")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes like '%重复%'";
else
where += " and s.notes like '%" + search_notes + "%'";
}
if (!string.IsNullOrWhiteSpace(search_user_notes))
where += " and s.user_notes like '%" + search_user_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
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_cat))
where += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and p.product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrEmpty(search_sub_sa_name))
{
where += " and (s.operate_sub_sa_name like '%" + search_sub_sa_name + "%'";
where += " or u.nick_name like '%" + operate_sub_sa_name + "%')";
}
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
//if (isDetail)
//sql = "select * from kjd.product_select where 1=1";
//else
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
"s.sub_user_name,s.notes,s.user_notes,s.status,s.draft_id,s.add_times,s.add_time,s.mdy_time," +
"s.fission_product_name,s.operate_sub_sa_name,s.add_sub_sa_time," +
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img," +
"u.nick_name as operate_sub_sa_nick " +
"from kjd.product_select s left join kjd.product p on s.out_product_id=p.id " +
"left join kjd.user u on u.user_name=s.operate_sub_sa_name " +
"where 1=1";
sql += where; // where子句
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductSelectResultParam> productLst = new List<ProductSelectResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
{
id = row["id"].ParseToInt(),
out_product_Id = row["out_product_Id"].ParseToString(),
shop_account = row["shop_account"].ParseToString(),
shop_id = row["shop_id"].ParseToString(),
status = row["status"].ParseToString(),
sub_user_name = row["sub_user_name"].ParseToString(),
user_name = row["user_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
product_name = row["product_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ParseToString(),
draft_id = row["draft_id"].ParseToString(),
add_times = row["add_times"].ParseToInt(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
operate_sub_sa_name = row["operate_sub_sa_name"].ToString(),
operate_sub_sa_nick = row["operate_sub_sa_nick"].ToString(),
fission_product_name = row["fission_product_name"].ToString(),
user_notes = row["user_notes"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
prodSelect.add_sub_sa_time = row["add_sub_sa_time"] as DateTime?;
productLst.Add(prodSelect);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
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 DelSelectProd(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("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.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 = "delete from kjd.product_select 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>
/// <returns></returns>
public string SetSelectProductSubSa(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\":\"没有用户名\"}";
}
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(shop_id))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.product_select set";
if (operate_sub_sa_name != null)
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
if (!string.IsNullOrEmpty(id))
sql += " where id in (" + id + ")";
else if (!string.IsNullOrEmpty(shop_id))
sql += " where shop_id in ('" + shop_id.Replace(",","','") + "')";
else
sql += " where 1=2";
if(!string.IsNullOrEmpty(status))
sql += " and status='" + status + "';";
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 MdyProductSelectNotes(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");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string user_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "user_notes"));
string fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_product_name"));
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 kjd.product_select set";
if (notes != null)
sql += " notes=@notes,";
if (user_notes != null)
sql += " user_notes=@user_notes,";
if (fission_product_name != null)
sql += " fission_product_name=@fission_product_name,";
sql = sql.TrimEnd(',');
sql += " where id=@id;";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@id", Value = id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@fission_product_name", Value = fission_product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@user_notes", Value = user_notes, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
/*
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "spu_id", Value = spu_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "skc_id", Value = skc_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "main_img", Value = main_img, });
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 = "notes", Value = notes.ParseToString(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_md5", Value = product_md5, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "add_time", Value = add_time, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "mdy_time", Value = mdy_time, });
rst = mySql.ExecuteInsertId(sql, paramLst.ToArray());*/
@@ -1,775 +0,0 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI.Common;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace KJD_Web.BLL
{
public class ProductThirdManage
{
public string AddProduct(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 spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id");
string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id");
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"));
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"));
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"));
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"));
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img"));
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
var json_sign = RegexUtils.GetStringJson(ref product_json, "signedImageUrl"); // 取商品json数据里不同签名的部分
var product_md5 = EncrypUtil.GetMd5(product_json?.Replace(json_sign, "") + size_json);
var product_md5_2 = EncrypUtil.GetMd5(product_json?.Replace("'", "\\'").Replace(json_sign, "") + size_json);
sql = "select id from kjd.third_product where product_md5='" + product_md5 + "' or product_md5='" + product_md5_2 + "';";
var rst = mySql.ExecuteFirstInt(sql).ParseToLong();
if (rst <= 0)
{
//sql = "insert into kjd.third_product (spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,product_md5,add_time,mdy_time) " +
// "values ('" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" +
// ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" + product_md5 + "','" +
// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
//rst = mySql.ExecuteInsertId(sql);
sql = "insert into kjd.third_product (spu_id,skc_id,cat_id,cat_name,product_name," +
"ext_code,main_img,product_json,size_json,notes,product_md5,add_time,mdy_time) " +
"values (@spu_id,@skc_id,@cat_id,@cat_name,@product_name," +
"@ext_code,@main_img,@product_json,@size_json,@notes,@product_md5," +
"@add_time,@mdy_time);";
string add_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
string mdy_time = add_time;
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@spu_id", Value = spu_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@skc_id", Value = skc_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
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 = "@notes", Value = notes.ParseToString(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_md5", Value = product_md5, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@add_time", Value = add_time, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@mdy_time", Value = mdy_time, });
rst = mySql.ExecuteInsertId(sql, paramLst.ToArray());
mySql.Close();
}
if (rst > 0)
{
return "{\"code\":200,\"msg\":\"success\",\"id\":" + rst + "}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductList(string inputData, bool isDetail = 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 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_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("'", "\\'");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
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(id) from kjd.third_product where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
where += " and skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
where += " and cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and notes like '%" + search_notes + "%'";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and id in (" + search_db_ids + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
if (isDetail)
sql = "select * from kjd.third_product where 1=1";
else
sql = "select id,spu_id,skc_id,cat_id,cat_name,change_cat_id,change_cat_name,ext_code,product_name,main_img,notes," +
"add_time,mdy_time from kjd.third_product where 1=1";
sql += where;
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<DBProductResultParam> productLst = new List<DBProductResultParam>();
foreach (DataRow row in dt.Rows)
{
DBProductResultParam prod = new DBProductResultParam
{
id = Convert.ToInt32(row["id"]),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
cat_id = row["cat_id"].ToString(),
cat_name = row["cat_name"].ToString(),
change_cat_id = row["change_cat_id"].ToString(),
change_cat_name = row["change_cat_name"].ToString(),
product_name = row["product_name"].ToString(),
main_img = row["main_img"].ToString(),
ext_code = row["ext_code"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
};
if (isDetail)
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
}
productLst.Add(prod);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
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 DelDbProd(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("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.third_product 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 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 kjd.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))
{
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 change_cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "change_cat_id"))?.Replace("'", "\\'");
string change_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "change_cat_name"))?.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 kjd.third_product set";
if (change_cat_id != null)
sql += " change_cat_id='" + change_cat_id + "',";
if (change_cat_name != null)
sql += " change_cat_name='" + change_cat_name + "',";
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 AddUserSelectProduct(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 out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account")?.Replace("'", "\\'");
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name")?.Replace("'", "\\'");
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_product_remaining = RegexUtils.GetStringQuery(ref inputData, "add_product_remaining").ParseToInt();
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into kjd.third_product_select (out_product_Id,shop_id,shop_account,user_name,sub_user_name,notes,status,add_time,mdy_time) " +
"values ('" + out_product_Id + "','" + shop_id + "','" + shop_account + "','" + user_name + "','" + sub_user_name + "','" +
notes + "','" + status + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
if (add_product_remaining > 0)
{
add_product_remaining = add_product_remaining - 1;
sql += "\r\n";
sql += "update kjd.shop set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";";
//sql += "update kjd.shop_add_prod_count set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";";
sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" +
"ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)";
}
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 MdyUserSelectProductStatus(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 id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id")?.Replace("'", "\\'");
var up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
long l_draft_id = draft_id.ParseToLong();
long l_spu_map_table_id = l_draft_id % 128;
long l_select_map_table_id = id.ParseToLong() % 64;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
// 使用事务一次提交多个sql操作
//sql += "set @@autocommit=0;\r\n";
sql += "START TRANSACTION;\r\n";
if (!string.IsNullOrEmpty(up_spu_id) && !string.IsNullOrEmpty(draft_id))
{
sql += "insert into kjd_map.spu_map_" + l_spu_map_table_id +
" (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');\r\n";
sql += "insert into kjd_map.product_third_select_map_" + l_select_map_table_id +
" (product_id,product_select_db_id,shop_id) values(" + draft_id + "," + id + ",'" + shop_id + "');\r\n";
}
sql += "update kjd.third_product_select set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
if (status != null)
sql += " status='" + status + "',";
if (status == "已上传")
sql += " add_times=add_times+1,";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";\r\n";
var rst = mySql.ExecuteNonQuery(sql);
string errMsg = mySql.Message;
if (string.IsNullOrEmpty(errMsg))
sql = "COMMIT;";
else
sql = "ROLLBACK;";
mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetUserSelectProductList(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("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "\\'");
var search_shop_id = RegexUtils.GetStringQuery(ref inputData, "search_shop_id")?.Replace("'", "\\'");
var search_shop_account = RegexUtils.GetStringQuery(ref inputData, "search_shop_account");
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.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");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_user_notes = RegexUtils.GetStringQuery(ref inputData, "search_user_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var search_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "search_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var no_sub_sa = RegexUtils.GetStringQuery(ref inputData, "no_sub_sa")?.Replace("'", "\\'");
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(s.id) from kjd.third_product_select s " +
"left join kjd.third_product p on s.out_product_id=p.id " +
"left join kjd.user u on s.operate_sub_sa_name=u.user_name " +
"where 1=1";
string where = "";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(operate_sub_sa_name))
{
where += " and s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
}
if (no_sub_sa == "true")
where += " and s.operate_sub_sa_name is null";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
where += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
where += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
where += " and s.shop_account like @search_shop_account";
if (!string.IsNullOrWhiteSpace(search_notes))
{
//核价成功 重复 核价成功(重复)
if (search_notes == "无备注")
where += " and s.notes = ''";
else if (search_notes == "重复")
where += " and s.notes like '%重复%' and s.notes not like '%核价成功%' and s.notes not like '%核价通过%'";
else if (search_notes == "核价成功")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes not like '%重复%'";
else if (search_notes == "核价成功(重复)")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes like '%重复%'";
else
where += " and s.notes like '%" + search_notes + "%'";
}
if (!string.IsNullOrWhiteSpace(search_user_notes))
where += " and s.user_notes like '%" + search_user_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
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_cat))
where += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and p.product_name like @search_prod_name";
if (!string.IsNullOrEmpty(search_sub_sa_name))
{
where += " and (s.operate_sub_sa_name like '%" + search_sub_sa_name + "%'";
where += " or u.nick_name like '%" + operate_sub_sa_name + "%')";
}
sql += where;
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_shop_account", Value = "%" + search_shop_account + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_prod_name", Value = "%" + search_prod_name + "%", });
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
//if (isDetail)
//sql = "select * from kjd.third_product_select where 1=1";
//else
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
"s.sub_user_name,s.notes,s.user_notes,s.status,s.draft_id,s.add_times,s.add_time,s.mdy_time," +
"s.fission_product_name,s.operate_sub_sa_name,s.add_sub_sa_time," +
"p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.change_cat_id,p.change_cat_name,p.ext_code,p.product_name,p.main_img," +
"u.nick_name as operate_sub_sa_nick " +
"from kjd.third_product_select s left join kjd.third_product p on s.out_product_id=p.id " +
"left join kjd.user u on u.user_name=s.operate_sub_sa_name " +
"where 1=1";
sql += where; // where子句
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductSelectResultParam> productLst = new List<ProductSelectResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
{
id = row["id"].ParseToInt(),
out_product_Id = row["out_product_Id"].ParseToString(),
shop_account = row["shop_account"].ParseToString(),
shop_id = row["shop_id"].ParseToString(),
status = row["status"].ParseToString(),
sub_user_name = row["sub_user_name"].ParseToString(),
user_name = row["user_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
change_cat_id = row["change_cat_id"].ParseToString(),
change_cat_name = row["change_cat_name"].ParseToString(),
product_name = row["product_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ParseToString(),
draft_id = row["draft_id"].ParseToString(),
add_times = row["add_times"].ParseToInt(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
operate_sub_sa_name = row["operate_sub_sa_name"].ToString(),
operate_sub_sa_nick = row["operate_sub_sa_nick"].ToString(),
fission_product_name = row["fission_product_name"].ToString(),
user_notes = row["user_notes"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
prodSelect.add_sub_sa_time = row["add_sub_sa_time"] as DateTime?;
productLst.Add(prodSelect);
}
var data = JsonUtils.SerializerObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
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 DelSelectProd(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("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.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 = "delete from kjd.third_product_select 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>
/// <returns></returns>
public string SetSelectProductSubSa(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\":\"没有用户名\"}";
}
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(shop_id))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.third_product_select set";
if (operate_sub_sa_name != null)
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
if (!string.IsNullOrEmpty(id))
sql += " where id in (" + id + ")";
else if (!string.IsNullOrEmpty(shop_id))
sql += " where shop_id in ('" + shop_id.Replace(",","','") + "')";
else
sql += " where 1=2";
if(!string.IsNullOrEmpty(status))
sql += " and status='" + status + "';";
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 MdyProductSelectNotes(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");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string user_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "user_notes"));
string fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_product_name"));
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 kjd.third_product_select set";
if (notes != null)
sql += " notes=@notes,";
if (user_notes != null)
sql += " user_notes=@user_notes,";
if (fission_product_name != null)
sql += " fission_product_name=@fission_product_name,";
sql = sql.TrimEnd(',');
sql += " where id=@id;";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@id", Value = id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@fission_product_name", Value = fission_product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@user_notes", Value = user_notes, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
-771
View File
@@ -1,771 +0,0 @@
using KJD_Web.Model;
using KJD_Web.Model.ShopModel;
using KJD_Web.Utils;
using MySqlX.XDevAPI;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace KJD_Web.BLL
{
public class ShopManage
{
public string GetShop(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var search_id = RegexUtils.GetStringQuery(ref inputData, "search_id");
var search_user_name = RegexUtils.GetStringQuery(ref inputData, "search_user_name");
var search_login_name = RegexUtils.GetStringQuery(ref inputData, "search_login_name");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_name = RegexUtils.GetStringQuery(ref inputData, "search_name");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(shop_ids))
{
List<string> shopIdLst = shop_ids.Split(',').ToList();
shop_ids = "'" + string.Join("','", shopIdLst) + "'";
}
var shop_names = RegexUtils.GetStringQuery(ref inputData, "shop_names");
if (!string.IsNullOrWhiteSpace(shop_names))
{
List<string> shopNameLst = shop_names.Split(',').ToList();
shop_names = "'" + string.Join("','", shopNameLst) + "'";
}
var shop_notes = RegexUtils.GetStringQuery(ref inputData, "shop_notes");
if (!string.IsNullOrWhiteSpace(shop_notes))
{
List<string> shopNotesLst = shop_notes.Split(',').ToList();
shop_notes = "'" + string.Join("','", shopNotesLst) + "'";
}
var page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
if (page_size == 0)
page_size = 50;
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(s.id) FROM kjd.shop s WHERE 1=1";
//where子句
string where = "";
if (isAdmin)
where += " and (s.cookie='' or s.shop_id!='')";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like '%" + user_name + "%')";
if (!string.IsNullOrWhiteSpace(operate_sub_sa_name))
where += " and s.operate_sub_sa_name='" + operate_sub_sa_name + "'";
if (!string.IsNullOrWhiteSpace(search_user_name))
where += " and s.user_name like '%" + search_user_name + "%'";
if (!string.IsNullOrWhiteSpace(search_login_name))
where += " and s.login_name like '%" + search_login_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_id))
where += " and s.shop_id like '%" + search_id + "%'";
if (!string.IsNullOrWhiteSpace(search_name))
where += " and s.shop_account like '%" + search_name + "%'";
if (!string.IsNullOrWhiteSpace(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(shop_names))
where += " and s.shop_account in (" + shop_names + ")";
if (!string.IsNullOrWhiteSpace(shop_notes))
where += " and s.notes in (" + shop_notes + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.shop_id,s.shop_account,s.sub_user_name,s.user_name," +
"s.company_name,s.notes,s.login_status,s.login_status2,c.add_product_remaining,c.add_product_month,s.add_time,s.mdy_time," +
"s.add_sub_sa_time,s.operate_sub_sa_name";
//sql += " FROM kjd.shop s WHERE 1=1";
sql += " FROM kjd.shop s LEFT JOIN kjd.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1";
sql += where; // where 子句
sql += " ORDER BY s.id DESC";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList=new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
login_status2 = row["login_status2"].ToString(),
add_product_remaining = row["add_product_remaining"].ParseToInt(),
add_product_month = row["add_product_month"].ParseToInt(),
operate_sub_sa_name = row["operate_sub_sa_name"] as string,
};
shopList.Add(shop);
}
//sql = "\r\nINSERT INTO kjd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
//foreach (var shop in shopList)
//{
// sql += "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + shop.add_product_remaining + "," + shop.add_product_month + "),";
//}
//sql = sql.TrimEnd(',') + " \r\n";
//sql += "ON DUPLICATE KEY UPDATE " +
// "shop_account=VALUES(shop_account)," +
// "add_product_remaining=VALUES(add_product_remaining)," +
// "add_product_month=VALUES(add_product_month);";
//var result = mySql.ExecuteNonQuery(sql);
//mySql.Close();
int month = DateTime.Now.Month;
var shopMonthList = shopList.Where(s => s.add_product_month != month);
if (shopMonthList.Count() > 0)
{
int remainCount = 100;
var shopMonthIdList = shopMonthList.Select(s => s.id);
mySql = new MysqlUtils(conn);
string ids = string.Join(",", shopMonthIdList);
sql = "";
sql += "update kjd.shop set add_product_remaining=" + remainCount + ", add_product_month=" + month +
" where 1=1 and id in (" + ids + ");";
sql += "\r\nINSERT INTO kjd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
foreach (var shop in shopMonthList)
{
sql+= "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + remainCount + "," + month + "),";
}
sql = sql.TrimEnd(',') + " \r\n";
sql += "ON DUPLICATE KEY UPDATE " +
"shop_account=VALUES(shop_account)," +
"add_product_remaining=VALUES(add_product_remaining)," +
"add_product_month=VALUES(add_product_month);";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
foreach (var shop in shopMonthList)
{
shop.add_product_month = month;
shop.add_product_remaining = remainCount;
}
}
}
var data = JsonUtils.SerializerObjectToString(shopList);
//return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string SubSaGetSelectProdShop(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var search_id = RegexUtils.GetStringQuery(ref inputData, "search_id");
var search_user_name = RegexUtils.GetStringQuery(ref inputData, "search_user_name");
var search_login_name = RegexUtils.GetStringQuery(ref inputData, "search_login_name");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_name = RegexUtils.GetStringQuery(ref inputData, "search_name");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(shop_ids))
{
List<string> shopIdLst = shop_ids.Split(',').ToList();
shop_ids = "'" + string.Join("','", shopIdLst) + "'";
}
var shop_names = RegexUtils.GetStringQuery(ref inputData, "shop_names");
if (!string.IsNullOrWhiteSpace(shop_names))
{
List<string> shopNameLst = shop_names.Split(',').ToList();
shop_names = "'" + string.Join("','", shopNameLst) + "'";
}
var shop_notes = RegexUtils.GetStringQuery(ref inputData, "shop_notes");
if (!string.IsNullOrWhiteSpace(shop_notes))
{
List<string> shopNotesLst = shop_notes.Split(',').ToList();
shop_notes = "'" + string.Join("','", shopNotesLst) + "'";
}
var page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
if (page_size == 0)
page_size = 50;
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(s.id) FROM kjd.shop s WHERE 1=1";
//where子句
string where = "";
if (!string.IsNullOrWhiteSpace(operate_sub_sa_name))
where += " and (s.shop_id in (SELECT DISTINCT shop_id From kjd.product_select WHERE operate_sub_sa_name='" + operate_sub_sa_name + "') or " +
"s.shop_id in (SELECT DISTINCT shop_id From kjd.third_product_select WHERE operate_sub_sa_name='" + operate_sub_sa_name + "'))";
where += " and (s.cookie='' or s.shop_id!='')";
//if (!string.IsNullOrWhiteSpace(operate_sub_sa_name))
// where += " and s.operate_sub_sa_name='" + operate_sub_sa_name + "'";
if (!string.IsNullOrWhiteSpace(search_user_name))
where += " and s.user_name like '%" + search_user_name + "%'";
if (!string.IsNullOrWhiteSpace(search_login_name))
where += " and s.login_name like '%" + search_login_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_id))
where += " and s.shop_id like '%" + search_id + "%'";
if (!string.IsNullOrWhiteSpace(search_name))
where += " and s.shop_account like '%" + search_name + "%'";
if (!string.IsNullOrWhiteSpace(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(shop_names))
where += " and s.shop_account in (" + shop_names + ")";
if (!string.IsNullOrWhiteSpace(shop_notes))
where += " and s.notes in (" + shop_notes + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.shop_id,s.shop_account,s.sub_user_name,s.user_name," +
"s.company_name,s.notes,s.login_status,s.login_status2,c.add_product_remaining,c.add_product_month,s.add_time,s.mdy_time," +
"s.add_sub_sa_time,s.operate_sub_sa_name";
sql += " FROM kjd.shop s LEFT JOIN kjd.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1";
sql += where; // where 子句
sql += " ORDER BY s.id DESC";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList = new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
login_status2 = row["login_status2"].ToString(),
add_product_remaining = row["add_product_remaining"].ParseToInt(),
add_product_month = row["add_product_month"].ParseToInt(),
operate_sub_sa_name = row["operate_sub_sa_name"] as string,
};
shopList.Add(shop);
}
//sql = "\r\nINSERT INTO kjd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
//foreach (var shop in shopList)
//{
// sql += "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + shop.add_product_remaining + "," + shop.add_product_month + "),";
//}
//sql = sql.TrimEnd(',') + " \r\n";
//sql += "ON DUPLICATE KEY UPDATE " +
// "shop_account=VALUES(shop_account)," +
// "add_product_remaining=VALUES(add_product_remaining)," +
// "add_product_month=VALUES(add_product_month);";
//var result = mySql.ExecuteNonQuery(sql);
//mySql.Close();
int month = DateTime.Now.Month;
var shopMonthList = shopList.Where(s => s.add_product_month != month);
if (shopMonthList.Count() > 0)
{
int remainCount = 100;
var shopMonthIdList = shopMonthList.Select(s => s.id);
mySql = new MysqlUtils(conn);
string ids = string.Join(",", shopMonthIdList);
sql = "";
sql += "update kjd.shop set add_product_remaining=" + remainCount + ", add_product_month=" + month +
" where 1=1 and id in (" + ids + ");";
sql += "\r\nINSERT INTO kjd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
foreach (var shop in shopMonthList)
{
sql += "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + remainCount + "," + month + "),";
}
sql = sql.TrimEnd(',') + " \r\n";
sql += "ON DUPLICATE KEY UPDATE " +
"shop_account=VALUES(shop_account)," +
"add_product_remaining=VALUES(add_product_remaining)," +
"add_product_month=VALUES(add_product_month);";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
foreach (var shop in shopMonthList)
{
shop.add_product_month = month;
shop.add_product_remaining = remainCount;
}
}
}
var data = JsonUtils.SerializerObjectToString(shopList);
//return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string UpdateAddProdRemaining(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");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var remainCount = RegexUtils.GetStringQuery(ref inputData, "remain_count");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(shop_ids))
{
List<string> shopIdLst = shop_ids.Split(',').ToList();
shop_ids = "'" + string.Join("','", shopIdLst) + "'";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql += "update kjd.shop_add_prod_count set add_product_remaining=" + remainCount +
" where 1=1 and shop_id in (" + shop_ids + ");";
var rst = mySql.ExecuteNonQuery(sql);
var msg = mySql.Message;
mySql.Close();
if (rst)
return "{\"code\":200,\"msg\":\"success\"}";
else
return "{\"code\":50000,\"msg\":\"" + msg + "\"}";
}
else
{
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
//获取一个手机登录号码下的所有店铺(以便有则更新,无则新增)
public string GetOneLoginNameShop(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select id,login_name,login_pass,cookie,cookie2,shop_id,shop_account,sub_user_name,user_name from kjd.shop where user_name='"
+ user_name + "' and login_name='" + login_name + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList = new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
};
shopList.Add(shop);
}
var data = JsonUtils.SerializerObjectToString(shopList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
//获取一个手机登录号码下特定ID的店铺
public string GetOneIdShop(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select id,login_name,login_pass,cookie,cookie2,shop_id,shop_account,sub_user_name,user_name from kjd.shop where user_name='"
+ user_name + "' and login_name='" + login_name + "' and shop_id='" + shop_id + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList = new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
};
shopList.Add(shop);
}
var data = JsonUtils.SerializerObjectToString(shopList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string AddShop(string inputData, bool isAdmin=false)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (isAdmin)
user_name = RegexUtils.GetStringQuery(ref inputData, "shop_user_name");
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
string login_pass = RegexUtils.GetStringQuery(ref inputData, "login_pass");
string sub_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_user_name"));
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
string group_name = RegexUtils.GetStringQuery(ref inputData, "group_name");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":501,\"msg\":\"没有店铺登录名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
if (string.IsNullOrEmpty(shop_id))
sql = "select exists (select 1 from kjd.shop where login_name='" + login_name + "' and user_name='" + user_name + "')";
else
sql = "select exists (select 1 from kjd.shop where login_name='" + login_name + "' and user_name='" + user_name +
"' and shop_id='" + shop_id + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist>0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"店铺" + login_name +" " + shop_account + "已存在\"}";
}
sql = "insert into kjd.shop (login_name,login_pass,cookie,cookie2,shop_account,shop_id,sub_user_name,user_name,group_name,notes,add_time,mdy_time) " +
"values ('" + login_name + "','" + login_pass + "','" + cookie + "','" + cookie2 + "','" + shop_account + "','" + shop_id + "','" +
sub_user_name + "','" + user_name + "','" + group_name + "','" + notes + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string MdyShop(string inputData, bool isAdmin=false)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (isAdmin)
user_name = RegexUtils.GetStringQuery(ref inputData, "shop_user_name");
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
string login_pass = RegexUtils.GetStringQuery(ref inputData, "login_pass");
string sub_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_user_name"));
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
string new_shop_id = RegexUtils.GetStringQuery(ref inputData, "new_shop_id");
string old_shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
string group_name = RegexUtils.GetStringQuery(ref inputData, "group_name");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string login_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":501,\"msg\":\"没有店铺登录名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.shop set";
if (login_pass != null)
sql += " login_pass='" + login_pass + "',";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (cookie2 != null)
sql += " cookie2='" + cookie2 + "',";
if (new_shop_id != null)
sql += " shop_id='" + new_shop_id + "',";
if (shop_account != null)
sql += " shop_account='" + shop_account + "',";
if (sub_user_name != null)
sql += " sub_user_name='" + sub_user_name + "',";
if (group_name != null)
sql += " group_name='" + group_name + "',";
if (notes != null)
sql += " notes='" + notes + "',";
if (login_status != null)
sql += " login_status='" + login_status + "',";
sql = sql.TrimEnd(',');
sql += " where login_name='" + login_name + "' and (user_name='" + user_name + "' or sub_user_name like '%" + user_name + "%')";
if (!string.IsNullOrEmpty(old_shop_id))
sql += " and shop_id='" + old_shop_id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string MdyCookieAndLoginStatus(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
string login_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status"));
string login_status2 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status2"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":500,\"msg\":\"店铺没有登录名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.shop set";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (cookie2 != null)
sql += " cookie2='" + cookie2 + "',";
if (login_status != null)
sql += " login_status='" + login_status + "',";
if (login_status2 != null)
sql += " login_status2='" + login_status2 + "',";
sql = sql.TrimEnd(',');
sql += " where login_name='" + login_name + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string DelShop(string inputData, bool isAdmin=false)
{
if (!string.IsNullOrEmpty(inputData))
{
var login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (isAdmin)
user_name = RegexUtils.GetStringQuery(ref inputData, "shop_user_name");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":501,\"msg\":\"没有店铺登录名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.shop where user_name='" + user_name + "' and login_name='" + login_name + "'";
if (!string.IsNullOrEmpty(shop_id))
sql += " and shop_id='" + shop_id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
/// <summary>
/// 设置店铺的二级超管
/// </summary>
/// <returns></returns>
public string SetShopSubSa(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\":\"没有用户名\"}";
}
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var login_name = RegexUtils.GetStringQuery(ref inputData, "shop_login_name")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(login_name))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.shop set";
if (operate_sub_sa_name != null)
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
if (!string.IsNullOrEmpty(id))
sql += " where id in (" + id + ")";
else if (!string.IsNullOrEmpty(login_name))
sql += " where login_name in ('" + login_name.Replace(",", "','") + "')";
else
sql += " where 1=2";
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\":\"输入为空\"}";
}
}
}
@@ -1,60 +0,0 @@
using KJD_Web.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.BLL
{
public class ToolManage
{
//mysql workbench 存储过程,可以使用分隔符重定义
// string 存储过程1 = @"
//DELIMITER $
//DROP PROCEDURE IF EXISTS add_spu_map;
//CREATE PROCEDURE add_spu_map()
//BEGIN
//insert into kjd_map.spu_map_0 (draft_id,from_spu_id,shop_id) values(9122600878,727585921,'3049342434562');
//update kjd.third_product_select set draft_id='9122600878', status='已上传', add_times=add_times+1, mdy_time='2025-08-06 11:54:50' where id=6532;
//END $
//DELIMITER ;
//CALL add_spu_map();";
//腾讯云服务器存储过程,不能使用分隔符重定义
// string 存储过程2 = @"
//DROP PROCEDURE IF EXISTS add_spu_map;
//CREATE PROCEDURE add_spu_map()
//BEGIN
//insert into kjd_map.spu_map_1 (draft_id,from_spu_id,shop_id) values(9122600878,727585921,'3049342434562');
//update kjd.third_product_select set draft_id='9122600878', status='已上传', add_times=add_times+1, mdy_time='2025-08-06 11:54:50' where id=6532;
//END ;
//CALL add_spu_map();";
public void CreateTable()
{
// string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
// MysqlUtils mySql = new MysqlUtils(conn);
// string sql = "";
// string sql1 = "";
// for (int i = 0; i < 64; i++)
// {
// //sql = @"drop table if exists kjd_map.spu_map_" + i + ";\r\n";
// sql = @"CREATE TABLE IF NOT EXISTS kjd_map.product_third_select_map_" + i + @" (
// `id` int NOT NULL AUTO_INCREMENT,
// `product_id` bigint NOT NULL COMMENT '草稿箱/商品Id',
// `product_select_db_id` bigint NOT NULL COMMENT '选品上传数据库Id',
// `shop_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '上传的店铺',
// PRIMARY KEY (`id`)
//) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '上传商品与母店商品spu映射关系';";
// sql += @"
//ALTER TABLE
// kjd_map.product_third_select_map_" + i + @"
//ADD
// COLUMN `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP";
// var rst = mySql.ExecuteNonQuery(sql);
// }
// mySql.Close();
}
}
}
@@ -1,49 +0,0 @@
using KJD_Web.Utils;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.BLL
{
public class UpadteManage
{
public string GetUpdate(string inputData)
{
//string time1 = Encryption(time);
//return "time=" + time + "&code=" + time1 + "&NbCodeVersion=1" + "&version=" + BaseClass.VersionCount
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\":\"校验失败\"}";
var version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
var serverVersion = System.Configuration.ConfigurationManager.ConnectionStrings["UpdateVersion"].ConnectionString;
var UpdateFiles = System.Configuration.ConfigurationManager.ConnectionStrings["UpdateFiles"].ConnectionString;
var UpdateExe = System.Configuration.ConfigurationManager.ConnectionStrings["UpdateExe"].ConnectionString;
var UpdateExeChk = System.Configuration.ConfigurationManager.ConnectionStrings["UpdateExeChk"].ConnectionString;
var LowVersion = System.Configuration.ConfigurationManager.ConnectionStrings["LowVersion"].ConnectionString;
if (version > LowVersion.ParseToInt())
{
return "{\"code\":200,\"msg\":\"success\",\"next_version\":" + serverVersion + ",\"exe_check\":\"" + UpdateExeChk +
"\",\"exe_address\":\"" + UpdateExe + "\",\"file_address\":\"" + UpdateFiles + "\"}";
}
else if (version > 0)
{
return "{\"code\":501,\"msg\":\"版本过低已无法直接升级,请联系管理员获取最新安装包\"}";
}
else
{
return "{\"code\":502,\"msg\":\"get update version failed\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
}
}
-470
View File
@@ -1,470 +0,0 @@
using KJD_Web.Model;
using KJD_Web.Utils;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Web;
using System.Web.UI.WebControls;
namespace KJD_Web.BLL
{
public class UserManage
{
public string CheckUserLogin(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from kjd.user where user_name='"
+ mobile + "' and password='" + password + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["user_name"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
company_name = row["company_name"].ToString(),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
};
if (string.IsNullOrEmpty(user.company_name))
{
user.company_name = "-";
}
var data = JsonUtils.SerializerObjectToString(user);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
return "{\"code\":1,\"msg\":\"用户名或密码错误\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "company"))?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select exists (select 1 from kjd.user where user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"用户名已存在\"}";
}
sql = "insert into kjd.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,parent_user_name,add_time,mdy_time) " +
"values ('" + nick_name + "','" + user_name + "','" + mobile + "','" + password + "','" + card_id + "','" +
group_id + "','" + company_name + "','" + notes + "','" + parent_user_name + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (!rst)
return "{\"code\":501,\"msg\":\""+ mySql.Message + "\"}";
else
return "{\"code\":200,\"msg\":\"子账户创建成功!\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var group = RegexUtils.GetStringQuery(ref inputData, "group");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from kjd.user where parent_user_name='"
+ user_name + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<UserLoginResultParam> userList = new List<UserLoginResultParam>();
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["mobile"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
parent_user_name = row["parent_user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
};
if (string.IsNullOrEmpty(user.mobile))
{
user.mobile = row["user_name"].ToString();
}
userList.Add(user);
}
var data = JsonUtils.SerializerObjectToString(userList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//sql = "select * from kjd.user where parent_user_name='"
// + user_name + "'";
sql = "update kjd.user set";
if (!string.IsNullOrEmpty(nick_name))
sql += " nick_name='" + nick_name + "',";
if (!string.IsNullOrEmpty(user_name))
sql += " user_name='" + user_name + "',";
if (!string.IsNullOrEmpty(mobile))
sql += " mobile='" + mobile + "',";
if (!string.IsNullOrEmpty(password))
sql += " password='" + password + "',";
if (!string.IsNullOrEmpty(group_id))
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "id");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.user where id='"
+ id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败,请稍后重试\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetAllUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var search = RegexUtils.GetStringQuery(ref inputData, "search")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
//string sql = "select * from kjd.user where group_id=3";
string sql = "select * from kjd.user where 1=1";
if (!string.IsNullOrEmpty(group_id))
sql += " and group_id=" + group_id;
if (!string.IsNullOrEmpty(sa_level))
sql += " and sa_level=" + sa_level;
if (!string.IsNullOrEmpty(search))
sql += " and (user_name like '%" + search +
"%' or nick_name like '%" + search +
"%' or company_name like '%" + search + "%')";
sql += " order by id desc";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<UserLoginResultParam> userList = new List<UserLoginResultParam>();
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["mobile"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
parent_user_name = row["parent_user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
};
if (string.IsNullOrEmpty(user.mobile))
{
user.mobile = row["user_name"].ToString();
}
userList.Add(user);
}
var data = JsonUtils.SerializerObjectToString(userList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'"); ;
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select exists (select 1 from kjd.user where user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"用户名已存在\"}";
}
sql = "insert into kjd.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,sa_level,add_time,mdy_time) " +
"values ('" + nick_name + "','" + user_name + "','" + mobile + "','" + password + "','" + card_id + "','" +
group_id + "','" + company_name + "','" + notes + "'," + sa_level + ",'" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (!rst)
return "{\"code\":501,\"msg\":\"" + mySql.Message + "\"}";
else
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//sql = "select * from kjd.user where parent_user_name='"
// + user_name + "'";
sql = "update kjd.user set";
if (!string.IsNullOrEmpty(nick_name))
sql += " nick_name='" + nick_name + "',";
if (!string.IsNullOrEmpty(user_name))
sql += " user_name='" + user_name + "',";
if (!string.IsNullOrEmpty(mobile))
sql += " mobile='" + mobile + "',";
if (!string.IsNullOrEmpty(company_name))
sql += " company_name='" + company_name + "',";
if (!string.IsNullOrEmpty(password))
sql += " password='" + password + "',";
if (!string.IsNullOrEmpty(group_id))
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
if (!string.IsNullOrEmpty(sa_level))
sql += " sa_level=" + sa_level + ",";
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 ChangePassword(string inputData)
{
var userName = RegexUtils.GetStringJson(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringJson(ref inputData, "password")?.Replace("'", "\\'");
var newPassword = RegexUtils.GetStringJson(ref inputData, "new_password")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select user_id,password from pepdtp.user where user_id='"
+ userName + "' and password='" + password + "'";
var dw = mySql.ExecuteDataTableRow(sql);
if (dw != null)
{
UserLoginResultParam user = new UserLoginResultParam
{
user_name = dw["user_id"].ToString(),
password = dw["password"].ToString(),
};
sql = "update pepdtp.user set password = '" + newPassword + "' where user_id='" + userName + "'";
var result = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (result)
{
return "{\"code\":0,\"msg\":\"密码修改成功!\"}";
}
else
return "{\"code\":19999,\"msg\":\"密码修改失败!请稍后再试。\"}";
}
else
{
mySql.Close();
return "{\"code\":1,\"msg\":\"原密码错误。\"}";
}
}
public string return_package_secret_key { get; set; } = "aaMETt2bPe6YHzZ1ojbC+6wOvgtwehqc6A+/Rz+pCUU=";
public string GetPackageSign(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var timestamp = RegexUtils.GetStringQuery(ref inputData, "timestamp")?.Replace("'", "\\'");
var mallId = RegexUtils.GetStringQuery(ref inputData, "mallId")?.Replace("'", "\\'");
var returnPackageNo = RegexUtils.GetStringQuery(ref inputData, "returnPackageNo")?.Replace("'", "\\'");
int r2 = RegexUtils.GetStringQuery(ref inputData, "r2").ParseToInt();
string c2 = RegexUtils.GetStringQuery(ref inputData, "c2");
if (EncrypUtil.Encryption(r2) != c2)
return "{\"code\":2,\"msg\":\"不合法的输入内容\"}";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from kjd.user where user_name='"
+ mobile + "' and password='" + password + "'";
sql = "select * from kjd.user where user_name='" + mobile + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt == null || dt.Rows.Count <=0)
{
return "{\"code\":1,\"msg\":\"用户不存在\"}";
}
string sign = EncrypUtil.GetMd5(timestamp + return_package_secret_key + mallId + returnPackageNo).ToLower();
return "{\"code\":200, \"sign\":\"" + sign + "\", \"msg\":\"\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
+32
View File
@@ -53,6 +53,38 @@ namespace KJD_Web
hPath = hPath.Replace("/price/", "/PriceService.asmx/");
Context.RewritePath(hPath);
}
if (!hPath.Contains(".asmx") && hPath.Contains("/bxx_user/"))
{
hPath = hPath.Replace("/bxx_user/", "/BXXUserService.asmx/");
Context.RewritePath(hPath);
}
else if (!hPath.Contains(".asmx") && hPath.Contains("/bxx_shop/"))
{
hPath = hPath.Replace("/bxx_shop/", "/BXXShopService.asmx/");
Context.RewritePath(hPath);
}
//else if (!hPath.Contains(".asmx") && hPath.Contains("/update/"))
//{
// hPath = hPath.Replace("/update/", "/UpdateService.asmx/");
// Context.RewritePath(hPath);
//}
else if (!hPath.Contains(".asmx") && hPath.Contains("/bxx_product/"))
{
hPath = hPath.Replace("/bxx_product/", "/BXXProductService.asmx/");
Context.RewritePath(hPath);
}
else if (!hPath.Contains(".asmx") && hPath.Contains("/bxx_product_third/"))
{
hPath = hPath.Replace("/bxx_product_third/", "/BXXProductThirdService.asmx/");
Context.RewritePath(hPath);
}
else if (!hPath.Contains(".asmx") && hPath.Contains("/bxx_price/"))
{
hPath = hPath.Replace("/bxx_price/", "/BXXPriceService.asmx/");
Context.RewritePath(hPath);
}
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
@@ -75,23 +75,33 @@
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />
<Content Include="BXXPriceService.asmx" />
<Content Include="PriceService.asmx" />
<Content Include="BXXProductService.asmx" />
<Content Include="BXXProductThirdService.asmx" />
<Content Include="ProductThirdService.asmx" />
<Content Include="ProductService.asmx" />
<Content Include="BXXShopService.asmx" />
<Content Include="ShopService.asmx" />
<Content Include="UpdateService.asmx" />
<Content Include="ToolService.asmx" />
<Content Include="BXXUserService.asmx" />
<Content Include="UserService.asmx" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="BLL\PriceManage.cs" />
<Compile Include="BLL\ProductThirdManage.cs" />
<Compile Include="BLL\ProductManage.cs" />
<Compile Include="BLL\ShopManage.cs" />
<Compile Include="BLL\ToolManage.cs" />
<Compile Include="BLL\UpadteManage.cs" />
<Compile Include="BLL\UserManage.cs" />
<Compile Include="BLL\BXX\BXXPriceManage.cs" />
<Compile Include="BLL\BXX\BXXProductManage.cs" />
<Compile Include="BLL\BXX\BXXProductThirdManage.cs" />
<Compile Include="BLL\BXX\BXXShopManage.cs" />
<Compile Include="BLL\BXX\BXXUserManage.cs" />
<Compile Include="BLL\KJD\PriceManage.cs" />
<Compile Include="BLL\KJD\ProductThirdManage.cs" />
<Compile Include="BLL\KJD\ProductManage.cs" />
<Compile Include="BLL\KJD\ShopManage.cs" />
<Compile Include="BLL\KJD\ToolManage.cs" />
<Compile Include="BLL\KJD\UpadteManage.cs" />
<Compile Include="BLL\KJD\UserManage.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@@ -103,10 +113,22 @@
<Compile Include="Model\ProductSelectResultParam.cs" />
<Compile Include="Model\ShopModel\ShopParam.cs" />
<Compile Include="Model\UserLoginResultParam.cs" />
<Compile Include="BXXPriceService.asmx.cs">
<DependentUpon>BXXPriceService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="PriceService.asmx.cs">
<DependentUpon>PriceService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="BXXProductService.asmx.cs">
<DependentUpon>BXXProductService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="BXXProductThirdService.asmx.cs">
<DependentUpon>BXXProductThirdService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="ProductThirdService.asmx.cs">
<DependentUpon>ProductThirdService.asmx</DependentUpon>
<SubType>Component</SubType>
@@ -116,6 +138,10 @@
<DependentUpon>ProductService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="BXXShopService.asmx.cs">
<DependentUpon>BXXShopService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="ShopService.asmx.cs">
<DependentUpon>ShopService.asmx</DependentUpon>
<SubType>Component</SubType>
@@ -128,6 +154,10 @@
<DependentUpon>ToolService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="BXXUserService.asmx.cs">
<DependentUpon>BXXUserService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="UserService.asmx.cs">
<DependentUpon>UserService.asmx</DependentUpon>
<SubType>Component</SubType>
@@ -157,6 +187,7 @@
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+77 -3
View File
@@ -490,6 +490,56 @@
<Compile Include="MainForm.designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopAddEditForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopAddEditForm.Designer.cs">
<DependentUpon>PDDShopAddEditForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ShopForms\MPddShopForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\MPddShopForm.Designer.cs">
<DependentUpon>MPddShopForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopListForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopListForm.Designer.cs">
<DependentUpon>PDDShopListForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopLoginForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopLoginForm.Designer.cs">
<DependentUpon>PDDShopLoginForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopUpdateCookieForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDShopUpdateCookieForm.Designer.cs">
<DependentUpon>PDDShopUpdateCookieForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDSubAccountListForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDSubAccountListForm.Designer.cs">
<DependentUpon>PDDSubAccountListForm.cs</DependentUpon>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDSubAccountShopEditForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\PDDSubAccountShopEditForm.Designer.cs">
<DependentUpon>PDDSubAccountShopEditForm.cs</DependentUpon>
</Compile>
<Compile Include="BLL\ShopBLL.cs" />
<Compile Include="PDDForms\ShopForms\ShopBrowserObject.cs" />
<Compile Include="PDDForms\ShopForms\UcSubAccount.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="PDDForms\ShopForms\UcSubAccount.Designer.cs">
<DependentUpon>UcSubAccount.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
@@ -791,6 +841,30 @@
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\PDDShopAddEditForm.resx">
<DependentUpon>PDDShopAddEditForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\MPddShopForm.resx">
<DependentUpon>MPddShopForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\PDDShopListForm.resx">
<DependentUpon>PDDShopListForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\PDDShopLoginForm.resx">
<DependentUpon>PDDShopLoginForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\PDDShopUpdateCookieForm.resx">
<DependentUpon>PDDShopUpdateCookieForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\PDDSubAccountListForm.resx">
<DependentUpon>PDDSubAccountListForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\PDDSubAccountShopEditForm.resx">
<DependentUpon>PDDSubAccountShopEditForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PDDForms\ShopForms\UcSubAccount.resx">
<DependentUpon>UcSubAccount.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
@@ -838,6 +912,8 @@
<Content Include="icon.ico" />
<Content Include="qk.ico" />
<Content Include="Resources\errpic.png" />
<Content Include="Resources\login_bg_pdd.png" />
<Content Include="Resources\main_form_logo_pdd.png" />
<Content Include="Static\base.css" />
<Content Include="Static\DyCategorys.txt" />
<Content Include="Static\js\jquery.dad.min.js" />
@@ -942,9 +1018,7 @@
<Name>Work</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="PDDForms\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -16,7 +16,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
public partial class AdminAccountForm : BaseForm
{
public static List<DouShopSubAccountInfo> AllUsers { get; set; } = new List<DouShopSubAccountInfo>();
public static List<ShopSubAccountInfo> AllUsers { get; set; } = new List<ShopSubAccountInfo>();
public MainForm Mf { get; set; } = null;
public string Uid { get; set; } = "";
@@ -125,7 +125,7 @@ namespace TemuKJD.KJDForms.AdminForms
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
{
string oStr = JsonHelper.SerializeObject(obj);
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
ShopSubAccountInfo user = new ShopSubAccountInfo();
user.id = BaseRegex.GetIntJson(ref oStr, "id");
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
@@ -13,6 +13,7 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.KJDForms.BaseForms;
using TemuKJD.KJDForms.ShopForms;
@@ -204,7 +205,7 @@ namespace TemuKJD.KJDForms.AdminForms
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
pageCount = Math.Max(pageCount, 1);
return AdminShopListForm.DeserializationShop(html);
return ShopBLL.DeserializationShop(html);
}
private void btnEmpty_Click(object sender, EventArgs e)
@@ -19,7 +19,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
List<string> lstShopLoginName = new List<string>();
List<DouShopSubAccountInfo> lstSubSa = new List<DouShopSubAccountInfo>();
List<ShopSubAccountInfo> lstSubSa = new List<ShopSubAccountInfo>();
public AdminShopAddSubSaForm(List<string> ShopSelectIds = null)
{
InitializeComponent();
@@ -79,7 +79,7 @@ namespace TemuKJD.KJDForms.AdminForms
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
{
string oStr = JsonHelper.SerializeObject(obj);
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
ShopSubAccountInfo user = new ShopSubAccountInfo();
user.id = BaseRegex.GetIntJson(ref oStr, "id");
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
@@ -15,6 +15,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.KJDForms.BaseForms;
using TemuKJD.KJDForms.ShopForms;
@@ -287,7 +288,8 @@ namespace TemuKJD.KJDForms.AdminForms
case "删除":
if (BaseMsgForm.ShowConfirm("确定删除店铺吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
return;
AdminDelServerShop(shop);
if (ShopBLL.AdminDelServerShop(shop))
SearchShop(this.ucSplitPage1.CurrentPage);
break;
case "编辑":
ShopAddEditForm editForm = new ShopAddEditForm(shop);
@@ -351,12 +353,12 @@ namespace TemuKJD.KJDForms.AdminForms
}
else
{
AdminAddServerShop(shopInfo);
ShopBLL.AdminAddServerShop(shopInfo);
}
}
else
{
AdminMdyServerShop(shopInfo);
ShopBLL.AdminMdyServerShop(shopInfo);
}
SearchShop(this.ucSplitPage1.CurrentPage);
}
@@ -422,165 +424,7 @@ namespace TemuKJD.KJDForms.AdminForms
pageCount = Math.Ceiling(1.0 * count / pageSize).ParseToInt();
pageCount = Math.Max(pageCount, 1);
return DeserializationShop(html);
}
public static List<ShopLoginInfo> AdminGetServerShopLstByIds(List<string> shop_ids)
{
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
shop_ids = shop_ids.Where(s => !string.IsNullOrEmpty(s)).ToList();
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
var data = UserLogin.GetSignaturex() +
"&shop_ids='" + string.Join("','", shop_ids) + "'";
data += "&page_size=200";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html)
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
{
return new List<ShopLoginInfo>();
}
return DeserializationShop(html);
}
public static string AdminGetServerShopLstForSetCookie(ShopLoginInfo loginShop, List<ShopLoginInfo> lstRst)
{
if (lstRst == null)
lstRst = new List<ShopLoginInfo>();
var url = BaseClass.BuildObjString("shop/admin_get_shop_list");
var data = UserLogin.GetSignaturex() +
"&search_user_name=" + loginShop.UserName +
"&search_login_name=" + loginShop.LoginName;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html)
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
{
return "获取失败:" + BaseRegex.GetStringJson(ref html, "msg");
}
lstRst.AddRange(DeserializationShop(html));
return "success";
}
public static List<ShopLoginInfo> DeserializationShop(string shopJson)
{
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
if (!shopJson.Contains("data"))
return list;
var jArr = JObject.Parse(shopJson)["data"];
if (jArr.Count() == 0)
return list;
foreach (JObject jObj in jArr)
{
string shopStr = jObj.ToString();
ShopLoginInfo shop = new ShopLoginInfo();
shop.DbId = BaseRegex.GetStringJson(ref shopStr, "id");
if (shop.DbId == null)
continue;
shop.LoginName = BaseRegex.GetStringJson(ref shopStr, "login_name");
shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass");
shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id");
shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account");
shop.UserName = BaseRegex.GetStringJson(ref shopStr, "user_name");
shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name");
shop.GroupName = BaseRegex.GetStringJson(ref shopStr, "shop_group");
shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie");
shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+");
shop.Cookies2 = BaseRegex.GetStringJson(ref shopStr, "cookie2").ParseToString();
shop.Cookies2 = shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+");
shop.CompanyName = BaseRegex.GetStringJson(ref shopStr, "company_name");
shop.Notes = BaseRegex.GetStringJson(ref shopStr, "notes");
shop.LoginStatus = BaseRegex.GetStringJson(ref shopStr, "login_status");
shop.LoginStatus2 = BaseRegex.GetStringJson(ref shopStr, "login_status2");
shop.OperateSubSaName = BaseRegex.GetStringJson(ref shopStr, "operate_sub_sa_name");
shop.AddProductRemaining = BaseRegex.GetIntJson(ref shopStr, "add_product_remaining");
list.Add(shop);
}
return list;
}
public static string AdminAddServerShop(ShopLoginInfo _shop)
{
var url = BaseClass.BuildObjString("shop/admin_add_shop");
var data = UserLogin.GetSignaturex()
+ "&shop_user_name=" + _shop.UserName
+ "&login_name=" + _shop.LoginName
+ "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password)
+ "&shop_id=" + _shop.ShopId
+ "&shop_account=" + _shop.ShopAccount
+ "&cookie=" + _shop.Cookies
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName)
+ "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName)
+ "&notes=" + GetHtml.UrlEncodeUtf8(_shop.Notes)
+ "&login_status=" + _shop.LoginStatus;
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref result, "msg");
if (string.IsNullOrEmpty(msg))
msg = "店铺保存失败!";
BaseMsgForm.ShowError(msg);
}
return result;
}
public static string AdminMdyServerShop(ShopLoginInfo _shop)
{
var url = BaseClass.BuildObjString("shop/admin_mdy_shop");
var data = UserLogin.GetSignaturex()
+ "&shop_user_name=" + _shop.UserName
+ "&login_name=" + _shop.LoginName
+ "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password)
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.GroupName)
+ "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName)
+ "&notes=" + GetHtml.UrlEncodeUtf8(_shop.Notes);
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref result, "msg");
if (string.IsNullOrEmpty(msg))
msg = "店铺保存失败!";
BaseMsgForm.ShowError(msg);
}
return result;
}
public void AdminDelServerShop(ShopLoginInfo _shop)
{
var url = BaseClass.BuildObjString("shop/admin_del_shop");
var data = UserLogin.GetSignaturex() + "&login_name=" + _shop.LoginName
+ "&shop_user_name=" + _shop.UserName;
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
BaseMsgForm.ShowError("删除失败:" + BaseRegex.GetStringJson(ref result, "msg"));
else
{
SearchShop(this.ucSplitPage1.CurrentPage);
}
return ShopBLL.DeserializationShop(html);
}
private void btnCheck_Click(object sender, EventArgs e)
@@ -642,7 +486,7 @@ namespace TemuKJD.KJDForms.AdminForms
var shop = shops.FirstOrDefault(v => v.LoginName == shopLoginNames[i]);
// 先从服务端取最新cookie
var serverCampanys = AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList());
var serverCampanys = ShopBLL.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList());
var serverShop = serverCampanys.FirstOrDefault();
if (shop != null && serverShop != null)
{
@@ -25,6 +25,8 @@ using Work;
using Work.BLL.Tools;
using TemuKJD.KJDForms.ShopForms;
using TemuKJD.KJDForms.ToolForms;
using TemuKJD.BLL;
namespace TemuKJD.KJDForms.AdminForms
{
public partial class AdminShopLoginForm : LRBaseForm
@@ -167,7 +169,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
newShop.LoginStatus = "登录成功";
newShop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
var html = AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端
var html = ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端
if (!html.Contains("\"code\":200"))
isSuccess = false;
}
@@ -266,7 +268,7 @@ namespace TemuKJD.KJDForms.AdminForms
{
newShop.LoginStatus2 = "国际版在线";
newShop.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
var html = AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端
var html = ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端
if (!html.Contains("\"code\":200"))
isSuccess = false;
}
@@ -24,6 +24,7 @@ using TemuKJD.KJDForms.ShopForms;
using System.Globalization;
using TemuKJD.KJDForms.ToolForms;
using System.Text.RegularExpressions;
using TemuKJD.BLL;
namespace TemuKJD.KJDForms.ProductSelectForms
{
@@ -192,7 +193,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
this.ucSplitPage1.TotalPage = pageCount;
var shopIdLst = list.Select(p => p.shop_id).Distinct().ToList();
shopLst = AdminShopListForm.AdminGetServerShopLstByIds(shopIdLst);
shopLst = ShopBLL.AdminGetServerShopLstByIds(shopIdLst);
if (defaultBitmap == null)
defaultBitmap = new Bitmap(80, 80);
@@ -789,7 +790,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
public ShopLoginInfo AdminGetServerShop(string shop_id)
{
List<ShopLoginInfo> list = AdminShopListForm.AdminGetServerShopLstByIds(new string[] { shop_id }.ToList());
List<ShopLoginInfo> list = ShopBLL.AdminGetServerShopLstByIds(new string[] { shop_id }.ToList());
return list.FirstOrDefault();
}
@@ -27,7 +27,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
List<string> lstShopSelectId = new List<string>();
SetSubSaType setSubSaType;
List<DouShopSubAccountInfo> lstSubSa = new List<DouShopSubAccountInfo>();
List<ShopSubAccountInfo> lstSubSa = new List<ShopSubAccountInfo>();
public DbProductSelectSetSubSaForm(List<string> ProductSelectIds = null,
List<string> ShopSelectIds = null, SetSubSaType type = SetSubSaType.DbProduct)
{
@@ -123,7 +123,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
{
string oStr = JsonHelper.SerializeObject(obj);
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
ShopSubAccountInfo user = new ShopSubAccountInfo();
user.id = BaseRegex.GetIntJson(ref oStr, "id");
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
@@ -25,6 +25,7 @@ using TemuKJD.KJDForms.ProductSelectForms;
using System.Text.RegularExpressions;
using System.Globalization;
using TemuKJD.KJDForms.ToolForms;
using TemuKJD.BLL;
namespace TemuKJD.KJDForms.ProductThirdSelectForms
{
@@ -125,7 +126,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
this.ucSplitPage1.TotalPage = pageCount;
var shopIdLst = list.Select(p => p.shop_id).Distinct().ToList();
shopLst = AdminShopListForm.AdminGetServerShopLstByIds(shopIdLst);
shopLst = ShopBLL.AdminGetServerShopLstByIds(shopIdLst);
if (defaultBitmap == null)
defaultBitmap = new Bitmap(80, 80);
@@ -753,7 +754,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
public ShopLoginInfo GetServerShopById(string shop_id)
{
List<ShopLoginInfo> list = AdminShopListForm.AdminGetServerShopLstByIds(new string[] { shop_id }.ToList());
List<ShopLoginInfo> list = ShopBLL.AdminGetServerShopLstByIds(new string[] { shop_id }.ToList());
return list.FirstOrDefault();
}
@@ -30,17 +30,15 @@ namespace TemuKJD.KJDForms.SalesCenterForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx3 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkIfLowCancel = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.actDiscount80 = new TemuKJD.KJDForms.SalesCenterForms.UcActivityDiscountCtrl();
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.ucCheckBox2 = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -55,6 +53,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.chkFullShop = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkNoSaleProd = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.numOnSaleDays2 = new System.Windows.Forms.NumericUpDown();
this.numSaleCount = new System.Windows.Forms.NumericUpDown();
this.cmbDays = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
@@ -62,6 +61,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.label2 = new System.Windows.Forms.Label();
this.numOnSaleDays = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnRefreshShop = new DevComponents.DotNetBar.PanelEx();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
@@ -102,6 +102,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colRecommendPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colRecommendInventory = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colTargetActivityStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPrcie = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colInventory = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -118,6 +119,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.actDiscount85.SuspendLayout();
this.actDiscount70.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numOnSaleDays2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numSaleCount)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numOnSaleDays)).BeginInit();
this.ucGroupBoxEx1.SuspendLayout();
@@ -171,6 +173,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
| System.Windows.Forms.AnchorStyles.Right)));
this.ucGroupBoxEx3.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx3.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx3.Controls.Add(this.chkIfLowCancel);
this.ucGroupBoxEx3.Controls.Add(this.actDiscount80);
this.ucGroupBoxEx3.Controls.Add(this.actDiscount85);
this.ucGroupBoxEx3.Controls.Add(this.actDiscount70);
@@ -186,6 +189,17 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.ucGroupBoxEx3.TabStop = false;
this.ucGroupBoxEx3.Text = "活动设置";
//
// chkIfLowCancel
//
this.chkIfLowCancel.AutoSize = true;
this.chkIfLowCancel.Location = new System.Drawing.Point(653, 84);
this.chkIfLowCancel.Name = "chkIfLowCancel";
this.chkIfLowCancel.Size = new System.Drawing.Size(207, 21);
this.chkIfLowCancel.TabIndex = 723;
this.chkIfLowCancel.Text = "设置库存低于最低库存不报名活动";
this.chkIfLowCancel.UseVisualStyleBackColor = true;
this.chkIfLowCancel.Visible = false;
//
// actDiscount80
//
this.actDiscount80.AutoSize = true;
@@ -198,16 +212,16 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.actDiscount80.IsDefaultInventory = false;
this.actDiscount80.Location = new System.Drawing.Point(15, 82);
this.actDiscount80.Name = "actDiscount80";
this.actDiscount80.Size = new System.Drawing.Size(318, 21);
this.actDiscount80.Size = new System.Drawing.Size(303, 26);
this.actDiscount80.TabIndex = 715;
//
// object_6dcc57fe_428d_475c_90c2_d99d71a7014f
//
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.AutoSize = true;
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.Location = new System.Drawing.Point(198, 2);
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.Location = new System.Drawing.Point(180, 2);
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.Margin = new System.Windows.Forms.Padding(0);
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.Name = "object_6dcc57fe_428d_475c_90c2_d99d71a7014f";
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.Size = new System.Drawing.Size(120, 16);
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.Size = new System.Drawing.Size(123, 21);
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.TabIndex = 706;
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.Text = "平台推荐最低库存";
this.object_6dcc57fe_428d_475c_90c2_d99d71a7014f.UseVisualStyleBackColor = true;
@@ -217,7 +231,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.ucCheckBox2.AutoSize = true;
this.ucCheckBox2.Location = new System.Drawing.Point(198, 2);
this.ucCheckBox2.Name = "ucCheckBox2";
this.ucCheckBox2.Size = new System.Drawing.Size(48, 16);
this.ucCheckBox2.Size = new System.Drawing.Size(51, 21);
this.ucCheckBox2.TabIndex = 706;
this.ucCheckBox2.Text = "默认";
this.ucCheckBox2.UseVisualStyleBackColor = true;
@@ -227,7 +241,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.ucCheckBox3.AutoSize = true;
this.ucCheckBox3.Location = new System.Drawing.Point(198, 2);
this.ucCheckBox3.Name = "ucCheckBox3";
this.ucCheckBox3.Size = new System.Drawing.Size(48, 16);
this.ucCheckBox3.Size = new System.Drawing.Size(51, 21);
this.ucCheckBox3.TabIndex = 706;
this.ucCheckBox3.Text = "默认";
this.ucCheckBox3.UseVisualStyleBackColor = true;
@@ -241,17 +255,17 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.actDiscount85.Discount = 85;
this.actDiscount85.Inventory = 10;
this.actDiscount85.IsDefaultInventory = false;
this.actDiscount85.Location = new System.Drawing.Point(351, 82);
this.actDiscount85.Location = new System.Drawing.Point(329, 82);
this.actDiscount85.Name = "actDiscount85";
this.actDiscount85.Size = new System.Drawing.Size(321, 21);
this.actDiscount85.Size = new System.Drawing.Size(306, 26);
this.actDiscount85.TabIndex = 711;
//
// object_5db00808_c6be_4ffa_a702_9b91e2208933
//
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.AutoSize = true;
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.Location = new System.Drawing.Point(198, 2);
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.Location = new System.Drawing.Point(180, 2);
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.Name = "object_5db00808_c6be_4ffa_a702_9b91e2208933";
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.Size = new System.Drawing.Size(120, 16);
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.Size = new System.Drawing.Size(123, 21);
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.TabIndex = 706;
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.Text = "平台推荐最低库存";
this.object_5db00808_c6be_4ffa_a702_9b91e2208933.UseVisualStyleBackColor = true;
@@ -261,7 +275,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.ucCheckBox1.AutoSize = true;
this.ucCheckBox1.Location = new System.Drawing.Point(198, 2);
this.ucCheckBox1.Name = "ucCheckBox1";
this.ucCheckBox1.Size = new System.Drawing.Size(48, 16);
this.ucCheckBox1.Size = new System.Drawing.Size(51, 21);
this.ucCheckBox1.TabIndex = 706;
this.ucCheckBox1.Text = "默认";
this.ucCheckBox1.UseVisualStyleBackColor = true;
@@ -274,17 +288,17 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.actDiscount70.Discount = 70;
this.actDiscount70.Inventory = 10;
this.actDiscount70.IsDefaultInventory = false;
this.actDiscount70.Location = new System.Drawing.Point(351, 54);
this.actDiscount70.Location = new System.Drawing.Point(329, 54);
this.actDiscount70.Name = "actDiscount70";
this.actDiscount70.Size = new System.Drawing.Size(321, 21);
this.actDiscount70.Size = new System.Drawing.Size(306, 26);
this.actDiscount70.TabIndex = 710;
//
// chkDiscount6
//
this.chkDiscount6.AutoSize = true;
this.chkDiscount6.Location = new System.Drawing.Point(198, 2);
this.chkDiscount6.Location = new System.Drawing.Point(180, 2);
this.chkDiscount6.Name = "chkDiscount6";
this.chkDiscount6.Size = new System.Drawing.Size(120, 16);
this.chkDiscount6.Size = new System.Drawing.Size(123, 21);
this.chkDiscount6.TabIndex = 706;
this.chkDiscount6.Text = "平台推荐最低库存";
this.chkDiscount6.UseVisualStyleBackColor = true;
@@ -298,7 +312,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.actDiscount60.IsDefaultInventory = false;
this.actDiscount60.Location = new System.Drawing.Point(15, 54);
this.actDiscount60.Name = "actDiscount60";
this.actDiscount60.Size = new System.Drawing.Size(318, 21);
this.actDiscount60.Size = new System.Drawing.Size(303, 23);
this.actDiscount60.TabIndex = 709;
//
// panelEx2
@@ -308,7 +322,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.panelEx2.Cursor = System.Windows.Forms.Cursors.Hand;
this.panelEx2.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panelEx2.Location = new System.Drawing.Point(1055, 32);
this.panelEx2.Location = new System.Drawing.Point(1050, 32);
this.panelEx2.Name = "panelEx2";
this.panelEx2.Size = new System.Drawing.Size(70, 23);
this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -333,7 +347,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.chkFullShop.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkFullShop.Location = new System.Drawing.Point(18, 27);
this.chkFullShop.Name = "chkFullShop";
this.chkFullShop.Size = new System.Drawing.Size(96, 16);
this.chkFullShop.Size = new System.Drawing.Size(99, 21);
this.chkFullShop.TabIndex = 684;
this.chkFullShop.Text = "报名全店活动";
this.chkFullShop.UseVisualStyleBackColor = true;
@@ -344,7 +358,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.chkNoSaleProd.AutoSize = true;
this.chkNoSaleProd.Location = new System.Drawing.Point(120, 27);
this.chkNoSaleProd.Name = "chkNoSaleProd";
this.chkNoSaleProd.Size = new System.Drawing.Size(96, 16);
this.chkNoSaleProd.Size = new System.Drawing.Size(99, 21);
this.chkNoSaleProd.TabIndex = 685;
this.chkNoSaleProd.Text = "算法报名活动";
this.chkNoSaleProd.UseVisualStyleBackColor = true;
@@ -352,6 +366,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
//
// panel1
//
this.panel1.Controls.Add(this.numOnSaleDays2);
this.panel1.Controls.Add(this.numSaleCount);
this.panel1.Controls.Add(this.cmbDays);
this.panel1.Controls.Add(this.label4);
@@ -359,17 +374,35 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.numOnSaleDays);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.label5);
this.panel1.Location = new System.Drawing.Point(223, 23);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(397, 26);
this.panel1.Size = new System.Drawing.Size(545, 26);
this.panel1.TabIndex = 722;
this.panel1.Visible = false;
//
// numOnSaleDays2
//
this.numOnSaleDays2.Location = new System.Drawing.Point(143, 2);
this.numOnSaleDays2.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.numOnSaleDays2.Name = "numOnSaleDays2";
this.numOnSaleDays2.Size = new System.Drawing.Size(46, 23);
this.numOnSaleDays2.TabIndex = 730;
this.numOnSaleDays2.Value = new decimal(new int[] {
9999,
0,
0,
0});
//
// numSaleCount
//
this.numSaleCount.Location = new System.Drawing.Point(286, 2);
this.numSaleCount.Location = new System.Drawing.Point(329, 2);
this.numSaleCount.Name = "numSaleCount";
this.numSaleCount.Size = new System.Drawing.Size(40, 21);
this.numSaleCount.Size = new System.Drawing.Size(40, 23);
this.numSaleCount.TabIndex = 726;
//
// cmbDays
@@ -379,7 +412,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.cmbDays.Items.AddRange(new object[] {
"7",
"30"});
this.cmbDays.Location = new System.Drawing.Point(203, 1);
this.cmbDays.Location = new System.Drawing.Point(246, 1);
this.cmbDays.Name = "cmbDays";
this.cmbDays.Size = new System.Drawing.Size(38, 24);
this.cmbDays.TabIndex = 729;
@@ -388,35 +421,40 @@ namespace TemuKJD.KJDForms.SalesCenterForms
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(243, 6);
this.label4.Location = new System.Drawing.Point(286, 5);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 728;
this.label4.Text = "天销量";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(328, 6);
this.label3.Location = new System.Drawing.Point(371, 5);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.Size = new System.Drawing.Size(68, 17);
this.label3.TabIndex = 727;
this.label3.Text = "以内的商品";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(148, 6);
this.label2.Location = new System.Drawing.Point(191, 5);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.Size = new System.Drawing.Size(56, 17);
this.label2.TabIndex = 725;
this.label2.Text = "天,且近";
//
// numOnSaleDays
//
this.numOnSaleDays.Location = new System.Drawing.Point(106, 2);
this.numOnSaleDays.Location = new System.Drawing.Point(80, 2);
this.numOnSaleDays.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.numOnSaleDays.Name = "numOnSaleDays";
this.numOnSaleDays.Size = new System.Drawing.Size(40, 21);
this.numOnSaleDays.Size = new System.Drawing.Size(46, 23);
this.numOnSaleDays.TabIndex = 724;
this.numOnSaleDays.Value = new decimal(new int[] {
30,
@@ -427,11 +465,20 @@ namespace TemuKJD.KJDForms.SalesCenterForms
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 6);
this.label1.Location = new System.Drawing.Point(3, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(101, 12);
this.label1.Size = new System.Drawing.Size(80, 17);
this.label1.TabIndex = 723;
this.label1.Text = "设置加站时间超过";
this.label1.Text = "设置加站时间";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(125, 5);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(20, 17);
this.label5.TabIndex = 731;
this.label5.Text = "至";
//
// ucGroupBoxEx1
//
@@ -494,7 +541,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.chkGetDiscount.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkGetDiscount.Location = new System.Drawing.Point(20, 68);
this.chkGetDiscount.Name = "chkGetDiscount";
this.chkGetDiscount.Size = new System.Drawing.Size(96, 28);
this.chkGetDiscount.Size = new System.Drawing.Size(99, 38);
this.chkGetDiscount.TabIndex = 0;
this.chkGetDiscount.Text = "同时查询折扣\r\n (较耗时)";
this.chkGetDiscount.UseVisualStyleBackColor = true;
@@ -566,18 +613,18 @@ namespace TemuKJD.KJDForms.SalesCenterForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -588,14 +635,6 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colLoginStatus,
this.colCanUse,
this.colMessage});
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.DefaultCellStyle = dataGridViewCellStyle12;
this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvShop.Location = new System.Drawing.Point(4, 0);
this.dgvShop.Name = "dgvShop";
@@ -693,19 +732,19 @@ namespace TemuKJD.KJDForms.SalesCenterForms
//
this.dgvActivity.AllowUserToAddRows = false;
this.dgvActivity.AllowUserToDeleteRows = false;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvActivity.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvActivity.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
this.dgvActivity.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvActivity.BackgroundColor = System.Drawing.Color.White;
this.dgvActivity.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvActivity.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvActivity.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
this.dgvActivity.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvActivity.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheckActivity,
@@ -717,14 +756,6 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colSignUpTime,
this.colDiscount,
this.colActivityMsg});
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvActivity.DefaultCellStyle = dataGridViewCellStyle15;
this.dgvActivity.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvActivity.Location = new System.Drawing.Point(0, 0);
this.dgvActivity.Name = "dgvActivity";
@@ -801,18 +832,18 @@ namespace TemuKJD.KJDForms.SalesCenterForms
//
this.dgvProduct.AllowUserToAddRows = false;
this.dgvProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle16.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
this.dgvProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle17.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheckProduct,
@@ -827,17 +858,10 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colExtCode,
this.colRecommendPrice,
this.colRecommendInventory,
this.colTargetActivityStock,
this.colPrcie,
this.colInventory,
this.colMsg});
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvProduct.DefaultCellStyle = dataGridViewCellStyle18;
this.dgvProduct.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvProduct.Location = new System.Drawing.Point(0, 0);
this.dgvProduct.Name = "dgvProduct";
@@ -939,6 +963,13 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colRecommendInventory.ReadOnly = true;
this.colRecommendInventory.Width = 65;
//
// colTargetActivityStock
//
this.colTargetActivityStock.HeaderText = "最低库存";
this.colTargetActivityStock.Name = "colTargetActivityStock";
this.colTargetActivityStock.ReadOnly = true;
this.colTargetActivityStock.Width = 65;
//
// colPrcie
//
this.colPrcie.HeaderText = "申报价格";
@@ -1045,6 +1076,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1424, 529);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "MarketingActivityForm";
this.Text = "店铺优化";
this.Load += new System.EventHandler(this.MarketingActivityForm_Load);
@@ -1063,6 +1095,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.actDiscount70.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numOnSaleDays2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numSaleCount)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numOnSaleDays)).EndInit();
this.ucGroupBoxEx1.ResumeLayout(false);
@@ -1127,21 +1160,6 @@ namespace TemuKJD.KJDForms.SalesCenterForms
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown numOnSaleDays;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckProduct;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubmitActivityId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubmitActivityName;
private System.Windows.Forms.DataGridViewImageColumn colPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colProdName;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn coSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrcie;
private System.Windows.Forms.DataGridViewTextBoxColumn colInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.NumericUpDown numSaleCount;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox cmbDays;
@@ -1163,5 +1181,24 @@ namespace TemuKJD.KJDForms.SalesCenterForms
private System.Windows.Forms.DataGridViewTextBoxColumn colLoginStatus;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckProduct;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubmitActivityId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubmitActivityName;
private System.Windows.Forms.DataGridViewImageColumn colPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colProdName;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn coSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colTargetActivityStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrcie;
private System.Windows.Forms.DataGridViewTextBoxColumn colInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private UserComponent.UcCheckBox chkIfLowCancel;
private System.Windows.Forms.NumericUpDown numOnSaleDays2;
private System.Windows.Forms.Label label5;
}
}
@@ -393,9 +393,11 @@ namespace TemuKJD.KJDForms.SalesCenterForms
pActThematic.activityTypeName = pActivity.activityName;
lstActivityThematic.Add(pActThematic);
string name = pActThematic.activityThematicName;
pActThematic.discount = BaseRegex.GetMatchRegexString(ref name, "(\\d{1,3}折)").ParseToString();
pActThematic.discount = pActThematic.discount.Replace("折", "");
pActThematic.discount = BaseRegex.GetMatchRegexString(ref name, "(\\d{1,3}(\\.?\\d?)折)").ParseToString();
pActThematic.discount = pActThematic.discount.Replace("折", "").Replace(".","");
pActThematic.discount = string.IsNullOrWhiteSpace(pActThematic.discount) ? "" : pActThematic.discount;
if (pActThematic.discount.Length == 1)
pActThematic.discount += "0"; // 补0
}
}
}
@@ -636,6 +638,8 @@ namespace TemuKJD.KJDForms.SalesCenterForms
var dailyPrice = skuObj["dailyPrice"].ParseToInt();
var discount = suggestActivityPrice * 100.0 / dailyPrice;
actInfo.discount = Math.Round(discount) + "";
if (actInfo.discount.Length == 1)
actInfo.discount += "0"; // 补0
Invoke(new Action(() =>
{
actRow.Cells["colDiscount"].Value = string.IsNullOrEmpty(actInfo.discount) ? "-" : actInfo.discount.TrimEnd('0') + "折";
@@ -665,7 +669,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
return lstDiscount.First();
if (discount >= lstDiscount.Last())
return lstDiscount.Last();
for (int i = 0; i < lstDiscount.Count - 2; i++)
for (int i = 0; i < lstDiscount.Count - 1; i++)
{
if (discount >= lstDiscount[i] && discount < lstDiscount[i + 1])
return lstDiscount[i];
@@ -732,6 +736,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
public List<string> GetNoSaleProd(string shopId)
{
int onSaleDays = 0;
int onSaleDays2 = 9999;
int saleCount = 0;
string days = "7";
//int i = 0;
@@ -741,6 +746,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
{
days = cmbDays.Text;
onSaleDays = numOnSaleDays.Value.ParseToInt();
onSaleDays2 = numOnSaleDays2.Value.ParseToInt();
saleCount = numSaleCount.Value.ParseToInt();
this.statusBar.lblTaskStatus.Text = "正在查询无销量商品...";
@@ -775,7 +781,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
{
page++;
string jsonRst = GetNoSaleProd(shop, days, onSaleDays, saleCount, page);
string jsonRst = GetNoSaleProd(shop, days, onSaleDays, onSaleDays2, saleCount, page);
if (!jsonRst.Contains("\"success\":true"))
{
@@ -871,7 +877,12 @@ namespace TemuKJD.KJDForms.SalesCenterForms
int tryCount = 0;
tryAgain:
Thread.Sleep(100 + Randomx.GetId(200));
if (chkNoSaleProd.Checked && noSaleProdIdLst.Count == 0)
{
noSaleProdIdLst.Add("123");
}
var jsonRst = GetActivityMatch(shop, activity.activityType, activity.activityThematicId, string.Join(",", noSaleProdIdLst));
if (jsonRst.Contains("指定的值含有无效的控制字符") || jsonRst.Contains("login") || jsonRst.Contains("Login"))
{
Invoke(new Action(() =>
@@ -948,8 +959,10 @@ namespace TemuKJD.KJDForms.SalesCenterForms
discountCtrl = this.actDiscount85;
// 如果是默认库存或者库存小于推荐值,使用推荐库存
int inventory = discountCtrl.Inventory;
if (inventory < prod.suggestActivityStock || discountCtrl.IsDefaultInventory)
inventory = prod.suggestActivityStock.ParseToInt();
//if (inventory < prod.suggestActivityStock || discountCtrl.IsDefaultInventory)
// inventory = prod.suggestActivityStock.ParseToInt();
if (inventory < prod.targetActivityStock || discountCtrl.IsDefaultInventory)
inventory = prod.targetActivityStock.ParseToInt();
Invoke(new Action(() =>
{
int rowId = dgvProduct.Rows.Add(
@@ -965,13 +978,23 @@ namespace TemuKJD.KJDForms.SalesCenterForms
prod.skcList.FirstOrDefault()?.extCode,
activity.discount.Trim('0') + "折",
prod.suggestActivityStock,
prod.targetActivityStock,
activity.discount.Trim('0') + "折",
inventory
);
dgvProduct.Rows[rowId].Height = 30;
prodSubmitRows.Add(dgvProduct.Rows[rowId]);
// 过低的报名数量则不参与活动
if (!discountCtrl.IsDefaultInventory && chkIfLowCancel.Checked && discountCtrl.Inventory < prod.targetActivityStock)
{
}
else
prodSubmitRows.Add(dgvProduct.Rows[rowId]);
}));
if (!discountCtrl.IsDefaultInventory && chkIfLowCancel.Checked && discountCtrl.Inventory < prod.targetActivityStock)
{
continue;
}
ActProductListItem activityProditem = new ActProductListItem();
activityProditem.productId = prod.productId;
activityProditem.activityStock = inventory;
@@ -1137,16 +1160,16 @@ namespace TemuKJD.KJDForms.SalesCenterForms
/// <param name="onSalesDays">加入站点天数</param>
/// <param name="page"></param>
/// <returns></returns>
private string GetNoSaleProd(ShopLoginInfo shop, string days, int onSalesDays, int saleCount = 0, int page=1)
private string GetNoSaleProd(ShopLoginInfo shop, string days, int onSalesDays, int onSalesDays2, int saleCount = 0, int page=1)
{
string url = "https://agentseller.temu.com/mms/venom/api/supplier/sales/management/listWarehouse";
string body;
if (days == "7")
body = @"{""pageNo"":" + page + @",""pageSize"":40,""isLack"":0,""selectStatusList"":[12],""priceAdjustRecentDays"":7,
""sevenDaysSaleVolumMin"":0, ""sevenDaysSaleVolumMax"":" + saleCount + @",""onSalesDurationOfflineGte"":" + onSalesDays + "}";
""sevenDaysSaleVolumMin"":0, ""sevenDaysSaleVolumMax"":" + saleCount + @",""onSalesDurationOfflineGte"":" + onSalesDays + @",""onSalesDurationOfflineLte"":" + onSalesDays2 + "}";
else
body = @"{""pageNo"":" + page + @",""pageSize"":40,""isLack"":0,""selectStatusList"":[12],""priceAdjustRecentDays"":7,
""thirtyDaysSaleVolumMin"":0, ""thirtyDaysSaleVolumMax"":" + saleCount + @",""onSalesDurationOfflineGte"":" + onSalesDays + "}";
""thirtyDaysSaleVolumMin"":0, ""thirtyDaysSaleVolumMax"":" + saleCount + @",""onSalesDurationOfflineGte"":" + onSalesDays + @",""onSalesDurationOfflineLte"":"+ onSalesDays2 + "}";
string refere = "https://agentseller.temu.com/stock/fully-mgt/sale-manage/main";
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
@@ -198,6 +198,9 @@
<metadata name="colRecommendInventory.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colTargetActivityStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPrcie.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -31,7 +31,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
{
this.components = new System.ComponentModel.Container();
this.numInventory = new System.Windows.Forms.NumericUpDown();
this.chkDefaultInventory = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkMinInventory = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numInventory)).BeginInit();
this.SuspendLayout();
@@ -46,7 +46,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
0,
0});
this.numInventory.Name = "numInventory";
this.numInventory.Size = new System.Drawing.Size(65, 21);
this.numInventory.Size = new System.Drawing.Size(49, 21);
this.numInventory.TabIndex = 707;
this.numInventory.Value = new decimal(new int[] {
10,
@@ -55,16 +55,17 @@ namespace TemuKJD.KJDForms.SalesCenterForms
0});
this.numInventory.ValueChanged += new System.EventHandler(this.numInventory_ValueChanged);
//
// chkDefaultInventory
// chkMinInventory
//
this.chkDefaultInventory.AutoSize = true;
this.chkDefaultInventory.Location = new System.Drawing.Point(198, 2);
this.chkDefaultInventory.Margin = new System.Windows.Forms.Padding(0);
this.chkDefaultInventory.Name = "chkDefaultInventory";
this.chkDefaultInventory.Size = new System.Drawing.Size(120, 16);
this.chkDefaultInventory.TabIndex = 706;
this.chkDefaultInventory.Text = "平台推荐最低库存";
this.chkDefaultInventory.UseVisualStyleBackColor = true;
this.chkMinInventory.AutoSize = true;
this.chkMinInventory.Location = new System.Drawing.Point(180, 2);
this.chkMinInventory.Margin = new System.Windows.Forms.Padding(0);
this.chkMinInventory.Name = "chkMinInventory";
this.chkMinInventory.Size = new System.Drawing.Size(120, 16);
this.chkMinInventory.TabIndex = 706;
this.chkMinInventory.Text = "平台允许最低库存";
this.chkMinInventory.UseVisualStyleBackColor = true;
this.chkMinInventory.CheckedChanged += new System.EventHandler(this.chkDefaultInventory_CheckedChanged);
//
// label1
//
@@ -82,10 +83,10 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.Controls.Add(this.numInventory);
this.Controls.Add(this.chkDefaultInventory);
this.Controls.Add(this.chkMinInventory);
this.Controls.Add(this.label1);
this.Name = "UcActivityDiscountCtrl";
this.Size = new System.Drawing.Size(318, 21);
this.Size = new System.Drawing.Size(300, 21);
((System.ComponentModel.ISupportInitialize)(this.numInventory)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -95,7 +96,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
#endregion
private System.Windows.Forms.NumericUpDown numInventory;
private UserComponent.UcCheckBox chkDefaultInventory;
private UserComponent.UcCheckBox chkMinInventory;
private System.Windows.Forms.Label label1;
}
}
@@ -73,13 +73,13 @@ namespace TemuKJD.KJDForms.SalesCenterForms
{
get
{
return this.chkDefaultInventory.Checked;
return this.chkMinInventory.Checked;
}
set
{
if (this.chkDefaultInventory.Checked != value)
if (this.chkMinInventory.Checked != value)
{
this.chkDefaultInventory.Checked = value;
this.chkMinInventory.Checked = value;
this.Invalidate();
}
}
@@ -89,5 +89,10 @@ namespace TemuKJD.KJDForms.SalesCenterForms
{
this.inventory = numInventory.Value.ParseToInt();
}
private void chkDefaultInventory_CheckedChanged(object sender, EventArgs e)
{
numInventory.Enabled = !chkMinInventory.Checked;
}
}
}
+4 -3
View File
@@ -21,6 +21,7 @@ using Work;
using NaiBa.Util;
using System.Globalization;
using TemuKJD.KJDForms.AdminForms;
using TemuKJD.BLL;
namespace TemuKJD.KJDForms.ShopForms
{
@@ -171,7 +172,7 @@ namespace TemuKJD.KJDForms.ShopForms
if (jArr.Count() == 0)
break;
list.AddRange(AdminForms.AdminShopListForm.DeserializationShop(html));
list.AddRange(ShopBLL.DeserializationShop(html));
}
return list;
}
@@ -619,7 +620,7 @@ namespace TemuKJD.KJDForms.ShopForms
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopNames[i]);
// 先从服务端取最新cookie
var serverCampanys = AdminShopListForm.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList());
var serverCampanys = ShopBLL.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList());
var sss = string.Join(",", serverCampanys.Select(s => s.UserName + s.ShopAccount));
var serverShop = serverCampanys.FirstOrDefault();
if (shop != null && serverShop != null)
@@ -760,7 +761,7 @@ namespace TemuKJD.KJDForms.ShopForms
shop.ShopSubAccountList.Clear();
if (!string.IsNullOrWhiteSpace(shop.SubUserName))
{
DouShopSubAccountInfo subAccount = new DouShopSubAccountInfo();
ShopSubAccountInfo subAccount = new ShopSubAccountInfo();
subAccount.sub_user_name = shop.SubUserName;
subAccount.user_name = shop.SubUserName;
subAccount.shop_login_name = shop.LoginName;
@@ -15,6 +15,7 @@ using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using Work;
using TemuKJD.KJDForms.AdminForms;
using TemuKJD.BLL;
namespace TemuKJD.KJDForms.ShopForms
{
@@ -156,7 +157,7 @@ namespace TemuKJD.KJDForms.ShopForms
}
List<ShopLoginInfo> serverShopLst = new List<ShopLoginInfo>();
var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
var rst = ShopBLL.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
if (rst != "success")
{
@@ -233,7 +234,7 @@ namespace TemuKJD.KJDForms.ShopForms
}
List<ShopLoginInfo> serverShopLst = new List<ShopLoginInfo>();
var rst = AdminShopListForm.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
var rst = ShopBLL.AdminGetServerShopLstForSetCookie(shopLoginInfo, serverShopLst);
if (rst != "success")
{
@@ -310,7 +311,7 @@ namespace TemuKJD.KJDForms.ShopForms
if (oldServerShop == null)
{
if (updateFrom != SetCookieFromEnum.normal_user)
AdminShopListForm.AdminAddServerShop(newShop); // 店铺写入到服务端
ShopBLL.AdminAddServerShop(newShop); // 店铺写入到服务端
else
ShopListForm.AddServerDouShop(newShop); // 店铺写入到服务端
}
@@ -16,7 +16,7 @@ namespace TemuKJD.KJDForms.ShopForms
{
public partial class SubAccountListForm : BaseForm
{
public static List<DouShopSubAccountInfo> AllUsers { get; set; } = new List<DouShopSubAccountInfo>();
public static List<ShopSubAccountInfo> AllUsers { get; set; } = new List<ShopSubAccountInfo>();
public MainForm Mf { get; set; } = null;
public string Uid { get; set; } = "";
public SubAccountListForm()
@@ -120,7 +120,7 @@ namespace TemuKJD.KJDForms.ShopForms
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
{
string oStr = JsonHelper.SerializeObject(obj);
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
ShopSubAccountInfo user = new ShopSubAccountInfo();
user.id = BaseRegex.GetIntJson(ref oStr, "id");
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
@@ -17,9 +17,9 @@ namespace TemuKJD.KJDForms.ShopForms
public partial class SubAccountShopEditForm : LRBaseForm
{
ShopLoginInfo shop = null;
public List<DouShopSubAccountInfo> AllSubAccountList { get; set; } = new List<DouShopSubAccountInfo>();
public List<DouShopSubAccountInfo> ShopSubAccountList { get; set; } = new List<DouShopSubAccountInfo>();
public List<DouShopSubAccountInfo> NotShopSubAccountList { get; set; } = new List<DouShopSubAccountInfo>();
public List<ShopSubAccountInfo> AllSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
public List<ShopSubAccountInfo> ShopSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
public List<ShopSubAccountInfo> NotShopSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
public SubAccountShopEditForm(ShopLoginInfo _shop)
{
InitializeComponent();
@@ -51,7 +51,7 @@ namespace TemuKJD.KJDForms.ShopForms
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
{
string oStr = JsonHelper.SerializeObject(obj);
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
ShopSubAccountInfo user = new ShopSubAccountInfo();
user.id = BaseRegex.GetIntJson(ref oStr, "id");
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
@@ -134,8 +134,8 @@ namespace TemuKJD.KJDForms.ShopForms
private void btnOk_Click(object sender, EventArgs e)
{
List<DouShopSubAccountInfo> AddUsers = new List<DouShopSubAccountInfo>();
List<DouShopSubAccountInfo> DeleteUsers = new List<DouShopSubAccountInfo>();
List<ShopSubAccountInfo> AddUsers = new List<ShopSubAccountInfo>();
List<ShopSubAccountInfo> DeleteUsers = new List<ShopSubAccountInfo>();
foreach (Control c in this.flpNotSubAccount.Controls)
{
var co = c as UcSubAccount;
+2 -2
View File
@@ -13,14 +13,14 @@ namespace TemuKJD.KJDForms.ShopForms
{
public partial class UcSubAccount : UserControl
{
public DouShopSubAccountInfo subAccount = null;
public ShopSubAccountInfo subAccount = null;
public delegate void SubAcountDelegate(object obj);
public event SubAcountDelegate AddSubAcountEvent;
public event SubAcountDelegate RemoveSubAcountEvent;
public UcSubAccount(DouShopSubAccountInfo _subAccount, bool isNotShopSubAccount = true)
public UcSubAccount(ShopSubAccountInfo _subAccount, bool isNotShopSubAccount = true)
{
InitializeComponent();
subAccount = _subAccount;
+26 -4
View File
@@ -39,6 +39,7 @@ using AllBase.Model.Param.ProductManage;
using TemuKJD.KJDForms.SalesCenterForms;
using NaiBa.CefHelper.Handler;
using TemuKJD.KJDForms.AdminForms;
using TemuKJD.PDDForms.ShopForms;
namespace TemuKJD
{
@@ -141,6 +142,9 @@ namespace TemuKJD
InitializeComponent();
LoginType = loginType;
if (loginType == "Pdd")
BaseClass.MainPath = "binxixi";
instance = this;
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
}
@@ -190,6 +194,13 @@ namespace TemuKJD
//
//return;
if (BaseClass.MainPath == "binxixi")
{
//this.pbLogo.Image = Properties.Resources.main_form_logo_pdd;
BaseClass.LogoImage = Properties.Resources.main_form_logo_pdd;
BaseClass.Ico = Icon.FromHandle(Properties.Resources.system_pdd.GetHicon());
}
Rectangle rect = Screen.GetWorkingArea(this);
int width = rect.Width;
int height = rect.Height;
@@ -624,14 +635,25 @@ namespace TemuKJD
}
//internal GoodsCollectForm gcf;
private ShopForm shopForm;
private object shopForm;
private void pnlShop_Click(object sender, EventArgs e)
{
if (shopForm == null)
if (BaseClass.MainPath == "kuajingda")
{
shopForm = new ShopForm();
if (shopForm == null)
{
shopForm = new ShopForm();
}
ShowMainPanel(shopForm as ShopForm, sender as Panel);
}
else
{
if (shopForm == null)
{
shopForm = new MPddShopForm();
}
ShowMainPanel(shopForm as MPddShopForm, sender as Panel);
}
ShowMainPanel(shopForm, sender as Panel);
}
private AdminForm adminForm;
+20
View File
@@ -293,6 +293,16 @@ namespace TemuKJD.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap login_bg_pdd {
get {
object obj = ResourceManager.GetObject("login_bg_pdd", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
@@ -323,6 +333,16 @@ namespace TemuKJD.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap main_form_logo_pdd {
get {
object obj = ResourceManager.GetObject("main_form_logo_pdd", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
+6
View File
@@ -178,6 +178,9 @@
<data name="login_bg_agent" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\login_bg_agent.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="login_bg_pdd" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\login_bg_pdd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="login_input_bg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\login_input_bg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -187,6 +190,9 @@
<data name="main_form_logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\main_form_logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="main_form_logo_pdd" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\main_form_logo_pdd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="main_form_top_right_bg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\main_form_top_right_bg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Binary file not shown.
+3
View File
@@ -38,6 +38,9 @@ namespace TemuKJD.UserForm
private void LoginForm_Load(object sender, EventArgs e)
{
if (BaseClass.MainPath == "binxixi")
this.panelEx1.Style.BackgroundImage = Properties.Resources.login_bg_pdd;
GetUserList();
#if DEBUG
if (File.Exists(System.Environment.CurrentDirectory + "\\TemuKJD.exe.choice.debug.tools"))