代码拉取完成,页面将自动刷新
const userCtrl = require("./controller/userCtrl");
const rlCtrl = require("./controller/rlCtrl");
const workCtrl = require("./controller/workCtrl");
const messageCtrl = require("./controller/messageCtrl");
const fileGiteeCtrl = require("./controller/fileGitee")
const appCtrl = require("./controller/application")
const wx135Ctrl = require("./controller/wechat/135")
const HHAICtrl = require("./controller/AI/hh")
const tool = require("./tool.js")
let routeConfigs = {
user: {
ctrl: userCtrl,
router: [{
url: 'user/register',
method: "GET"
}, {
url: 'user/getUserInfo',
method: "GET"
}, {
url: 'user/getDepartmentPerson',
method: "GET"
}],
},
rl: {
ctrl: rlCtrl,
router: [{
url: 'rl/getRl',
method: "GET"
}]
},
file: {
ctrl: fileGiteeCtrl,
router: [{
url: 'file/upload',
method: "POST"
}]
},
app: {
ctrl: appCtrl,
router: [{
url: 'app/appConfig',
method: "GET"
}, {
url: 'app/appMain',
method: "GET"
}]
},
wx: {
ctrl: wx135Ctrl,
router: [{
url: 'wx/135/getList',
method: "GET"
}]
},
AI: {
ctrl: HHAICtrl,
router: [{
url: 'AI/HH/HH',
authority: "0000010000",
method: "GET"
}]
},
message: {
ctrl: messageCtrl,
router: [{
url: 'message/getMyMessage',
method: "GET"
}, {
url: 'message/getQ',
method: "GET"
}, {
url: 'message/getNews',
method: "GET"
}, {
url: 'message/setWrite',
method: "GET"
}, {
url: 'message/upQ',
method: "POST"
}, {
url: 'message/upNews',
method: "POST"
}, {
url: 'message/getCanUp',
method: "GET"
}, {
url: 'message/setQImg',
method: "POST"
}, {
url: 'message/create',
method: "GET"
}, {
url: 'message/face',
method: "GET"
}, {
url: 'message/psd',
method: "GET"
}]
},
work: {
ctrl: workCtrl,
router: [{
url: 'work/add',
method: "GET"
}, {
url: 'work/save',
method: "GET"
}, {
url: 'work/getPaper',
method: "GET"
}, {
url: 'work/setCanSee',
method: "GET"
}, {
url: 'work/getMyWork',
method: "GET"
}, {
url: 'work/delMyWork',
method: "GET"
}, {
url: 'work/getMyDoWork',
method: "GET"
}]
}
}
class router {
constructor(app) {
this.app = app
}
addRoute(routeConfigs) {
let AAC = {} // Account authority controller
Object.keys(routeConfigs).map((rKey) => {
for (let rc of routeConfigs[rKey].router) {
AAC[rc.url] = rc
if (rc.method == "GET") {
this.app.get("/" + rc.url, (req, resp) => {
req.query.uId=tool.decodeToken(req.query.uToken)
console.log(9)
return routeConfigs[rKey].ctrl[rc.url.split("/").slice(-1)].call(this, req, resp)
})
}
}
})
return AAC
}
}
module.exports = {
router, routeConfigs
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。