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
b16f2e25
Commit
b16f2e25
authored
Mar 17, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
439d1842
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
50 deletions
+25
-50
center-app/app/base/api/impl/auth/accessAuth.js
+5
-8
center-app/app/base/db/cache/appUserPinByChannelUserIdCache.js
+3
-1
center-app/app/base/utils/businessManager/opPlatformUtils.js
+17
-41
No files found.
center-app/app/base/api/impl/auth/accessAuth.js
View file @
b16f2e25
...
...
@@ -29,11 +29,11 @@ class AccessAuthAPI extends APIBase {
var
result
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoin
(
pobj
);
return
result
;
}
async
get
LoginByUserName
(
pobj
,
qobj
,
req
)
{
//通过账户获取用户信息----------------------------actionBody.userName
if
(
!
pobj
.
actionBody
.
userName
)
{
return
system
.
getResult
(
null
,
"actionBody.
userName
can not be empty !"
);
async
get
UserPinByChannelUserId
(
pobj
,
qobj
,
req
)
{
//通过账户获取用户信息----------------------------actionBody.channelUserId
if
(
!
pobj
.
actionBody
.
channelUserId
)
{
return
system
.
getResult
(
null
,
"actionBody.
channelUserId
can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
get
LoginByUserName
(
pobj
);
var
result
=
await
this
.
opPlatformUtils
.
get
UserPinByChannelUserId
(
pobj
);
return
result
;
}
...
...
@@ -58,13 +58,10 @@ class AccessAuthAPI extends APIBase {
if
(
!
actionBody
.
newPwd
)
{
return
system
.
getResult
(
null
,
"actionBody.newPwd can not be empty !"
);
}
if
(
!
actionBody
.
userpin
)
{
return
system
.
getResult
(
null
,
"actionBody.userpin can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
putUserPwdByMobile
(
pobj
,
actionBody
);
return
result
;
}
async
getLoginInfo
(
pobj
,
qobj
,
req
)
{
//通过
手机验证码修改用户密码
async
getLoginInfo
(
pobj
,
qobj
,
req
)
{
//通过
userpin获取用户信息
var
actionBody
=
pobj
.
actionBody
;
if
(
!
actionBody
.
userpin
)
{
return
system
.
getResult
(
null
,
"actionBody.userpin can not be empty !"
);
...
...
center-app/app/base/db/cache/appUserPinByChannelUserIdCache.js
View file @
b16f2e25
...
...
@@ -18,12 +18,13 @@ class AppUserPinByChannelUserIdCache extends CacheBase {
var
actionBody
=
val
.
actionBody
;
var
appInfo
=
val
.
appInfo
;
var
createUserPwd
=
inputkey
;
//(格式:appInfo.uapp_key+”_“+actionBody.channelUserId)
var
channelUserMoblie
=
actionBody
.
channelUserMoblie
||
"15010888888"
;
var
channelUserMoblie
=
actionBody
.
mobile
?
actionBody
.
mobile
:
actionBody
.
channelUserId
;
var
userInfo
=
await
this
.
appuserDao
.
getItemByChannelUserId
(
actionBody
.
channelUserId
,
appInfo
.
uapp_id
);
if
(
userInfo
)
{
if
(
userInfo
.
is_enabled
!=
1
)
{
return
system
.
getResult
(
null
,
"user to item is Disable !"
);
}
userInfo
.
userpin
=
actionBody
.
userpin
;
return
system
.
getResultSuccess
(
userInfo
);
}
var
uUserInfo
=
await
this
.
opPlatformUtils
.
createUserInfo
(
actionBody
.
channelUserId
,
channelUserMoblie
,
...
...
@@ -46,6 +47,7 @@ class AppUserPinByChannelUserIdCache extends CacheBase {
};
userInfo
=
await
this
.
appuserDao
.
create
(
params
);
}
userInfo
.
userpin
=
actionBody
.
userpin
;
return
system
.
getResultSuccess
(
userInfo
);
}
}
...
...
center-app/app/base/utils/businessManager/opPlatformUtils.js
View file @
b16f2e25
...
...
@@ -294,51 +294,23 @@ class OpPlatformUtils {
var
result
=
await
cacheManager
[
"AppTokenByHostsCache"
].
cache
(
inputkey
,
actionBody
,
system
.
shortExTime
);
return
result
;
}
// async getReqUserPinByChannelUserId(pobj) {
// var inputkey = pobj.appInfo.uapp_key + "_" + pobj.actionBody.channelUserId;
// var cacheManager = system.getObject("db.common.cacheManager");
// var result = await cacheManager["AppUserPinByChannelUserIdCache"].getCache(inputkey, pobj, system.shortExTime);
// if (result && result.status == 0) {
// return system.getResultFail(system.reDoLoginFail, "请勿重复登录");
// }
// result = await cacheManager["AppUserPinByChannelUserIdCache"].cache(inputkey, pobj, system.shortExTime);
// return result;
// if (!actionBody.channelUserId) {
// return system.getResult(null, "actionBody.channelUserId can not be empty");
// }
// var cacheManager = system.getObject("db.common.cacheManager");
// var result = await cacheManager["AppUserPinByChannelUserId"].cache(userPinValue, actionBody, system.exTime);
// return result;
// }
// async getReqUserPinByChannelUserId(actionBody, userPinValue) {
// if (!actionBody.channelUserId) {
// return system.getResult(null, "actionBody.channelUserId can not be empty");
// }
// var cacheManager = system.getObject("db.common.cacheManager");
// var result = await cacheManager["AppUserPinByChannelUserId"].cache(userPinValue, actionBody, system.exTime);
// return result;
// }
/**
*
通过账户和密码登录
* @param {*} pobj pobj.actionBody:{
userName
:XX}
*
渠道通过账户进行登录,有则返回用户信息,没有则创建用户---actionBody.channelUserId
* @param {*} pobj pobj.actionBody:{
channelUserId
:XX}
*/
async
get
LoginByUserName
(
pobj
)
{
var
inputkey
=
pobj
.
appInfo
.
uapp_key
+
"_"
+
pobj
.
actionBody
.
userName
;
async
get
UserPinByChannelUserId
(
pobj
)
{
var
inputkey
=
pobj
.
appInfo
.
uapp_key
+
"_"
+
pobj
.
actionBody
.
channelUserId
;
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
result
=
await
cacheManager
[
"AppUserPinBy
UserName
Cache"
].
getCache
(
inputkey
);
var
result
=
await
cacheManager
[
"AppUserPinBy
ChannelUserId
Cache"
].
getCache
(
inputkey
);
if
(
result
&&
result
.
status
==
0
)
{
if
(
result
.
data
.
userpin
)
{
return
system
.
getResultFail
(
system
.
reDoLoginFail
,
"请勿重复登录"
,
{
userpin
:
result
.
data
.
userpin
||
""
});
}
else
{
await
cacheManager
[
"AppUserPinByLoginPwdCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByUserNameCache"
].
invalidate
(
inputkey
);
return
system
.
getResultFail
(
system
.
reDoLoginFail
,
"请勿重复处理"
,
{
userpin
:
result
.
data
.
userpin
||
""
});
}
else
{
await
this
.
clearLoginCache
(
inputkey
);
}
}
var
result
=
await
cacheManager
[
"AppUserPinBy
UserName
Cache"
].
cache
(
inputkey
,
pobj
,
system
.
shortExTime
);
var
result
=
await
cacheManager
[
"AppUserPinBy
ChannelUserId
Cache"
].
cache
(
inputkey
,
pobj
,
system
.
shortExTime
);
if
(
result
&&
result
.
status
==
0
)
{
var
userpinKey
=
this
.
getUserPinKey
(
pobj
.
actionBody
.
userpin
);
this
.
redisClient
.
setWithEx
(
userpinKey
,
JSON
.
stringify
(
result
),
system
.
exTime
);
...
...
@@ -430,14 +402,18 @@ class OpPlatformUtils {
var
userResult
=
JSON
.
parse
(
userInfoResult
);
if
(
userResult
.
status
==
0
)
{
var
inputkey
=
pobj
.
appInfo
.
uapp_key
+
"_"
+
userResult
.
data
.
channel_username
;
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
await
cacheManager
[
"AppUserPinByLoginPwdCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByUserNameCache"
].
invalidate
(
inputkey
);
await
this
.
clearLoginCache
(
inputkey
);
}
this
.
redisClient
.
delete
(
userpinKey
);
return
system
.
getResultSuccess
();;
}
async
clearLoginCache
(
inputkey
)
{
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
await
cacheManager
[
"AppUserPinByLoginPwdCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByUserNameCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByChannelUserIdCache"
].
invalidate
(
inputkey
);
}
}
module
.
exports
=
OpPlatformUtils
;
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