Commit 99595946 authored by 智勇's avatar 智勇

FILTER_URL

parent c75f50ba
......@@ -163,6 +163,15 @@ function luhmCheck(bankno) {
}
}
function createBank() {
let cnt = 1
let bank = 'ICBC'
let re = []
let t = RandomCreateBankID(bank)
return { bank: bank, bank_no: t }
}
exports.createBankId = async function () {
await this.bindDefault
let req = this.request.query
......@@ -183,7 +192,7 @@ exports.createBankId = async function () {
} else {
this.body = { code: "0001", msg: "count不是数字" }
}
this.body = { code: "0000", BankID: re, bank: bank, count: re.length }
this.body = { code: "0000", bankID: re, bank: bank, count: re.length }
}
......@@ -298,10 +307,10 @@ function getInfo(pid) {
_id = String(_id), sex = _id.substr(16, 1) % 2 ? "" : "";
prov = areaCode[_id.substr(0, 2)] || "无法确定";
let birthday = (new Date(_id.substr(6, 4), _id.substr(10, 2) - 1, _id.substr(12, 2))).toLocaleDateString();
// return [prov, birthday, sex];
// let name = getName()
// let phone = getMoble()
return { id: pid, id_province: prov, birthday: birthday, sex, sex }
let bank_info = createBank()
return { ID: pid, IDProvince: prov, birthday: birthday, sex, sex, bank: bank_info.bank, bankNo: bank_info.bank_no }
}
let get_person_from_acs = function () {
......@@ -454,6 +463,6 @@ exports.createID = async function () {
} else {
this.body = { code: "0001", msg: "count不是数字" }
}
this.body = { code: "0000", BankID: re, count: re.length }
this.body = { code: "0000", detail: re, count: re.length }
}
\ No newline at end of file
......@@ -28,8 +28,8 @@ app.use(Middles.compress());
app.use(Middles.body());
// 配置静态文件路由
app.use(Middles.static(['/assets/**/*', '/*/assets/**/*','/**/*.js'], {
dir: config.path.project+'qa-home/web/dist/',
app.use(Middles.static(['/assets/**/*', '/*/assets/**/*', '/**/*.js'], {
dir: config.path.project + 'qa-home/web/dist/',
maxage: config.site.env == 'production' && 60 * 60 * 1000
}));
......@@ -67,9 +67,9 @@ let vhosts = Object.keys(config.vhost).map((item) => {
hosts: config.hosts, // 接口域名hosts配置,可以不配置
allowShowApi: config.site.env !== 'production'
}, {
// request 配置
timeout: config.proxy.timeout // 接口超时时间
}));
// request 配置
timeout: config.proxy.timeout // 接口超时时间
}));
// 配置模板引擎
let engine = (typeof config.template === 'string' ? config.template : config.template[appName]);
......@@ -77,8 +77,8 @@ let vhosts = Object.keys(config.vhost).map((item) => {
root: appPath + '/web/dist',
extension: 'html',
engine: engine || 'swiger',
locals: {
constant: config.constant
locals: {
constant: config.constant
},
cache: config.site.env == 'production' && 'memory'
}));
......@@ -116,13 +116,16 @@ function requestPromise(option) {
})
})
}
let FILTER_URL = [
'/indexurl/server/get_index_url',
'/docker/server_v2/get_code'
'/docker/server_v2/get_code',
'/testdata/server/createID',
'/testdata/server/createBankId'
];
let FILTER_URL_STR = FILTER_URL.join(',');
function urlFilter(url){
function urlFilter(url) {
return FILTER_URL_STR.indexOf(url) == -1 ? true : false;
}
......@@ -140,7 +143,7 @@ app.use(async (ctx, next) => {
if (config.site.env !== 'development' && urlFilter(ctx.request.url)) {
let token = ctx.header['x-token'];
if (token) {
if (session[token] == undefined){
if (session[token] == undefined) {
let info = await requestPromise({
url: `http://user.q-gp.com/user/check_token?token=${token}`,
method: "GET"
......@@ -153,14 +156,14 @@ app.use(async (ctx, next) => {
await next();
return;
}
}else{
} else {
ctx.user = session[token];
await next();
return;
}
}
ctx.status = 401;
}else{
} else {
await next();
}
}
......@@ -168,8 +171,3 @@ app.use(async (ctx, next) => {
app.use(Middles.vhost(vhosts));
module.exports = app;
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