This commit is contained in:
@@ -45,7 +45,7 @@ def get_current_wechat_user(request):
|
||||
except (BadSignature, SignatureExpired):
|
||||
return None
|
||||
|
||||
def get_access_token(config=None):
|
||||
def get_access_token(config=None, force_refresh=False):
|
||||
"""
|
||||
获取微信接口调用凭证 (client_credential)
|
||||
"""
|
||||
@@ -54,9 +54,10 @@ def get_access_token(config=None):
|
||||
if config:
|
||||
cache_key = f'wechat_access_token_{config.app_id}'
|
||||
|
||||
token = cache.get(cache_key)
|
||||
if token:
|
||||
return token
|
||||
if not force_refresh:
|
||||
token = cache.get(cache_key)
|
||||
if token:
|
||||
return token
|
||||
|
||||
if not config:
|
||||
# 优先查找指定 AppID
|
||||
|
||||
Reference in New Issue
Block a user