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
d32619f7
Commit
d32619f7
authored
Jun 30, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
e647bc09
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
86 deletions
+35
-86
esign-sve-uc/app/base/api/impl/op/action.js
+14
-3
esign-sve-uc/app/base/service/impl/user/userSve.js
+21
-82
esign-sve-uc/app/config/localsettings.js
+0
-1
No files found.
esign-sve-uc/app/base/api/impl/op/action.js
View file @
d32619f7
...
@@ -32,7 +32,6 @@ class ActionAPI extends APIBase {
...
@@ -32,7 +32,6 @@ class ActionAPI extends APIBase {
async
handleRequest
(
action_process
,
action_type
,
action_body
)
{
async
handleRequest
(
action_process
,
action_type
,
action_body
)
{
var
opResult
=
null
;
var
opResult
=
null
;
switch
(
action_type
)
{
switch
(
action_type
)
{
// 测试
// 新增
// 新增
case
"saveAdminUser"
:
case
"saveAdminUser"
:
opResult
=
await
this
.
userSve
.
saveAdminUser
(
action_body
);
opResult
=
await
this
.
userSve
.
saveAdminUser
(
action_body
);
...
@@ -41,8 +40,20 @@ class ActionAPI extends APIBase {
...
@@ -41,8 +40,20 @@ class ActionAPI extends APIBase {
case
"saveMerchantUser"
:
case
"saveMerchantUser"
:
opResult
=
await
this
.
userSve
.
saveMerchantUser
(
action_body
);
opResult
=
await
this
.
userSve
.
saveMerchantUser
(
action_body
);
break
;
break
;
case
"login"
:
case
"adminLogin"
:
opResult
=
await
this
.
userSve
.
login
(
action_body
);
opResult
=
await
this
.
userSve
.
adminLogin
(
action_body
);
break
;
case
"merchantLogin"
:
opResult
=
await
this
.
userSve
.
merchantLogin
(
action_body
);
break
;
case
"userInfo"
:
opResult
=
await
this
.
userSve
.
info
(
action_body
);
break
;
case
"userPage"
:
opResult
=
await
this
.
userSve
.
pageByCondition
(
action_body
);
break
;
case
"userEnabled"
:
opResult
=
await
this
.
userSve
.
enabled
(
action_body
);
break
;
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
...
...
esign-sve-uc/app/base/service/impl/user/userSve.js
View file @
d32619f7
...
@@ -82,12 +82,21 @@ class UserService extends ServiceBase {
...
@@ -82,12 +82,21 @@ class UserService extends ServiceBase {
user
.
ucname
=
this
.
trim
(
obj
.
ucname
);
user
.
ucname
=
this
.
trim
(
obj
.
ucname
);
user
.
mobile
=
this
.
trim
(
obj
.
mobile
);
user
.
mobile
=
this
.
trim
(
obj
.
mobile
);
user
.
real_name
=
this
.
trim
(
obj
.
real_name
);
user
.
real_name
=
this
.
trim
(
obj
.
real_name
);
user
.
is_enabled
=
obj
.
is_enabled
||
false
;
if
(
password
)
{
if
(
password
)
{
user
.
password
=
await
this
.
getEncryptStr
(
password
);
user
.
password
=
await
this
.
getEncryptStr
(
password
);
}
}
let
exists
=
await
this
.
dao
.
findOne
({
uctype
:
user
.
uctype
,
ucname
:
user
.
ucname
});
if
(
user
.
id
)
{
if
(
user
.
id
)
{
if
(
exists
&&
exists
.
id
!=
user
.
id
)
{
return
system
.
getResult
(
-
1
,
`用户名[
${
user
.
ucname
}
]重复`
);
}
user
=
await
user
.
save
();
user
=
await
user
.
save
();
}
else
{
}
else
{
if
(
exists
)
{
return
system
.
getResult
(
-
1
,
`用户名[
${
user
.
ucname
}
]重复`
);
}
user
.
autoIncrement
=
true
;
user
.
autoIncrement
=
true
;
user
=
await
this
.
dao
.
create
(
user
);
user
=
await
this
.
dao
.
create
(
user
);
}
}
...
@@ -102,17 +111,18 @@ class UserService extends ServiceBase {
...
@@ -102,17 +111,18 @@ class UserService extends ServiceBase {
}
}
async
info
(
params
)
{
async
info
(
params
)
{
var
id
=
Number
(
params
.
id
||
0
);
let
id
=
Number
(
params
.
id
||
0
);
var
user
=
await
this
.
dao
.
getById
(
id
);
let
user
=
await
this
.
dao
.
getById
(
id
);
if
(
!
user
)
{
if
(
!
user
)
{
return
system
.
getResult
(
null
,
"用户不存在"
);
return
system
.
getResult
(
null
,
"用户不存在"
);
}
}
this
.
handleDate
(
user
,
[
"created_at"
],
null
,
-
8
);
user
.
password
=
""
;
this
.
handleDate
(
user
,
[
"created_at"
,
"updated_at"
],
null
);
return
system
.
getResultSuccess
(
user
);
return
system
.
getResultSuccess
(
user
);
}
}
async
enabled
(
params
)
{
async
enabled
(
params
)
{
var
user
=
await
this
.
dao
.
findById
(
params
.
id
);
let
user
=
await
this
.
dao
.
findById
(
params
.
id
);
if
(
!
user
)
{
if
(
!
user
)
{
return
system
.
getResult
(
null
,
"用户不存在"
);
return
system
.
getResult
(
null
,
"用户不存在"
);
}
}
...
@@ -122,12 +132,14 @@ class UserService extends ServiceBase {
...
@@ -122,12 +132,14 @@ class UserService extends ServiceBase {
}
}
async
pageByCondition
(
params
)
{
async
pageByCondition
(
params
)
{
var
result
=
{
let
result
=
{
count
:
0
,
count
:
0
,
rows
:
[]
rows
:
[]
};
};
var
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
params
.
startRow
=
(
params
.
currentPage
-
1
)
*
params
.
pageSize
;
if
(
params
.
orgpath
)
{
if
(
params
.
orgpath
)
{
params
.
orgpath
=
params
.
orgpath
+
"%"
;
params
.
orgpath
=
params
.
orgpath
+
"%"
;
}
}
...
@@ -136,34 +148,17 @@ class UserService extends ServiceBase {
...
@@ -136,34 +148,17 @@ class UserService extends ServiceBase {
return
result
;
return
result
;
}
}
result
.
count
=
total
;
result
.
count
=
total
;
params
.
startRow
=
(
currentPage
-
1
)
*
pageSize
;
result
.
rows
=
await
this
.
dao
.
listByCondition
(
params
)
||
[];
result
.
rows
=
await
this
.
dao
.
listByCondition
(
params
)
||
[];
if
(
result
.
rows
)
{
if
(
result
.
rows
)
{
for
(
let
item
of
result
.
rows
)
{
for
(
let
item
of
result
.
rows
)
{
this
.
handleDate
(
item
,
[
"created_at"
],
null
,
-
8
);
this
.
handleDate
(
item
,
[
"created_at"
],
null
);
}
}
await
this
.
setRoles
(
result
.
rows
);
await
this
.
setOrg
(
result
.
rows
);
}
}
return
system
.
getResultSuccess
(
result
);
return
system
.
getResultSuccess
(
result
);
}
}
async
delUser
(
params
)
{
var
user
=
await
this
.
findById
(
params
.
id
);
if
(
!
user
)
{
return
system
.
getResultSuccess
();
}
if
(
user
.
saas_id
!=
params
.
saas_id
)
{
return
system
.
getResult
(
null
,
"权限不足"
);
}
await
this
.
delete
({
id
:
params
.
id
});
return
system
.
getResultSuccess
();
}
async
updPassword
(
params
)
{
async
updPassword
(
params
)
{
var
user
=
await
this
.
findById
(
params
.
id
);
let
user
=
await
this
.
findById
(
params
.
id
);
if
(
!
user
)
{
if
(
!
user
)
{
return
system
.
getResult
(
null
,
"用户不存在"
);
return
system
.
getResult
(
null
,
"用户不存在"
);
}
}
...
@@ -178,61 +173,6 @@ class UserService extends ServiceBase {
...
@@ -178,61 +173,6 @@ class UserService extends ServiceBase {
return
system
.
getResultSuccess
(
rs
);
return
system
.
getResultSuccess
(
rs
);
}
}
async
findUsers
(
params
)
{
if
(
params
.
roleCodes
&&
params
.
roleCodes
.
length
>
0
)
{
var
roleIds
=
await
this
.
roleDao
.
findIdsByCode
(
params
.
roleCodes
,
params
.
saas_id
);
if
(
!
roleIds
)
{
return
[];
}
params
.
roleIds
=
roleIds
;
}
let
rs
=
await
this
.
dao
.
findUsers
(
params
);
return
system
.
getResultSuccess
(
rs
);
}
async
setOrg
(
rows
)
{
if
(
!
rows
||
rows
.
length
==
0
)
{
return
;
}
let
orgIds
=
[];
for
(
let
row
of
rows
)
{
orgIds
.
push
(
row
.
org_id
);
}
let
map
=
await
this
.
orgDao
.
mapByIds
(
orgIds
);
for
(
let
row
of
rows
)
{
let
org
=
map
[
row
.
org_id
]
||
{};
row
.
orgname
=
org
.
orgname
||
""
;
row
.
org
=
org
;
}
}
async
setRoles
(
rows
)
{
if
(
!
rows
||
rows
.
length
==
0
)
{
return
;
}
let
userIds
=
[];
for
(
let
row
of
rows
)
{
userIds
.
push
(
row
.
id
);
}
let
rolesMap
=
await
this
.
userroleDao
.
mapByUserIds2
(
userIds
);
for
(
let
row
of
rows
)
{
let
roleIds
=
[];
let
roleNames
=
[];
let
roles
=
rolesMap
[
row
.
id
]
||
[];
for
(
let
r
of
roles
)
{
roleIds
.
push
(
r
.
id
);
roleNames
.
push
(
r
.
name
);
}
row
.
roleIds
=
roleIds
.
join
(
","
);
row
.
roleNames
=
roleNames
.
join
(
","
);
row
.
roles
=
roles
;
}
}
}
}
module
.
exports
=
UserService
;
module
.
exports
=
UserService
;
\ No newline at end of file
esign-sve-uc/app/config/localsettings.js
View file @
d32619f7
...
@@ -14,7 +14,6 @@ var settings={
...
@@ -14,7 +14,6 @@ var settings={
// port: 3306,
// port: 3306,
host
:
'43.247.184.35'
,
host
:
'43.247.184.35'
,
port
:
8899
,
port
:
8899
,
dialect
:
'mysql'
,
dialect
:
'mysql'
,
operatorsAliases
:
false
,
operatorsAliases
:
false
,
pool
:
{
pool
:
{
...
...
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