Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qaHome
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qaHome
Commits
99595946
Commit
99595946
authored
May 21, 2018
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FILTER_URL
parent
c75f50ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
server.js
app/qa-home/controller/testdata/server.js
+13
-4
app.js
src/app.js
+15
-17
No files found.
app/qa-home/controller/testdata/server.js
View file @
99595946
...
...
@@ -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
"
,
B
ankID
:
re
,
bank
:
bank
,
count
:
re
.
length
}
this
.
body
=
{
code
:
"
0000
"
,
b
ankID
:
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
src/app.js
View file @
99595946
...
...
@@ -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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment