Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
bp
op-web-service
Commits
a66321bf
Commit
a66321bf
authored
May 28, 2021
by
mengwenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 更新请求代码
parent
ec879c13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
40 deletions
+5
-40
system.js
server/controllers/system.js
+5
-40
No files found.
server/controllers/system.js
View file @
a66321bf
const
{
LOGIN_URI
,
API_INTERNAL_URI
}
=
require
(
"../config.js"
);
const
req
=
require
(
"../utils/request"
).
httpReq
;
/**
* 用户登录校验,用于校验是否是公司员工, 目前使用pandora系统的登录验证
*/
exports
.
login
=
async
(
ctx
,
next
)
=>
{
const
url
=
`
${
LOGIN_URI
}
/api/v1/pandora/auth`
;
const
opts
=
{
url
,
exports
.
login
=
async
ctx
=>
{
var
url
=
`
${
LOGIN_URI
}
/api/v1/pandora/auth`
;
var
opts
=
{
url
:
url
,
method
:
"POST"
,
json
:
true
,
timeout
:
8000
,
body
:
ctx
.
request
.
body
};
// ctx.body = await req(ctx, opts)
const
userInfo
=
await
req
(
ctx
,
opts
);
// {
// type: 'Bearer',
// token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjIwNTc1OTMsImlhdCI6MTYyMjAxNDM5MywiaW5mbyI6eyJpZCI6IjczMjQ3MzQzOSIsImlzU3VwZXIiOnRydWUsIm5hbWUiOiLlkJXkvJ_mnJ0iLCJkZXBhcnRtZW50SWQiOiIxMzk4MzY4NDEwIiwicGVybWlzc2lvbnMiOltdLCJzZWN1cml0eSI6ZmFsc2UsImFjdGl2ZSI6dHJ1ZX19.65357uakQSUaWS95c16nQgj9JkBmKGvwGJW4C4hEjWY',
// auth: {
// id: '732473439',
// isSuper: true,
// name: '吕伟朝',
// departmentId: '1398368410',
// permissions: [],
// security: false,
// active: true
// },
// userInfo: {
// id: '732473439',
// isSuper: true,
// name: '吕伟朝',
// displayName: '吕伟朝',
// email: 'lvweichao@yidian-inc.com',
// departmentId: '1398368410',
// department: { id: '1398368410', name: '平台产品研发部' },
// property: 'yidian',
// description: '',
// createdAt: '2020-07-31T08:24:05Z',
// lastUpdate: '2020-08-07T07:18:59.194Z',
// active: true
// }
// }
if
(
typeof
userInfo
===
"string"
)
{
ctx
.
body
=
{
status
:
"fail"
,
message
:
userInfo
};
}
console
.
log
(
43444
,
userInfo
,
typeof
userInfo
);
// if userInfo
...
...
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