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
f8e82d94
Commit
f8e82d94
authored
Apr 25, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
2b0242df
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
6 deletions
+7
-6
center-manage/app/base/controller/ctl.base.js
+3
-3
center-manage/app/base/db/cache/appCache.js
+1
-1
center-manage/app/base/db/cache/companyCache.js
+1
-1
center-manage/app/base/service/impl/auth/userSve.js
+1
-1
center-manage/app/base/system.js
+1
-0
No files found.
center-manage/app/base/controller/ctl.base.js
View file @
f8e82d94
...
...
@@ -28,7 +28,7 @@ class CtlBase {
let
custtags
=
req
.
headers
[
"x-consumetag"
]?
req
.
headers
[
"x-consumetag"
].
split
(
"|"
):
null
;
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
req
.
xctx
=
{
appkey
:
req
.
headers
[
"x
-app-
key"
],
//用于系统管理区分应用,比如角色
appkey
:
req
.
headers
[
"x
app
key"
],
//用于系统管理区分应用,比如角色
companyid
:
custtags
?
custtags
[
0
].
split
(
"_"
)[
1
]:
null
,
password
:
custtags
?
custtags
[
1
].
split
(
"_"
)[
1
]:
null
,
username
:
req
.
headers
[
"x-consumer-username"
],
...
...
@@ -47,7 +47,7 @@ class CtlBase {
// if(!req.xctx.companyid && !req.xctx.companykey){
// return [-200,"请求头缺少应用x-app-key"]
// }
if
(
!
req
.
xctx
.
companyid
&&
c
req
.
xctx
.
companykey
){
if
(
!
req
.
xctx
.
companyid
&&
req
.
xctx
.
companykey
){
let
comptmp
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
req
.
xctx
.
companykey
);
req
.
xctx
.
companyid
=
comptmp
.
id
;
}
...
...
@@ -58,7 +58,7 @@ class CtlBase {
async
doexec
(
methodname
,
pobj
,
query
,
req
)
{
try
{
let
xarg
=
await
this
.
setContextParams
(
pobj
,
query
,
req
);
if
(
xarg
[
0
]
<
0
){
if
(
xarg
&&
xarg
[
0
]
<
0
){
return
system
.
getResultFail
(...
xarg
);
}
//从请求头里面取appkey_consumename
...
...
center-manage/app/base/db/cache/appCache.js
View file @
f8e82d94
...
...
@@ -17,7 +17,7 @@ class AppCache extends CacheBase{
return
"g_applocal_"
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
const
configValue
=
await
this
.
appDao
.
findOne
({
where
:{
appkey
:
inputkey
}
});
const
configValue
=
await
this
.
appDao
.
findOne
({
appkey
:
inputkey
});
if
(
configValue
)
{
return
JSON
.
stringify
(
configValue
);
}
...
...
center-manage/app/base/db/cache/companyCache.js
View file @
f8e82d94
...
...
@@ -17,7 +17,7 @@ class CompanyCache extends CacheBase{
return
"gc_companylocal_"
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
const
configValue
=
await
this
.
companyDao
.
findOne
({
where
:{
companykey
:
inputkey
}
});
const
configValue
=
await
this
.
companyDao
.
findOne
({
companykey
:
inputkey
});
if
(
configValue
)
{
return
JSON
.
stringify
(
configValue
);
}
...
...
center-manage/app/base/service/impl/auth/userSve.js
View file @
f8e82d94
...
...
@@ -54,7 +54,7 @@ class UserService extends ServiceBase {
//设置默认角色,租户
//设置默认普通角色,由于有了租户概念,所以注册时,需要知道当前租户和应用的id 才可以设置默认角色 todo
var
roles
=
await
self
.
roleDao
.
model
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
rolecodes
}
}
,
app_id
:
p
.
app_id
,
company_id
:
p
.
company_id
},
transaction
:
t
});
var
roles
=
await
self
.
roleDao
.
model
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
rolecodes
},
app_id
:
p
.
app_id
,
company_id
:
p
.
company_id
},
transaction
:
t
});
if
(
roles
&&
roles
.
length
>
0
){
await
u
.
setRoles
(
roles
,
{
transaction
:
t
});
}
...
...
center-manage/app/base/system.js
View file @
f8e82d94
...
...
@@ -211,6 +211,7 @@ class System {
try
{
ClassObj
=
require
(
objabspath
);
}
catch
(
e
){
console
.
log
(
e
)
let
fname
=
objsettings
[
packageName
+
"base"
];
ClassObj
=
require
(
fname
);
}
...
...
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