Commit 757f1431 authored by gengshaojing's avatar gengshaojing

update: 外网域名模块访问限制

parent b20024d5
......@@ -11,15 +11,22 @@ exports.index = (ctx, next) => {
const hostname = ctx.hostname;
const pathArr = ctx.path.substring(1).split("/");
// console.log(hostname);
// console.log(pathArr);
console.log(hostname);
console.log(pathArr);
if (hostname === "opservice.yidianzixun.com" || hostname === "www.opservice.yidianzixun.com") {
if (pathArr[1] !== "activity" && pathArr[1] !== "groupmeal") {
// 外网域名
const hostNameArr = ["127.0.0.1", "opservice.yidianzixun.com", "test-opservice.yidianzixun.com", "preprod-opservice.yidianzixun.com"];
// 允许访问的模块
const allowModuleArr = ["activity", "groupmeal"];
// 不允许访问的模块
const noAllowModuleArr = ["goods", "enterprise", "withdrawal"];
if (hostNameArr.includes(hostname) && noAllowModuleArr.includes(pathArr[1])) {
ctx.body = "权限不足";
return;
}
}
if (!cachePage) {
cachePage = fs.readFileSync(path.join(__dirname, "../../public/dist/index.html"), { encoding: "utf-8" });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment