优化了微店商品上传 优化pdd买手读单
This commit is contained in:
1 parent
6c4f16b897
commit
f360688c43
62 files changed
+5620
-1432
No files matched your search
@@ -149,6 +149,7 @@ namespace KJD_Web.BLL.BXX
|
||||
string sku_secret_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_secret_json"))?.Replace("'", "\\'");
|
||||
string wx_img_map_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_img_map_json"))?.Replace("'", "\\'");
|
||||
string problem_prod_data = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "problem_prod_data"))?.Replace("'", "\\'");
|
||||
string is_relation = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "is_relation"))?.Replace("'", "\\'");
|
||||
|
||||
if (string.IsNullOrEmpty(user_name))
|
||||
{
|
||||
@@ -226,6 +227,8 @@ namespace KJD_Web.BLL.BXX
|
||||
sql += " p.wx_img_map_json=@wx_img_map_json,";
|
||||
if (!problem_prod_data.IsNullOrEmpty())
|
||||
sql += " p.problem_prod_data=" + problem_prod_data + ",";
|
||||
if (!is_relation.IsNullOrEmpty())
|
||||
sql += " p.is_relation=" + is_relation + ",";
|
||||
sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where spu_id='" + spu_id + "';";
|
||||
@@ -471,6 +474,7 @@ namespace KJD_Web.BLL.BXX
|
||||
var real_coid = RegexUtils.GetStringQuery(ref inputData, "real_coid")?.Replace("'", "\\'");
|
||||
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
|
||||
var problem_prod_data = RegexUtils.GetStringQuery(ref inputData, "problem_prod_data")?.Replace("'", "\\'");
|
||||
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation")?.Replace("'", "\\'");
|
||||
var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
|
||||
var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'");
|
||||
|
||||
@@ -517,7 +521,8 @@ namespace KJD_Web.BLL.BXX
|
||||
where += " and p.special_prod_type ='" + special_prod_type + "'";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(search_spu))
|
||||
where += " and p.spu_id like '%" + search_spu + "%'";
|
||||
//where += " and p.spu_id like '%" + 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))
|
||||
@@ -599,6 +604,10 @@ namespace KJD_Web.BLL.BXX
|
||||
else
|
||||
where += " and p.problem_prod_data='" + problem_prod_data + "'";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(is_relation))
|
||||
{
|
||||
where += " and p.is_relation=" + is_relation;
|
||||
}
|
||||
if (start_time != null && end_time != null)
|
||||
{
|
||||
where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'";
|
||||
@@ -627,7 +636,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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," +
|
||||
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
|
||||
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id," +
|
||||
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," +
|
||||
" 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" +
|
||||
@@ -637,7 +646,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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," +
|
||||
" p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," +
|
||||
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id," +
|
||||
" p.wx_cat_leaf,p.send_to_out_server,p.secret_spu_id,p.real_coid,p.real_spu_id,p.is_relation," +
|
||||
" 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" +
|
||||
@@ -707,6 +716,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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(),
|
||||
};
|
||||
if (isDetail)
|
||||
{
|
||||
@@ -1362,10 +1372,11 @@ namespace KJD_Web.BLL.BXX
|
||||
var wx_safe_status = RegexUtils.GetStringQuery(ref inputData, "wx_safe_status")?.Replace("'", "\\'");
|
||||
var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'");
|
||||
var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'");
|
||||
var is_not_count = (RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'")).ParseToBool();
|
||||
var prod_count = (RegexUtils.GetStringQuery(ref inputData, "prod_count")?.Replace("'", "\\'")).ParseToInt();
|
||||
var add_days_less = RegexUtils.GetStringQuery(ref inputData, "add_days_less")?.Replace("'", "\\'").ParseToNullableInt();
|
||||
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'").ParseToString();
|
||||
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count").ParseToBool(); // 不计数
|
||||
var prod_count = RegexUtils.GetStringQuery(ref inputData, "prod_count").ParseToInt();
|
||||
var add_days_less = RegexUtils.GetStringQuery(ref inputData, "add_days_less").ParseToNullableInt();
|
||||
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
|
||||
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation").ParseToNullableInt();
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
@@ -1439,6 +1450,10 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
where += " and has_wx_format = '" + has_wx_format + "'";
|
||||
}
|
||||
if (is_relation != null)
|
||||
{
|
||||
where += " and is_relation = " + is_relation;
|
||||
}
|
||||
sql += where;
|
||||
|
||||
int count = prod_count;
|
||||
@@ -1480,7 +1495,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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.group,p.notes,p.add_time,p.mdy_time,p.product_get_type," +
|
||||
" p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3,p.send_to_out_server," +
|
||||
" p.wx_cat_leaf" +
|
||||
" p.wx_cat_leaf,p.is_relation" +
|
||||
" from bxx.product p where p.is_del=0";
|
||||
//where子句
|
||||
//sql += where;
|
||||
@@ -1528,6 +1543,7 @@ namespace KJD_Web.BLL.BXX
|
||||
wx_safe_status = row["wx_safe_status"].ToString(),
|
||||
special_prod_type = row["special_prod_type"].ToString(),
|
||||
send_to_out_server = row["send_to_out_server"].ParseToInt(),
|
||||
is_relation = row["is_relation"].ParseToInt(),
|
||||
};
|
||||
productLst.Add(prod);
|
||||
}
|
||||
@@ -2996,6 +3012,11 @@ namespace KJD_Web.BLL.BXX
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 随机工厂商品
|
||||
/// </summary>
|
||||
/// <param name="inputData"></param>
|
||||
/// <returns></returns>
|
||||
public string GetRandomCompanyProductConfig(string inputData)
|
||||
{
|
||||
var timeCalc = DateTime.Now;
|
||||
@@ -3043,6 +3064,131 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string AddRelation(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 up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(up_spu_id))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少上家编号\"}";
|
||||
}
|
||||
var index = RegexUtils.GetStringQuery(ref inputData, "index").ParseToNullableLong();
|
||||
if (index == null)
|
||||
index = Math.Abs(up_spu_id.GetHashCode()) % 128;
|
||||
var up_goods_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "up_goods_name"));
|
||||
if (string.IsNullOrEmpty(up_goods_name))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少上家商品名称\"}";
|
||||
}
|
||||
var from_site = RegexUtils.GetStringQuery(ref inputData, "from_site")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(from_site))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少关联商品平台\"}";
|
||||
}
|
||||
var goods_id = RegexUtils.GetStringQuery(ref inputData, "goods_id")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(goods_id))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少关联商品编号\"}";
|
||||
}
|
||||
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(shop_id))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少关联店铺编号\"}";
|
||||
}
|
||||
var price_max = RegexUtils.GetStringQuery(ref inputData, "price_max")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(price_max))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少关联最高价格\"}";
|
||||
}
|
||||
var price_min = RegexUtils.GetStringQuery(ref inputData, "price_min")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(price_min))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少关联最低价格\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "insert into bxx_relation.out_prod_relation_" + index.ParseToString().PadLeft(4, '0') +
|
||||
" (up_spu_id,up_goods_name,from_site,goods_id,shop_id,price_min,price_max) " +
|
||||
" values ('" + up_spu_id + "',@up_goods_name,'" + from_site + "','" +
|
||||
goods_id + "'," + shop_id + "," + price_min + "," + price_max + ");";
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@up_goods_name", Value = up_goods_name, });
|
||||
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
|
||||
mySql.Close();
|
||||
if (mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"成功\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"失败:" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetRelation(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 up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty(up_spu_id))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"缺少来源商品编号\"}";
|
||||
}
|
||||
var index = RegexUtils.GetStringQuery(ref inputData, "index").ParseToNullableLong();
|
||||
if (index == null)
|
||||
index = Math.Abs(up_spu_id.GetHashCode()) % 128;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select * from bxx_relation.out_prod_relation_" + index.ParseToString().PadLeft(4, '0') +
|
||||
" where up_spu_id='" + up_spu_id + "' limit 20;";
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
if (mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
JArray jArr = new JArray();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
JObject jObj = new JObject();
|
||||
jObj["id"] = row["id"].ParseToInt();
|
||||
jObj["up_spu_id"] = row["up_spu_id"].ToString();
|
||||
jObj["up_goods_name"] = row["up_goods_name"].ToString();
|
||||
jObj["from_site"] = row["from_site"].ToString();
|
||||
jObj["goods_id"] = row["goods_id"].ToString();
|
||||
jObj["shop_id"] = row["shop_id"].ToString();
|
||||
jObj["price_min"] = row["price_min"].ParseToInt();
|
||||
jObj["price_max"] = row["price_max"].ParseToInt();
|
||||
jObj["add_time"] = row["add_time"].ParseToString().ParseToDateTime();
|
||||
jArr.Add(jObj);
|
||||
}
|
||||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
var data = JsonUtils.SerializeObjectToString(jArr, jsonSetting);
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + jArr.Count + "}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"失败:" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using KJD_Web.Model;
|
||||
using KJD_Web.Model.ShopModel;
|
||||
using KJD_Web.Utils;
|
||||
using MySql.Data.MySqlClient;
|
||||
using MySqlX.XDevAPI;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -10,11 +12,242 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
public class BXXShopManage
|
||||
{
|
||||
public string GetPddClientInfo(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 bxx.user where user_name='"
|
||||
+ mobile + "' and password='" + password + "'";
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
if (dt == null)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"用户不存在\"}";
|
||||
}
|
||||
|
||||
JArray jArr = new JArray();
|
||||
|
||||
JObject obj1 = new JObject();
|
||||
obj1["describe"] = "貔貅管家";
|
||||
obj1["client_id"] = "ad502ec19e0c49ab9df14f83494e153c";
|
||||
obj1["client_secret"] = "bd52aba51737d03fc073711d386b3b0779d010ad";
|
||||
obj1["market_id"] = 84862;
|
||||
obj1["redirect_uri"] = "http%3A%2F%2Fpo.e57.cn%2Flogin%3Fsource%3Dpdd_code";
|
||||
obj1["is_current"] = false;
|
||||
jArr.Add(obj1);
|
||||
|
||||
JObject obj2 = new JObject();
|
||||
obj2["describe"] = "小红椒商品管理";
|
||||
obj2["client_id"] = "48e76c60853d47d8a4e2e631b6db26b5";
|
||||
obj2["client_secret"] = "b2a5f9eeb36d192ed035f023eaf9ce5280aac397";
|
||||
obj2["market_id"] = 84690;
|
||||
obj2["redirect_uri"] = "http%3A%2F%2Fxtjpd.jiaotian.vip%2Fpdd_token.html";
|
||||
obj2["is_current"] = true;
|
||||
jArr.Add(obj2);
|
||||
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + JsonUtils.SerializeObject(jArr) + "}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetShopClientInfo(string inputData, bool isAdmin = false)
|
||||
{
|
||||
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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
|
||||
var password = RegexUtils.GetStringQuery(ref inputData, "password");
|
||||
if (string.IsNullOrEmpty(user_name))
|
||||
{
|
||||
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
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 page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
|
||||
|
||||
if (page_size == 0)
|
||||
page_size = 500;
|
||||
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "SELECT COUNT(s.id) FROM bxx.shop_api_auth s WHERE 1=1";
|
||||
|
||||
//where子句
|
||||
string where = "";
|
||||
if (!string.IsNullOrWhiteSpace(shop_ids))
|
||||
where += " and s.ShopId in (" + shop_ids + ")";
|
||||
sql += where;
|
||||
|
||||
var count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
DataTable dt;
|
||||
if (count == 0)
|
||||
{
|
||||
dt = new DataTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "SELECT * FROM bxx.shop_api_auth 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 (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":50001,\"msg\":\"查询失败:" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
if (dt != null)
|
||||
{
|
||||
List<AuthInfo> shopAuthList = new List<AuthInfo>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
AuthInfo auth = new AuthInfo
|
||||
{
|
||||
id = Convert.ToInt32(row["id"]),
|
||||
AccessToken = row["AccessToken"].ToString(),
|
||||
ApiAuthStatus = row["ApiAuthStatus"].ToString(),
|
||||
AppKey = row["AppKey"].ToString(),
|
||||
AppSecret = row["AppSecret"].ToString(),
|
||||
ExpiresTime = row["ExpiresTime"].ParseToString().ParseToDateTime(),
|
||||
RefreshToken = row["RefreshToken"].ToString(),
|
||||
ShopId = row["ShopId"].ToString(),
|
||||
UpdateTime = row["UpdateTime"].ParseToString().ParseToDateTime(),
|
||||
};
|
||||
shopAuthList.Add(auth);
|
||||
}
|
||||
var data = JsonUtils.SerializeObjectToString(shopAuthList);
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
|
||||
public string AddMdyShopClientInfo(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\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
string ShopId = RegexUtils.GetStringQuery(ref inputData, "ShopId")?.Replace("'", "\\'");
|
||||
string AppKey = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "AppKey"))?.Replace("'", "\\'");
|
||||
string AccessToken = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "AccessToken"))?.Replace("'", "\\'");
|
||||
string RefreshToken = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "RefreshToken"))?.Replace("'", "\\'");
|
||||
string AppSecret = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "AppSecret"))?.Replace("'", "\\'");
|
||||
string ExpiresTime = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ExpiresTime"))?.Replace("'", "\\'");
|
||||
string ApiAuthStatus = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ApiAuthStatus"))?.Replace("'", "\\'");
|
||||
if (string.IsNullOrEmpty("ShopId"))
|
||||
return "{\"code\":50001,\"msg\":\"没有店铺编号\"}";
|
||||
if (string.IsNullOrEmpty("AppKey"))
|
||||
return "{\"code\":50001,\"msg\":\"没有Api编号\"}";
|
||||
if (string.IsNullOrEmpty("AccessToken"))
|
||||
return "{\"code\":50001,\"msg\":\"没有令牌信息\"}";
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "SELECT ShopId,AppKey FROM `bxx`.`shop_api_auth` where ShopId='" + ShopId + "' and AppKey='" + AppKey + "'";
|
||||
|
||||
string where = "";
|
||||
sql += where;
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (dt != null)
|
||||
{
|
||||
conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
mySql = new MysqlUtils(conn);
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
sql = "INSERT INTO `bxx`.`shop_api_auth` (ShopId,AppKey,AccessToken,RefreshToken,AppSecret,ExpiresTime,ApiAuthStatus)" +
|
||||
" VALUES (@ShopId,@AppKey,@AccessToken,@RefreshToken,@AppSecret,@ExpiresTime,@ApiAuthStatus);";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "UPDATE `bxx`.`shop_api_auth` SET AccessToken=@AccessToken";
|
||||
if (RefreshToken != null)
|
||||
sql += ", RefreshToken=@RefreshToken ";
|
||||
if (AppSecret != null)
|
||||
sql += ", AppSecret=@AppSecret ";
|
||||
if (ExpiresTime != null)
|
||||
sql += ", ExpiresTime=@ExpiresTime ";
|
||||
if (ApiAuthStatus != null)
|
||||
sql += ", ApiAuthStatus=@ApiAuthStatus ";
|
||||
sql += " WHERE ShopId=@ShopId and AppKey=@AppKey;";
|
||||
}
|
||||
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "ShopId", Value = ShopId, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "AppKey", Value = AppKey, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "AccessToken", Value = AccessToken.ParseToString(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "RefreshToken", Value = RefreshToken.ParseToString(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "AppSecret", Value = AppSecret.ParseToString(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.DateTime, ParameterName = "ExpiresTime", Value = ExpiresTime.ParseToDateTime(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "ApiAuthStatus", Value = ApiAuthStatus, });
|
||||
|
||||
mySql.ExecuteNonQuery(sql, paramLst.ToArray());
|
||||
mySql.Close();
|
||||
if (string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":\"\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetShop(string inputData, bool isAdmin = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
@@ -919,10 +1152,10 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.anti_contents,s.pddid,s.mall_id,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," +
|
||||
sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.wd_token,s.mall_id,s.shop_id,s.shop_account,s.sub_user_name," +
|
||||
"s.user_name,s.company_name,s.notes,s.login_status,s.login_status2," +
|
||||
"s.add_time,s.mdy_time,s.add_sub_sa_time,s.operate_sub_sa_name";
|
||||
sql += " FROM weidian.shop s LEFT JOIN weidian.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1";
|
||||
sql += " FROM weidian.shop s WHERE 1=1";
|
||||
|
||||
sql += where; // where 子句
|
||||
|
||||
@@ -932,6 +1165,10 @@ namespace KJD_Web.BLL.BXX
|
||||
}
|
||||
|
||||
mySql.Close();
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
if (dt != null)
|
||||
{
|
||||
List<ShopParam> shopList = new List<ShopParam>();
|
||||
@@ -944,7 +1181,7 @@ namespace KJD_Web.BLL.BXX
|
||||
login_pass = row["login_pass"].ToString(),
|
||||
cookie = row["cookie"].ToString(),
|
||||
cookie2 = row["cookie2"].ToString(),
|
||||
anti_contents = row["anti_contents"].ToString(),
|
||||
wd_token = row["wd_token"].ToString(),
|
||||
shop_id = row["shop_id"].ToString(),
|
||||
shop_account = row["shop_account"].ToString(),
|
||||
sub_user_name = row["sub_user_name"].ToString(),
|
||||
@@ -953,10 +1190,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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"].ParseToString(),
|
||||
pddid = row["pddid"].ParseToString(),
|
||||
mall_id = row["mall_id"].ParseToString(),
|
||||
};
|
||||
shopList.Add(shop);
|
||||
@@ -981,7 +1215,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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 anti_contents = RegexUtils.GetStringQuery(ref inputData, "anti_contents");
|
||||
string wd_token = RegexUtils.GetStringQuery(ref inputData, "wd_token");
|
||||
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
|
||||
string mall_id = RegexUtils.GetStringQuery(ref inputData, "mall_id");
|
||||
string shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
|
||||
@@ -1011,12 +1245,13 @@ namespace KJD_Web.BLL.BXX
|
||||
if (exist > 0)
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"店铺" + login_name + " " + shop_account + "已存在\"}";
|
||||
//return "{\"code\":500,\"msg\":\"店铺" + login_name + " " + shop_account + "已存在\"}";
|
||||
return MdyWeiDianShop(inputData, isAdmin);
|
||||
}
|
||||
|
||||
sql = "insert into weidian.shop (login_name,login_pass,cookie,cookie2,anti_contents,shop_account,shop_id," +
|
||||
sql = "insert into weidian.shop (login_name,login_pass,cookie,cookie2,wd_token,shop_account,shop_id," +
|
||||
"mall_id,sub_user_name,user_name,group_name,notes,add_time,mdy_time) " +
|
||||
"values ('" + login_name + "','" + login_pass + "','" + cookie + "','" + cookie2 + "','" + anti_contents + "','" + shop_account + "','" + shop_id +
|
||||
"values ('" + login_name + "','" + login_pass + "','" + cookie + "','" + cookie2 + "','" + wd_token + "','" + shop_account + "','" + shop_id +
|
||||
"','" + mall_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") + "');";
|
||||
@@ -1026,6 +1261,8 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
else
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
@@ -1042,7 +1279,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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 anti_contents = RegexUtils.GetStringQuery(ref inputData, "anti_contents");
|
||||
string wd_token = RegexUtils.GetStringQuery(ref inputData, "wd_token");
|
||||
string new_shop_id = RegexUtils.GetStringQuery(ref inputData, "new_shop_id");
|
||||
string old_shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
|
||||
string mall_id = RegexUtils.GetStringQuery(ref inputData, "mall_id");
|
||||
@@ -1072,8 +1309,8 @@ namespace KJD_Web.BLL.BXX
|
||||
sql += " cookie='" + cookie + "',";
|
||||
if (cookie2 != null)
|
||||
sql += " cookie2='" + cookie2 + "',";
|
||||
if (anti_contents != null)
|
||||
sql += " anti_contents='" + anti_contents + "',";
|
||||
if (wd_token != null)
|
||||
sql += " wd_token='" + wd_token + "',";
|
||||
if (new_shop_id != null)
|
||||
sql += " shop_id='" + new_shop_id + "',";
|
||||
if (mall_id != null)
|
||||
@@ -1093,6 +1330,95 @@ namespace KJD_Web.BLL.BXX
|
||||
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\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
|
||||
public string MdyWeiDianShopCookie(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 shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
|
||||
string wd_token = RegexUtils.GetStringQuery(ref inputData, "wd_token");
|
||||
string cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"));
|
||||
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(shop_id))
|
||||
{
|
||||
return "{\"code\":501,\"msg\":\"没有店铺信息\"}";
|
||||
}
|
||||
if (string.IsNullOrEmpty(cookie) && string.IsNullOrEmpty(login_status))
|
||||
{
|
||||
return "{\"code\":501,\"msg\":\"cookie和登录状态不能全为空\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update weidian.shop set";
|
||||
if (cookie != null)
|
||||
sql += " cookie='" + cookie + "',";
|
||||
if (wd_token != null)
|
||||
sql += " wd_token='" + wd_token + "',";
|
||||
if (login_status != null)
|
||||
sql += " login_status='" + login_status + "',";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where shop_id='" + shop_id + "'";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
|
||||
public string DelWeiDianShop(string inputData, bool isAdmin = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
if (isAdmin)
|
||||
user_name = RegexUtils.GetStringQuery(ref inputData, "shop_user_name")?.Replace("'", "\\'");
|
||||
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.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(shop_id))
|
||||
{
|
||||
return "{\"code\":501,\"msg\":\"没有指定要删除的店铺\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "delete from weidian.shop where user_name='" + user_name + "' and shop_id='" + shop_id + "'";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
|
||||
@@ -33,6 +33,33 @@ namespace KJD_Web.BLL
|
||||
|
||||
public void CreateTable()
|
||||
{
|
||||
//string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
//MysqlUtils mySql = new MysqlUtils(conn);
|
||||
//string sql = "";
|
||||
//for (int i = 0; i < 128; i++)
|
||||
//{
|
||||
// sql = @"drop table if exists bxx_relation.out_prod_relation_" + i.ParseToString().PadLeft(4, '0') + ";\r\n";
|
||||
// sql += @"CREATE TABLE bxx_relation.out_prod_relation_" + i.ParseToString().PadLeft(4, '0') + @" (
|
||||
// `id` int NOT NULL AUTO_INCREMENT,
|
||||
// `up_spu_id` varchar(50) NOT NULL COMMENT '源商品id信息,此字段为分表依据',
|
||||
// `up_goods_name` varchar(255) NOT NULL COMMENT '源商品标题',
|
||||
// `from_site` varchar(10) NOT NULL COMMENT '商品来源平台如pdd,tb,1688,vd(微店)等',
|
||||
// `goods_id` varchar(50) NOT NULL COMMENT '映射商品id信息',
|
||||
// `shop_id` varchar(50) NOT NULL COMMENT '上传到的店铺id',
|
||||
// `price_min` int NOT NULL COMMENT '最低价,单位分',
|
||||
// `price_max` int NOT NULL COMMENT '最高价,单位分',
|
||||
// `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
// PRIMARY KEY(`id`),
|
||||
// KEY `index_add_time` (`add_time`) USING BTREE,
|
||||
// KEY `index_up_spu_id` (`up_spu_id`) USING BTREE,
|
||||
// KEY `index_shop_id` (`shop_id`) USING BTREE,
|
||||
// KEY `index_price_min` (`price_min`) USING BTREE,
|
||||
// KEY `index_price_max` (`price_max`) USING BTREE
|
||||
// ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '记录拼多多关联数据信息'";
|
||||
// var rst = mySql.ExecuteNonQuery(sql);
|
||||
//}
|
||||
//mySql.Close();
|
||||
|
||||
|
||||
//string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
//MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
@@ -374,6 +374,7 @@ namespace KJD_Web.BLL.WXXD
|
||||
|
||||
public string WXAddSecretSpuIdShopIdMap(string inputData)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"接口已作废\"}";
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
|
||||
@@ -539,5 +539,34 @@ namespace KJD_Web
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拼多多关联新增
|
||||
/// </summary>
|
||||
[WebMethod]
|
||||
public void add_relation()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().AddRelation(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
/// <summary>
|
||||
/// 拼多多关联获取
|
||||
/// </summary>
|
||||
[WebMethod]
|
||||
public void get_relation()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().GetRelation(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,41 @@ namespace KJD_Web
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_pdd_client_info()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().GetPddClientInfo(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_shop_client_info()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().GetShopClientInfo(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
//WXAddMdyShopClientInfo
|
||||
[WebMethod]
|
||||
public void add_mdy_shop_client_info()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().AddMdyShopClientInfo(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_shop_list()
|
||||
{
|
||||
@@ -240,5 +275,61 @@ namespace KJD_Web
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void add_weidian_shop()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().AddWeiDianShop(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void mdy_weidian_shop()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().MdyWeiDianShop(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void mdy_weidian_shop_cookie()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().MdyWeiDianShopCookie(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_weidian_shop()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().GetWeiDianShop(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void del_weidian_shop()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXShopManage().DelWeiDianShop(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,7 @@ namespace KJD_Web.Model
|
||||
public string real_spu_id { get; set; }
|
||||
public string has_wx_format { get; set; }
|
||||
public string problem_prod_data { get; set; }
|
||||
public int is_relation { get; set; }
|
||||
}
|
||||
|
||||
public class KJDDBProduct : DBProductResultParam
|
||||
|
||||
@@ -25,6 +25,10 @@ namespace KJD_Web.Model.ShopModel
|
||||
/// </summary>
|
||||
public string mall_id { get; set; }
|
||||
/// <summary>
|
||||
/// 微店网页token
|
||||
/// </summary>
|
||||
public string wd_token { get; set; }
|
||||
/// <summary>
|
||||
/// 微信openId
|
||||
/// </summary>
|
||||
public string openid { get; set; }
|
||||
@@ -65,4 +69,17 @@ namespace KJD_Web.Model.ShopModel
|
||||
public DateTime? jit_expire_time { get; set; }
|
||||
public DateTime? add_time { get; set; }
|
||||
}
|
||||
|
||||
public class AuthInfo
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string ShopId { get; set; } = "";
|
||||
public string AccessToken { get; set; } = "";
|
||||
public string RefreshToken { get; set; } = "";
|
||||
public string AppKey { get; set; } = "";
|
||||
public string AppSecret { get; set; } = "";
|
||||
public DateTime ExpiresTime { get; set; }
|
||||
public DateTime UpdateTime { get; set; } = DateTime.MinValue;
|
||||
public string ApiAuthStatus { get; set; } = "未授权";
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,10 @@ namespace KJD_Web.Upload.Prod
|
||||
{
|
||||
string prodStr = Encoding.UTF8.GetString(this.FileUpload1.FileBytes);
|
||||
prodStr = TextBox2.Text.Trim();
|
||||
var reducePer = 0m;
|
||||
var realPricePer = 1m - reducePer * 0.01m;
|
||||
if (realPricePer < 0.1m)
|
||||
realPricePer = 0.1m;
|
||||
|
||||
WXClientProductInfoLite wxClientProd = new WXClientProductInfoLite();
|
||||
|
||||
@@ -92,11 +96,11 @@ namespace KJD_Web.Upload.Prod
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.product_key = JsonUtils.DeserializeJsonToObject<wx_client_prod_key>(regex_str);
|
||||
if (wxClientProd.product_key == null)
|
||||
return "解析失败";
|
||||
return "解析失败product_key";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败product_key";
|
||||
}
|
||||
|
||||
//商品详情格式
|
||||
@@ -105,7 +109,7 @@ namespace KJD_Web.Upload.Prod
|
||||
//主标题
|
||||
wxClientProd.info.title = RegexUtils.GetStringJson(ref prodStr, "title");
|
||||
if (wxClientProd.info.title.IsNullOrEmpty())
|
||||
return "解析失败";
|
||||
return "解析失败title";
|
||||
|
||||
//副标题
|
||||
wxClientProd.info.sub_title = RegexUtils.GetStringJson(ref prodStr, "sub_title");
|
||||
@@ -116,11 +120,11 @@ namespace KJD_Web.Upload.Prod
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.head_img = JsonUtils.DeserializeJsonToListNullable<string>(regex_str);
|
||||
if (wxClientProd.info.head_img == null)
|
||||
return "解析失败";
|
||||
return "解析失败head_img";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败head_img";
|
||||
}
|
||||
|
||||
var nodeCatId = RegexUtils.GetStringJson(ref prodStr, "nodeCatId");
|
||||
@@ -139,7 +143,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败category";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "detail");
|
||||
@@ -158,7 +162,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败detail";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "param");
|
||||
@@ -173,7 +177,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败param";
|
||||
}
|
||||
|
||||
//品牌id
|
||||
@@ -191,7 +195,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
return "解析失败sku_id_list";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "sku_list");
|
||||
@@ -204,7 +208,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败sku_list";
|
||||
}
|
||||
|
||||
if (wxClientProd.info.sku_list == null)
|
||||
@@ -222,7 +226,16 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败sku_info";
|
||||
}
|
||||
}
|
||||
|
||||
// 佣金商品 根据折扣价格和佣金比例减去佣金
|
||||
if (wxClientProd.info.sku_list != null)
|
||||
{
|
||||
foreach (var sku in wxClientProd.info.sku_list.sku_info)
|
||||
{
|
||||
sku.price = (sku.price - (sku.price - sku.discounted_price) * (1m - realPricePer)).ParseToInt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +249,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败product_sale_attrs";
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +268,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败service_desc";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "express_info");
|
||||
@@ -268,7 +281,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败express_info";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "headVideoInfo");
|
||||
@@ -281,7 +294,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败headVideoInfo";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonObjStrJson(ref prodStr, "afterSaleInfo");
|
||||
@@ -294,7 +307,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败afterSaleInfo";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "deliveryExpressFee");
|
||||
@@ -307,7 +320,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败deliveryExpressFee";
|
||||
}
|
||||
|
||||
str_lst = RegexUtils.GetJsonArrStrJson(ref prodStr, "templateInfo");
|
||||
@@ -320,7 +333,7 @@ namespace KJD_Web.Upload.Prod
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败templateInfo";
|
||||
}
|
||||
|
||||
wxClientProd.info.spuCode = RegexUtils.GetStringJson(ref prodStr, "spuCode");
|
||||
@@ -331,11 +344,26 @@ namespace KJD_Web.Upload.Prod
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.productSkus = JsonUtils.DeserializeJsonToList<WXProductSkuInfoLite>(regex_str);
|
||||
if (wxClientProd.productSkus == null)
|
||||
return "解析失败";
|
||||
return "解析失败productSkus";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败";
|
||||
return "解析失败productSkus";
|
||||
}
|
||||
|
||||
// 佣金商品 根据价格给售卖价格赋值,如果价格丢失,直接在售卖价上计算
|
||||
foreach (var sku in wxClientProd.productSkus)
|
||||
{
|
||||
var wxDisSku = wxClientProd.info.sku_list?.sku_info?.FirstOrDefault(s => s.sku_id == sku.skuKey.skuId);
|
||||
if (wxDisSku != null)
|
||||
sku.productSkuInfo.salePrice = wxDisSku.price;
|
||||
else
|
||||
sku.productSkuInfo.salePrice = (sku.productSkuInfo.salePrice - sku.productSkuInfo.salePrice * realPricePer).ParseToInt();
|
||||
}
|
||||
|
||||
if (wxClientProd.productSkus.Min(s => s.productSkuInfo.salePrice * 0.01m) == 0)
|
||||
{
|
||||
return "解析失败Sku价格为0";
|
||||
}
|
||||
|
||||
return SaveWxProd(wxClientProd.product_key.product_id, wxClientProd, prodStr);
|
||||
|
||||
Reference in new issue
Block a user