爆款商品查询功能

This commit is contained in:
wule committed 2026-09-07 16:24:37 +08:00
1 parent 0f072ebd07
commit a34a0b4a78
4 files changed
+432 -42

No files matched your search

+376 -15
View File
@@ -660,8 +660,8 @@ namespace KJD_Web.BLL.BXX
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation")?.Replace("'", "\\'");
var add_time_begin = RegexUtils.GetStringQuery(ref inputData, "add_time_begin")?.Replace("'", "\\'");
var add_time_end = RegexUtils.GetStringQuery(ref inputData, "add_time_end")?.Replace("'", "\\'");
var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'");
var mdy_time_begin = RegexUtils.GetStringQuery(ref inputData, "mdy_time_begin")?.Replace("'", "\\'");
var mdy_time_end = RegexUtils.GetStringQuery(ref inputData, "mdy_time_end")?.Replace("'", "\\'");
var ban_wx = RegexUtils.GetStringQuery(ref inputData, "ban_wx")?.Replace("'", "\\'");
var ban_pdd = RegexUtils.GetStringQuery(ref inputData, "ban_pdd")?.Replace("'", "\\'");
var add_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
@@ -669,8 +669,8 @@ namespace KJD_Web.BLL.BXX
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count") == "true"; // 不计数
var no_fission_words = RegexUtils.GetStringQuery(ref inputData, "no_fission_words").ParseToBool(); // 未裂变标题
var fission_words = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_words"))?.Replace("'", "\\'");
var sale_count_num_less = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count_num_less"))?.Replace("'", "\\'");
var sale_count_num_more = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count_num_more"))?.Replace("'", "\\'");
var max_sale_count_num = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "max_sale_count_num"))?.Replace("'", "\\'");
var min_sale_count_num = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "min_sale_count_num"))?.Replace("'", "\\'");
var is_del = RegexUtils.GetStringQuery(ref inputData, "is_del").ParseToInt();
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
@@ -706,9 +706,9 @@ namespace KJD_Web.BLL.BXX
// forceIndex.Add("index_add_user_name");
if (!search_notes.IsNullOrEmpty())
forceIndex.Add("index_notes");
if (!start_time.IsNullOrEmpty())
if (!mdy_time_begin.IsNullOrEmpty() || !mdy_time_end.IsNullOrEmpty())
forceIndex.Add("index_mdy_time");
if (!sale_count_num_less.IsNullOrEmpty() || !sale_count_num_more.IsNullOrEmpty())
if (!max_sale_count_num.IsNullOrEmpty() || !min_sale_count_num.IsNullOrEmpty())
forceIndex.Add("index_sale_count_num");
if (!forceIndex.Contains("index_view_uv"))
@@ -853,9 +853,9 @@ namespace KJD_Web.BLL.BXX
{
where += " and p.add_time between '" + add_time_begin + "' and '" + add_time_end + "'";
}
if (start_time != null && end_time != null)
if (mdy_time_begin != null && mdy_time_end != null)
{
where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'";
where += " and p.mdy_time between '" + mdy_time_begin + "' and '" + mdy_time_end + "'";
}
if (ban_wx != null)
{
@@ -895,13 +895,13 @@ namespace KJD_Web.BLL.BXX
{
where += " and fission_words LIKE '" + fission_words + "%'";
}
if (!string.IsNullOrEmpty(sale_count_num_less))
if (!string.IsNullOrEmpty(max_sale_count_num))
{
where += " and p.sale_count_num<=" + sale_count_num_less;
where += " and p.sale_count_num<=" + max_sale_count_num;
}
if (!string.IsNullOrEmpty(sale_count_num_more))
if (!string.IsNullOrEmpty(min_sale_count_num))
{
where += " and p.sale_count_num>=" + sale_count_num_more;
where += " and p.sale_count_num>=" + min_sale_count_num;
}
sql += where;
@@ -1119,6 +1119,367 @@ namespace KJD_Web.BLL.BXX
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 获取爆款数据接口
/// </summary>
/// <param name="inputData"></param>
/// <param name="isDetail"></param>
/// <returns></returns>
public string GetHotProductList(string inputData, bool isDetail)
{
var timeCalc = DateTime.Now;
if (!string.IsNullOrEmpty(inputData))
{
var sign = RegexUtils.GetStringQuery(ref inputData, "sign");
if (!WXShopManage.GetTimeSign(sign))
return "{\"code\":500,\"msg\":\"校验失败\"}";
var wx_safe_status = "安全商品,未校验";
var special_prod_type = "爆款数据";
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
var ext_code_in = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code_in"))?.Replace("'", "\\'");
var search_prod_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_prod_name"))?.Replace("'", "\\'");
var wx_cat_1 = RegexUtils.GetStringQuery(ref inputData, "wx_cat_1")?.Replace("'", "\\'");
var wx_cat_2 = RegexUtils.GetStringQuery(ref inputData, "wx_cat_2")?.Replace("'", "\\'");
var wx_cat_3 = RegexUtils.GetStringQuery(ref inputData, "wx_cat_3")?.Replace("'", "\\'");
var wx_cat_leaf = RegexUtils.GetStringQuery(ref inputData, "wx_cat_leaf")?.Replace("'", "\\'");
var product_get_type = RegexUtils.GetStringQuery(ref inputData, "product_get_type")?.Replace("'", "\\'");
var add_time_begin = RegexUtils.GetStringQuery(ref inputData, "add_time_begin")?.Replace("'", "\\'");
var add_time_end = RegexUtils.GetStringQuery(ref inputData, "add_time_end")?.Replace("'", "\\'");
var mdy_time_begin = RegexUtils.GetStringQuery(ref inputData, "mdy_time_begin")?.Replace("'", "\\'");
var mdy_time_end = RegexUtils.GetStringQuery(ref inputData, "mdy_time_end")?.Replace("'", "\\'");
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count").ParseToString().ToLower() == "true";
var max_view_uv = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "max_view_uv"))?.ParseToNullableInt();
var min_view_uv = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "min_view_uv"))?.ParseToNullableInt();
var max_sale_count_num = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "max_sale_count_num"))?.Replace("'", "\\'");
var min_sale_count_num = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "min_sale_count_num"))?.Replace("'", "\\'");
var sort_field = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sort_field"))?.Replace("'", "\\'");
var is_del = RegexUtils.GetStringQuery(ref inputData, "is_del").ParseToInt();
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 tableName = GetProductTableName(inputData);
string sql = "";
List<string> forceIndex = new List<string>() { };
if (!isDetail)
{
if (!search_prod_name.IsNullOrEmpty())
forceIndex.Add("index_product_name");
if (!search_spu.IsNullOrEmpty())
forceIndex.Add("index_spu_id");
if (min_view_uv > 0)
forceIndex.Add("index_view_uv");
if (!ext_code_in.IsNullOrEmpty())
forceIndex.Add("index_ext_code");
if (!mdy_time_begin.IsNullOrEmpty() || !mdy_time_end.IsNullOrEmpty())
forceIndex.Add("index_mdy_time");
if (!max_sale_count_num.IsNullOrEmpty() || !min_sale_count_num.IsNullOrEmpty())
forceIndex.Add("index_sale_count_num");
if (!forceIndex.Contains("index_view_uv"))
forceIndex.Add("index_sort_add_time");
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
sql = " select count(*) from " + tableName + " p ";
//sql += " LEFT JOIN bxx.jst_supplier_ban_platform b ON (p.skc_id=b.coid or p.real_coid=b.coid)" +
if (forceIndex.Count > 0)
sql += " FORCE INDEX(" + string.Join(",", forceIndex) + ")";
sql += " WHERE p.is_del=" + is_del;
string where = "";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and p.id in (" + search_db_ids + ")";
if (!string.IsNullOrWhiteSpace(ext_code_in))
where += " and p.ext_code in ('" + string.Join("','", ext_code_in.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) + "')";
if (!string.IsNullOrEmpty(product_get_type))
where += " and p.product_get_type in ('" + product_get_type.Replace(",", "','") + "')";
else
where += " and p.product_get_type in ('厂商直采','1688厂家','1688外部数据','微信小店','微信店采','母店采集','机会商品','以图搜品','多多外部数据','微信外部数据')";
if (!string.IsNullOrEmpty(wx_safe_status))
where += " and p.wx_safe_status in ('" + wx_safe_status.Replace(",", "','") + "')";
if (!string.IsNullOrEmpty(special_prod_type))
where += " and p.special_prod_type in ('" + special_prod_type.Replace(",", "','") + "')";
if (!string.IsNullOrWhiteSpace(search_spu))
{
if (search_spu.Contains(",") || search_spu.Contains(",") || search_spu.Contains(";") || search_spu.Contains(";"))
where += " and p.spu_id in ('" + string.Join("','", search_spu.Split(new string[] { ",", ",", ";", ";" }, StringSplitOptions.RemoveEmptyEntries)) + "')";
else
where += " and p.spu_id like '" + search_spu + "%'";
}
if (!string.IsNullOrWhiteSpace(search_prod_name))
{
var searchProdNameWords = search_prod_name.Split(new string[] { ",", ",", ";", ";", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
var multi_search_prod_name = "";
var index = 0;
foreach (var word in searchProdNameWords)
{
index++;
string parameName = "@prodNameWords" + index;
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = parameName, Value = word, });
multi_search_prod_name += " or p.product_name like CONCAT(" + parameName + ",'%')";
}
where += " and (" + multi_search_prod_name.Substring(4) + ")";
}
if (!string.IsNullOrWhiteSpace(wx_cat_1))
where += " and p.wx_cat_1 in (" + wx_cat_1 + ")";
if (!string.IsNullOrWhiteSpace(wx_cat_2))
where += " and p.wx_cat_2 in (" + wx_cat_2 + ")";
if (!string.IsNullOrWhiteSpace(wx_cat_3))
where += " and p.wx_cat_3 in (" + wx_cat_3 + ")";
if (!string.IsNullOrWhiteSpace(wx_cat_leaf))
where += " and p.wx_cat_leaf in (" + wx_cat_leaf + ")";
if (!where.Contains("send_to_out_server"))
{
where += " and p.send_to_out_server IN (0,1,2,127)";
}
if (!where.Contains("distribution_set"))
{
where += " and p.distribution_set IN (0,1,2,127)";
}
if (add_time_begin != null && add_time_end != null)
{
where += " and p.add_time between '" + add_time_begin + "' and '" + add_time_end + "'";
}
if (mdy_time_begin != null && mdy_time_end != null)
{
where += " and p.mdy_time between '" + mdy_time_begin + "' and '" + mdy_time_end + "'";
}
where += " and p.ban_wx in (0,1)";
where += " and p.ban_pdd in (0,1)";
where += " and p.add_user_name='admin'";
if (max_view_uv != null)
{
where += " and p.view_uv<=" + min_view_uv;
}
if (min_view_uv != null)
{
where += " and p.view_uv>=" + min_view_uv;
}
if (!string.IsNullOrEmpty(max_sale_count_num))
{
where += " and p.sale_count_num<=" + max_sale_count_num;
}
if (!string.IsNullOrEmpty(min_sale_count_num))
{
where += " and p.sale_count_num>=" + min_sale_count_num;
}
sql += where;
var count = 0;
if (isDetail || is_not_count)
count = 1;
else
{
count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
}
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = " SELECT p.id " +
" FROM " + tableName + " p";
if (forceIndex.Count > 0)
sql += " FORCE INDEX(" + string.Join(",", forceIndex) + ")";
sql += " WHERE p.is_del=" + is_del;
//where子句
sql += where;
if (sort_field == "view_uv")
sql += " order by p.view_uv desc, p.add_time desc";
else
sql += " order by p.add_time desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
if (!string.IsNullOrEmpty(mySql.Message) || dt == null)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
var db_ids = string.Join(",", dt.Rows.Cast<DataRow>().Select(r => r["id"].ParseToInt()));
if (string.IsNullOrEmpty(db_ids))
{
mySql.Close();
return "{\"code\":200,\"data\":[],\"count\":" + 0 + "}";
}
if (isDetail)
sql = " SELECT p.*" +
" from " + tableName + " p" +
" where p.is_del=" + is_del;
else
sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name," +
" p.main_img,p.notes,p.add_time,p.mdy_time,p.fission_words,p.head_words,p.end_words,p.group," +
" p.product_get_type,p.wx_safe_status,p.sale_count_num,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation,p.view_uv,p.add_user_name,p.is_del" +
" FROM " + tableName + " p" +
" WHERE p.is_del=" + is_del;
sql += " and id in (" + db_ids + ")";
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
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"]),
from_shop_id = row["from_shop_id"].ToString(),
from_shop_name = row["from_shop_name"].ToString(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
cat_id = row["cat_id"].ToString(),
cat_name = row["cat_name"].ToString(),
wx_cat_1 = row["wx_cat_1"].ToString(),
wx_cat_2 = row["wx_cat_2"].ToString(),
wx_cat_3 = row["wx_cat_3"].ToString(),
wx_cat_leaf = row["wx_cat_leaf"].ToString(),
product_name = row["product_name"].ToString(),
main_img = row["main_img"].ToString(),
ext_code = row["ext_code"].ToString(),
price_text = row["price_text"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
group = row["group"].ToString(),
end_words = row["end_words"].ParseToString(),
fission_words = row["fission_words"].ParseToString(),
head_words = row["head_words"].ParseToString(),
product_get_type_text = row["product_get_type"].ToString(),
view_uv = row["view_uv"].ParseToNullableInt(),
sale_count = row["sale_count"].ParseToInt(),
sale_count_num = row["sale_count_num"].ParseToInt(),
sale_count_text = row["sale_count_text"].ToString(),
wx_safe_status = row["wx_safe_status"].ToString(),
special_prod_type = row["special_prod_type"].ToString(),
main_cat_id = row["main_cat_id"].ToString(),
main_cat_name = row["main_cat_name"].ToString(),
send_to_out_server = row["send_to_out_server"].ParseToInt(),
secret_spu_id = row["secret_spu_id"].IsNullOrEmpty() ? null : row["secret_spu_id"].ParseToString(),
real_coid = row["real_coid"].IsNullOrEmpty() ? null : row["real_coid"].ParseToString(),
real_spu_id = row["real_spu_id"].IsNullOrEmpty() ? null : row["real_spu_id"].ParseToString(),
is_relation = row["is_relation"].ParseToInt(),
add_user_name = row["add_user_name"].ParseToString(),
is_del = row["is_del"].ParseToNullableInt(),
};
if (isDetail)
{
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_secret_json = row["sku_secret_json"].ToString();
prod.fission_imgs = row["fission_imgs"].ToString();
prod.has_wx_format = row["has_wx_format"].ParseToNullableString(); // 微信回采
prod.wx_img_map_json = row["wx_img_map_json"].ToString();
if (!prod.sku_secret_json.IsNullOrEmpty() && prod.secret_spu_id.IsNullOrEmpty())
{
var secret_json = prod.sku_secret_json;
var goodsId = RegexUtils.GetStringJson(ref secret_json, "goodsId");
prod.secret_spu_id = goodsId;
if (!string.IsNullOrWhiteSpace(goodsId))
{
mySql = new MysqlUtils(conn);
try
{
sql = "update " + tableName + " set secret_spu_id='" + goodsId + "' where spu_id='" + prod.spu_id + "'";
mySql.ExecuteNonQuery(sql);
}
catch { }
mySql.Close();
}
}
if (prod.product_json.Contains("\"source_json\"") && !prod.product_json.Contains("\"source_json\":null"))
{
mySql = new MysqlUtils(conn);
try
{
JObject jObj = JsonUtils.JObjectParse(prod.product_json);
jObj["source_json"] = null;
var newProdJson = JsonUtils.SerializeObject(jObj);
sql = "update " + tableName + " set product_json=@product_json where spu_id='" + prod.spu_id + "'";
paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = newProdJson, });
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
prod.product_json = newProdJson;
}
catch
{
}
mySql.Close();
}
if (prod.product_json.Contains(":null"))
{
mySql = new MysqlUtils(conn);
try
{
JObject jObj = JsonUtils.JObjectParse(prod.product_json);
RemoveNullProperties(jObj);
JsonSerializerSettings jsonIgnoreNullSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var newProdJson = JsonUtils.SerializeObjectToString(jObj, jsonIgnoreNullSetting);
sql = "update " + tableName + " set product_json=@product_json where spu_id='" + prod.spu_id + "'";
paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = newProdJson, });
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
prod.product_json = newProdJson;
}
catch
{
}
mySql.Close();
}
}
productLst.Add(prod);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(productLst, jsonSetting);
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
if (is_not_count)
count = productLst.Count;
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 递归剔除JObject中值为null的字段 (修改为null才删除,empty不删除)
/// </summary>
@@ -2078,7 +2439,7 @@ namespace KJD_Web.BLL.BXX
min_view_uv = 100;
if (is学员数据)
min_view_uv = null;
var sale_count_num_less = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count_num_less"))?.Replace("'", "\\'");
var max_sale_count_num = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count_num_less"))?.Replace("'", "\\'");
var sale_count_num_more = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sale_count_num_more"))?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
@@ -2229,9 +2590,9 @@ namespace KJD_Web.BLL.BXX
{
where += " and view_uv>= " + min_view_uv + "";
}
if (!string.IsNullOrEmpty(sale_count_num_less))
if (!string.IsNullOrEmpty(max_sale_count_num))
{
where += " and p.sale_count_num<=" + sale_count_num_less;
where += " and p.sale_count_num<=" + max_sale_count_num;
}
if (!string.IsNullOrEmpty(sale_count_num_more))
{
@@ -25,6 +25,10 @@ namespace KJD_Web.BLL.WXXD
{
return new BLL.BXX.BXXProductManage().GetProductList(inputData, isDetail);
}
public string WXGetHotProductList(string inputData, bool isDetail = false)
{
return new BLL.BXX.BXXProductManage().GetHotProductList(inputData, isDetail);
}
public string WXGetPDDProductGroups(string inputData)
{
+26 -27
View File
@@ -648,29 +648,20 @@ namespace KJD_Web.BLL.WXXD
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
/// <summary>
/// ai api
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string GetOneShopCookieByAppId(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var shop_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "shop_id"))?.Replace("'", "\\'");
var sign = RegexUtils.GetStringQuery(ref inputData, "sign");
if (shop_id.IsNullOrEmpty())
return "{\"code\":500,\"msg\":\"未指定店铺\"}";
bool isSign = false;
for (int i = 0; i <= 5; i++)
{
if (EncrypUtil.GetMd5(DateTime.Now.AddMinutes(i).ToString("yyyyMMddHHmm") + "wxxd").ToLower() == sign.ToLower())
{
isSign = true;
break;
}
else if (i > 0 && EncrypUtil.GetMd5(DateTime.Now.AddMinutes(-i).ToString("yyyyMMddHHmm") + "wxxd").ToLower() == sign.ToLower())
{
isSign = true;
break;
}
}
if (!isSign)
var sign = RegexUtils.GetStringQuery(ref inputData, "sign");
if (!GetTimeSign(sign))
return "{\"code\":500,\"msg\":\"校验失败\"}";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
@@ -681,17 +672,6 @@ namespace KJD_Web.BLL.WXXD
mySql.Close();
if (dt != null)
{
//List<ShopParam> shopList = new List<ShopParam>();
//foreach (DataRow row in dt.Rows)
//{
// ShopParam shop = new ShopParam
// {
// shop_id = row["shop_id"].ToString(),
// cookie = row["cookie"].ToString(),
// };
// shopList.Add(shop);
//}
//var data = JsonUtils.SerializeObjectToString(shopList);
JArray jArr = new JArray();
foreach (DataRow row in dt.Rows)
{
@@ -1924,5 +1904,24 @@ namespace KJD_Web.BLL.WXXD
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public static bool GetTimeSign(string sign)
{
bool isSign = false;
for (int i = 0; i <= 5; i++)
{
if (EncrypUtil.GetMd5(DateTime.Now.AddMinutes(i).ToString("yyyyMMddHHmm") + "wxxd").ToLower() == sign.ToLower())
{
isSign = true;
break;
}
else if (i > 0 && EncrypUtil.GetMd5(DateTime.Now.AddMinutes(-i).ToString("yyyyMMddHHmm") + "wxxd").ToLower() == sign.ToLower())
{
isSign = true;
break;
}
}
return isSign;
}
}
}
+26
View File
@@ -73,6 +73,32 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void get_hot_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXProductManage().WXGetHotProductList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_hot_detail_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXProductManage().WXGetHotProductList(jsontext, true);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_pdd_product_list_random()
{