'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 交易记录表 const OperationlogSchema = { // login_id: { type: String, required: false, maxLength: 100 }, // 登陆者id login_role: { type: String, required: false, maxLength: 5 }, // 登陆者角色(如:展会申请用户) login_name: { type: String, required: false, maxLength: 20 }, // 登陆者名字 operation_edit: { type: String, required: false, maxLength: 50 }, // 操作者动作 operation_result: { type: String, required: false, maxLength: 5 }, // 0成功 1失败 type: { type: String, required: false, maxLength: 5, default: '0' }, // 0登录者信息、1操作信息、2.。。 remark: { type: String, required: false, maxLength: 500 }, // 说明 }; const schema = new Schema(OperationlogSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Operationlog', schema, 'operation_log'); };