six_003
This commit is contained in:
+13
-11
@@ -33,10 +33,11 @@ class sixToken:
|
||||
wechat_appid = "wx654fffabd4b1f5cf" # TODO 服务号的测试的
|
||||
# wechat_appsecret = "1c76fbfea91f36bede14e2cf2dc756dc" #TODO 服务号的appsecret
|
||||
wechat_appsecret = "b1017a44b93fb08ae95b408fd19ff9d9" # 服务号测试的appsecret
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_wecom_token(cls):
|
||||
""""""
|
||||
print("每次都会被调用的wecom")
|
||||
查询对象, 是否存在 = weitoken.objects.get_or_create(token_name="wecom_token")
|
||||
if 查询对象.token_value is None:
|
||||
print("为空,get_wecom_token 新调用一下")
|
||||
@@ -52,7 +53,7 @@ class sixToken:
|
||||
else:
|
||||
return 查询对象.token_value
|
||||
return 查询对象.token_value
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_wecom_tick(cls):
|
||||
pass
|
||||
@@ -73,7 +74,7 @@ class sixToken:
|
||||
print("在有效时间内")
|
||||
return 查询对象.tick_value
|
||||
return 查询对象.tick_value
|
||||
|
||||
|
||||
@classmethod
|
||||
def mini_token(cls):
|
||||
""""""
|
||||
@@ -84,7 +85,7 @@ class sixToken:
|
||||
小程序token: str = jmespath.search(data=token, expression="access_token", )
|
||||
返回对象, _ = weitoken.objects.update_or_create(token_name="mini_token", defaults={"token_value": 小程序token})
|
||||
return 返回对象
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_mini_token(cls):
|
||||
"""
|
||||
@@ -92,6 +93,7 @@ class sixToken:
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
print("是不是每次都在调用的吗")
|
||||
查询对象, 是否存在 = weitoken.objects.get_or_create(token_name="mini_token")
|
||||
if 查询对象.token_value is None:
|
||||
创建的新对象 = cls.mini_token()
|
||||
@@ -106,7 +108,7 @@ class sixToken:
|
||||
else:
|
||||
return 查询对象.token_value
|
||||
return None
|
||||
|
||||
|
||||
@classmethod
|
||||
def token统一调服务号(cls):
|
||||
"""获取了六果服务号的token:注意不是授权时的token"""
|
||||
@@ -122,11 +124,11 @@ class sixToken:
|
||||
ticket服务号 = pydash.get(obj=json_data, path="ticket", default=None)
|
||||
返回对象, _ = weitoken.objects.update_or_create(token_name="mini_token", defaults={"token_value": wechat_token服务号, "tick_value": ticket服务号})
|
||||
return 返回对象
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_wechat_token(cls):
|
||||
""""""
|
||||
|
||||
|
||||
查询对象, 是否存在 = weitoken.objects.get_or_create(token_name="wechat_token")
|
||||
if 查询对象.token_value is None:
|
||||
print("为空,所以需要重 新调用一下")
|
||||
@@ -143,7 +145,7 @@ class sixToken:
|
||||
print("在有效时间内")
|
||||
return 查询对象.token_value
|
||||
return None
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_wechat_tick_token(cls):
|
||||
查询对象, 是否存在 = weitoken.objects.get_or_create(token_name="wechat_token")
|
||||
@@ -162,7 +164,7 @@ class sixToken:
|
||||
print("在有效时间内")
|
||||
return 查询对象.tick_value
|
||||
return None
|
||||
|
||||
|
||||
@classmethod
|
||||
def token统一调用企微获取接口(cls):
|
||||
"""手机端的token"""
|
||||
@@ -183,7 +185,7 @@ class sixToken:
|
||||
"phone_token_value": phone_token, "token_value": 企微token, "tick_value": wecom_tick_data,
|
||||
})
|
||||
return 返回对象
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_weom_phone_token(cls):
|
||||
查询对象, 是否存在 = weitoken.objects.get_or_create(token_name="wecom_token")
|
||||
@@ -202,7 +204,7 @@ class sixToken:
|
||||
print("在有效时间内")
|
||||
return 查询对象.phone_token_value
|
||||
return None
|
||||
|
||||
|
||||
@classmethod
|
||||
def 服务号网页授权TOKEN(cls, code: str):
|
||||
"""用户授权时,需要的token;
|
||||
|
||||
Reference in New Issue
Block a user