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
29967344
Commit
29967344
authored
Apr 28, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
74c42368
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
9 deletions
+13
-9
center-manage/app/base/controller/ctl.base.js
+6
-2
center-manage/app/base/controller/impl/auth/userCtl.js
+1
-1
center-manage/app/base/db/dao.base.js
+1
-1
center-manage/app/base/db/impl/auth/roleDao.js
+2
-2
center-manage/app/base/db/initData.js
+2
-2
center-manage/app/base/service/impl/auth/userSve.js
+1
-1
No files found.
center-manage/app/base/controller/ctl.base.js
View file @
29967344
...
...
@@ -15,11 +15,15 @@ class CtlBase {
const
up
=
await
this
.
service
.
update
(
pobj
);
return
system
.
getResult
(
up
);
}
async
delete
(
pobj
,
qobj
,
req
)
{
const
up
=
await
this
.
service
.
delete
(
pobj
);
return
system
.
getResult
(
up
);
}
async
findAndCountAll
(
pobj
,
qobj
,
req
)
{
//设置查询条件
console
.
log
(
pobj
)
const
app
s
=
await
this
.
service
.
findAndCountAll
(
pobj
);
return
system
.
getResult
(
app
s
);
const
r
s
=
await
this
.
service
.
findAndCountAll
(
pobj
);
return
system
.
getResult
(
r
s
);
}
async
refQuery
(
pobj
,
qobj
,
req
)
{
return
this
.
service
.
refQuery
(
pobj
);
...
...
center-manage/app/base/controller/impl/auth/userCtl.js
View file @
29967344
...
...
@@ -40,7 +40,7 @@ class UserCtl extends CtlBase {
async
create
(
p
,
q
,
req
){
//检查是否有用户名和密码
if
(
!
p
obj
.
userName
)
{
if
(
!
p
.
userName
)
{
return
system
.
getResult
(
null
,
"请检查用户名和密码是否存在"
)
}
let
rtn
=
await
this
.
service
.
registerByTantent
(
p
,
q
);
...
...
center-manage/app/base/db/dao.base.js
View file @
29967344
...
...
@@ -62,7 +62,7 @@ class Dao {
}
}
async
delete
(
qobj
,
t
)
{
var
en
=
await
this
.
model
.
findOne
({
where
:
qobj
});
var
en
=
await
this
.
model
.
findOne
({
where
:
{
id
:
qobj
.
id
}
});
if
(
t
!=
null
&&
t
!=
'undefined'
)
{
if
(
en
!=
null
)
{
return
en
.
destroy
({
transaction
:
t
});
...
...
center-manage/app/base/db/impl/auth/roleDao.js
View file @
29967344
...
...
@@ -15,8 +15,8 @@ class RoleDao extends Dao{
// // w["app_id"]=obj.appid;
// // }
// }
w
[
"app_id"
]
=
obj
.
appid
;
w
[
"company_id"
]
=
obj
.
tocompany
id
;
w
[
"app_id"
]
=
obj
.
app
_
id
;
w
[
"company_id"
]
=
obj
.
company_
id
;
return
w
;
}
extraModelFilter
(){
...
...
center-manage/app/base/db/initData.js
View file @
29967344
...
...
@@ -17,8 +17,8 @@ db.sync({force:true}).then(async ()=>{
"backend"
:
"192.168.4.1"
});
let
Role
=
db
.
models
[
"role"
];
await
Role
.
create
({
code
:
"ta"
,
name
:
"租户"
,
app_id
:
appnew
.
id
,
company_id
:
settings
.
pmcompanyid
})
await
Role
.
create
({
code
:
"pr"
,
name
:
"个人"
,
app_id
:
appnew
.
id
,
company_id
:
settings
.
pmcompanyid
})
await
Role
.
create
({
code
:
"ta"
,
name
:
"租户"
,
isSystem
:
true
,
app_id
:
appnew
.
id
,
company_id
:
settings
.
pmcompanyid
})
await
Role
.
create
({
code
:
"pr"
,
name
:
"个人"
,
isSystem
:
true
,
app_id
:
appnew
.
id
,
company_id
:
settings
.
pmcompanyid
})
let
usuper
=
await
usS
.
pmregister
({
userName
:
"sm"
,
password
:
"951753"
,
isSuper
:
true
,
isAdmin
:
true
,
isSystem
:
true
,
isEnabled
:
true
,
nickName
:
"superman"
,
app_id
:
appnew
.
id
,
company_id
:
settings
.
id
})
...
...
center-manage/app/base/service/impl/auth/userSve.js
View file @
29967344
...
...
@@ -44,7 +44,7 @@ class UserService extends ServiceBase {
//对于租户类型注册,创建一个默认公司,公司名称xxxx的公司
//如果非租户类型,需要按照传递进来的公司companykey,来查询公司,按照companykey缓存到redis
let
cmpkey
=
self
.
getUUID
();
let
rolecodes
=
p
.
rolecode
?
p
.
rolecodes
:
[
settings
.
pmroleid
[
"ta"
]];
let
rolecodes
=
p
.
rolecode
s
?
p
.
rolecodes
:
[
settings
.
pmroleid
[
"ta"
]];
if
(
rolecodes
[
0
]
==
settings
.
pmroleid
[
"ta"
])
{
//如果注册时,角色是租户,那么需要创建默认公司
let
cmp
=
await
self
.
companyDao
.
create
({
name
:
p
.
userName
+
"的公司"
,
companykey
:
cmpkey
},
t
);
p
.
company_id
=
cmp
.
id
;
...
...
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