店铺单店token获取并使用逻辑实现

This commit is contained in:
wule committed 2026-02-06 15:13:43 +08:00
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)
{