拼多多买手订单抓取推送

This commit is contained in:
wule committed 2026-04-10 16:00:24 +08:00
1 parent fa96cc1444
commit caeea6e0c3
18 files changed
+1703 -215

No files matched your search

@@ -250,6 +250,90 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyViolationProd(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")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"))?.Replace("'", "\\'");
string secret_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "secret_spu_id"))?.Replace("'", "\\'");
string spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spu_id"))?.Replace("'", "\\'");
string group = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "group"))?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
string wx_safe_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_safe_status"))?.Replace("'", "\\'");
if (string.IsNullOrWhiteSpace(product_name) && string.IsNullOrWhiteSpace(secret_spu_id) && string.IsNullOrWhiteSpace(spu_id))
return "{\"code\":500,\"msg\":\"没有商品查询信息\"}";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
if (!string.IsNullOrEmpty(product_name))
sql = "select id,spu_id from bxx.product p where p.product_name='" + product_name + "' and p.wx_safe_status in ('安全商品','未校验');";
else if (!string.IsNullOrEmpty(secret_spu_id))
sql = "select id,spu_id from bxx.product p where p.secret_spu_id='" + secret_spu_id + "' and p.wx_safe_status in ('安全商品','未校验');";
else
sql = "select id,spu_id from bxx.product p where p.spu_id='" + spu_id + "' and p.wx_safe_status in ('安全商品','未校验');";
var dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message))
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
var ids = "";
foreach(DataRow row in dt.Rows)
{
ids += row["spu_id"].ParseToString() + "','";
}
ids.Trim(',', '\'');
if (string.IsNullOrEmpty(ids))
{
return "{\"code\":200,\"msg\":\"success\",\"err_msg\":\"商品不存在\"}";
}
else
{
sql = "update bxx.product p set";
if (group != null)
sql += " p.group='" + group + "',";
if (notes != null)
sql += " p.notes='" + notes + "',";
if (wx_safe_status != null)
sql += " p.wx_safe_status='" + wx_safe_status + "',";
sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where p.spu_id in('" + ids + "')";
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 GetProductSpuIdLst(string inputData)
{
var timeCalc = DateTime.Now;
@@ -1295,11 +1379,11 @@ namespace KJD_Web.BLL.BXX
}
if (!string.IsNullOrEmpty(wx_cat_2))
{
where += " and p.wx_cat_2=" + wx_cat_2 + "";
where += " and p.wx_cat_2 in (" + wx_cat_2 + ")";
}
if (!string.IsNullOrEmpty(wx_cat_3))
{
where += " and p.wx_cat_3=" + wx_cat_3 + "";
where += " and p.wx_cat_3 in (" + wx_cat_3 + ")";
}
if (!string.IsNullOrEmpty(product_get_type))
where += " and p.product_get_type ='" + product_get_type + "'";
@@ -1,4 +1,6 @@
using KJD_Web.Model;
using KJD_Web.Model.PddModel;
using KJD_Web.Model.ShopModel;
using KJD_Web.Utils;
using NaiBa.Util.Extension;
using System;
@@ -201,7 +203,6 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
@@ -390,8 +391,6 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string ChangePassword(string inputData)
{
var userName = RegexUtils.GetStringJson(ref inputData, "user_name")?.Replace("'", "\\'");
@@ -527,5 +526,305 @@ namespace KJD_Web.BLL.BXX
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
string buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id")?.Replace("'", "\\'");
string buyer_name = RegexUtils.GetStringQuery(ref inputData, "buyer_name")?.Replace("'", "\\'");
string buyer_nick = RegexUtils.GetStringQuery(ref inputData, "buyer_nick")?.Replace("'", "\\'");
string cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(buyer_name))
{
return "{\"code\":501,\"msg\":\"没有买手登录名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select exists (select 1 from bxx.shop where buyer_id='" + buyer_id + "' and user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"买手" + buyer_name + " " + buyer_nick + "已存在\"}";
}
sql = "insert into bxx.buyer (user_name,buyer_id,buyer_name,buyer_nick,cookie,notes) " +
"values ('" + user_name + "','" + buyer_id + "','" + buyer_name + "','" + buyer_nick + "','" + cookie + "','" + notes + "');";
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 MdyBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
string buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id")?.Replace("'", "\\'");
string buyer_name = RegexUtils.GetStringQuery(ref inputData, "buyer_name")?.Replace("'", "\\'"); ;
string buyer_nick = RegexUtils.GetStringQuery(ref inputData, "buyer_nick")?.Replace("'", "\\'"); ;
string cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'"); ;
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(buyer_id))
{
return "{\"code\":501,\"msg\":\"没有买手号\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.buyer set";
if (buyer_name != null)
sql += " buyer_name='" + buyer_name + "',";
if (buyer_nick != null)
sql += " buyer_nick='" + buyer_nick + "',";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (notes != null)
sql += " notes='" + notes + "',";
if (status != null)
sql += " status='" + status + "',";
sql = sql.TrimEnd(',');
sql += " where buyer_id='" + buyer_id + "' and user_name='" + user_name + "'";
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 MdyBuyerCookie(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "buyer_user_name")?.Replace("'", "\\'");
string buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id")?.Replace("'", "\\'");
string cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(buyer_id))
{
return "{\"code\":501,\"msg\":\"没有买手号\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.buyer set";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (status != null)
sql += " status='" + status + "',";
sql = sql.TrimEnd(',');
sql += " where buyer_id='" + buyer_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 GetBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_buyer_id = RegexUtils.GetStringQuery(ref inputData, "search_buyer_id");
var search_buyer_name = RegexUtils.GetStringQuery(ref inputData, "search_buyer_name");
var search_buyer_nick = RegexUtils.GetStringQuery(ref inputData, "search_buyer_nick");
var buyer_ids = RegexUtils.GetStringQuery(ref inputData, "buyer_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(buyer_ids))
{
List<string> shopIdLst = buyer_ids.Split(',').ToList();
buyer_ids = "'" + string.Join("','", shopIdLst) + "'";
}
var buyer_names = RegexUtils.GetStringQuery(ref inputData, "buyer_names");
if (!string.IsNullOrWhiteSpace(buyer_names))
{
List<string> shopNameLst = buyer_names.Split(',').ToList();
buyer_names = "'" + string.Join("','", shopNameLst) + "'";
}
var buyer_nicks = RegexUtils.GetStringQuery(ref inputData, "buyer_nicks");
if (!string.IsNullOrWhiteSpace(buyer_nicks))
{
List<string> shopNotesLst = buyer_nicks.Split(',').ToList();
buyer_nicks = "'" + 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 bxx.buyer s WHERE 1=1";
//where子句
string where = "";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_buyer_id))
where += " and s.buyer_id like '%" + search_buyer_id + "%'";
if (!string.IsNullOrWhiteSpace(search_buyer_name))
where += " and s.buyer_name like '%" + search_buyer_name + "%'";
if (!string.IsNullOrWhiteSpace(search_buyer_nick))
where += " and s.buyer_nick like '%" + search_buyer_nick + "%'";
if (!string.IsNullOrWhiteSpace(buyer_ids))
where += " and s.buyer_id in (" + buyer_ids + ")";
if (!string.IsNullOrWhiteSpace(buyer_names))
where += " and s.buyer_name in (" + buyer_names + ")";
if (!string.IsNullOrWhiteSpace(buyer_nicks))
where += " and s.buyer_nick in (" + buyer_nicks + ")";
if (!string.IsNullOrWhiteSpace(user_name))
where += " and s.user_name='" + user_name + "'";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "SELECT s.*";
sql += " FROM bxx.buyer s 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<BuyerLoginInfo> buyerList = new List<BuyerLoginInfo>();
foreach (DataRow row in dt.Rows)
{
BuyerLoginInfo shop = new BuyerLoginInfo
{
id = Convert.ToInt32(row["id"]),
cookie = row["cookie"].ToString(),
user_name = row["user_name"].ToString(),
notes = row["notes"].ToString(),
add_time = row["add_time"].ParseToString().ParseToDateTime(),
mdy_time = row["mdy_time"].ParseToString().ParseToDateTime(),
buyer_id = row["buyer_id"].ToString(),
buyer_name = row["buyer_name"].ToString(),
buyer_nick = row["buyer_nick"].ToString(),
status = row["status"].ToString(),
};
buyerList.Add(shop);
}
var data = JsonUtils.SerializeObjectToString(buyerList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string DelBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id");
if (string.IsNullOrEmpty(buyer_id))
{
return "{\"code\":500,\"msg\":\"没有买手号\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "DELETE FROM bxx.buyer WHERE user_name='" + user_name + "' and buyer_id='" + buyer_id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":501,\"msg\":" + mySql.Message + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
}
}
@@ -182,6 +182,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void mdy_violation_prod()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdyViolationProd(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void del_db_product()
{
@@ -197,5 +197,62 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
//AddBuyer
[WebMethod]
public void add_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXUserManage().AddBuyer(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXUserManage().MdyBuyer(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_buyer_cookie()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXUserManage().MdyBuyerCookie(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXUserManage().GetBuyer(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void del_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXUserManage().DelBuyer(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}
@@ -117,6 +117,7 @@
<Compile Include="BLL\WXXD\WXShopManage.cs" />
<Compile Include="BLL\WXXD\WXUserManage.cs" />
<Compile Include="Model\JSTDownProdSkuInfo.cs" />
<Compile Include="Model\PddModel\BuyerLoginInfo.cs" />
<Compile Include="Model\PddModel\PDDMaterialInfo.cs" />
<Compile Include="Model\PddModel\PDDProductDecorationInfo.cs" />
<Compile Include="Model\PddModel\PDDSizeSpecInfo.cs" />
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model.PddModel
{
public class BuyerLoginInfo
{
public int id { get; set; }
public string user_name { get; set; }
public string buyer_id { get; set; }
public string buyer_name { get; set; }
public string buyer_nick { get; set; }
public string cookie { get; set; }
public string status { get; set; }
public string notes { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}