Browse Source

app check

release_1.3.0
巴林闲侠 3 years ago
parent
commit
467aa7ce2e
  1. 27
      code/VideoAccess-VCMP/api/app/lib/controllers/application/index.js

27
code/VideoAccess-VCMP/api/app/lib/controllers/application/index.js

@ -3,6 +3,32 @@ const fs = require('fs');
const moment = require('moment')
const uuid = require('uuid');
async function check (ctx) {
try {
const { models } = this.fs.dc;
const { appKey, appSecret } = this.request.body;
const existRes = await models.Application.findOne({
where: {
appKey: appKey,
appSecret: appSecret,
}
})
if (!existRes) {
throw '应用不存在'
} else if (existRes.forbidden) {
throw '应用已被禁用'
}
ctx.status = 204;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body =
typeof error == 'string' ? {
message: error
} : error
}
}
async function edit (ctx, next) {
let errMsg = '创建应用失败'
const transaction = await ctx.fs.dc.orm.transaction();
@ -51,6 +77,7 @@ async function edit (ctx, next) {
module.exports = {
check,
edit,
get,
};
Loading…
Cancel
Save