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
af871764
Commit
af871764
authored
Aug 03, 2020
by
v_vjyjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
68e3394b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
29 deletions
+28
-29
center-manage/app/base/controller/impl/auth/userCtl.js
+28
-29
No files found.
center-manage/app/base/controller/impl/auth/userCtl.js
View file @
af871764
...
@@ -7,35 +7,35 @@ class UserCtl extends CtlBase {
...
@@ -7,35 +7,35 @@ class UserCtl extends CtlBase {
constructor
()
{
constructor
()
{
super
(
"auth"
,
CtlBase
.
getServiceName
(
UserCtl
));
super
(
"auth"
,
CtlBase
.
getServiceName
(
UserCtl
));
}
}
async
logout
(
pobj
,
qobj
,
req
)
{
async
logout
(
pobj
,
qobj
,
req
)
{
let
rtn
=
await
this
.
service
.
logout
(
pobj
)
let
rtn
=
await
this
.
service
.
logout
(
pobj
)
return
system
.
getResult
(
rtn
)
return
system
.
getResult
(
rtn
)
}
}
async
pmgetUserByCode
(
pobj
,
qobj
,
req
)
{
async
pmgetUserByCode
(
pobj
,
qobj
,
req
)
{
let
code
=
pobj
.
code
let
code
=
pobj
.
code
let
rtn
=
await
this
.
service
.
pmgetUserByCode
(
code
)
let
rtn
=
await
this
.
service
.
pmgetUserByCode
(
code
)
return
system
.
getResult
(
rtn
)
return
system
.
getResult
(
rtn
)
}
}
async
loginApp
(
pobj
,
qobj
,
req
)
{
async
loginApp
(
pobj
,
qobj
,
req
)
{
let
appkey
=
pobj
.
fromAppKey
let
appkey
=
pobj
.
fromAppKey
let
uname
=
pobj
.
username
let
uname
=
pobj
.
username
let
rtn
=
await
this
.
service
.
loginApp
(
appkey
,
uname
)
let
rtn
=
await
this
.
service
.
loginApp
(
appkey
,
uname
)
return
system
.
getResult
(
rtn
);
return
system
.
getResult
(
rtn
);
}
}
async
resetPassword
(
pobj
,
qobj
,
req
)
{
async
resetPassword
(
pobj
,
qobj
,
req
)
{
await
this
.
service
.
resetPassword
(
req
.
xctx
.
username
,
pobj
.
onepassword
)
await
this
.
service
.
resetPassword
(
req
.
xctx
.
username
,
pobj
.
onepassword
)
return
system
.
getResult
({});
return
system
.
getResult
({});
}
}
async
allowOrNot
(
pobj
,
qobj
,
req
)
{
async
allowOrNot
(
pobj
,
qobj
,
req
)
{
await
this
.
service
.
updateByWhere
({
isEnabled
:
!
pobj
.
isEnabled
},{
company_id
:
pobj
.
company_id
})
await
this
.
service
.
updateByWhere
({
isEnabled
:
!
pobj
.
isEnabled
},
{
company_id
:
pobj
.
company_id
})
return
system
.
getResult
({});
return
system
.
getResult
({});
}
}
async
allowOrNotToOne
(
pobj
,
qobj
,
req
)
{
async
allowOrNotToOne
(
pobj
,
qobj
,
req
)
{
await
this
.
service
.
updateByWhere
({
isEnabled
:
!
pobj
.
isEnabled
},{
id
:
pobj
.
curid
})
await
this
.
service
.
updateByWhere
({
isEnabled
:
!
pobj
.
isEnabled
},
{
id
:
pobj
.
curid
})
return
system
.
getResult
({});
return
system
.
getResult
({});
}
}
async
initNewInstance
(
queryobj
,
req
)
{
async
initNewInstance
(
queryobj
,
req
)
{
var
rtn
=
{};
var
rtn
=
{};
rtn
.
roles
=
[];
rtn
.
roles
=
[];
return
system
.
getResultSuccess
(
rtn
);
return
system
.
getResultSuccess
(
rtn
);
...
@@ -46,17 +46,17 @@ class UserCtl extends CtlBase {
...
@@ -46,17 +46,17 @@ class UserCtl extends CtlBase {
// let v = await this.smsS.sendVCode(mobile);
// let v = await this.smsS.sendVCode(mobile);
// return system.getResult({ vcodestr: v });
// return system.getResult({ vcodestr: v });
// }
// }
async
exit
(
pobj
,
qobj
,
req
)
{
async
exit
(
pobj
,
qobj
,
req
)
{
}
}
//应用的自由用户注册,无需验证,需要前端头设置公司KEY
//应用的自由用户注册,无需验证,需要前端头设置公司KEY
async
pmregisterByFreeUser
(
p
,
q
,
req
)
{
async
pmregisterByFreeUser
(
p
,
q
,
req
)
{
//检查是否有用户名和密码
//检查是否有用户名和密码
if
(
!
pobj
.
userName
||
!
pobj
.
password
)
{
if
(
!
pobj
.
userName
||
!
pobj
.
password
)
{
return
system
.
getResult
(
null
,
"请检查用户名和密码是否存在"
)
return
system
.
getResult
(
null
,
"请检查用户名和密码是否存在"
)
}
}
//p.company_id = req.xctx.companyid;//控制基类里已经添加
//p.company_id = req.xctx.companyid;//控制基类里已经添加
if
(
!
p
.
company_id
)
{
if
(
!
p
.
company_id
)
{
return
system
.
getResultFail
(
-
201
,
"自有用户创建需要提供公司KEY"
);
return
system
.
getResultFail
(
-
201
,
"自有用户创建需要提供公司KEY"
);
}
}
...
@@ -64,7 +64,7 @@ class UserCtl extends CtlBase {
...
@@ -64,7 +64,7 @@ class UserCtl extends CtlBase {
return
rtn
;
return
rtn
;
}
}
async
create
(
p
,
q
,
req
)
{
async
create
(
p
,
q
,
req
)
{
//检查是否有用户名和密码
//检查是否有用户名和密码
if
(
!
p
.
userName
)
{
if
(
!
p
.
userName
)
{
return
system
.
getResult
(
null
,
"请检查用户名和密码是否存在"
)
return
system
.
getResult
(
null
,
"请检查用户名和密码是否存在"
)
...
@@ -77,7 +77,7 @@ class UserCtl extends CtlBase {
...
@@ -77,7 +77,7 @@ class UserCtl extends CtlBase {
//和租户绑定同一家公司
//和租户绑定同一家公司
//按照用户名和密码进行注册
//按照用户名和密码进行注册
//控制器端检查用户名和密码非空
//控制器端检查用户名和密码非空
async
registerByTantent
(
p
,
q
,
req
)
{
async
registerByTantent
(
p
,
q
,
req
)
{
//检查是否有用户名和密码
//检查是否有用户名和密码
if
(
!
pobj
.
userName
)
{
if
(
!
pobj
.
userName
)
{
return
system
.
getResult
(
null
,
"请检查用户名和密码是否存在"
)
return
system
.
getResult
(
null
,
"请检查用户名和密码是否存在"
)
...
@@ -86,7 +86,7 @@ class UserCtl extends CtlBase {
...
@@ -86,7 +86,7 @@ class UserCtl extends CtlBase {
return
rtn
;
return
rtn
;
}
}
//租户用户名和密码的租户注册
//租户用户名和密码的租户注册
async
pmregister
(
pobj
,
qobj
,
req
)
{
async
pmregister
(
pobj
,
qobj
,
req
)
{
//平台注册设置平台的应用ID
//平台注册设置平台的应用ID
pobj
.
app_id
=
settings
.
pmappid
;
pobj
.
app_id
=
settings
.
pmappid
;
//检查是否有用户名和密码
//检查是否有用户名和密码
...
@@ -96,19 +96,19 @@ class UserCtl extends CtlBase {
...
@@ -96,19 +96,19 @@ class UserCtl extends CtlBase {
var
rtn
=
await
this
.
service
.
pmregister
(
pobj
);
var
rtn
=
await
this
.
service
.
pmregister
(
pobj
);
return
system
.
getResult
(
rtn
);
return
system
.
getResult
(
rtn
);
}
}
async
pmlogin
(
pobj
,
qobj
,
req
)
{
async
pmlogin
(
pobj
,
qobj
,
req
)
{
//平台注册设置平台的应用ID
//平台注册设置平台的应用ID
let
rtn
=
await
this
.
service
.
pmlogin
(
pobj
,
qobj
,
req
);
let
rtn
=
await
this
.
service
.
pmlogin
(
pobj
,
qobj
,
req
);
return
system
.
getResult
(
rtn
);
return
system
.
getResult
(
rtn
);
}
}
async
getUserInfo
(
pobj
,
qobj
,
req
)
{
async
getUserInfo
(
pobj
,
qobj
,
req
)
{
let
uname
=
req
.
xctx
.
username
;
let
uname
=
req
.
xctx
.
username
;
let
rtn
=
await
this
.
service
.
getUserInfo
(
uname
);
let
rtn
=
await
this
.
service
.
getUserInfo
(
uname
);
return
system
.
getResult
(
rtn
);
return
system
.
getResult
(
rtn
);
}
}
//按照电话创建自由用户
//按照电话创建自由用户
async
pmloginByVCodeForFreeUser
(
p
,
q
,
req
)
{
async
pmloginByVCodeForFreeUser
(
p
,
q
,
req
)
{
if
(
!
pobj
.
mobile
||
!
pobj
.
vcode
)
{
if
(
!
pobj
.
mobile
||
!
pobj
.
vcode
)
{
return
system
.
getResult
(
null
,
"请检查手机号和验证码是否存在"
)
return
system
.
getResult
(
null
,
"请检查手机号和验证码是否存在"
)
}
}
...
@@ -119,14 +119,13 @@ class UserCtl extends CtlBase {
...
@@ -119,14 +119,13 @@ class UserCtl extends CtlBase {
let
rtn
=
await
this
.
service
.
pmloginByVCodeForFreeUser
(
p
,
q
);
let
rtn
=
await
this
.
service
.
pmloginByVCodeForFreeUser
(
p
,
q
);
return
rtn
;
return
rtn
;
}
}
async
pmloginByVCode
(
pobj
,
qobj
,
req
)
{
async
pmloginByVCode
(
pobj
,
qobj
,
req
)
{
let
rtn
=
await
this
.
service
.
pmloginByVCode
(
pobj
,
qobj
);
let
rtn
=
await
this
.
service
.
pmloginByVCode
(
pobj
,
qobj
);
return
system
.
getResult
(
rtn
);
return
system
.
getResult
(
rtn
);
}
}
async
pmSendVCode
(
pobj
,
qobj
,
req
)
{
async
pmSendVCode
(
pobj
,
qobj
,
req
)
{
let
rtn
=
await
this
.
service
.
sendVCode
(
pobj
,
qobj
);
let
rtn
=
await
this
.
service
.
sendVCode
(
pobj
,
qobj
);
return
system
.
getResult
(
rtn
);
return
system
.
getResult
(
rtn
);
}
}
}
}
module
.
exports
=
UserCtl
;
module
.
exports
=
UserCtl
;
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