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
dbd48def
Commit
dbd48def
authored
Feb 11, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
39a1252b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
129 deletions
+82
-129
center-channel/app/base/api/impl/auth/accessAuth.js
+11
-14
center-channel/app/base/db/cache/appUserPinByChannelUserId.js
+0
-25
center-channel/app/base/db/cache/appUserPinByLoginPwdCache.js
+0
-25
center-channel/app/base/db/cache/appUserPinByLoginVcodeCache.js
+0
-25
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
+62
-38
center-channel/app/config/routes/api.js
+9
-2
center-channel/igirl_channel_interface document.docx
+0
-0
No files found.
center-channel/app/base/api/impl/auth/accessAuth.js
View file @
dbd48def
...
@@ -29,44 +29,41 @@ class AccessAuthAPI extends APIBase {
...
@@ -29,44 +29,41 @@ class AccessAuthAPI extends APIBase {
case
"test"
:
//测试
case
"test"
:
//测试
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
break
;
break
;
case
"getVerifyCode"
:
case
"getVerifyCode"
:
//获取默认模板的手机验证码
opResult
=
await
this
.
utilsAuthSve
.
getVerifyCodeByMoblie
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsAuthSve
.
getVerifyCodeByMoblie
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
()
return
system
.
getResultSuccess
()
}
}
break
;
break
;
case
"loginUserByChannelUserId"
:
case
"userPinByLgoin"
:
//通过账户和密码登录
opResult
=
await
this
.
utilsAuthSve
.
loginUserByChannelUserId
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
break
;
case
"userPinByLgoin"
:
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoin
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoin
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
}
break
;
break
;
case
"userPinByLgoinVcode"
:
case
"userPinByLgoinVcode"
:
//通过短信登录信息
pobj
.
actionBody
.
reqType
=
"login"
;
pobj
.
actionBody
.
reqType
=
"login"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
}
break
;
break
;
case
"userPinByRegister"
:
case
"userPinByRegister"
:
//通过短信注册信息
pobj
.
actionBody
.
reqType
=
"reg"
;
pobj
.
actionBody
.
reqType
=
"reg"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
}
break
;
break
;
case
"logout"
:
case
"putUserPwdByMobile"
:
//通过手机验证码修改用户密码
opResult
=
await
this
.
utilsAuthSve
.
userLogout
(
pobj
,
pobj
.
actionBody
);
break
;
case
"putUserPwdByMobile"
:
opResult
=
await
this
.
utilsAuthSve
.
putUserPwdByMobile
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsAuthSve
.
putUserPwdByMobile
(
pobj
,
pobj
.
actionBody
);
break
;
break
;
case
"getLoginInfo"
:
//通过userpin获取用户登录信息
opResult
=
await
this
.
utilsAuthSve
.
getLoginInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"logout"
:
//用户退出
opResult
=
await
this
.
utilsAuthSve
.
userLogout
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
...
center-channel/app/base/db/cache/appUserPinByChannelUserId.js
deleted
100644 → 0
View file @
39a1252b
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
AppUserPinByChannelUserId
extends
CacheBase
{
constructor
()
{
super
();
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/loginUserByChannelUserId"
);
var
result
=
acckapp
.
stdout
;
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
}
return
system
.
getResult
(
null
,
"data is empty"
);
}
}
module
.
exports
=
AppUserPinByChannelUserId
;
center-channel/app/base/db/cache/appUserPinByLoginPwdCache.js
deleted
100644 → 0
View file @
39a1252b
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
AppUserPinByLoginPwdCache
extends
CacheBase
{
constructor
()
{
super
();
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
;
center-channel/app/base/db/cache/appUserPinByLoginVcodeCache.js
deleted
100644 → 0
View file @
39a1252b
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
AppUserPinByLoginVcodeCache
extends
CacheBase
{
constructor
()
{
super
();
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
;
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
View file @
dbd48def
...
@@ -8,26 +8,6 @@ class UtilsAuthSve extends AppServiceBase {
...
@@ -8,26 +8,6 @@ class UtilsAuthSve extends AppServiceBase {
super
();
super
();
this
.
centerAppUrl
=
settings
.
centerAppUrl
();
this
.
centerAppUrl
=
settings
.
centerAppUrl
();
}
}
async
loginUserByChannelUserId
(
pobj
,
actionBody
)
{
var
opResult
=
null
;
switch
(
pobj
.
actionProcess
)
{
case
"gsbhome"
:
opResult
=
await
this
.
getDefaultUserInfo
(
pobj
,
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_process参数错误"
);
break
;
}
return
opResult
;
}
async
getDefaultUserInfo
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
channelUserId
)
{
return
system
.
getResult
(
null
,
"actionBody.channelUserId can not be empty"
);
}
var
result
=
await
this
.
cacheManager
[
"AppUserPinByChannelUserId"
].
cache
(
actionBody
.
userpin
,
pobj
,
system
.
exTime
);
return
result
;
}
//---------------登录-----------------------------------------------------
//---------------登录-----------------------------------------------------
async
getReqTokenByHosts
(
actionBody
,
tokenValue
)
{
//获取token
async
getReqTokenByHosts
(
actionBody
,
tokenValue
)
{
//获取token
...
@@ -50,7 +30,11 @@ class UtilsAuthSve extends AppServiceBase {
...
@@ -50,7 +30,11 @@ class UtilsAuthSve extends AppServiceBase {
var
result
=
await
this
.
cacheManager
[
"AppTokenByHostsCache"
].
cache
(
tokenValue
,
actionBody
,
system
.
exTime
);
var
result
=
await
this
.
cacheManager
[
"AppTokenByHostsCache"
].
cache
(
tokenValue
,
actionBody
,
system
.
exTime
);
return
result
;
return
result
;
}
}
/**
* 通过账户和密码登录
* @param {*} pobj
* @param {*} actionBody {userName:XX,password:XXX}
*/
async
getReqUserPinByLgoin
(
pobj
,
actionBody
)
{
async
getReqUserPinByLgoin
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
userName
)
{
if
(
!
actionBody
.
userName
)
{
return
system
.
getResult
(
null
,
"actionBody.userName can not be empty"
);
return
system
.
getResult
(
null
,
"actionBody.userName can not be empty"
);
...
@@ -58,9 +42,19 @@ class UtilsAuthSve extends AppServiceBase {
...
@@ -58,9 +42,19 @@ class UtilsAuthSve extends AppServiceBase {
if
(
!
actionBody
.
password
)
{
if
(
!
actionBody
.
password
)
{
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
}
}
var
result
=
await
this
.
cacheManager
[
"AppUserPinByLoginPwdCache"
].
cache
(
actionBody
.
userpin
,
pobj
,
system
.
exTime
);
var
acckapp
=
await
this
.
restClient
.
execPost
(
pobj
,
settings
.
centerAppUrl
()
+
"auth/accessAuth/login"
);
return
result
;
var
result
=
acckapp
.
stdout
;
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
}
return
system
.
getResult
(
null
,
"data is empty"
);
}
}
/**
* 通过短信登录或注册信息
* @param {*} pobj
* @param {*} actionBody {mobile:XXX,vcode:XXX,reqType:"reg",password:XXX-reqType为reg时有此值}
*/
async
getReqUserPinByLgoinVcode
(
pobj
,
actionBody
)
{
async
getReqUserPinByLgoinVcode
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
mobile
)
{
if
(
!
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty"
);
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty"
);
...
@@ -73,11 +67,20 @@ class UtilsAuthSve extends AppServiceBase {
...
@@ -73,11 +67,20 @@ class UtilsAuthSve extends AppServiceBase {
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
}
}
}
}
var
result
=
await
this
.
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
cache
(
actionBody
.
userpin
,
pobj
,
system
.
exTime
);
var
acckapp
=
await
this
.
restClient
.
execPost
(
pobj
,
settings
.
centerAppUrl
()
+
"auth/accessAuth/loginByVerifyCode"
);
return
result
;
var
result
=
acckapp
.
stdout
;
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
}
return
system
.
getResult
(
null
,
"data is empty"
);
}
}
/**
* 获取默认模板的手机验证码
* @param {*} pobj
* @param {*} actionBody {mobile:XXX}
*/
async
getVerifyCodeByMoblie
(
pobj
,
actionBody
)
{
async
getVerifyCodeByMoblie
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
mobile
)
{
if
(
!
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty !"
);
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty !"
);
...
@@ -85,6 +88,11 @@ class UtilsAuthSve extends AppServiceBase {
...
@@ -85,6 +88,11 @@ class UtilsAuthSve extends AppServiceBase {
return
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/accessAuth/getVerifyCodeByMoblie"
);
return
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/accessAuth/getVerifyCodeByMoblie"
);
}
}
/**
* 通过手机验证码修改用户密码
* @param {*} pobj
* @param {*} actionBody {mobile:XX,vcode:XXX,newPwd:XXX,userpin:XXXXX}
*/
async
putUserPwdByMobile
(
pobj
,
actionBody
)
{
async
putUserPwdByMobile
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
mobile
)
{
if
(
!
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"pobj.mobile can not be empty !"
);
return
system
.
getResult
(
null
,
"pobj.mobile can not be empty !"
);
...
@@ -95,31 +103,47 @@ class UtilsAuthSve extends AppServiceBase {
...
@@ -95,31 +103,47 @@ class UtilsAuthSve extends AppServiceBase {
if
(
!
actionBody
.
newPwd
)
{
if
(
!
actionBody
.
newPwd
)
{
return
system
.
getResult
(
null
,
"pobj.newPwd can not be empty !"
);
return
system
.
getResult
(
null
,
"pobj.newPwd can not be empty !"
);
}
}
if
(
!
actionBody
.
userpin
)
{
return
system
.
getResult
(
null
,
"pobj.userpin can not be empty !"
);
}
if
(
!
pobj
.
appInfo
)
{
if
(
!
pobj
.
appInfo
)
{
return
system
.
getResult
(
null
,
"pobj.appInfo can not be empty !"
);
return
system
.
getResult
(
null
,
"pobj.appInfo can not be empty !"
);
}
}
var
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/accessAuth/modiPasswordByMobile"
);
var
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/accessAuth/modiPasswordByMobile"
);
if
(
result
.
status
==
0
&&
actionBody
.
userpin
)
{
if
(
result
.
status
==
0
)
{
this
.
userLogout
(
pobj
,
actionBody
);
}
return
result
;
}
/**
* 通过userpin获取用户登录信息
* @param {*} pobj
* @param {*} actionBody {userpin:XXXXX}
*/
async
getLoginInfo
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
userpin
)
{
return
system
.
getResult
(
null
,
"pobj.userpin can not be empty !"
);
}
if
(
!
pobj
.
appInfo
)
{
return
system
.
getResult
(
null
,
"pobj.appInfo can not be empty !"
);
}
var
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/accessAuth/getLoginInfo"
);
if
(
result
.
status
==
0
)
{
this
.
userLogout
(
pobj
,
actionBody
);
this
.
userLogout
(
pobj
,
actionBody
);
}
}
return
result
;
return
result
;
}
}
/**
* 用户退出
* @param {*} pobj
* @param {*} actionBody {userpin:XXXX}
*/
async
userLogout
(
pobj
,
actionBody
)
{
async
userLogout
(
pobj
,
actionBody
)
{
console
.
log
(
actionBody
.
userpin
);
console
.
log
(
actionBody
.
userpin
);
if
(
!
actionBody
.
userpin
)
{
if
(
!
actionBody
.
userpin
)
{
return
system
.
getResult
(
null
,
"actionBody.userpin can not be empty !"
);
return
system
.
getResult
(
null
,
"actionBody.userpin can not be empty !"
);
}
}
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
applogout
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/accessAuth/logout"
);
var
userinfo
=
await
this
.
cacheManager
[
"AppUserPinByLoginPwdCache"
].
cache
(
actionBody
.
userpin
,
pobj
,
system
.
exTime
);
if
(
userinfo
.
data
){
pobj
.
actionBody
.
userName
=
userinfo
.
data
.
channel_username
;
}
else
{
return
system
.
getResultSuccess
();
}
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
invalidate
(
actionBody
.
userpin
);
await
cacheManager
[
"AppUserPinByLoginPwdCache"
].
invalidate
(
actionBody
.
userpin
);
var
applogout
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/accessAuth/logout"
);
return
applogout
;
return
applogout
;
}
}
...
...
center-channel/app/config/routes/api.js
View file @
dbd48def
var
url
=
require
(
"url"
);
var
url
=
require
(
"url"
);
var
system
=
require
(
"../../base/system"
);
var
system
=
require
(
"../../base/system"
);
var
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
module
.
exports
=
function
(
app
)
{
module
.
exports
=
function
(
app
)
{
//-----------------------新的模式------------------开始
//-----------------------新的模式------------------开始
...
@@ -45,7 +46,7 @@ module.exports = function (app) {
...
@@ -45,7 +46,7 @@ module.exports = function (app) {
"tmConfirm"
,
"updateTmInfo"
,
"tmConfirm"
,
"updateTmInfo"
,
"updateNclInfo"
,
"updateContacts"
,
"updateNclInfo"
,
"updateContacts"
,
"updateCustomerInfo"
,
"addOrderAndDelivery"
,
"updateCustomerInfo"
,
"addOrderAndDelivery"
,
"updateOrderPayStatus"
,
"getPolicyNeedList"
,
"submitPolicyNeedNotes"
"updateOrderPayStatus"
,
"getPolicyNeedList"
,
"submitPolicyNeedNotes"
];
];
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
...
@@ -55,7 +56,13 @@ module.exports = function (app) {
...
@@ -55,7 +56,13 @@ module.exports = function (app) {
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
else
{
}
else
{
var
result
=
await
cacheManager
[
"AppUserPinByChannelUserId"
].
getCache
(
userpin
,
system
.
exTime
);
var
params
=
{
"actionType"
:
"getLoginInfo"
,
"actionBody"
:
{
"userpin"
:
userpin
}
}
result
=
await
utilsAuthSve
.
getLoginInfo
(
params
,
params
.
actionBody
);
if
(
result
.
status
!=
0
)
{
if
(
result
.
status
!=
0
)
{
result
.
status
=
system
.
noLogin
;
result
.
status
=
system
.
noLogin
;
result
.
msg
=
"user login is invalidation"
;
result
.
msg
=
"user login is invalidation"
;
...
...
center-channel/igirl_channel_interface document.docx
deleted
100644 → 0
View file @
39a1252b
File deleted
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