msg.py 960 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter database
  5. name:msg.py
  6. author:rabin
  7. mqtt里的key:msg/type_key/farm_id/uid,value
  8. """
  9. from __load__ import *
  10. class Msg(Model):
  11. __table__ = 'msg'
  12. __comment__ = '消息表'
  13. id = Fields(type='uuid', primaryKey=True, comment='消息ID', uuid='farm_id')
  14. farm_id = Fields(type='int', default='setting.farm', comment='园区ID')
  15. device_id = Fields(type='uuid', comment='设备ID')
  16. uid = Fields(type='uuid', comment='用户ID')
  17. type_id = Fields(type='int', comment='分类ID')
  18. link = Fields(type='varchar(255)', comment='消息链接')
  19. content = Fields(type='text', comment='消息内容')
  20. push = Fields(type='varchar(50)', comment='推送')
  21. status = Fields(type='boolean', default='False', comment='是否已读')
  22. state = Fields(type='boolean', default='True', comment='数据存在状态')
  23. cdate = Fields(type='int', default='time', comment='创建时间')