Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
c44768e9
Commit
c44768e9
authored
Apr 26, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
4fc6ba08
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
12 deletions
+55
-12
xgg-deliver/app/base/controller/impl/uc/userCtl.js
+26
-11
xgg-deliver/app/config/routes/web.js
+1
-1
xgg-deliver/app/front/entry/public/apidoc/user/login.md
+28
-0
No files found.
xgg-deliver/app/base/controller/impl/uc/userCtl.js
View file @
c44768e9
...
@@ -51,8 +51,8 @@ class UserCtl extends CtlBase {
...
@@ -51,8 +51,8 @@ class UserCtl extends CtlBase {
let
rs
=
{
let
rs
=
{
key
:
loginKey
.
xggadminsid
,
key
:
loginKey
.
xggadminsid
,
taxLoginUrl
:
ntapi
.
taxLoginUrl
+
`?username=
${
loginUser
.
ucname
}
&cookieId=
${
loginKey
.
subsid
}
&target=tax&baseurl=
${
loginBaseUrl
}
`
,
//
taxLoginUrl: ntapi.taxLoginUrl + `?username=${loginUser.ucname}&cookieId=${loginKey.subsid}&target=tax&baseurl=${loginBaseUrl}`,
finLoginUrl
:
ntapi
.
taxLoginUrl
+
`?username=
${
loginUser
.
ucname
}
&cookieId=
${
loginKey
.
subsid
}
&baseurl=
${
loginBaseUrl
}
`
,
//
finLoginUrl: ntapi.taxLoginUrl + `?username=${loginUser.ucname}&cookieId=${loginKey.subsid}&baseurl=${loginBaseUrl}`,
loginname
:
loginUser
.
ucname
,
loginname
:
loginUser
.
ucname
,
auth
:
loginUser
.
auth
,
auth
:
loginUser
.
auth
,
isManager
:
loginUser
.
isManager
,
isManager
:
loginUser
.
isManager
,
...
@@ -67,19 +67,34 @@ class UserCtl extends CtlBase {
...
@@ -67,19 +67,34 @@ class UserCtl extends CtlBase {
}
}
}
}
async
ngaLogin
(
params
,
pobj2
,
req
,
res
)
{
// 登录用户
let
loginUser
=
req
.
loginUser
;
// 登录地址加密
let
ntapi
=
settings
.
ntapi
();
let
loginUrl
=
settings
.
protocalPrefix
+
req
.
headers
[
'host'
]
+
"/#/logins"
;
console
.
log
(
loginUrl
,
"---------------loginUrl--------------"
);
let
loginBaseUrl
=
system
.
base64_encode
(
loginUrl
);
let
url
;
// 登录用户key
let
subsid
=
"sub_"
+
req
.
sid
.
replace
(
"jfs_"
,
""
);
await
this
.
redisClientTax
.
setWithEx
(
subsid
,
(
loginUser
.
nt_user_id
||
""
).
toString
(),
60
*
60
*
5
);
if
(
params
.
type
==
"tax"
)
{
url
=
ntapi
.
taxLoginUrl
+
`?username=
${
loginUser
.
ucname
}
&cookieId=
${
subsid
}
&target=tax&baseurl=
${
loginBaseUrl
}
`
;
}
else
{
url
=
ntapi
.
finLoginUrl
+
`?username=
${
loginUser
.
ucname
}
&cookieId=
${
subsid
}
&baseurl=
${
loginBaseUrl
}
`
;
}
return
system
.
getResult
(
url
);
}
async
setLogin
(
user
)
{
async
setLogin
(
user
)
{
user
.
loginsid
=
"jfs_"
+
uuidv4
();
user
.
loginsid
=
"jfs_"
+
uuidv4
();
user
.
subsid
=
"sub_"
+
uuidv4
();
// if(settings.env == 'dev') {
// user.loginsid = "jfs_" + "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
// user.subsid = "sub_" + "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
// }
// xggadminsid = "jfs_" + "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
await
this
.
redisClient
.
setWithEx
(
user
.
loginsid
,
JSON
.
stringify
(
user
),
60
*
60
*
5
);
await
this
.
redisClient
.
setWithEx
(
user
.
loginsid
,
JSON
.
stringify
(
user
),
60
*
60
*
5
);
await
this
.
redisClientTax
.
setWithEx
(
user
.
subsid
,
(
user
.
nt_user_id
||
""
).
toString
(),
60
*
60
*
5
);
return
{
return
{
xggadminsid
:
user
.
loginsid
,
xggadminsid
:
user
.
loginsid
subsid
:
user
.
subsid
,
};
};
}
}
...
...
xgg-deliver/app/config/routes/web.js
View file @
c44768e9
...
@@ -16,7 +16,7 @@ module.exports = function (app) {
...
@@ -16,7 +16,7 @@ module.exports = function (app) {
jsonUser
=
JSON
.
parse
(
jsonUser
);
jsonUser
=
JSON
.
parse
(
jsonUser
);
}
}
}
}
req
.
sid
=
xggadminsid
||
""
;
if
(
req
.
url
.
indexOf
(
"auth/userCtl/login"
)
>
0
||
if
(
req
.
url
.
indexOf
(
"auth/userCtl/login"
)
>
0
||
req
.
url
.
indexOf
(
"uc/userCtl/login"
)
>
0
||
req
.
url
.
indexOf
(
"uc/userCtl/login"
)
>
0
||
req
.
url
.
indexOf
(
"auth/userCtl/smsCode"
)
>
0
||
req
.
url
.
indexOf
(
"auth/userCtl/smsCode"
)
>
0
||
...
...
xgg-deliver/app/front/entry/public/apidoc/user/login.md
View file @
c44768e9
<a
name=
"menu"
>
目录
</a>
<a
name=
"menu"
>
目录
</a>
1.
[
登录
](
#login
)
1.
[
登录
](
#login
)
1.
[
财税登录
](
#ngaLogin
)
1.
[
当前用户信息查询
](
#currentUser
)
1.
[
当前用户信息查询
](
#currentUser
)
## **<a name="login"> 登录</a>**
## **<a name="login"> 登录</a>**
...
@@ -35,6 +36,33 @@
...
@@ -35,6 +36,33 @@
```
```
## **<a name="ngaLogin"> 财税登录</a>**
[
返回到目录
](
#menu
)
##### URL
[
/web/uc/userCtl/ngaLogin
]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
| 参数 | 必选 | 类型 | 说明|
| -------- | -------- | ------------|---------|
|
**type**
| 是 | String | 税务或者财务(tax, fin)|
```
javascript
{
"type"
:
"tax"
// 登录类型 tax税务 fin财务
}
```
#### 返回结果
```
javascript
{
"status"
:
0
,
"msg"
:
"success"
,
"data"
:
"https://nt.gongsibao.com/web/auth?..."
// 登录地址,判断一下不为空的话,window.open这个
}
```
## **<a name="currentUser"> 当前用户信息查询</a>**
## **<a name="currentUser"> 当前用户信息查询</a>**
[
返回到目录
](
#menu
)
[
返回到目录
](
#menu
)
...
...
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