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
f63628d0
Commit
f63628d0
authored
May 10, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
caaaa7ee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
center-manage/app/base/controller/ctl.base.js
+5
-4
center-manage/app/base/db/impl/common/connection.js
+4
-1
No files found.
center-manage/app/base/controller/ctl.base.js
View file @
f63628d0
...
...
@@ -40,19 +40,20 @@ class CtlBase {
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
req
.
xctx
=
{
appkey
:
req
.
headers
[
"xappkey"
],
//用于系统管理区分应用,比如角色
fromappkey
:
req
.
headers
[
"xfromappkey"
],
//来源APP,如果没有来源与appkey相同
companyid
:
custtags
?
custtags
[
0
].
split
(
"_"
)[
1
]:
null
,
fromcompanykey
:
req
.
headers
[
"xfromcompanykey"
],
//专用于自由用户注册,自由用户用于一定属于某个存在的公司
password
:
custtags
?
custtags
[
lastindex
].
split
(
"_"
)[
1
]:
null
,
username
:
req
.
headers
[
"x-consumer-username"
],
userid
:
req
.
headers
[
"x-consumer-custom-id"
],
credid
:
req
.
headers
[
"x-credential-identifier"
],
companykey
:
req
.
headers
[
"xcompanykey"
],
//专用于自由用户注册,自由用户用于一定属于某个存在的公司
regrole
:
req
.
headers
[
"xregrole"
],
bizpath
:
req
.
headers
[
"xbizpath"
],
}
if
(
!
req
.
xctx
.
appkey
){
return
[
-
200
,
"请求头缺少应用x-app-key"
]
}
else
{
let
app
=
await
this
.
cacheManager
[
"AppCache"
].
cache
(
req
.
xctx
.
appkey
);
let
app
=
await
this
.
cacheManager
[
"AppCache"
].
cache
(
req
.
xctx
.
from
appkey
);
req
.
xctx
.
appid
=
app
.
id
;
if
(
!
pobj
.
app_id
){
pobj
.
app_id
=
app
.
id
;
//传递参数对象里注入app_id
...
...
@@ -63,8 +64,8 @@ class CtlBase {
// if(!req.xctx.companyid && !req.xctx.companykey){
// return [-200,"请求头缺少应用x-app-key"]
// }
if
(
!
req
.
xctx
.
companyid
&&
req
.
xctx
.
companykey
&&
req
.
xctx
.
companykey
!=
"null"
){
let
comptmp
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
req
.
xctx
.
companykey
);
if
(
!
req
.
xctx
.
companyid
&&
req
.
xctx
.
fromcompanykey
&&
req
.
xctx
.
from
companykey
!=
"null"
){
let
comptmp
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
req
.
xctx
.
from
companykey
);
req
.
xctx
.
companyid
=
comptmp
.
id
;
}
if
(
req
.
xctx
.
companyid
){
//在请求传递数据对象注入公司id
...
...
center-manage/app/base/db/impl/common/connection.js
View file @
f63628d0
...
...
@@ -46,7 +46,10 @@ class DbFactory{
this
.
db
.
models
.
user
.
belongsTo
(
this
.
db
.
models
.
app
,{
constraints
:
false
,});
this
.
db
.
models
.
role
.
belongsTo
(
this
.
db
.
models
.
app
,
{
constraints
:
false
,});
this
.
db
.
models
.
org
.
belongsTo
(
this
.
db
.
models
.
app
,{
constraints
:
false
,});
this
.
db
.
models
.
auth
.
belongsTo
(
this
.
db
.
models
.
app
,{
constraints
:
false
,});
this
.
db
.
models
.
auth
.
belongsTo
(
this
.
db
.
models
.
company
,{
constraints
:
false
,});
this
.
db
.
models
.
auth
.
belongsTo
(
this
.
db
.
models
.
role
,{
constraints
:
false
,});
this
.
db
.
models
.
app
.
belongsTo
(
this
.
db
.
models
.
user
,{
as
:
"creator"
,
constraints
:
false
,});
...
...
@@ -54,7 +57,7 @@ class DbFactory{
this
.
db
.
models
.
user
.
belongsTo
(
this
.
db
.
models
.
company
,{
constraints
:
false
,});
this
.
db
.
models
.
role
.
belongsTo
(
this
.
db
.
models
.
company
,
{
constraints
:
false
,});
this
.
db
.
models
.
org
.
belongsTo
(
this
.
db
.
models
.
company
,{
constraints
:
false
,});
this
.
db
.
models
.
auth
.
belongsTo
(
this
.
db
.
models
.
company
,{
constraints
:
false
,});
this
.
db
.
models
.
route
.
belongsTo
(
this
.
db
.
models
.
app
,{
constraints
:
false
,});
this
.
db
.
models
.
plugin
.
belongsTo
(
this
.
db
.
models
.
app
,{
constraints
:
false
,});
...
...
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