新版本号 优化上货

This commit is contained in:
wule committed 2026-11-19 16:43:33 +08:00
1 parent 5a6995d70b
commit f1577027e5
14 files changed
+296 -83

No files matched your search

+42 -24
View File
@@ -43,28 +43,46 @@ namespace TemuKJD.BLL
return GlobalConfig.WxGlobalTokenList.Where(t => t.isExpire != true).OrderBy(x => Guid.NewGuid()).FirstOrDefault();
}
public WXShopTokenInfo GetShopWxToken(ShopLoginInfo shop)
{
var url = BaseClass.BuildObjString("shop/e57_get_wx_shop_token");
var data = UserLogin.GetSignaturex();
data += "&shop_id=" + shop.ShopId;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":0"))
{
}
else
{
var token = new WXShopTokenInfo()
{
shopId = shop.ShopId,
accessToken = BaseRegex.GetStringJson(ref html, "accessToken"),
mdyTime = DateTime.Now,
};
//shop.WxToken = BaseRegex.GetStringJson(ref html, "accessToken");
//shop.WxTokenExpire = DateTime.Now.AddMinutes(60);
return token;
}
return new WXShopTokenInfo() { shopId = shop.ShopId, accessToken = "", mdyTime = DateTime.Now };
}
}
private WXShopTokenInfo UpdateShopWxToken(ShopLoginInfo shop)
{
var url = BaseClass.BuildObjString("shop/e57_get_wx_shop_token");
var data = UserLogin.GetSignaturex();
data += "&shop_id=" + shop.ShopId;
var html = GetHtml.PostUtf8(url, data);
// 获取失败
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":0"))
{
return new WXShopTokenInfo() { shopId = shop.ShopId, accessToken = "", mdyTime = DateTime.Now };
}
else
{
var token = new WXShopTokenInfo()
{
shopId = shop.ShopId,
accessToken = BaseRegex.GetStringJson(ref html, "accessToken"),
mdyTime = DateTime.Now,
};
return token;
}
}
public WXShopTokenInfo GetWxToken(ShopLoginInfo shop)
{
WXShopTokenInfo token = GlobalConfig.lstWXShopTokenInfo.FirstOrDefault(t => t.shopId == shop.ShopId);
if (token == null)
token = new WXShopTokenInfo();
if (token.isExpire || string.IsNullOrEmpty(token.accessToken))
{
token = new WxApiBLL().UpdateShopWxToken(shop);
if (!string.IsNullOrEmpty(token.accessToken))
{
GlobalConfig.lstWXShopTokenInfo.RemoveAll(t => t.shopId == shop.ShopId);
GlobalConfig.lstWXShopTokenInfo.Add(token);
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_shop_token_list", GlobalConfig.lstWXShopTokenInfo);
}
}
return token;
}
}
}