vipParse.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # File : vipParse.py
  4. # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
  5. # Date : 2022/10/31
  6. from base.database import db
  7. from datetime import datetime
  8. class VipParse(db.Model):
  9. __tablename__ = 'vip_parse'
  10. id = db.Column(db.Integer, primary_key=True, autoincrement=True)
  11. name = db.Column(db.String(20))
  12. url = db.Column(db.String(255),unique=True)
  13. state = db.Column(db.Integer, default=1)
  14. type = db.Column(db.Integer, default=0)
  15. order = db.Column(db.Integer, default=0)
  16. ext = db.Column(db.String(255))
  17. header = db.Column(db.String(255))
  18. create_date = db.Column(db.DateTime, index=True, default=datetime.now)
  19. write_date = db.Column(db.DateTime, index=True, default=datetime.now,onupdate=datetime.now)
  20. def __repr__(self):
  21. return "<VipParse(id='%s', name='%s', url='%s')>" % (
  22. self.id, self.name, self.url)
  23. @classmethod
  24. def hasItem(self, url):
  25. exists = db.session.query(self).filter(self.url == url).scalar() is not None
  26. if exists:
  27. return True
  28. else:
  29. return False