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
9f769970
Commit
9f769970
authored
Jan 08, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
257ab0f4
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
137 additions
and
9 deletions
+137
-9
igirl-channel/app/base/api/impl/auth/accessAuth.js
+29
-2
igirl-channel/app/base/db/cache.base.js
+2
-0
igirl-channel/app/base/db/cache/appUserPinByChannelUserId.js
+0
-5
igirl-channel/app/base/db/cache/appUserPinByLoginPwdCache.js
+27
-0
igirl-channel/app/base/db/cache/appUserPinByLoginVcodeCache.js
+27
-0
igirl-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
+9
-1
igirl-channel/app/base/utils/businessManager/opPlatformUtils.js
+43
-1
No files found.
igirl-channel/app/base/api/impl/auth/accessAuth.js
View file @
9f769970
...
@@ -37,19 +37,46 @@ class AccessAuthAPI extends APIBase {
...
@@ -37,19 +37,46 @@ class AccessAuthAPI extends APIBase {
return
result
;
return
result
;
}
}
async
opActionProcess
(
action_process
,
action_type
,
action_body
,
pobj
,
req
)
{
async
opActionProcess
(
action_process
,
action_type
,
action_body
,
pobj
,
req
)
{
var
opResult
=
null
;
var
opResult
=
system
.
getResult
(
null
,
"req Failure"
);
var
userpin
=
this
.
getUUID
();
action_body
.
appInfo
=
req
.
appInfo
;
switch
(
action_type
)
{
switch
(
action_type
)
{
// sy
// sy
case
"test"
:
//测试
case
"test"
:
//测试
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
break
;
break
;
case
"getVerifyCode"
:
opResult
=
await
this
.
opPlatformUtils
.
getVerifyCodeByMoblie
(
action_body
,
action_process
,
req
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
()
}
break
;
case
"loginUserByChannelUserId"
:
case
"loginUserByChannelUserId"
:
var
userpin
=
this
.
getUUID
();
opResult
=
await
this
.
utilsAuthSve
.
loginUserByChannelUserId
(
action_body
,
action_process
,
userpin
,
req
);
opResult
=
await
this
.
utilsAuthSve
.
loginUserByChannelUserId
(
action_body
,
action_process
,
userpin
,
req
);
if
(
opResult
.
status
==
0
)
{
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
userpin
})
return
system
.
getResultSuccess
({
userpin
:
userpin
})
}
}
break
;
break
;
case
"userPinByLgoin"
:
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoin
(
action_body
,
action_process
,
userpin
,
req
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
userpin
})
}
break
;
case
"userPinByLgoinVcode"
:
action_body
.
reqType
=
"login"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
action_body
,
action_process
,
userpin
,
req
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
userpin
})
}
break
;
case
"userPinByRegister"
:
action_body
.
reqType
=
"reg"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
action_body
,
action_process
,
userpin
,
req
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
userpin
})
}
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
...
igirl-channel/app/base/db/cache.base.js
View file @
9f769970
...
@@ -44,7 +44,9 @@ class CacheBase {
...
@@ -44,7 +44,9 @@ class CacheBase {
if
(
!
cacheValue
||
cacheValue
==
"undefined"
||
cacheValue
==
"null"
)
{
if
(
!
cacheValue
||
cacheValue
==
"undefined"
||
cacheValue
==
"null"
)
{
return
system
.
getResultFail
(
system
.
cacheInvalidation
,
"cache is invalidation"
)
return
system
.
getResultFail
(
system
.
cacheInvalidation
,
"cache is invalidation"
)
}
else
{
}
else
{
if
(
ex
)
{
this
.
redisClient
.
set
(
cachekey
,
cacheValue
,
ex
);
this
.
redisClient
.
set
(
cachekey
,
cacheValue
,
ex
);
}
return
JSON
.
parse
(
cacheValue
);
return
JSON
.
parse
(
cacheValue
);
}
}
}
}
...
...
igirl-channel/app/base/db/cache/appUserPinByChannelUserId.js
View file @
9f769970
...
@@ -13,13 +13,8 @@ class AppUserPinByChannelUserId extends CacheBase {
...
@@ -13,13 +13,8 @@ class AppUserPinByChannelUserId extends CacheBase {
return
settings
.
cacheprefix
+
"_userPin:"
;
return
settings
.
cacheprefix
+
"_userPin:"
;
}
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
app_hosts
=
val
;
if
(
!
app_hosts
)
{
return
system
.
getResult
(
null
,
"app_hosts can not be empty"
);
}
var
acckapp
=
await
this
.
restClient
.
execPost
(
val
,
settings
.
centerAppUrl
()
+
"auth/accessAuth/loginUserByChannelUserId"
);
var
acckapp
=
await
this
.
restClient
.
execPost
(
val
,
settings
.
centerAppUrl
()
+
"auth/accessAuth/loginUserByChannelUserId"
);
var
result
=
acckapp
.
stdout
;
var
result
=
acckapp
.
stdout
;
console
.
log
(
acckapp
.
stdout
,
"AppTokenByHostsCache............. acckapp.stdout.........."
)
if
(
result
)
{
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
return
tmp
;
...
...
igirl-channel/app/base/db/cache/appUserPinByLoginPwdCache.js
0 → 100644
View file @
9f769970
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
AppUserPinByLoginPwdCache
extends
CacheBase
{
constructor
()
{
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
appuserDao
=
system
.
getObject
(
"db.dbapp.appuserDao"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
}
desc
()
{
return
"应用中缓存访问token"
;
}
prefix
()
{
return
settings
.
cacheprefix
+
"_userPin:"
;
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
acckapp
=
await
this
.
restClient
.
execPost
(
val
,
settings
.
centerAppUrl
()
+
"auth/accessAuth/login"
);
var
result
=
acckapp
.
stdout
;
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
}
return
system
.
getResult
(
null
,
"data is empty"
);
}
}
module
.
exports
=
AppUserPinByLoginPwdCache
;
igirl-channel/app/base/db/cache/appUserPinByLoginVcodeCache.js
0 → 100644
View file @
9f769970
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
AppUserPinByLoginVcodeCache
extends
CacheBase
{
constructor
()
{
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
appuserDao
=
system
.
getObject
(
"db.dbapp.appuserDao"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
}
desc
()
{
return
"应用中缓存访问token"
;
}
prefix
()
{
return
settings
.
cacheprefix
+
"_userPin:"
;
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
acckapp
=
await
this
.
restClient
.
execPost
(
val
,
settings
.
centerAppUrl
()
+
"auth/accessAuth/loginByVerifyCode"
);
var
result
=
acckapp
.
stdout
;
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
}
return
system
.
getResult
(
null
,
"data is empty"
);
}
}
module
.
exports
=
AppUserPinByLoginVcodeCache
;
igirl-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
View file @
9f769970
...
@@ -7,7 +7,6 @@ class UtilsAuthSve {
...
@@ -7,7 +7,6 @@ class UtilsAuthSve {
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
}
}
async
loginUserByChannelUserId
(
action_body
,
action_process
,
userpin
,
req
)
{
async
loginUserByChannelUserId
(
action_body
,
action_process
,
userpin
,
req
)
{
action_body
.
appInfo
=
req
.
appInfo
;
var
opResult
=
null
;
var
opResult
=
null
;
switch
(
action_process
)
{
switch
(
action_process
)
{
case
"gsbhome"
:
case
"gsbhome"
:
...
@@ -24,6 +23,15 @@ class UtilsAuthSve {
...
@@ -24,6 +23,15 @@ class UtilsAuthSve {
return
userinfo
;
return
userinfo
;
}
}
//---------------登录-----------------------------------------------------
async
getReqUserPinByLgoin
(
action_body
,
action_process
,
userpin
,
req
)
{
var
userinfo
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoin
(
action_body
,
userpin
);
return
userinfo
;
}
async
getReqUserPinByLgoinVcode
(
action_body
,
action_process
,
userpin
,
req
)
{
var
userinfo
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoinVcode
(
action_body
,
userpin
,
action_body
.
reqType
);
return
userinfo
;
}
}
}
module
.
exports
=
UtilsAuthSve
;
module
.
exports
=
UtilsAuthSve
;
igirl-channel/app/base/utils/businessManager/opPlatformUtils.js
View file @
9f769970
...
@@ -152,7 +152,7 @@ class OpPlatformUtils {
...
@@ -152,7 +152,7 @@ class OpPlatformUtils {
return
system
.
getResultSuccess
(
restResult
.
data
);
return
system
.
getResultSuccess
(
restResult
.
data
);
}
}
//-----
新的方式
//-----
-------------------新的方式------------------------------------------------------------------------------------
async
getReqTokenByHosts
(
appHosts
,
tokenValue
)
{
async
getReqTokenByHosts
(
appHosts
,
tokenValue
)
{
if
(
!
appHosts
)
{
if
(
!
appHosts
)
{
return
system
.
getResult
(
null
,
"appHosts can not be empty"
);
return
system
.
getResult
(
null
,
"appHosts can not be empty"
);
...
@@ -161,6 +161,7 @@ class OpPlatformUtils {
...
@@ -161,6 +161,7 @@ class OpPlatformUtils {
var
result
=
await
cacheManager
[
"AppTokenByHostsCache"
].
cache
(
tokenValue
,
appHosts
,
system
.
exTime
);
var
result
=
await
cacheManager
[
"AppTokenByHostsCache"
].
cache
(
tokenValue
,
appHosts
,
system
.
exTime
);
return
result
;
return
result
;
}
}
async
getReqUserPinByChannelUserId
(
actionBody
,
userPinValue
)
{
async
getReqUserPinByChannelUserId
(
actionBody
,
userPinValue
)
{
if
(
!
actionBody
.
channelUserId
)
{
if
(
!
actionBody
.
channelUserId
)
{
return
system
.
getResult
(
null
,
"actionBody.channelUserId can not be empty"
);
return
system
.
getResult
(
null
,
"actionBody.channelUserId can not be empty"
);
...
@@ -169,6 +170,47 @@ class OpPlatformUtils {
...
@@ -169,6 +170,47 @@ class OpPlatformUtils {
var
result
=
await
cacheManager
[
"AppUserPinByChannelUserId"
].
cache
(
userPinValue
,
actionBody
,
system
.
exTime
);
var
result
=
await
cacheManager
[
"AppUserPinByChannelUserId"
].
cache
(
userPinValue
,
actionBody
,
system
.
exTime
);
return
result
;
return
result
;
}
}
async
getReqUserPinByLgoin
(
actionBody
,
userPinValue
)
{
if
(
!
actionBody
.
userName
)
{
return
system
.
getResult
(
null
,
"actionBody.userName can not be empty"
);
}
if
(
!
actionBody
.
password
)
{
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
}
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
result
=
await
cacheManager
[
"AppUserPinByLoginPwdCache"
].
cache
(
userPinValue
,
actionBody
,
system
.
exTime
);
return
result
;
}
async
getReqUserPinByLgoinVcode
(
actionBody
,
userPinValue
,
reqType
)
{
if
(
!
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty"
);
}
if
(
!
actionBody
.
vcode
)
{
return
system
.
getResult
(
null
,
"actionBody.vcode can not be empty"
);
}
if
(
reqType
==
"reg"
)
{
if
(
!
actionBody
.
password
)
{
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
}
}
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
result
=
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
cache
(
userPinValue
,
actionBody
,
system
.
exTime
);
return
result
;
}
async
getVerifyCodeByMoblie
(
actionBody
)
{
if
(
!
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"pobj.mobile can not be empty !"
);
}
var
acckapp
=
await
this
.
restClient
.
execPost
(
actionBody
,
settings
.
centerAppUrl
()
+
"auth/accessAuth/getVerifyCodeByMoblie"
);
var
result
=
acckapp
.
stdout
;
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
}
return
system
.
getResult
(
null
,
"data is empty"
);
}
}
}
module
.
exports
=
OpPlatformUtils
;
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