From f43970a061d3c90520b4e8f48caa17a204d9a085 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期四, 15 八月 2024 10:19:38 +0800
Subject: [PATCH] 完供应商自主维护商品api和后台基础管理页面

---
 CoreCms.Net.Task/RefreshWeChatAccessTokenJob.cs |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/CoreCms.Net.Task/RefreshWeChatAccessTokenJob.cs b/CoreCms.Net.Task/RefreshWeChatAccessTokenJob.cs
index e416d73..fdef0d4 100644
--- a/CoreCms.Net.Task/RefreshWeChatAccessTokenJob.cs
+++ b/CoreCms.Net.Task/RefreshWeChatAccessTokenJob.cs
@@ -1,10 +1,10 @@
 锘�/***********************************************************************
- *            Project: CoreCms.Net                                     *
- *                Web: https://CoreCms.Net                             *
- *        ProjectName: 鏍稿績鍐呭绠$悊绯荤粺                                *
- *             Author: 澶х伆鐏�                                          *
- *              Email: JianWeie@163.com                                *
- *         CreateTime: 2020-08-25 1:25:29
+ *            Project: baifenBinfa.Net                                     *
+ *                Web: https://baifenBinfa.com                             *
+ *        ProjectName: 鐧惧垎鍏垫硶绠$悊绯荤粺                               *
+ *             Author:                                        *
+ *              Email:                               *
+ *         CreateTime: 2024-03-11 09:33:00
  *        Description: 鏆傛棤
  ***********************************************************************/
 
@@ -142,6 +142,7 @@
                 if (!string.IsNullOrEmpty(_weChatOptions.WxOpenAppId) && !string.IsNullOrEmpty(_weChatOptions.WxOpenAppSecret))
                 {
                     var entity = await _weChatAccessTokenServices.QueryByClauseAsync(p => p.appId == _weChatOptions.WxOpenAppId && p.appType == (int)GlobalEnumVars.AccessTokenEnum.WxOpenAccessToken);
+
                     if (entity == null || entity.expireTimestamp <= DateTimeOffset.Now.ToUnixTimeSeconds())
                     {
                         var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
@@ -203,6 +204,18 @@
                     }
                     else
                     {
+
+
+
+                      var value=  await _redisOperationRepository.Get<WeChatAccessToken>(
+                               GlobalEnumVars.AccessTokenEnum.WxOpenAccessToken.ToString());
+                        if (value == null)
+                        {
+                            //閲嶆柊璁剧疆key
+                            await _redisOperationRepository.SetAsync(
+                            GlobalEnumVars.AccessTokenEnum.WxOpenAccessToken.ToString(), entity,
+                            TimeSpan.FromMinutes(120));
+                        }
                         //鎻掑叆鏃ュ織
                         var model = new SysTaskLog
                         {

--
Gitblit v1.9.1