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
4e7e7dbe
Commit
4e7e7dbe
authored
Dec 27, 2021
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config
parent
49dcfd06
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
12 deletions
+38
-12
center-manage/app/base/service/impl/auth/userSve.js
+21
-12
center-manage/app/config/environment.js
+17
-0
No files found.
center-manage/app/base/service/impl/auth/userSve.js
View file @
4e7e7dbe
...
@@ -145,19 +145,23 @@ class UserService extends ServiceBase {
...
@@ -145,19 +145,23 @@ class UserService extends ServiceBase {
var
self
=
this
;
var
self
=
this
;
//先要按照用户名,在统一账户中查找存在性
//先要按照用户名,在统一账户中查找存在性
//如果不存在
//如果不存在
console
.
log
(
UserService
.
consumerUrl
(
p
.
userName
))
if
(
settings
.
env
!=
"dev"
){
let
consumer
=
await
this
.
cget
(
UserService
.
consumerUrl
(
p
.
userName
));
console
.
log
(
UserService
.
consumerUrl
(
p
.
userName
))
if
(
!
consumer
.
data
)
{
let
consumer
=
await
this
.
cget
(
UserService
.
consumerUrl
(
p
.
userName
));
return
null
;
if
(
!
consumer
.
data
)
{
}
else
{
console
.
log
(
JSON
.
stringify
(
consumer
.
data
))
let
password
=
consumer
.
data
.
tags
[
1
].
split
(
"_"
)[
1
];
let
passwd
=
system
.
desEncript
(
p
.
password
)
let
inpassword
=
this
.
getEncryptStr
(
passwd
);
if
(
password
!=
inpassword
)
{
return
null
;
return
null
;
}
else
{
console
.
log
(
JSON
.
stringify
(
consumer
.
data
))
let
password
=
consumer
.
data
.
tags
[
1
].
split
(
"_"
)[
1
];
let
passwd
=
system
.
desEncript
(
p
.
password
)
let
inpassword
=
this
.
getEncryptStr
(
passwd
);
if
(
password
!=
inpassword
)
{
return
null
;
}
}
}
}
}
var
rtn
=
{}
var
rtn
=
{}
return
this
.
db
.
transaction
(
async
function
(
t
)
{
return
this
.
db
.
transaction
(
async
function
(
t
)
{
//从缓存中取得
//从缓存中取得
...
@@ -168,8 +172,13 @@ class UserService extends ServiceBase {
...
@@ -168,8 +172,13 @@ class UserService extends ServiceBase {
// });
// });
let
userfind
=
await
self
.
cacheManager
[
"UserCache"
].
cache
(
p
.
userName
)
let
userfind
=
await
self
.
cacheManager
[
"UserCache"
].
cache
(
p
.
userName
)
if
(
userfind
)
{
if
(
userfind
)
{
let
token
=
await
self
.
cmakejwt
(
userfind
.
jwtkey
,
userfind
.
jwtsecret
,
null
);
if
(
settings
.
env
!=
"dev"
){
rtn
.
token
=
token
;
let
token
=
await
self
.
cmakejwt
(
userfind
.
jwtkey
,
userfind
.
jwtsecret
,
null
);
rtn
.
token
=
token
;
}
else
{
rtn
.
token
=
p
.
userName
;
}
let
roleids
=
userfind
.
Roles
.
map
(
item
=>
{
let
roleids
=
userfind
.
Roles
.
map
(
item
=>
{
return
item
.
id
return
item
.
id
...
...
center-manage/app/config/environment.js
View file @
4e7e7dbe
...
@@ -19,8 +19,25 @@ module.exports = function (app) {
...
@@ -19,8 +19,25 @@ module.exports = function (app) {
app
.
use
(
bodyParser
.
json
({
limit
:
'50mb'
}));
app
.
use
(
bodyParser
.
json
({
limit
:
'50mb'
}));
app
.
use
(
bodyParser
.
urlencoded
({
limit
:
'50mb'
,
extended
:
true
}));
app
.
use
(
bodyParser
.
urlencoded
({
limit
:
'50mb'
,
extended
:
true
}));
routes
(
app
);
//初始化路由
routes
(
app
);
//初始化路由
app
.
use
(
history
());
app
.
use
(
history
());
app
.
use
(
express
.
static
(
path
.
join
(
settings
.
basepath
,
'/app/front/entry/public'
)));
app
.
use
(
express
.
static
(
path
.
join
(
settings
.
basepath
,
'/app/front/entry/public'
)));
app
.
all
(
'*'
,
function
(
req
,
res
,
next
)
{
// res.header('Access-Control-Allow-Origin', '*');
// res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
// res.header("P3P","CP=CAO PSA OUR");
// res.header('Access-Control-Allow-Credentials', 'true');
if
(
req
.
method
==
'OPTIONS'
)
{
res
.
send
(
200
);
}
else
{
next
();
}
});
// development only
// development only
if
(
'development'
==
app
.
get
(
'env'
))
{
if
(
'development'
==
app
.
get
(
'env'
))
{
app
.
use
(
errorHandler
());
app
.
use
(
errorHandler
());
...
...
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