123456789101112131415161718192021 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 微信公众号关注用户表
- const wxUserCache = {
- wxopenid: { type: String }, // 公众号id
- unionid: { type: String }, // 开放平台id
- remark: { type: String },
- };
- const schema = new Schema(wxUserCache, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ wxopenid: 1 });
- schema.index({ unionid: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('WxUserCache', schema, 'wxUserCache');
- };
|