✨ feat(后台): 37sdk需求
This commit is contained in:
@@ -3,13 +3,14 @@ import { GMGroupModel } from '@db/GMGroup'
|
||||
import { GMRecordModel } from '@db/GMRecord'
|
||||
import { GM_API_TYPE, STATUS } from '@consts';
|
||||
import { gameData } from '@pubUtils/data';
|
||||
import { nowSeconds } from '@pubUtils/timeUtil';
|
||||
|
||||
module.exports = () => {
|
||||
return async function tokenParser(ctx, next) {
|
||||
|
||||
if (!ctx.request.headers || !ctx.request.headers.token) {
|
||||
console.error('token not found');
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.TOKEN_ERR);
|
||||
return;
|
||||
}
|
||||
const user = await GMUserModel.getGmAccountByToken(ctx.request.headers.token);
|
||||
@@ -18,6 +19,11 @@ module.exports = () => {
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.TOKEN_ERR);
|
||||
return;
|
||||
}
|
||||
if((user?.expireTime||0) < nowSeconds()) {
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.TOKEN_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
const url = ctx.request.url;
|
||||
let dicApi = gameData.apiByUrl.get(url);
|
||||
if(!dicApi) {
|
||||
|
||||
Reference in New Issue
Block a user