Commit e402c9b2 by 王昆

gsb

parent d4f3826e
...@@ -166,6 +166,12 @@ class System { ...@@ -166,6 +166,12 @@ class System {
return uuid.join(''); return uuid.join('');
} }
static endWith(source, str){
if(!str || !source || source.length == 0 || str.length > source.length) {
return false;
}
return source.substring(source.length - str.length) == str;
}
static microsetting() { static microsetting() {
console.log(settings.env, "-------------- microsetting env ------------------"); console.log(settings.env, "-------------- microsetting env ------------------");
var path = "/api/op/action/springboard"; var path = "/api/op/action/springboard";
......
...@@ -3,6 +3,20 @@ var System = require("../../base/system"); ...@@ -3,6 +3,20 @@ var System = require("../../base/system");
const settings = require("../settings"); const settings = require("../settings");
module.exports = function (app) { module.exports = function (app) {
app.all("/applet/*", function (req, res, next) { app.all("/applet/*", function (req, res, next) {
let openid = req.body.openid || req.query.openid;
if (System.endWith(req.url, "applet/merchantApplet/login") ||
System.endWith(req.url, "applet/merchantApplet/uploadConfig")) {
if (openid) {
req.openid = openid;
} else {
req.openid = null;
}
return next();
}
if (!openid) {
res.end(JSON.stringify({ code: 403, msg: "no login" }));
return;
}
return next(); return next();
}); });
......
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