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
dcd2197d
Commit
dcd2197d
authored
Aug 20, 2020
by
王悦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录超时重置密码
parent
26d7e704
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
2 deletions
+61
-2
center-manage/app/base/controller/impl/auth/userCtl.js
+14
-0
center-manage/app/base/db/cache/loginTimesCache.js
+39
-0
center-manage/app/base/service/impl/auth/userSve.js
+8
-2
No files found.
center-manage/app/base/controller/impl/auth/userCtl.js
View file @
dcd2197d
...
@@ -103,8 +103,22 @@ class UserCtl extends CtlBase {
...
@@ -103,8 +103,22 @@ class UserCtl extends CtlBase {
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
);
if
(
!
rtn
){
//登录错误
let
times
=
this
.
service
.
cacheManager
[
"LoginTimesCache"
].
incrAsync
(
pobj
.
userName
);
if
(
times
==
4
)
{
await
this
.
service
.
updateByWhere
({
isEnabled
:
false
},
{
userName
:
pobj
.
userName
})
}
}
return
system
.
getResult
(
rtn
);
return
system
.
getResult
(
rtn
);
}
}
async
unlockUser
(
pobj
,
qobj
,
req
)
{
try
{
await
this
.
service
.
unlockUser
(
req
.
xctx
.
username
)
return
system
.
getResult
({});
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
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
);
...
...
center-manage/app/base/db/cache/loginTimesCache.js
0 → 100644
View file @
dcd2197d
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
LoginTimesCache
extends
CacheBase
{
constructor
()
{
super
();
}
isdebug
()
{
return
settings
.
env
==
"dev"
;
}
desc
()
{
return
"缓存登录错误次数信息"
;
}
prefix
()
{
return
"g_login_times:"
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
if
(
val
)
{
return
val
;
}
return
null
;
}
async
incrAsync
(
key
)
{
let
cache
=
await
this
.
getCache
(
key
);
if
(
!
cache
)
{
await
this
.
cache
(
key
,
0
,
60
*
1000
)
}
return
this
.
redisClient
.
incr
(
key
,)
}
}
module
.
exports
=
LoginTimesCache
;
\ No newline at end of file
center-manage/app/base/service/impl/auth/userSve.js
View file @
dcd2197d
...
@@ -134,6 +134,12 @@ class UserService extends ServiceBase {
...
@@ -134,6 +134,12 @@ class UserService extends ServiceBase {
}
}
});
});
}
}
async
unlockUser
(
username
)
{
let
initpassword
=
this
.
getEncryptStr
(
settings
.
defaultpwd
);
await
this
.
resetPassword
(
username
,
initpassword
);
return
this
.
updateByWhere
({
isEnabled
:
true
},
{
userName
:
username
})
}
async
logout
(
pobj
)
{
async
logout
(
pobj
)
{
await
this
.
cacheManager
[
"UserCache"
].
invalidate
(
pobj
.
username
);
await
this
.
cacheManager
[
"UserCache"
].
invalidate
(
pobj
.
username
);
return
{}
return
{}
...
@@ -384,7 +390,7 @@ class UserService extends ServiceBase {
...
@@ -384,7 +390,7 @@ class UserService extends ServiceBase {
//按照客户电话,建立和业务员的映射关系
//按照客户电话,建立和业务员的映射关系
//如果已经分配过,那么优先分配
//如果已经分配过,那么优先分配
/**
/**
*
*
* @param {*} clientMobile 客户电话
* @param {*} clientMobile 客户电话
* @param {*} spName 服务商名称
* @param {*} spName 服务商名称
* @param {*} productCatName 产品类型名称
* @param {*} productCatName 产品类型名称
...
@@ -489,7 +495,7 @@ class UserService extends ServiceBase {
...
@@ -489,7 +495,7 @@ class UserService extends ServiceBase {
return
costAmount
return
costAmount
}
}
/**
/**
*
*
* @param {*} clientMobile 客户电话
* @param {*} clientMobile 客户电话
* @param {*} spName 服务商名称
* @param {*} spName 服务商名称
* @param {*} productCatName 产品类型名称
* @param {*} productCatName 产品类型名称
...
...
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