vreq
This commit is contained in:
@@ -7,7 +7,9 @@ const Action = require('../action/action.model');
|
|||||||
const Ticket = require('../ticket/ticket.model');
|
const Ticket = require('../ticket/ticket.model');
|
||||||
const User = require('../user/user.model');
|
const User = require('../user/user.model');
|
||||||
const Fund = require('../fund/fund.model');
|
const Fund = require('../fund/fund.model');
|
||||||
|
const Vreq = require('../vreq/vreq.model');
|
||||||
const crypto = require('../../utils/crypto');
|
const crypto = require('../../utils/crypto');
|
||||||
|
const { handleReq } = require('../vreq/vreq.handler');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
signup: inject(function (SysConfig) {
|
signup: inject(function (SysConfig) {
|
||||||
@@ -126,5 +128,32 @@ module.exports = {
|
|||||||
async handleTicket (req, res) {
|
async handleTicket (req, res) {
|
||||||
const { adminId } = res.locals.user;
|
const { adminId } = res.locals.user;
|
||||||
if (!adminId) return res.json({ code: 1, msg: '非法访问' });
|
if (!adminId) return res.json({ code: 1, msg: '非法访问' });
|
||||||
|
// const { ticketId } = req.body.query;
|
||||||
|
},
|
||||||
|
async getVreqs (req, res) {
|
||||||
|
const { adminId } = res.locals.user;
|
||||||
|
if (!adminId) return res.json({ code: 1, msg: '非法访问' });
|
||||||
|
const { pageSize = 10, pageIndex = 1} = req.body.option || {};
|
||||||
|
await Vreq.find({ ...req.body.query }).limit(+pageSize).skip((+pageIndex - 1) * +pageSize).then(data => {
|
||||||
|
return res.json({
|
||||||
|
code: 0,
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}).catch(err => {
|
||||||
|
return res.json({
|
||||||
|
code: 1,
|
||||||
|
msg: err.msg
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async handleVreq (req, res) {
|
||||||
|
const { adminId } = res.locals.user;
|
||||||
|
if (!adminId) return res.json({ code: 1, msg: '非法访问' });
|
||||||
|
const { vreqId } = req.body.query;
|
||||||
|
return await Vreq.findById(vreqId).then(vreq => {
|
||||||
|
handleReq(vreq, adminId).then(data => {
|
||||||
|
return res.json(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -28,6 +28,11 @@ const services = [
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
controller: controller.getFunds
|
controller: controller.getFunds
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
url: '/vreqs',
|
||||||
|
method: 'POST',
|
||||||
|
controller: controller.getVreqs
|
||||||
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,23 @@ function createVerifyReq (data) {
|
|||||||
async function handleReq (vreq, adminName) {
|
async function handleReq (vreq, adminName) {
|
||||||
await User.findByIdAndUpdate(vreq.userId, {
|
await User.findByIdAndUpdate(vreq.userId, {
|
||||||
verifyLevel: vreq.verifyLevel
|
verifyLevel: vreq.verifyLevel
|
||||||
}).catch(err => mylog.error(err));
|
}).catch(err => {
|
||||||
|
mylog.error(err);
|
||||||
|
return {
|
||||||
|
code: 2,
|
||||||
|
msg: 'error',
|
||||||
|
err: err.msg
|
||||||
|
};
|
||||||
|
});
|
||||||
await vreq.updateOne({ status: 1, info: '审核通过', handler: adminName })
|
await vreq.updateOne({ status: 1, info: '审核通过', handler: adminName })
|
||||||
.catch(err => mylog.error(err));
|
.catch(err => {
|
||||||
|
mylog.error(err);
|
||||||
|
return {
|
||||||
|
code: 2,
|
||||||
|
msg: 'error',
|
||||||
|
err: err.msg
|
||||||
|
};
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
code: 0,
|
code: 0,
|
||||||
msg: '认证成功'
|
msg: '认证成功'
|
||||||
|
|||||||
Reference in New Issue
Block a user