微信商品回采功能
This commit is contained in:
1 parent
3db584fe1e
commit
d9900452f2
35 files changed
+4850
-696
No files matched your search
@@ -265,6 +265,7 @@ namespace KJD_Web.BLL.BXX
|
||||
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||||
var search_secret_spu_ids = RegexUtils.GetStringQuery(ref inputData, "search_secret_spu_ids")?.Replace("'", "\\'");
|
||||
var search_spu_ids = RegexUtils.GetStringQuery(ref inputData, "search_spu_ids")?.Replace("'", "\\'");
|
||||
var wx_safe_status = RegexUtils.GetStringQuery(ref inputData, "wx_safe_status")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(500);
|
||||
@@ -281,6 +282,10 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
sql += " and p.spu_id in ('" + string.Join("','", search_spu_ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) + "')";
|
||||
}
|
||||
if (wx_safe_status != null)
|
||||
{
|
||||
sql += " and p.wx_safe_status in ('" + string.Join("','", wx_safe_status.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) + "')";
|
||||
}
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
|
||||
mySql.Close();
|
||||
@@ -549,11 +554,12 @@ namespace KJD_Web.BLL.BXX
|
||||
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.has_wx_format = row["has_wx_format"].ParseToNullableString();
|
||||
prod.sku_img_replace_base64 = row["img_base64"].ToString();
|
||||
//prod.sku_img_replace_url = row["img_url"].ToString();
|
||||
prod.wx_img_map_json = row["wx_img_map_json"].ToString();
|
||||
|
||||
if(!prod.sku_secret_json.IsNullOrEmpty() && prod.secret_spu_id.IsNullOrEmpty())
|
||||
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");
|
||||
@@ -595,6 +601,153 @@ namespace KJD_Web.BLL.BXX
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回采微信小店属性等商品数据入库
|
||||
/// </summary>
|
||||
/// <param name="inputData"></param>
|
||||
/// <returns></returns>
|
||||
public string AddProdWXComplate(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var timeCalc = DateTime.Now;
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||||
if (user_name.IsNullOrEmpty())
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"用户信息不能为空\"}";
|
||||
}
|
||||
|
||||
var spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spu_id")).ParseToString().Replace("'", "\\'");
|
||||
var coid = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "coid")).ParseToString().Replace("'", "\\'");
|
||||
var secret_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "secret_spu_id")).ParseToString().Replace("'", "\\'");
|
||||
var wx_edit_prod_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_edit_prod_json")).ParseToString().Replace("'", "\\'");
|
||||
if (secret_spu_id.IsNullOrEmpty() || wx_edit_prod_json.IsNullOrEmpty())
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"商品回采数据不能为空\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "";
|
||||
sql = "INSERT INTO bxx.product_wx_complate (spu_id,coid,secret_spu_id,wx_edit_prod_json) VALUES " +
|
||||
" ('" + spu_id + "','" + coid + "','" + secret_spu_id + "','" + wx_edit_prod_json + "')" +
|
||||
" ON DUPLICATE KEY UPDATE spu_id=VALUES(spu_id),coid=VALUES(coid),wx_edit_prod_json=VALUES(wx_edit_prod_json);";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
if (!rst || !string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
sql = "UPDATE bxx.product set has_wx_format='1' where secret_spu_id='" + secret_spu_id + "'";
|
||||
rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (!rst || !string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"seconds\":" + seconds + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询回采微信小店属性等商品数据
|
||||
/// </summary>
|
||||
/// <param name="inputData"></param>
|
||||
/// <returns></returns>
|
||||
public string GetProdWXComplateList(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var timeCalc = DateTime.Now;
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
|
||||
if (user_name.IsNullOrEmpty())
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"用户信息不能为空\"}";
|
||||
}
|
||||
|
||||
var spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spu_id")).ParseToString().Replace("'", "\\'");
|
||||
var coid = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "coid")).ParseToString().Replace("'", "\\'");
|
||||
var search_secret_spu_ids = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_secret_spu_ids")).ParseToString().Replace("'", "\\'");
|
||||
if (search_secret_spu_ids.IsNullOrEmpty())
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"商品回采数据编号不能为空\"}";
|
||||
}
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(1000);
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "select id,spu_id,coid,secret_spu_id,wx_edit_prod_json,add_time" +
|
||||
" from bxx.product_wx_complate p where 1=1";
|
||||
if (search_secret_spu_ids != null)
|
||||
{
|
||||
sql += " and p.secret_spu_id in ('" + string.Join("','", search_secret_spu_ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) + "')";
|
||||
}
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
|
||||
mySql.Close();
|
||||
if (dt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
JArray wxProdComplateArr = new JArray();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
JObject wxProdComplateObj = new JObject();
|
||||
wxProdComplateObj["id"] = Convert.ToInt32(row["id"]);
|
||||
wxProdComplateObj["spu_id"] = row["spu_id"].ToString();
|
||||
wxProdComplateObj["coid"] = row["coid"].ToString();
|
||||
wxProdComplateObj["secret_spu_id"] = row["secret_spu_id"].ToString();
|
||||
wxProdComplateObj["wx_edit_prod_json"] = row["wx_edit_prod_json"].ToString();
|
||||
wxProdComplateObj["add_time"] = Convert.ToDateTime(row["add_time"]);
|
||||
wxProdComplateArr.Add(wxProdComplateObj);
|
||||
}
|
||||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
var data = JsonUtils.SerializerObjectToString(wxProdComplateArr, jsonSetting);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + wxProdComplateArr.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>
|
||||
/// 新增下架sku
|
||||
/// </summary>
|
||||
/// <param name="inputData"></param>
|
||||
/// <returns></returns>
|
||||
public string AddProdDownSku(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
@@ -669,6 +822,11 @@ namespace KJD_Web.BLL.BXX
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询下架sku
|
||||
/// </summary>
|
||||
/// <param name="inputData"></param>
|
||||
/// <returns></returns>
|
||||
public string GetProdDownSkuLstBySkuCodes(string inputData)
|
||||
{
|
||||
var timeCalc = DateTime.Now;
|
||||
@@ -989,6 +1147,7 @@ namespace KJD_Web.BLL.BXX
|
||||
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();
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
|
||||
@@ -1058,9 +1217,15 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
where += " and add_time > '" + DateTime.Now.AddDays(-add_days_less.ParseToInt()).ToString("yyyy-MM-dd") + "'";
|
||||
}
|
||||
if (!has_wx_format.IsNullOrEmpty())
|
||||
{
|
||||
where += " and has_wx_format = '" + has_wx_format + "'";
|
||||
}
|
||||
sql += where;
|
||||
|
||||
int count = prod_count;
|
||||
int count = prod_count;
|
||||
if (product_get_type == "厂商直采" && count > 1500)
|
||||
count /= 3;
|
||||
if (!is_not_count)
|
||||
{
|
||||
count = mySql.ExecuteRowCount(sql);
|
||||
|
||||
Reference in new issue
Block a user