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
0cec34cb
Commit
0cec34cb
authored
Dec 03, 2019
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
784c8438
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
xggsve-uc/app/base/db/models/user/user.js
+1
-0
xggsve-uc/app/base/service/impl/user/userSve.js
+24
-6
No files found.
xggsve-uc/app/base/db/models/user/user.js
View file @
0cec34cb
...
...
@@ -7,6 +7,7 @@ module.exports = (db, DataTypes) => {
ucname
:
DataTypes
.
STRING
,
password
:
DataTypes
.
STRING
,
uctype
:
DataTypes
.
INTEGER
,
uctypeId
:
DataTypes
.
STRING
,
org_id
:
DataTypes
.
INTEGER
,
orgpath
:
DataTypes
.
STRING
,
isMain
:
{
...
...
xggsve-uc/app/base/service/impl/user/userSve.js
View file @
0cec34cb
...
...
@@ -41,8 +41,9 @@ class UserService extends ServiceBase {
}
async
login
(
obj
)
{
var
u
ser
=
await
this
.
dao
.
getByUcname
(
obj
.
ucname
);
var
u
ctype
=
Number
(
obj
.
uctype
||
0
);
var
user
=
await
this
.
dao
.
getByUcname
(
obj
.
ucname
);
// 验证登录合法
if
(
!
user
)
{
return
system
.
getResult
(
null
,
"用户名或密码错误"
);
...
...
@@ -51,6 +52,10 @@ class UserService extends ServiceBase {
return
system
.
getResult
(
null
,
"用户已禁用"
);
}
if
(
uctype
&&
uctype
!=
user
.
uctype
)
{
return
system
.
getResult
(
null
,
"用户类型错误"
);
}
var
loginPwd
=
await
this
.
getEncryptStr
(
obj
.
password
);
if
(
loginPwd
!=
user
.
password
)
{
return
system
.
getResult
(
null
,
"用户名或密码错误"
);
...
...
@@ -76,6 +81,9 @@ class UserService extends ServiceBase {
// 详情
user
.
info
=
await
this
.
userinfoDao
.
findById
(
user
.
id
);
// 用户类型 1平台 2商户 3交付商 4个人
var
uctype
=
user
.
uctype
;
// 角色
user
.
roles
=
await
this
.
userroleDao
.
findUserRoles
(
user
.
id
);
// 构建请求权限接口参数
...
...
@@ -87,10 +95,13 @@ class UserService extends ServiceBase {
roleIds
:
roleIds
,
saas_id
:
user
.
saas_id
,
}
// 菜单权限
user
.
menus
=
await
this
.
authSve
.
menuByRoleIds
(
authParams
);
// 接口权限
user
.
auths
=
await
this
.
authSve
.
authByRoleIds
(
authParams
);
if
(
uctype
==
1
)
{
// 菜单权限
user
.
menus
=
await
this
.
authSve
.
menuByRoleIds
(
authParams
);
// 接口权限
user
.
auths
=
await
this
.
authSve
.
authByRoleIds
(
authParams
);
}
}
async
add
(
obj
)
{
...
...
@@ -100,7 +111,8 @@ class UserService extends ServiceBase {
var
ucid
=
this
.
trim
(
obj
.
ucid
);
var
ucname
=
this
.
trim
(
obj
.
ucname
);
var
password
=
this
.
trim
(
obj
.
password
);
var
uctype
=
this
.
trim
(
obj
.
uctype
);
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
;
...
...
@@ -122,6 +134,7 @@ class UserService extends ServiceBase {
ucname
:
ucname
,
password
:
await
this
.
getEncryptStr
(
password
),
uctype
:
uctype
,
uctypeId
:
uctypeId
,
org_id
:
org
.
id
||
0
,
isMain
:
isMain
,
orgpath
:
""
,
...
...
@@ -169,19 +182,24 @@ class UserService extends ServiceBase {
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
||
""
,
orgpath
:
""
,
isMain
:
obj
.
isMain
||
0
,
}
if
(
user
.
uctype
===
1
)
{
user
.
orgpath
=
isMain
?
org
.
path
:
org
.
path
+
"/"
+
id
;
}
var
info
=
{
id
:
id
,
mobile
:
mobile
,
...
...
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