operationlog.js 2.0 KB

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 交易记录表
  5. const OperationlogSchema = {
  6. // login_id: { type: String, required: false, maxLength: 100 }, // 登陆者id
  7. login_role: { type: String, required: false, maxLength: 5 }, // 登陆者角色(如:展会申请用户)
  8. login_name: { type: String, required: false, maxLength: 20 }, // 登陆者名字
  9. operation_edit: { type: String, required: false, maxLength: 50 }, // 操作者动作
  10. operation_result: { type: String, required: false, maxLength: 5 }, // 0成功 1失败
  11. type: { type: String, required: false, maxLength: 5, default: '0' }, // 0登录者信息、1操作信息、2.。。
  12. remark: { type: String, required: false, maxLength: 500 }, // 说明
  13. dockid: { type: String, required: false, maxLength: 500 }, // 对接id
  14. create_userid: { type: String, required: false, maxLength: 500 }, // 对接id
  15. userid: { type: String, required: false, maxLength: 500 }, // 购买人ID
  16. username: { type: String, required: false, maxLength: 500 }, // 购买人名称
  17. product_id: { type: String, required: false, maxLength: 500 }, // 产品ID
  18. product_name: { type: String, required: false, maxLength: 500 }, // 产品名称
  19. market_userid: { type: String, required: false, maxLength: 500 }, // 营销人ID
  20. market_username: { type: String, required: false, maxLength: 500 }, // 营销人名称
  21. description: { type: String, required: false, maxLength: 500 }, // 说明
  22. types: { type: String, required: false, maxLength: 20, default: '0' }, // 类别0、产品、1、专家
  23. status: { type: String, required: false, maxLength: 500 }, // 交易状态,0-发起交易,1-交易中,2-交易成功,3-交易取消
  24. };
  25. const schema = new Schema(OperationlogSchema, { toJSON: { virtuals: true } });
  26. schema.index({ id: 1 });
  27. schema.plugin(metaPlugin);
  28. module.exports = app => {
  29. const { mongoose } = app;
  30. return mongoose.model('Operationlog', schema, 'operation_log');
  31. };