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
337cf2a9
Commit
337cf2a9
authored
Mar 18, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
b16f2e25
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
69 deletions
+15
-69
center-app/app/base/api/impl/auth/accessAuth.js
+2
-2
center-app/app/base/db/cache/appUserPinByChannelUserIdCache.js
+0
-54
center-app/app/base/db/cache/appUserPinByUserNameCache.js
+10
-9
center-app/app/base/utils/businessManager/opPlatformUtils.js
+3
-4
No files found.
center-app/app/base/api/impl/auth/accessAuth.js
View file @
337cf2a9
...
...
@@ -29,11 +29,11 @@ class AccessAuthAPI extends APIBase {
var
result
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoin
(
pobj
);
return
result
;
}
async
get
UserPinByChannelUserId
(
pobj
,
qobj
,
req
)
{
//通过账户获取用户信息----------------------------actionBody.channelUserId
async
get
LoginByUserName
(
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
UserPinByChannelUserId
(
pobj
);
var
result
=
await
this
.
opPlatformUtils
.
get
LoginByUserName
(
pobj
);
return
result
;
}
...
...
center-app/app/base/db/cache/appUserPinByChannelUserIdCache.js
deleted
100644 → 0
View file @
b16f2e25
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
AppUserPinByChannelUserIdCache
extends
CacheBase
{
constructor
()
{
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
appuserDao
=
system
.
getObject
(
"db.dbapp.appuserDao"
);
}
desc
()
{
return
"应用中缓存访问token"
;
}
prefix
()
{
return
settings
.
cacheprefix
+
"_userPin:"
;
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
actionBody
=
val
.
actionBody
;
var
appInfo
=
val
.
appInfo
;
var
createUserPwd
=
inputkey
;
//(格式:appInfo.uapp_key+”_“+actionBody.channelUserId)
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
,
createUserPwd
,
appInfo
.
uapp_key
,
appInfo
.
uapp_secret
);
if
(
uUserInfo
.
status
!=
2000
&&
uUserInfo
.
status
!=
0
)
{
return
uUserInfo
;
}
//2000已经存在此用户 或 注册失败
if
(
uUserInfo
.
status
==
0
)
{
var
params
=
{
uapp_id
:
appInfo
.
uapp_id
,
channel_userid
:
actionBody
.
channelUserId
,
channel_username
:
actionBody
.
channelUserName
||
actionBody
.
channelUserId
,
channel_nickname
:
actionBody
.
nickName
||
""
,
mobile
:
channelUserMoblie
,
org_name
:
actionBody
.
orgName
||
""
,
org_path
:
actionBody
.
orgPath
||
""
,
is_enabled
:
1
,
email
:
actionBody
.
email
||
""
,
last_login_time
:
new
Date
()
};
userInfo
=
await
this
.
appuserDao
.
create
(
params
);
}
userInfo
.
userpin
=
actionBody
.
userpin
;
return
system
.
getResultSuccess
(
userInfo
);
}
}
module
.
exports
=
AppUserPinByChannelUserIdCache
;
center-app/app/base/db/cache/appUserPinByUserNameCache.js
View file @
337cf2a9
...
...
@@ -16,14 +16,10 @@ class AppUserPinByUserNameCache extends CacheBase {
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
actionBody
=
val
.
actionBody
;
var
appInfo
=
val
.
appInfo
;
var
uUserName
=
actionBody
.
userName
;
//uUserName
var
uUserName
=
actionBody
.
userName
?
actionBody
.
userName
:
actionBody
.
channelUserId
;
var
uPassword
=
actionBody
.
userName
;
//uPassword
var
mobile
=
actionBody
.
mobile
;
//uPassword
var
uUserInfo
=
await
this
.
opPlatformUtils
.
register
(
uUserName
,
uPassword
,
mobile
,
appInfo
.
uapp_key
,
appInfo
.
uapp_secret
);
if
(
uUserInfo
.
status
!=
0
&&
uUserInfo
.
status
!=
2000
)
{
return
uUserInfo
;
}
//值为2000为已经存在此用户,注册失败
var
mobile
=
actionBody
.
mobile
?
actionBody
.
mobile
:
actionBody
.
channelUserId
;
var
userInfo
=
await
this
.
appuserDao
.
getItemByChannelUserId
(
uUserName
,
appInfo
.
uapp_id
);
if
(
userInfo
)
{
if
(
userInfo
.
is_enabled
!=
1
)
{
...
...
@@ -32,12 +28,17 @@ class AppUserPinByUserNameCache extends CacheBase {
userInfo
.
userpin
=
actionBody
.
userpin
;
return
system
.
getResultSuccess
(
userInfo
);
}
var
uUserInfo
=
await
this
.
opPlatformUtils
.
register
(
uUserName
,
uPassword
,
mobile
,
appInfo
.
uapp_key
,
appInfo
.
uapp_secret
);
if
(
uUserInfo
.
status
!=
0
&&
uUserInfo
.
status
!=
2000
)
{
return
uUserInfo
;
}
//值为2000为已经存在此用户,注册失败
var
params
=
{
uapp_id
:
appInfo
.
uapp_id
,
channel_userid
:
uUserName
||
""
,
channel_userid
:
actionBody
.
channelUserId
||
""
,
channel_username
:
uUserName
||
""
,
channel_nickname
:
actionBody
.
nickName
||
""
,
mobile
:
actionBody
.
mobile
||
""
,
mobile
:
mobile
||
""
,
org_name
:
actionBody
.
orgName
||
""
,
org_path
:
actionBody
.
orgPath
||
""
,
is_enabled
:
1
,
...
...
center-app/app/base/utils/businessManager/opPlatformUtils.js
View file @
337cf2a9
...
...
@@ -299,10 +299,10 @@ class OpPlatformUtils {
* 渠道通过账户进行登录,有则返回用户信息,没有则创建用户---actionBody.channelUserId
* @param {*} pobj pobj.actionBody:{channelUserId:XX}
*/
async
get
UserPinByChannelUserId
(
pobj
)
{
async
get
LoginByUserName
(
pobj
)
{
var
inputkey
=
pobj
.
appInfo
.
uapp_key
+
"_"
+
pobj
.
actionBody
.
channelUserId
;
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
result
=
await
cacheManager
[
"AppUserPinBy
ChannelUserId
Cache"
].
getCache
(
inputkey
);
var
result
=
await
cacheManager
[
"AppUserPinBy
UserName
Cache"
].
getCache
(
inputkey
);
if
(
result
&&
result
.
status
==
0
)
{
if
(
result
.
data
.
userpin
)
{
return
system
.
getResultFail
(
system
.
reDoLoginFail
,
"请勿重复处理"
,
{
userpin
:
result
.
data
.
userpin
||
""
});
...
...
@@ -310,7 +310,7 @@ class OpPlatformUtils {
await
this
.
clearLoginCache
(
inputkey
);
}
}
var
result
=
await
cacheManager
[
"AppUserPinBy
ChannelUserId
Cache"
].
cache
(
inputkey
,
pobj
,
system
.
shortExTime
);
var
result
=
await
cacheManager
[
"AppUserPinBy
UserName
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
);
...
...
@@ -412,7 +412,6 @@ class OpPlatformUtils {
await
cacheManager
[
"AppUserPinByLoginPwdCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByUserNameCache"
].
invalidate
(
inputkey
);
await
cacheManager
[
"AppUserPinByChannelUserIdCache"
].
invalidate
(
inputkey
);
}
}
...
...
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