msg.py 781 B

1234567891011121314151617181920212223
  1. # -*- coding: utf-8 -*-
  2. """
  3. demeter web page
  4. name:msg.py
  5. author:rabin
  6. """
  7. from .__load__ import *
  8. class index_path(Load):
  9. @Web.auth
  10. @Web.setting
  11. def get(self):
  12. self.data['list'] = self.service('common').list('msg', search={'farm_id':self.data['setting']['farm']}, page=True, order='status asc, cdate desc')
  13. if self.data['list']:
  14. for key, value in enumerate(self.data['list']):
  15. type_info = self.service('common').one('msg_type', id=value['type_id'])
  16. self.data['list'][key]['type'] = type_info['name']
  17. self.data['list'][key]['cdates'] = Demeter.date(value['cdate'])
  18. id = value['id']
  19. update = {}
  20. update['status'] = True
  21. self.service('common').update('msg', id, update, cdate=False)
  22. self.view("msg/index.html")