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
651ed59c
Commit
651ed59c
authored
Jan 20, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
840c8f0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
136 deletions
+0
-136
xggsve-uc/app/base/service/impl/user/userSve.js
+0
-136
No files found.
xggsve-uc/app/base/service/impl/user/userSve.js
View file @
651ed59c
...
...
@@ -5,7 +5,6 @@ const settings = require("../../../../config/settings")
class
UserService
extends
ServiceBase
{
constructor
()
{
super
(
"user"
,
ServiceBase
.
getDaoName
(
UserService
));
this
.
userinfoDao
=
system
.
getObject
(
"db.user.userinfoDao"
);
this
.
userroleDao
=
system
.
getObject
(
"db.user.userroleDao"
);
this
.
authSve
=
system
.
getObject
(
"service.auth.authSve"
);
this
.
roleDao
=
system
.
getObject
(
"db.role.roleDao"
);
...
...
@@ -91,9 +90,6 @@ class UserService extends ServiceBase {
async
setLoginUser
(
user
)
{
// 登录成功,补充登录所需内容
// 详情
user
.
info
=
await
this
.
userinfoDao
.
findById
(
user
.
id
);
// 用户类型 1平台 2商户 3交付商 4个人
var
uctype
=
user
.
uctype
;
...
...
@@ -201,144 +197,12 @@ class UserService extends ServiceBase {
}
}
async
add
(
obj
)
{
try
{
var
roles
=
obj
.
roles
||
[];
var
org
=
obj
.
org
||
{};
var
saas_id
=
Number
(
obj
.
saas_id
||
0
);
var
ucid
=
this
.
trim
(
obj
.
ucid
);
var
ucname
=
this
.
trim
(
obj
.
ucname
);
var
password
=
this
.
trim
(
obj
.
password
);
var
uctype
=
Number
(
obj
.
uctype
||
1
);
var
uctypeId
=
this
.
trim
(
obj
.
uctypeId
);
var
mobile
=
this
.
trim
(
obj
.
mobile
);
var
realName
=
this
.
trim
(
obj
.
realName
);
var
isMain
=
obj
.
isMain
||
0
;
if
(
!
saas_id
)
{
return
system
.
getResult
(
null
,
"saas_id不存在"
);
}
var
exist
=
await
this
.
findOne
({
ucname
:
ucname
});
if
(
exist
)
{
return
system
.
getResult
(
null
,
`用户名【
${
ucname
}
】已存在`
);
}
var
user
=
{
saas_id
:
saas_id
,
ucid
:
ucid
,
ucname
:
ucname
,
password
:
await
this
.
getEncryptStr
(
password
),
uctype
:
uctype
,
uctypeId
:
uctypeId
,
org_id
:
org
.
id
||
0
,
isMain
:
isMain
,
orgpath
:
""
,
isEnabled
:
1
,
}
var
orgpath
=
org
.
path
||
""
;
var
info
=
{
mobile
:
mobile
,
realName
:
realName
,
}
var
self
=
this
;
user
=
await
self
.
db
.
transaction
(
async
function
(
t
)
{
// 创建商户
user
=
await
self
.
dao
.
create
(
user
,
t
);
info
.
id
=
user
.
id
;
info
=
await
self
.
userinfoDao
.
create
(
info
,
t
);
if
(
roles
&&
roles
.
length
>
0
)
{
for
(
var
r
of
roles
)
{
r
.
user_id
=
user
.
id
;
}
await
self
.
userroleDao
.
bulkCreate
(
roles
,
t
);
}
if
(
user
.
uctype
===
1
)
{
orgpath
=
(
isMain
?
orgpath
:
orgpath
+
"/"
+
user
.
id
)
+
"/"
;
await
self
.
dao
.
update
({
id
:
user
.
id
,
orgpath
:
orgpath
},
t
);
}
user
.
orgpath
=
orgpath
;
return
user
;
});
return
system
.
getResultSuccess
(
user
);
}
catch
(
error
)
{
return
system
.
getResult
(
-
1
,
`系统错误 错误信息
${
error
}
`
);
}
}
async
upd
(
obj
)
{
try
{
var
id
=
obj
.
id
;
var
roles
=
obj
.
roles
||
[];
var
org
=
obj
.
org
||
{};
var
uctype
=
this
.
trim
(
obj
.
uctype
);
var
uctypeId
=
this
.
trim
(
obj
.
uctypeId
);
var
mobile
=
this
.
trim
(
obj
.
mobile
);
var
realName
=
this
.
trim
(
obj
.
realName
);
var
isMain
=
obj
.
isMain
||
0
;
var
user
=
{
id
:
id
,
uctype
:
uctype
,
uctypeId
:
uctypeId
,
org_id
:
org
.
id
||
null
,
orgpath
:
""
,
isMain
:
obj
.
isMain
||
0
,
}
if
(
Number
(
this
.
trim
(
user
.
uctype
))
===
1
)
{
user
.
orgpath
=
(
isMain
?
org
.
path
:
org
.
path
+
"/"
+
id
)
+
"/"
;
}
var
info
=
{
id
:
id
,
mobile
:
mobile
,
realName
:
realName
,
}
var
self
=
this
;
user
=
await
self
.
db
.
transaction
(
async
function
(
t
)
{
// 创建商户
await
self
.
dao
.
update
(
user
,
t
);
await
self
.
userinfoDao
.
update
(
info
,
t
);
await
self
.
userroleDao
.
delByUserId
(
id
,
t
);
if
(
roles
&&
roles
.
length
>
0
)
{
for
(
var
r
of
roles
)
{
r
.
user_id
=
id
;
}
await
self
.
userroleDao
.
bulkCreate
(
roles
,
t
);
}
return
user
;
});
return
system
.
getResultSuccess
(
user
);
}
catch
(
error
)
{
return
system
.
getResult
(
-
1
,
`系统错误 错误信息
${
error
}
`
);
}
}
async
info
(
params
)
{
var
id
=
Number
(
params
.
id
||
0
);
var
user
=
await
this
.
dao
.
getById
(
id
);
if
(
!
user
)
{
return
system
.
getResult
(
null
,
"用户不存在"
);
}
var
info
=
await
this
.
userinfoDao
.
getById
(
id
);
user
.
mobile
=
info
.
mobile
;
user
.
realName
=
info
.
realName
;
user
.
roles
=
await
this
.
userroleDao
.
listByUserId
(
id
,
"user_id, role_id"
);
await
this
.
setRoleIds
([
user
]);
...
...
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