123456789101112131415161718192021222324252627282930313233343536 |
- from django.db import models
- # Create your models here.
- # wechat access_token
- class WeChatAccessToken(models.Model):
- id = models.AutoField(primary_key=True)
- application = models.CharField(max_length=64)
- # 每个微信公众号设定自己的application,保证自己access_token刷新
- requestTime = models.DateTimeField(auto_now=True)
- accessTokenKey = models.CharField(max_length=512)
- @staticmethod
- def search_by_application(name):
- try:
- return WeChatAccessToken.objects.get(application=name)
- except Exception as e:
- print(e)
- return None
- # jsapi_token
- class JsapiAccessToken(models.Model):
- id = models.AutoField(primary_key=True)
- application = models.CharField(max_length=64)
- # 每个微信公众号设定自己的application,保证自己jsapi_token刷新
- requestTime = models.DateTimeField(auto_now=True)
- accessTokenKey = models.CharField(max_length=512)
- @staticmethod
- def search_by_application(name):
- try:
- return JsapiAccessToken.objects.get(application=name)
- except Exception as e:
- print(e)
- return None
|