log.py 842 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from flask import Blueprint
  4. from api.base import Base
  5. from models import Log
  6. from models import Rules
  7. from models import Utils
  8. __author__ = 'James Iter'
  9. __date__ = '2017/4/8'
  10. __contact__ = 'james.iter.cn@gmail.com'
  11. __copyright__ = '(c) 2017 by James Iter.'
  12. blueprint = Blueprint(
  13. 'api_log',
  14. __name__,
  15. url_prefix='/api/log'
  16. )
  17. blueprints = Blueprint(
  18. 'api_logs',
  19. __name__,
  20. url_prefix='/api/logs'
  21. )
  22. log_base = Base(the_class=Log, the_blueprint=blueprint, the_blueprints=blueprints)
  23. @Utils.dumps2response
  24. def r_get(ids):
  25. return log_base.get(ids=ids, ids_rule=Rules.IDS.value, by_field='id')
  26. @Utils.dumps2response
  27. def r_get_by_filter():
  28. return log_base.get_by_filter()
  29. @Utils.dumps2response
  30. def r_content_search():
  31. return log_base.content_search()