msg.py 938 B

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