market.js 686 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 商品类型
  5. type: { type: String, required: true },
  6. // 商品名
  7. name: { type: String, required: true },
  8. // 商品绑定货物ID
  9. bindId: { type: String, required: true },
  10. // 商品状态 0=在售,1=下架,2=售馨
  11. status: { type: String, required: true },
  12. // 价格
  13. money: { type: Number, required: true },
  14. // 积分
  15. integral: { type: Number, required: true },
  16. // 图片
  17. thumbnail: { type: String, required: true },
  18. };
  19. const schema = new Schema(SchemaDefine);
  20. module.exports = app => {
  21. const { mongoose } = app;
  22. return mongoose.model('market', schema, 'market');
  23. };