Commit 5a5245be authored by gengshaojing's avatar gengshaojing

Merge branch 'out-domain'

parents eac1fb20 e35cd611
node_modules/
.idea/
.vscode/
build/*.js
src/assets
public
dist
.prettierrc.js
.eslintrc.js
server/
const fs = require('fs') const fs = require("fs");
const path = require('path') const path = require("path");
let cachePage = null; let cachePage = null;
exports.index = (ctx, next) => { exports.index = (ctx, next) => {
console.log('----- home') console.log("----- home");
// console.log(ctx.request.path)
// console.log(ctx.path)
const hostname = ctx.hostname;
const pathArr = ctx.path.substring(1).split("/");
// console.log(hostname);
// console.log(pathArr);
if (hostname === "opservice.yidianzixun.com" || hostname === "www.opservice.yidianzixun.com") {
if (pathArr[1] !== "activity" && pathArr[1] !== "groupmeal") {
ctx.body = "权限不足";
return;
}
}
if (!cachePage) { if (!cachePage) {
cachePage = fs.readFileSync(path.join(__dirname, '../../public/dist/index.html'), {encoding: 'utf-8'}) cachePage = fs.readFileSync(path.join(__dirname, "../../public/dist/index.html"), { encoding: "utf-8" });
} }
const content = cachePage; const content = cachePage;
ctx.body = content ctx.body = content;
} };
\ No newline at end of file
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