|
@@ -528,4 +528,38 @@ class BotRecords(db.Model):
|
|
|
'intent': self.intent,
|
|
|
'contents': self.contents,
|
|
|
'dialog': self.dialog,
|
|
|
+ }
|
|
|
+
|
|
|
+class WarningRecord(db.Model):
|
|
|
+ __tablename__ = 't_warning_record'
|
|
|
+ __table_args__ = {'comment': '告警记录表'}
|
|
|
+
|
|
|
+ id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='主键')
|
|
|
+ type = db.Column(db.SmallInteger, nullable=True, comment='类型(0:连续5个未接 1:10分钟空岗报警 2:连续3个5s内挂断)')
|
|
|
+ desc = db.Column(db.String(500), nullable=True, comment='报警描述')
|
|
|
+ read = db.Column(db.SmallInteger, nullable=False, default=0, comment='是否已读(0否 1是)')
|
|
|
+ del_flag = db.Column(db.SmallInteger, nullable=False, default=0, comment='删除标志(0代表存在 2代表删除)')
|
|
|
+ revision = db.Column(db.Integer, nullable=True, comment='乐观锁')
|
|
|
+ create_by = db.Column(db.String(100), nullable=True, comment='创建人')
|
|
|
+ create_time = db.Column(db.DateTime, nullable=True, comment='创建时间')
|
|
|
+ update_by = db.Column(db.String(100), nullable=True, comment='更新人')
|
|
|
+ update_time = db.Column(db.DateTime, nullable=True, comment='更新时间')
|
|
|
+ remark = db.Column(db.String(500), nullable=True, comment='备注')
|
|
|
+
|
|
|
+ def __repr__(self):
|
|
|
+ return json.dumps(self.to_dict())
|
|
|
+
|
|
|
+ def to_dict(self):
|
|
|
+ return {
|
|
|
+ 'id': self.id,
|
|
|
+ 'type': self.type,
|
|
|
+ 'desc': self.desc,
|
|
|
+ 'read': self.read,
|
|
|
+ 'del_flag': self.del_flag,
|
|
|
+ 'revision': self.revision,
|
|
|
+ 'create_by': self.create_by,
|
|
|
+ 'create_time': self.create_time.isoformat() if self.create_time else None,
|
|
|
+ 'update_by': self.update_by,
|
|
|
+ 'update_time': self.update_time.isoformat() if self.update_time else None,
|
|
|
+ 'remark': self.remark,
|
|
|
}
|