# -*- coding: utf-8 -*- from .__load__ import * class Role_data(Model): __table__ = 'role_data' __comment__ = '角色知识库' id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='ID') role_id = Fields(type='int', comment='角色id') data_id = Fields(type='int', comment='数据文件id') state = Fields(type='boolean', default='True', comment='数据存在状态') cdate = Fields(type='int', default='time', comment='创建时间') def getCur(self, id): self.id = id data = self.select(type='fetchone') return data def getList(self, page = 1, param = {}): cate = Demeter.model('video_cate').getCur() self.cate_id = cate['id'] Demeter.config['page'] = {} Demeter.config['page']['current'] = page data = self.select(page=True) result = [] if data: for key, value in enumerate(data): #cate = Demeter.service('common').one('video_cate', id=value['cate_id']) value['cdate'] = Demeter.date(value['cdate']) result.append([str(value['id']), value['name'], value['cdate'], '']) return result