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
88c60711
Commit
88c60711
authored
Nov 21, 2019
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ghsb
parent
1ceed396
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
7 deletions
+24
-7
xggpjb-admin/app/base/controller/impl/auth/userCtl.js
+5
-3
xggpjb-admin/app/base/db/metadata/apps/platform.js
+3
-1
xggpjb-admin/app/config/environment.js
+1
-1
xggpjb-admin/app/config/routes/web.js
+11
-0
xggpjb-admin/app/config/settings.js
+4
-2
No files found.
xggpjb-admin/app/base/controller/impl/auth/userCtl.js
View file @
88c60711
...
@@ -53,15 +53,17 @@ class UserCtl extends CtlBase {
...
@@ -53,15 +53,17 @@ class UserCtl extends CtlBase {
}
}
var
user
=
await
this
.
service
.
authByCode
(
loginrs
.
data
.
opencode
);
var
user
=
await
this
.
service
.
authByCode
(
loginrs
.
data
.
opencode
);
req
.
session
.
user
=
user
;
req
.
session
.
user
=
user
;
return
system
.
getResultSuccess
(
user
);
var
xggadminsid
=
await
this
.
setLogin
(
user
);
return
system
.
getResultSuccess
(
xggadminsid
);
}
catch
(
error
)
{
}
catch
(
error
)
{
return
system
.
getResultFail
(
500
,
"接口异常:"
+
error
.
message
);
return
system
.
getResultFail
(
500
,
"接口异常:"
+
error
.
message
);
}
}
}
}
async
setLogin
(
req
,
res
,
user
)
{
async
setLogin
(
user
)
{
var
xggadminsid
=
uuidv4
();
var
xggadminsid
=
uuidv4
();
await
this
.
redisClient
.
setWithEx
(
xggadminsid
+
"_admin_user"
,
JSON
.
stringify
(
user
),
60
*
60
*
2
);
await
this
.
redisClient
.
setWithEx
(
xggadminsid
,
JSON
.
stringify
(
user
),
60
*
60
);
return
xggadminsid
;
return
xggadminsid
;
}
}
...
...
xggpjb-admin/app/base/db/metadata/apps/platform.js
View file @
88c60711
const
settings
=
require
(
"../../../../config/settings"
);
module
.
exports
=
{
module
.
exports
=
{
"appid"
:
"8025f1249ad045f5a8c8d2100d3c46d0"
,
"appid"
:
settings
.
appKey
,
"label"
:
"研发开放平台"
,
"label"
:
"研发开放平台"
,
"config"
:
{
"config"
:
{
"rstree"
:
{
"rstree"
:
{
...
...
xggpjb-admin/app/config/environment.js
View file @
88c60711
...
@@ -27,7 +27,7 @@ module.exports = function (app) {
...
@@ -27,7 +27,7 @@ module.exports = function (app) {
app
.
all
(
'*'
,
function
(
req
,
res
,
next
)
{
app
.
all
(
'*'
,
function
(
req
,
res
,
next
)
{
req
.
objs
=
system
;
req
.
objs
=
system
;
res
.
header
(
'Access-Control-Allow-Origin'
,
'*'
);
res
.
header
(
'Access-Control-Allow-Origin'
,
'*'
);
res
.
header
(
'Access-Control-Allow-Headers'
,
'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild, xggpjbadminsid'
);
res
.
header
(
'Access-Control-Allow-Headers'
,
'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild, xgg
adminsid, xgg
pjbadminsid'
);
res
.
header
(
'Access-Control-Allow-Methods'
,
'PUT, POST, GET, DELETE, OPTIONS'
);
res
.
header
(
'Access-Control-Allow-Methods'
,
'PUT, POST, GET, DELETE, OPTIONS'
);
// res.header('Access-Control-Allow-Credentials', 'true');
// res.header('Access-Control-Allow-Credentials', 'true');
if
(
req
.
method
==
'OPTIONS'
)
{
if
(
req
.
method
==
'OPTIONS'
)
{
...
...
xggpjb-admin/app/config/routes/web.js
View file @
88c60711
...
@@ -8,7 +8,15 @@ module.exports = function (app) {
...
@@ -8,7 +8,15 @@ module.exports = function (app) {
app
.
all
(
"/web/*"
,
async
function
(
req
,
res
,
next
)
{
app
.
all
(
"/web/*"
,
async
function
(
req
,
res
,
next
)
{
// var xggadminsid = req.headers["xggadminsid"] || "";
// var xggadminsid = req.headers["xggadminsid"] || "";
// var jsonUser = await redisClient.get(xggadminsid);
// var jsonUser = await redisClient.get(xggadminsid);
var
xggadminsid
;
var
jsonUser
=
req
.
session
.
user
;
var
jsonUser
=
req
.
session
.
user
;
if
(
!
jsonUser
)
{
xggadminsid
=
req
.
headers
[
"xggadminsid"
]
||
""
;
jsonUser
=
await
redisClient
.
get
(
xggadminsid
);
if
(
!
jsonUser
)
{
jsonUser
=
JSON
.
parse
(
jsonUser
);
}
}
if
(
req
.
url
.
indexOf
(
"auth/userCtl/login"
)
>
0
||
if
(
req
.
url
.
indexOf
(
"auth/userCtl/login"
)
>
0
||
req
.
url
.
indexOf
(
"auth/userCtl/smsCode"
)
>
0
||
req
.
url
.
indexOf
(
"auth/userCtl/smsCode"
)
>
0
||
...
@@ -28,6 +36,9 @@ module.exports = function (app) {
...
@@ -28,6 +36,9 @@ module.exports = function (app) {
res
.
end
(
JSON
.
stringify
({
status
:
-
99
,
msg
:
"no login"
}));
res
.
end
(
JSON
.
stringify
({
status
:
-
99
,
msg
:
"no login"
}));
return
;
return
;
}
}
if
(
xggadminsid
)
{
redisClient
.
setWithEx
(
xggadminsid
,
JSON
.
stringify
(
jsonUser
),
60
*
60
);
}
req
.
loginUser
=
jsonUser
;
req
.
loginUser
=
jsonUser
;
next
();
next
();
});
});
...
...
xggpjb-admin/app/config/settings.js
View file @
88c60711
...
@@ -19,8 +19,10 @@ var settings = {
...
@@ -19,8 +19,10 @@ var settings = {
passroleid
:
2
,
passroleid
:
2
,
tanentroleid
:
1
,
tanentroleid
:
1
,
protocalPrefix
:
"http://"
,
protocalPrefix
:
"http://"
,
appKey
:
"8025f1249ad045f5a8c8d2100d3c46d0"
,
secret
:
"98691f4ba66747a38ba21148b4c876fe"
,
appKey
:
ENVINPUT
.
APP_ENV
==
"dev"
?
"fb16e81f860e490b8891c3ac96dd15be"
:
"8025f1249ad045f5a8c8d2100d3c46d0"
,
secret
:
ENVINPUT
.
APP_ENV
==
"dev"
?
"ecabf01cccc2472798f38c2d400e9108"
:
"98691f4ba66747a38ba21148b4c876fe"
,
salt
:
"%iatpD1gcxz7iF#B"
,
salt
:
"%iatpD1gcxz7iF#B"
,
defaultpwd
:
"987456"
,
defaultpwd
:
"987456"
,
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
...
...
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