verify
This commit is contained in:
47
src/modules/vreq/vreq.model.js
Normal file
47
src/modules/vreq/vreq.model.js
Normal file
@@ -0,0 +1,47 @@
|
||||
'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;
|
||||
Reference in New Issue
Block a user