店铺单店token获取并使用逻辑实现
This commit is contained in:
1 parent
4fd8d9cc17
commit
b42155ae6c
12 files changed
+289
-203
No files matched your search
@@ -1756,85 +1756,8 @@ namespace KJD_Web.BLL.BXX
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetAfterSale(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
string url = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "get_url"));
|
||||
string rst = HttpUtils.e57GetResponse(url, "");
|
||||
return rst;
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetWxTokens(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 id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'")).ParseToInt();
|
||||
if (id == 0)
|
||||
id = 1;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "select tokens,mdy_time from wxxd.wx_token WHERE id=" + id + ";";
|
||||
var rst = mySql.ExecuteDataTableRow(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string tokens = rst["tokens"].ParseToString();
|
||||
var mdyTime = Convert.ToDateTime(rst["mdy_time"]);
|
||||
if (mdyTime.AddMinutes(60) < DateTime.Now)
|
||||
{
|
||||
var tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", "");
|
||||
if (!tokenRst.Contains("\"code\":0"))
|
||||
tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", "");
|
||||
if (!tokenRst.Contains("\"code\":0"))
|
||||
{
|
||||
var errMsg = RegexUtils.GetStringJson(ref tokenRst, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = tokenRst;
|
||||
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
|
||||
}
|
||||
mdyTime = DateTime.Now;
|
||||
tokens = JsonUtils.SerializerObjectToString(JObject.Parse(tokenRst)["list"]);
|
||||
|
||||
conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
mySql = new MysqlUtils(conn);
|
||||
sql = "update wxxd.wx_token set tokens='" + tokens + "' where id=1;";
|
||||
bool su = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":200,\"tokens\":" + tokens + ",\"mdy_time\":\"" + mdyTime.ToString("yyyy-MM-dd HH:mm:ss") + "\"}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
|
||||
public string WxApiGetWxAllCate(string inputData)
|
||||
{
|
||||
|
||||
@@ -640,40 +640,6 @@ namespace KJD_Web.BLL.DYXD
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
|
||||
public string MdyAntiContent(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
|
||||
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
|
||||
string anti_contents = RegexUtils.GetStringQuery(ref inputData, "anti_contents");
|
||||
|
||||
int r2 = 0;
|
||||
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
|
||||
|
||||
if (string.IsNullOrEmpty(login_name))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"店铺没有登录名\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update dyxd.shop set";
|
||||
if (anti_contents != null)
|
||||
sql += " anti_contents='" + anti_contents + "',";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where login_name='" + login_name + "' and shop_id='" + shop_id + "';";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
|
||||
public string MdyCookieAndLoginStatus(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
|
||||
@@ -676,5 +676,60 @@ namespace KJD_Web.BLL.WXXD
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
|
||||
public string E57GetFreightTemplate(string inputData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputData))
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
// 供应商id
|
||||
string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
|
||||
|
||||
try
|
||||
{
|
||||
// 获取运费模板
|
||||
//"https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=10361546";
|
||||
var urlShip = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=" + coid;
|
||||
var shipRst = HttpUtils.e57GetResponse(urlShip, "");
|
||||
return shipRst;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":50001,\"msg\":\"" + ex.Message + "\"}";
|
||||
}
|
||||
}
|
||||
|
||||
public string E57AfterSale(string inputData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputData))
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
// 供应商id
|
||||
string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
|
||||
|
||||
try
|
||||
{
|
||||
// 获取推单售后地址
|
||||
//https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955
|
||||
var urlAfter = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + coid;
|
||||
var shipRst = HttpUtils.e57GetResponse(urlAfter, "");
|
||||
return shipRst;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":50001,\"msg\":\"" + ex.Message + "\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using KJD_Web.Model.ShopModel;
|
||||
using KJD_Web.Utils;
|
||||
using MySqlX.XDevAPI;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -644,40 +645,6 @@ namespace KJD_Web.BLL.WXXD
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
|
||||
public string MdyAntiContent(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
|
||||
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
|
||||
string anti_contents = RegexUtils.GetStringQuery(ref inputData, "anti_contents");
|
||||
|
||||
int r2 = 0;
|
||||
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
|
||||
|
||||
if (string.IsNullOrEmpty(login_name))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"店铺没有登录名\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update wxxd.shop set";
|
||||
if (anti_contents != null)
|
||||
sql += " anti_contents='" + anti_contents + "',";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where login_name='" + login_name + "' and shop_id='" + shop_id + "';";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"未知错误\"}";
|
||||
}
|
||||
|
||||
public string MdyCookieAndLoginStatus(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
@@ -816,5 +783,89 @@ namespace KJD_Web.BLL.WXXD
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string E57GetWxTokens(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 id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'")).ParseToInt();
|
||||
if (id == 0)
|
||||
id = 1;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "select tokens,mdy_time from wxxd.wx_token WHERE id=" + id + ";";
|
||||
var rst = mySql.ExecuteDataTableRow(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string tokens = rst["tokens"].ParseToString();
|
||||
var mdyTime = Convert.ToDateTime(rst["mdy_time"]);
|
||||
if (mdyTime.AddMinutes(60) < DateTime.Now)
|
||||
{
|
||||
var tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", "");
|
||||
if (!tokenRst.Contains("\"code\":0"))
|
||||
tokenRst = HttpUtils.e57GetResponse("https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户", "");
|
||||
if (!tokenRst.Contains("\"code\":0"))
|
||||
{
|
||||
var errMsg = RegexUtils.GetStringJson(ref tokenRst, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = tokenRst;
|
||||
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
|
||||
}
|
||||
mdyTime = DateTime.Now;
|
||||
tokens = JsonUtils.SerializerObjectToString(JObject.Parse(tokenRst)["list"]);
|
||||
|
||||
conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
mySql = new MysqlUtils(conn);
|
||||
sql = "update wxxd.wx_token set tokens='" + tokens + "' where id=1;";
|
||||
bool su = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":200,\"tokens\":" + tokens + ",\"mdy_time\":\"" + mdyTime.ToString("yyyy-MM-dd HH:mm:ss") + "\"}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string E57GetWxShopToken(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 shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
|
||||
var url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/info?appId=" + shop_id;
|
||||
|
||||
var tokenRst = HttpUtils.e57GetResponse(url, "");
|
||||
if (!tokenRst.Contains("\"code\":0"))
|
||||
tokenRst = HttpUtils.e57GetResponse(url, "");
|
||||
return tokenRst;
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using KJD_Web.BLL.BXX;
|
||||
using KJD_Web.BLL.WXXD;
|
||||
using KJD_Web.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -355,14 +356,14 @@ namespace KJD_Web
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().GetWxTokens(jsontext);
|
||||
result = new WXShopManage().E57GetWxTokens(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_wx_all_cate()
|
||||
public void wx_api_get_all_cate()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
|
||||
@@ -109,18 +109,6 @@ namespace KJD_Web
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_anti_content()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new DYShopManage().MdyAntiContent(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_shop_cookie_and_login_status()
|
||||
{
|
||||
|
||||
@@ -169,5 +169,65 @@ namespace KJD_Web
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void e57_get_freight_template()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXProductManage().E57GetFreightTemplate(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void e57_after_sale()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXProductManage().E57AfterSale(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void wx_api_get_all_cate()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().WxApiGetWxAllCate(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void wx_api_category_classify()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().WxApiCategoryClassify(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void wx_api_upload_image()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new BXXProductManage().WxApiUploadImage(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,18 +109,6 @@ namespace KJD_Web
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_anti_content()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXShopManage().MdyAntiContent(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_shop_cookie_and_login_status()
|
||||
{
|
||||
@@ -216,5 +204,30 @@ namespace KJD_Web
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void e57_get_wx_tokens()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXShopManage().E57GetWxTokens(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public void e57_get_wx_shop_token()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXShopManage().E57GetWxShopToken(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user