1拼多多sku货号价格 2拼多多sku增删改功能(70%)
This commit is contained in:
1 parent
4dde0936ed
commit
ad238cd241
31 files changed
+3155
-348
No files matched your search
@@ -596,5 +596,256 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public string AddExtCodePrice(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 ext_code_price = RegexUtils.GetStringQuery(ref inputData, "ext_code_price").ParseToInt();
|
||||
|
||||
if (string.IsNullOrEmpty(user_name))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
if (string.IsNullOrEmpty(ext_code))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"没有货号\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
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 = "@ext_code_price", Value = ext_code_price, });
|
||||
|
||||
string sql= "select count(ext_code) from bxx.ext_code_price where ext_code=@ext_code";
|
||||
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
|
||||
if (count.ParseToInt() > 0)
|
||||
{
|
||||
sql = "update bxx.ext_code_price set ext_code_price=@ext_code_price where ext_code=@ext_code";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "insert into bxx.ext_code_price (ext_code,ext_code_price) values (@ext_code,@ext_code_price);";
|
||||
}
|
||||
|
||||
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 GetExtCodePriceList(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_ext_price = RegexUtils.GetStringQuery(ref inputData, "start_ext_price");
|
||||
string end_ext_price = RegexUtils.GetStringQuery(ref inputData, "end_ext_price");
|
||||
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
|
||||
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.Int32, ParameterName = "@start_ext_price", Value = start_ext_price.ParseToInt(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_ext_price", Value = end_ext_price.ParseToInt(), });
|
||||
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 bxx.ext_code_price p where 1=1";
|
||||
|
||||
string where = "";
|
||||
if (!string.IsNullOrWhiteSpace(search_ext_code))
|
||||
where += " and p.ext_code like @search_ext_code";
|
||||
if (!string.IsNullOrWhiteSpace(start_ext_price))
|
||||
where += " and p.ext_code_price >= @start_ext_price";
|
||||
if (!string.IsNullOrWhiteSpace(end_ext_price))
|
||||
where += " and p.ext_code_price <= @end_ext_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 bxx.ext_code_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<DBExtCodePriceResult> priceList = new List<DBExtCodePriceResult>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
DBExtCodePriceResult price = new DBExtCodePriceResult
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
ext_code_price = row["ext_code_price"].ParseToInt(),
|
||||
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 DelDbExtCodePrice(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 bxx.ext_code_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\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string MdyDBExtCodePrice(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 ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
|
||||
string ext_code_price = RegexUtils.GetStringQuery(ref inputData, "original_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 = "@ext_code_price", Value = ext_code_price.ParseToInt(), });
|
||||
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 bxx.ext_code_price 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 bxx.ext_code_price set";
|
||||
if (ext_code != null)
|
||||
sql += " ext_code=@ext_code,";
|
||||
if (ext_code_price != null)
|
||||
sql += " ext_code_price=@ext_code_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\":\"输入为空\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,16 +211,24 @@ namespace KJD_Web.BLL.BXX
|
||||
else
|
||||
{
|
||||
if (isDetail)
|
||||
sql = "select p.*,s.img_base64,s.img_url from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where p.is_del=0";
|
||||
sql = "select p.*,s.img_base64,s.img_url,e.ext_code_price from bxx.product p" +
|
||||
" left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
|
||||
" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
|
||||
" where p.is_del=0";
|
||||
else if (string.IsNullOrEmpty(get_select_count))
|
||||
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
|
||||
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,s.img_url from bxx.product p " +
|
||||
"left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where p.is_del=0";
|
||||
" p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,s.img_url,e.ext_code_price" +
|
||||
" FROM bxx.product p " +
|
||||
" left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" +
|
||||
" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
|
||||
" where p.is_del=0";
|
||||
else
|
||||
sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
|
||||
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,s.img_url,COUNT(se.id) AS select_count " +
|
||||
"FROM bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " +
|
||||
"WHERE p.is_del=0";
|
||||
" p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,s.img_url,COUNT(se.id) AS select_count," +
|
||||
" e.ext_code_price" +
|
||||
" FROM bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " +
|
||||
" LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" +
|
||||
" WHERE p.is_del=0";
|
||||
|
||||
//where子句
|
||||
sql += where;
|
||||
@@ -253,7 +261,8 @@ namespace KJD_Web.BLL.BXX
|
||||
cat_name = row["cat_name"].ToString(),
|
||||
product_name = row["product_name"].ToString(),
|
||||
main_img = row["main_img"].ToString(),
|
||||
ext_code = row["ext_code"].ToString(),
|
||||
ext_code = row["ext_code"].ToString(),
|
||||
ext_code_price = row["ext_code_price"].IsNullOrEmpty() ? new int?() : row["ext_code_price"].ParseToInt(),
|
||||
price_text = row["price_text"].ToString(),
|
||||
//product_json = row["product_json"].ToString(),
|
||||
//size_json = row["size_json"].ToString(),
|
||||
@@ -272,6 +281,7 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
prod.product_json = row["product_json"].ToString();
|
||||
prod.size_json = row["size_json"].ToString();
|
||||
prod.sku_edit_json = row["sku_edit_json"].ToString();
|
||||
prod.sku_img_replace_base64 = row["img_base64"].ToString();
|
||||
//prod.sku_img_replace_url = row["img_url"].ToString();
|
||||
}
|
||||
|
||||
@@ -145,5 +145,54 @@ namespace KJD_Web
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
//AddExtCodePrice
|
||||
[WebMethod]
|
||||
public void add_ext_code_price()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXPriceManage().AddExtCodePrice(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_ext_code_price_list()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXPriceManage().GetExtCodePriceList(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void del_db_ext_code_price()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXPriceManage().DelDbExtCodePrice(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_db_ext_code_price()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXPriceManage().MdyDBExtCodePrice(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
|
||||
@@ -16,4 +16,13 @@ namespace KJD_Web.Model
|
||||
public DateTime add_time { get; set; }
|
||||
public DateTime mdy_time { get; set; }
|
||||
}
|
||||
|
||||
public class DBExtCodePriceResult
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string ext_code { get; set; }
|
||||
public int ext_code_price { get; set; }
|
||||
public DateTime add_time { get; set; }
|
||||
public DateTime mdy_time { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -23,15 +23,15 @@ namespace KJD_Web.Model
|
||||
/// </summary>
|
||||
public string price_text { get; set; }
|
||||
/// <summary>
|
||||
/// 成本价格
|
||||
/// jit成本价格
|
||||
/// </summary>
|
||||
public string cost_price { get; set; }
|
||||
/// <summary>
|
||||
/// 快递费
|
||||
/// jit快递费
|
||||
/// </summary>
|
||||
public string delivery_fee { get; set; }
|
||||
/// <summary>
|
||||
/// 贴单费
|
||||
/// jit贴单费
|
||||
/// </summary>
|
||||
public string mark_fee { get; set; }
|
||||
/// <summary>
|
||||
@@ -43,9 +43,14 @@ namespace KJD_Web.Model
|
||||
/// </summary>
|
||||
public string change_cat_name { get; set; }
|
||||
public string ext_code { get; set; }
|
||||
/// <summary>
|
||||
/// 拼多多 设置类目价格
|
||||
/// </summary>
|
||||
public int? ext_code_price { get; set; }
|
||||
public string product_name { get; set; }
|
||||
public string product_json { get; set; }
|
||||
public string size_json { get; set; }
|
||||
public string sku_edit_json { get; set; }
|
||||
public int sku_img_replace_id { get; set; }
|
||||
public string sku_img_replace_base64 { get; set; }
|
||||
public string sku_img_replace_url { get; set; }
|
||||
|
||||
Reference in new issue
Block a user