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
6328b659
Commit
6328b659
authored
Nov 28, 2019
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
a2d78833
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
131 additions
and
19 deletions
+131
-19
xggsve-uc/app/base/api/api.base.js
+1
-1
xggsve-uc/app/base/api/impl/op/action.js
+19
-10
xggsve-uc/app/base/db/dao.base.js
+4
-1
xggsve-uc/app/base/db/impl/auth/authDao.js
+5
-0
xggsve-uc/app/base/db/models/auth/auth.js
+1
-0
xggsve-uc/app/base/service/impl/auth/authSve.js
+93
-1
xggsve-uc/app/base/service/sve.base.js
+4
-0
xggsve-uc/app/config/localsettings.js
+3
-5
xggsve-uc/app/config/settings.js
+1
-1
No files found.
xggsve-uc/app/base/api/api.base.js
View file @
6328b659
...
...
@@ -70,7 +70,7 @@ class APIBase extends DocBase {
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
var
requestid
=
this
.
getUUID
();
try
{
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
)
||
{}
;
rtn
.
requestid
=
requestid
;
this
.
oplogSve
.
createDb
({
...
...
xggsve-uc/app/base/api/impl/op/action.js
View file @
6328b659
...
...
@@ -4,7 +4,14 @@ var settings = require("../../../../config/settings");
class
ActionAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
saasSve
=
system
.
getObject
(
"service.saas.saasSve"
);
this
.
userSve
=
system
.
getObject
(
"service.user.userSve"
);
this
.
orgSve
=
system
.
getObject
(
"service.org.orgSve"
);
this
.
authSve
=
system
.
getObject
(
"service.auth.authSve"
);
this
.
roleSve
=
system
.
getObject
(
"service.role.roleSve"
);
}
/**
* 接口跳转
* action_process 执行的流程
...
...
@@ -47,18 +54,28 @@ class ActionAPI extends APIBase {
case
"updOrg"
:
break
;
case
"delOrg"
:
// 是否 uc_user_org 表中有数据
// 删除
break
;
case
"listOrg"
:
break
;
// 菜单权限
case
"addAuth"
:
return
this
.
authSve
.
add
(
action_body
);
break
;
case
"updAuth"
:
return
this
.
authSve
.
upd
(
action_body
);
break
;
case
"delAuth"
:
case
"tree"
:
return
this
.
authSve
.
tree
(
action_body
);
break
;
case
"listAuth"
:
case
"byPid"
:
return
this
.
authSve
.
byPid
(
action_body
);
break
;
case
"delAuth"
:
// TODO 验证是否有角色关联
return
this
.
authSve
.
del
(
action_body
);
break
;
// 角色
...
...
@@ -71,8 +88,6 @@ class ActionAPI extends APIBase {
case
"listRole"
:
break
;
// 用户
case
"addUser"
:
break
;
...
...
@@ -82,12 +97,6 @@ class ActionAPI extends APIBase {
break
;
case
"listUser"
:
break
;
}
return
opResult
;
}
...
...
xggsve-uc/app/base/db/dao.base.js
View file @
6328b659
...
...
@@ -78,7 +78,6 @@ class Dao {
where
:
qobj
});
if
(
en
!=
null
)
{
1
return
en
.
destroy
();
}
return
null
;
...
...
@@ -157,6 +156,10 @@ class Dao {
console
.
log
(
qc
);
return
qc
;
}
async
findAll
(
obj
){
return
await
this
.
model
.
findAll
({
where
:
obj
||
{}});
}
async
findAndCountAll
(
qobj
,
t
)
{
var
qc
=
this
.
buildQuery
(
qobj
);
var
apps
=
await
this
.
model
.
findAndCountAll
(
qc
);
...
...
xggsve-uc/app/base/db/impl/auth/authDao.js
View file @
6328b659
...
...
@@ -4,5 +4,9 @@ class AuthDao extends Dao {
constructor
()
{
super
(
Dao
.
getModelName
(
AuthDao
));
}
async
all
()
{
return
this
.
customQuery
(
"SELECT * FROM uc_auth WHERE deleted_at IS NULL"
);
}
}
module
.
exports
=
AuthDao
;
\ No newline at end of file
xggsve-uc/app/base/db/models/auth/auth.js
View file @
6328b659
...
...
@@ -7,6 +7,7 @@ module.exports = (db, DataTypes) => {
menuType
:
DataTypes
.
INTEGER
,
name
:
DataTypes
.
STRING
,
icon
:
DataTypes
.
STRING
,
path
:
DataTypes
.
STRING
,
sort
:
DataTypes
.
STRING
,
saas_id
:
DataTypes
.
STRING
,
},
{
...
...
xggsve-uc/app/base/service/impl/auth/authSve.js
View file @
6328b659
...
...
@@ -4,6 +4,97 @@ const settings = require("../../../../config/settings")
class
AuthService
extends
ServiceBase
{
constructor
()
{
super
(
"auth"
,
ServiceBase
.
getDaoName
(
AuthService
));
this
.
pmap
=
{};
}
async
add
(
obj
)
{
var
saas_id
=
Number
(
obj
.
saas_id
||
0
);
var
pid
=
Number
(
obj
.
pid
||
0
);
if
(
!
saas_id
)
{
return
system
.
getResult
(
null
,
"请指定saas_id"
);
}
if
(
pid
===
0
)
{
// 验证是否存在其他权限
var
exist
=
await
this
.
findCount
({
where
:
{
saas_id
:
saas_id
}
});
if
(
exist
)
{
return
system
.
getResult
(
null
,
"菜单根目录已经存在"
);
}
}
obj
.
pid
=
pid
;
obj
.
saas_id
=
saas_id
;
obj
.
menuType
=
Number
(
obj
.
menuType
||
1
);
obj
.
name
=
this
.
trim
(
obj
.
name
);
obj
.
icon
=
this
.
trim
(
obj
.
icon
);
obj
.
path
=
this
.
trim
(
obj
.
path
);
obj
.
sort
=
Number
(
obj
.
sort
||
99
);
var
obj
=
await
this
.
dao
.
create
(
obj
);
return
system
.
getResultSuccess
();
}
async
upd
(
obj
)
{
var
saas_id
=
Number
(
obj
.
saas_id
||
0
);
var
pid
=
Number
(
obj
.
pid
||
0
);
var
id
=
Number
(
obj
.
id
||
0
);
if
(
!
id
)
{
return
system
.
getResult
(
null
,
"菜单不存在"
);
}
var
auth
=
await
this
.
findById
(
id
);
if
(
!
saas_id
)
{
return
system
.
getResult
(
null
,
"请指定saas_id"
);
}
if
(
saas_id
!=
auth
.
saas_id
)
{
return
system
.
getResult
(
null
,
"修改失败,权限不足"
);
}
auth
.
menuType
=
Number
(
obj
.
menuType
||
1
);
auth
.
name
=
this
.
trim
(
obj
.
name
);
auth
.
icon
=
this
.
trim
(
obj
.
icon
);
auth
.
path
=
this
.
trim
(
obj
.
path
);
auth
.
sort
=
Number
(
obj
.
sort
||
99
);
await
auth
.
save
();
return
system
.
getResultSuccess
();
}
async
byPid
(
obj
)
{
var
list
=
await
this
.
dao
.
findAll
({
pid
:
obj
.
pid
||
0
,
});
return
list
;
}
async
tree
()
{
var
all
=
await
this
.
dao
.
all
();
var
pmap
=
{};
for
(
var
item
of
all
)
{
var
list
=
pmap
[
item
.
pid
];
if
(
!
list
)
{
list
=
[];
}
list
.
push
(
item
);
pmap
[
item
.
pid
]
=
list
;
console
.
log
(
item
.
pid
);
}
for
(
var
item
of
all
)
{
item
.
childs
=
pmap
[
item
.
id
]
||
[];
}
return
system
.
getResultSuccess
(
pmap
[
0
]);
}
async
del
(
obj
)
{
await
this
.
delete
({
id
:
obj
.
id
});
return
system
.
getResultSuccess
();
}
}
module
.
exports
=
AuthService
;
module
.
exports
=
AuthService
;
\ No newline at end of file
xggsve-uc/app/base/service/sve.base.js
View file @
6328b659
...
...
@@ -183,6 +183,10 @@ class ServiceBase {
async
findById
(
oid
)
{
return
this
.
dao
.
findById
(
oid
);
}
async
findAll
(
obj
){
return
await
this
.
dao
.
findAll
(
obj
);
}
/*
返回20位业务订单号
prefix:业务前缀
...
...
xggsve-uc/app/config/localsettings.js
View file @
6328b659
...
...
@@ -7,12 +7,10 @@ var settings={
},
database
:{
dbname
:
"xgg-uc"
,
user
:
"
root
"
,
password
:
"
root
"
,
user
:
"
write
"
,
password
:
"
write
"
,
config
:
{
// host: '43.247.184.35',
// port: 8899,
host
:
'192.168.18.110'
,
host
:
'192.168.18.237'
,
port
:
3306
,
dialect
:
'mysql'
,
...
...
xggsve-uc/app/config/settings.js
View file @
6328b659
...
...
@@ -24,7 +24,7 @@ var settings = {
salt
:
"%iatpD1gcxz7iF#B"
,
defaultpwd
:
"987456"
,
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
310
3
,
port
:
process
.
env
.
NODE_PORT
||
310
6
,
reqEsAddr
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
...
...
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