北斗应用技术培训考试管理系统
This commit is contained in:
71
app/controller/Audit.js
Normal file
71
app/controller/Audit.js
Normal file
@@ -0,0 +1,71 @@
|
||||
const Controller = require('../core/base_controller');
|
||||
|
||||
const fileName = "Audit";
|
||||
|
||||
class AuditController extends Controller {
|
||||
// 管理系统查看用户关键信息变更
|
||||
async auditList() {
|
||||
const { ctx } = this;
|
||||
try {
|
||||
let rdmcode = await this.checkUid(ctx);
|
||||
if (!rdmcode) {
|
||||
this.setResponse(ctx, 401, 'token过期或错误', "none");
|
||||
return;
|
||||
}
|
||||
const uid = JSON.parse(rdmcode).uid;
|
||||
const body = ctx.request.body;
|
||||
const result = await ctx.service.audit.auditList(uid, body);
|
||||
if (result == "error") {
|
||||
this.setResponse(ctx, 500, '服务器错误', "none");
|
||||
return;
|
||||
}
|
||||
if (result) {
|
||||
let auditMsg = [];
|
||||
result.rows.forEach(element => {
|
||||
auditMsg.push(element.dataValues);
|
||||
});
|
||||
const data = {
|
||||
auditMsg: auditMsg,
|
||||
count: result.count
|
||||
};
|
||||
this.setResponse(ctx, 200, '操作成功', "deconstruction", data);
|
||||
} else {
|
||||
this.setResponse(ctx, 404, '操作失败', "none");
|
||||
}
|
||||
} catch (error) {
|
||||
const blockName = fileName + "--" + "auditList";
|
||||
ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error);
|
||||
this.setResponse(ctx, 500, '服务器错误', "none");
|
||||
}
|
||||
}
|
||||
|
||||
// 管理系统审核用户关键信息变更
|
||||
async userMsgAudit() {
|
||||
const { ctx } = this;
|
||||
try {
|
||||
let rdmcode = await this.checkUid(ctx);
|
||||
if (!rdmcode) {
|
||||
this.setResponse(ctx, 401, 'token过期或错误', "none");
|
||||
return;
|
||||
}
|
||||
const uid = JSON.parse(rdmcode).uid;
|
||||
const body = ctx.request.body;
|
||||
const result = await ctx.service.audit.userMsgAudit(uid, body);
|
||||
if (result == "error") {
|
||||
this.setResponse(ctx, 500, '服务器错误', "none");
|
||||
return;
|
||||
}
|
||||
if (result) {
|
||||
this.setResponse(ctx, 200, '操作成功', "none");
|
||||
} else {
|
||||
this.setResponse(ctx, 404, '操作失败', "none");
|
||||
}
|
||||
} catch (error) {
|
||||
const blockName = fileName + "--" + "userMsgAudit";
|
||||
ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error);
|
||||
this.setResponse(ctx, 500, '服务器错误', "none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AuditController;
|
||||
Reference in New Issue
Block a user