47 lines
874 B
JavaScript
47 lines
874 B
JavaScript
'use strict';
|
|
|
|
const mongoose = require('mongoose');
|
|
// 实名认证工单
|
|
const VreqSchema = new mongoose.Schema({
|
|
userId: {
|
|
type: String,
|
|
},
|
|
verifyLevel: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
status: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
data: {
|
|
type: {}
|
|
},
|
|
info: {
|
|
type: String,
|
|
default: '审核中'
|
|
},
|
|
option: {
|
|
type: {}
|
|
}
|
|
},{
|
|
timestamps: {}
|
|
});
|
|
|
|
const VreqModel = mongoose.model('Vreq', VreqSchema);
|
|
/**
|
|
* status: created -> processing -> finished
|
|
*/
|
|
VreqModel.prototype.next = async function (handler = '') {
|
|
// handler 表示处理人
|
|
if (+this.status === 1) return this;
|
|
if (this.status === 0) {
|
|
await this.update({
|
|
status: 'processing',
|
|
handler
|
|
});
|
|
}
|
|
return this;
|
|
};
|
|
|
|
module.exports = VreqModel; |