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
c540810d
Commit
c540810d
authored
May 10, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
f63628d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
center-manage/app/base/controller/impl/auth/authCtl.js
+6
-7
center-manage/app/base/service/impl/auth/authSve.js
+5
-5
center-manage/app/base/service/impl/common/appSve.js
+4
-4
No files found.
center-manage/app/base/controller/impl/auth/authCtl.js
View file @
c540810d
...
...
@@ -3,19 +3,18 @@ const http = require("http")
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
class
AuthCtl
extends
CtlBase
{
constructor
(){
super
(
"auth"
,
CtlBase
.
getServiceName
(
AuthCtl
));
}
async
saveAuths
(
q
obj
,
query
,
req
){
var
auths
=
qobj
.
au
s
;
var
xrtn
=
await
this
.
service
.
saveAuths
(
auths
,
req
.
appid
,
req
.
tocompany
id
);
async
saveAuths
(
p
obj
,
query
,
req
){
var
auths
=
pobj
.
auth
s
;
var
xrtn
=
await
this
.
service
.
saveAuths
(
auths
,
pobj
.
app_id
,
pobj
.
company_
id
);
return
system
.
getResult
(
xrtn
);
}
async
findAuthsByRole
(
q
obj
,
query
,
req
){
var
role
codestrs
=
qobj
.
rolecode
;
var
xrtn
=
await
this
.
service
.
findAuthsByRole
(
role
codestrs
,
req
.
appid
,
req
.
tocompany
id
);
async
findAuthsByRole
s
(
p
obj
,
query
,
req
){
var
role
ids
=
pobj
.
roleids
;
var
xrtn
=
await
this
.
service
.
findAuthsByRole
(
role
ids
,
pobj
.
app_id
,
pobj
.
company_
id
);
return
system
.
getResult
(
xrtn
);
}
}
...
...
center-manage/app/base/service/impl/auth/authSve.js
View file @
c540810d
...
...
@@ -5,12 +5,12 @@ class AuthService extends ServiceBase{
super
(
"auth"
,
ServiceBase
.
getDaoName
(
AuthService
));
}
//字符串数组参数
async
findAuthsByRole
(
role
codestr
,
appid
,
comid
){
async
findAuthsByRole
(
role
ids
,
appid
,
comid
){
//{where:{id:{[this.db.Op.in]:ids}}}
//var newattrs=rolecodestr.split(",");
var
aths
=
await
this
.
dao
.
model
.
findAll
({
attributes
:[
"bizcode"
,
"authstrs"
,
"codepath"
],
where
:{
role
code
:{[
this
.
db
.
Op
.
in
]:
rolecodestr
},
app_id
:
appid
,
company_id
:
comid
}});
where
:{
role
_id
:{[
this
.
db
.
Op
.
in
]:
roleids
}
}});
return
aths
;
}
async
saveAuths
(
auths
,
appid
,
cmid
){
...
...
@@ -25,17 +25,17 @@ class AuthService extends ServiceBase{
tmpAuth
.
company_id
=
cmid
;
var
objrtn
=
await
self
.
dao
.
model
.
findOrCreate
({
defaults
:
tmpAuth
,
where
:{
role
code
:
tmpAuth
.
rolecode
,
bizcode
:
tmpAuth
.
bizcode
},
//注意这里bizcode存储的是节点的code值
where
:{
role
_id
:
tmpAuth
.
role_id
,
bizcode
:
tmpAuth
.
bizcode
},
//注意这里bizcode存储的是节点的code值
transaction
:
t
,
});
console
.
log
(
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"
);
console
.
log
(
objrtn
);
if
(
!
objrtn
[
1
].
created
){
//就执行更新操作
await
objrtn
[
0
].
update
(
tmpAuth
,{
where
:{
role
code
:
tmpAuth
.
rolecode
,
bizcode
:
tmpAuth
.
bizcode
,
app_id
:
tmpAuth
.
app_id
},
transaction
:
t
})
await
objrtn
[
0
].
update
(
tmpAuth
,{
where
:{
role
_id
:
tmpAuth
.
role_id
,
bizcode
:
tmpAuth
.
bizcode
},
transaction
:
t
})
}
}
var
aths
=
await
self
.
dao
.
model
.
findAll
({
where
:{
role
code
:
tmpAuth
.
rolecode
,
app_id
:
tmpAuth
.
app_id
},
transaction
:
t
});
var
aths
=
await
self
.
dao
.
model
.
findAll
({
where
:{
role
_id
:
tmpAuth
.
role_id
,
app_id
:
tmpAuth
.
app_id
},
transaction
:
t
});
return
aths
;
});
}
...
...
center-manage/app/base/service/impl/common/appSve.js
View file @
c540810d
...
...
@@ -88,16 +88,16 @@ class AppService extends ServiceBase {
funcobjs
.
forEach
((
item
)
=>
{
if
(
item
.
children
)
{
if
(
parentfunc
){
item
.
bizCode
=
parentfunc
.
bizCode
+
"/"
+
item
.
name
item
.
codepath
=
parentfunc
.
codepath
+
"/"
+
item
.
name
}
else
{
item
.
bizCode
=
item
.
name
item
.
codepath
=
item
.
name
}
this
.
translateWithBizCode
(
item
.
children
,
item
)
}
else
{
if
(
parentfunc
){
item
.
bizCode
=
parentfunc
.
bizCode
+
"/"
+
item
.
name
item
.
codepath
=
parentfunc
.
codepath
+
"/"
+
item
.
name
}
else
{
item
.
bizCode
=
item
.
name
item
.
codepath
=
item
.
name
}
}
})
...
...
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