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
aa5c5398
Commit
aa5c5398
authored
May 20, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
aac3b8cb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
1 deletions
+45
-1
center-manage/app/base/controller/ctl.base.js
+1
-0
center-manage/app/base/controller/impl/common/appCtl.js
+7
-0
center-manage/app/base/controller/impl/common/companyCtl.js
+14
-0
center-manage/app/base/db/impl/common/appDao.js
+6
-1
center-manage/app/base/service/impl/common/companySve.js
+17
-0
No files found.
center-manage/app/base/controller/ctl.base.js
View file @
aa5c5398
...
...
@@ -74,6 +74,7 @@ class CtlBase {
}
if
(
req
.
xctx
.
userid
){
//在请求传递数据对象注入公司id
pobj
.
userid
=
req
.
xctx
.
userid
;
pobj
.
username
=
req
.
xctx
.
username
;
}
pobj
.
bizpath
=
req
.
xctx
.
bizpath
;
}
...
...
center-manage/app/base/controller/impl/common/appCtl.js
View file @
aa5c5398
...
...
@@ -10,6 +10,13 @@ class AppCtl extends CtlBase {
constructor
()
{
super
(
"common"
,
CtlBase
.
getServiceName
(
AppCtl
));
this
.
userCtl
=
system
.
getObject
(
"service.auth.userSve"
);
this
.
comS
=
system
.
getObject
(
"service.common.companySve"
);
}
async
findAndCountAll
(
pobj
,
qobj
,
req
)
{
let
comtemp
=
await
this
.
comS
.
findById
(
pobj
.
company_id
)
pobj
.
myappstrs
=
comtemp
.
appids
let
rtn
=
await
super
.
findAndCountAll
(
pobj
,
qobj
,
req
)
return
system
.
getResult
(
rtn
)
}
async
findAllApps
(
p
,
q
,
req
)
{
var
rtns
=
await
this
.
service
.
findAllApps
(
p
.
userid
);
...
...
center-manage/app/base/controller/impl/common/companyCtl.js
View file @
aa5c5398
...
...
@@ -15,6 +15,20 @@ class CompanyCtl extends CtlBase {
let
company
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
p
.
companykey
)
return
system
.
getResult
(
company
)
}
async
getMyApps
(
p
,
q
,
req
){
let
userfind
=
await
this
.
cacheManager
[
"UserCache"
].
getCache
(
p
.
username
)
let
isSuper
=
userfind
.
isSuper
if
(
userfind
.
company
.
appids
&&
userfind
.
company
.
appids
!=
""
){
let
appsarray
=
userfind
.
company
.
appids
.
split
(
","
)
let
appidsquery
=
appsarray
.
map
(
astr
=>
{
return
astr
.
split
(
"|"
)[
0
]
})
let
apps
=
await
this
.
service
.
getMyApps
(
appidsquery
,
isSuper
)
return
system
.
getResult
(
apps
)
}
else
{
return
[]
}
}
async
bindApps
(
p
,
q
,
req
){
let
appids
=
p
.
appids
let
cmpid
=
p
.
postcmpid
...
...
center-manage/app/base/db/impl/common/appDao.js
View file @
aa5c5398
...
...
@@ -8,7 +8,12 @@ class AppDao extends Dao{
extraWhere
(
obj
,
w
,
qc
,
linkAttrs
){
if
(
obj
.
bizpath
&&
obj
.
bizpath
!=
""
){
if
(
obj
.
bizpath
.
indexOf
(
"my_app"
)
>
0
){
//说明是租户查询自己创建的应用
w
[
"creator_id"
]
=
obj
.
userid
;
let
appstrs
=
obj
.
myappstrs
let
appsarray
=
appstrs
.
split
(
","
)
let
appidsquery
=
appsarray
.
map
(
astr
=>
{
return
astr
.
split
(
"|"
)[
0
]
})
w
[
"id"
]
=
{[
this
.
db
.
Op
.
in
]:
appidsquery
};
}
}
if
(
linkAttrs
.
length
>
0
){
...
...
center-manage/app/base/service/impl/common/companySve.js
View file @
aa5c5398
...
...
@@ -5,6 +5,23 @@ class CompanyService extends ServiceBase {
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
CompanyService
));
}
async
getMyApps
(
appids
,
isSuper
){
let
appsrtn
=
null
if
(
isSuper
){
appsrtn
=
this
.
db
.
models
.
app
.
findAll
({
where
:
{
id
:{[
this
.
db
.
Op
.
ne
]:
settings
.
pmappid
}
}
})
}
else
{
appsrtn
=
this
.
db
.
models
.
app
.
findAll
({
where
:
{
id
:{[
this
.
db
.
Op
.
in
]:
appids
}
}
})
}
return
appsrtn
}
async
bindApps
(
appids
,
companyid
){
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
)
{
...
...
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