Commit 757f1431 authored by gengshaojing's avatar gengshaojing

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

parent b20024d5
...@@ -11,14 +11,21 @@ exports.index = (ctx, next) => { ...@@ -11,14 +11,21 @@ exports.index = (ctx, next) => {
const hostname = ctx.hostname; const hostname = ctx.hostname;
const pathArr = ctx.path.substring(1).split("/"); const pathArr = ctx.path.substring(1).split("/");
// console.log(hostname); console.log(hostname);
// console.log(pathArr); 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"];
ctx.body = "权限不足";
return; // 允许访问的模块
} const allowModuleArr = ["activity", "groupmeal"];
// 不允许访问的模块
const noAllowModuleArr = ["goods", "enterprise", "withdrawal"];
if (hostNameArr.includes(hostname) && noAllowModuleArr.includes(pathArr[1])) {
ctx.body = "权限不足";
return;
} }
if (!cachePage) { if (!cachePage) {
......
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