北斗导航定位通信综合实践赛服务系统

This commit is contained in:
2026-03-27 17:50:54 +08:00
commit f1d7b4895c
44 changed files with 1810 additions and 0 deletions

67
app/controller/Contest.js Normal file
View File

@@ -0,0 +1,67 @@
const Controller = require('../core/base_controller');
const fileName = "Contest";
class ContestController extends Controller {
// 系统获取竞赛基本信息
async contestMsg() {
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 result = await ctx.service.contest.contestMsg(uid);
if (result == "error") {
this.setResponse(ctx, 500, '服务器错误', "none");
return;
}
if (result) {
const data = {
contestMsg: result.dataValues
}
this.setResponse(ctx, 200, '操作成功', "deconstruction", data);
} else {
this.setResponse(ctx, 404, '操作失败', "none");
}
} catch (error) {
const blockName = fileName + "--" + "contestMsg";
ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error);
this.setResponse(ctx, 500, '服务器错误', "none");
}
}
// 系统获取排名信息
async ranking() {
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 result = await ctx.service.contest.ranking(uid);
if (result == "error") {
this.setResponse(ctx, 500, '服务器错误', "none");
return;
}
if (result) {
const data = {
rankList: result
}
this.setResponse(ctx, 200, '操作成功', "deconstruction", data);
} else {
this.setResponse(ctx, 404, '操作失败', "none");
}
} catch (error) {
const blockName = fileName + "--" + "ranking";
ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error);
this.setResponse(ctx, 500, '服务器错误', "none");
}
}
}
module.exports = ContestController;