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
eaf8cd17
Commit
eaf8cd17
authored
Apr 16, 2021
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lin add getAllService
parent
25859d1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
107 deletions
+122
-107
center-app/app/base/api/impl/auth/accessAuth.js
+106
-101
center-app/app/base/service/impl/utilsSve/utilsappSve.js
+16
-6
No files found.
center-app/app/base/api/impl/auth/accessAuth.js
View file @
eaf8cd17
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
class
AccessAuthAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
appmobilemsgSve
=
system
.
getObject
(
"service.dbapp.appmobilemsgSve"
);
this
.
utilsappSve
=
system
.
getObject
(
"service.utilsSve.utilsappSve"
);
}
constructor
()
{
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
appmobilemsgSve
=
system
.
getObject
(
"service.dbapp.appmobilemsgSve"
);
this
.
utilsappSve
=
system
.
getObject
(
"service.utilsSve.utilsappSve"
);
}
async
getOssInfo
(
pobj
,
qobj
,
req
)
{
//获取oss信息
var
result
=
await
this
.
utilsappSve
.
getAppOssInfo
(
pobj
);
return
result
;
}
async
getOssInfo
(
pobj
,
qobj
,
req
)
{
//获取oss信息
var
result
=
await
this
.
utilsappSve
.
getAppOssInfo
(
pobj
);
return
result
;
}
async
getTokenByHosts
(
pobj
,
qobj
,
req
)
{
var
result
=
await
this
.
opPlatformUtils
.
getReqTokenByHosts
(
pobj
);
return
result
;
}
async
getTokenByHosts
(
pobj
,
qobj
,
req
)
{
var
result
=
await
this
.
opPlatformUtils
.
getReqTokenByHosts
(
pobj
);
return
result
;
}
async
getVerifyCodeByMoblie
(
pobj
,
qobj
,
req
)
{
//获取默认模板的手机验证码
if
(
!
pobj
.
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty !"
);
}
var
itemResult
=
await
this
.
appmobilemsgSve
.
getItemByUappId
(
pobj
);
var
result
=
system
.
getResult
(
null
,
"get msg error"
);
if
(
itemResult
.
status
!=
0
)
{
result
=
await
this
.
opPlatformUtils
.
fetchDefaultVCode
(
pobj
.
actionBody
.
mobile
,
pobj
.
appInfo
.
uapp_key
);
return
result
;
}
var
param
=
{
mobile
:
pobj
.
actionBody
.
mobile
,
tmplCode
:
itemResult
.
data
.
tmpl_code
,
signName
:
itemResult
.
data
.
sign_name
,
accessKeyId
:
itemResult
.
data
.
access_key_id
,
accessKeySecret
:
itemResult
.
data
.
access_key_secret
}
result
=
await
this
.
opPlatformUtils
.
fetchOtherVCode
(
param
,
pobj
.
appInfo
.
uapp_key
);
return
result
;
async
getVerifyCodeByMoblie
(
pobj
,
qobj
,
req
)
{
//获取默认模板的手机验证码
if
(
!
pobj
.
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty !"
);
}
async
login
(
pobj
,
qobj
,
req
)
{
//通过账户和密码登录
if
(
!
pobj
.
actionBody
.
userName
)
{
return
system
.
getResult
(
null
,
"actionBody.userName can not be empty !"
);
}
if
(
!
pobj
.
actionBody
.
password
)
{
return
system
.
getResult
(
null
,
"actionBody.password can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoin
(
pobj
);
return
result
;
var
itemResult
=
await
this
.
appmobilemsgSve
.
getItemByUappId
(
pobj
);
var
result
=
system
.
getResult
(
null
,
"get msg error"
);
if
(
itemResult
.
status
!=
0
)
{
result
=
await
this
.
opPlatformUtils
.
fetchDefaultVCode
(
pobj
.
actionBody
.
mobile
,
pobj
.
appInfo
.
uapp_key
);
return
result
;
}
async
getLoginByUserName
(
pobj
,
qobj
,
req
)
{
//通过账户获取用户信息----------------------------actionBody.channelUserId
if
(
!
pobj
.
actionBody
.
channelUserId
)
{
return
system
.
getResult
(
null
,
"actionBody.channelUserId can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
getLoginByUserName
(
pobj
);
return
result
;
var
param
=
{
mobile
:
pobj
.
actionBody
.
mobile
,
tmplCode
:
itemResult
.
data
.
tmpl_code
,
signName
:
itemResult
.
data
.
sign_name
,
accessKeyId
:
itemResult
.
data
.
access_key_id
,
accessKeySecret
:
itemResult
.
data
.
access_key_secret
}
result
=
await
this
.
opPlatformUtils
.
fetchOtherVCode
(
param
,
pobj
.
appInfo
.
uapp_key
);
return
result
;
}
async
loginByVerifyCode
(
pobj
,
qobj
,
req
)
{
//通过短信登录或注册信息
if
(
!
pobj
.
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty !"
);
}
if
(
!
pobj
.
actionBody
.
vcode
)
{
return
system
.
getResult
(
null
,
"actionBody.vcode can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoinVcode
(
pobj
);
return
result
;
async
login
(
pobj
,
qobj
,
req
)
{
//通过账户和密码登录
if
(
!
pobj
.
actionBody
.
userName
)
{
return
system
.
getResult
(
null
,
"actionBody.userName can not be empty !"
);
}
if
(
!
pobj
.
actionBody
.
password
)
{
return
system
.
getResult
(
null
,
"actionBody.password can not be empty !"
);
}
async
modiPasswordByMobile
(
pobj
,
qobj
,
req
)
{
//通过手机验证码修改用户密码
var
actionBody
=
pobj
.
actionBody
;
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
(
!
actionBody
.
newPwd
)
{
return
system
.
getResult
(
null
,
"actionBody.newPwd can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
putUserPwdByMobile
(
pobj
,
actionBody
);
return
result
;
var
result
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoin
(
pobj
);
return
result
;
}
async
getLoginByUserName
(
pobj
,
qobj
,
req
)
{
//通过账户获取用户信息----------------------------actionBody.channelUserId
if
(
!
pobj
.
actionBody
.
channelUserId
)
{
return
system
.
getResult
(
null
,
"actionBody.channelUserId can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
getLoginByUserName
(
pobj
);
return
result
;
}
async
putUserMobileByVcode
(
pobj
,
qobj
,
req
)
{
//通过手机验证码修改手机号、邮箱
var
actionBody
=
pobj
.
actionBody
;
if
(
!
actionBody
.
vcode
)
{
return
system
.
getResult
(
null
,
"actionBody.vcode can not be empty !"
);
}
if
(
!
pobj
.
userInfo
){
return
system
.
getResult
(
null
,
"userpin can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
putUserMobileByVcode
(
pobj
,
actionBody
);
return
result
;
async
loginByVerifyCode
(
pobj
,
qobj
,
req
)
{
//通过短信登录或注册信息
if
(
!
pobj
.
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty !"
);
}
async
getLoginInfo
(
pobj
,
qobj
,
req
)
{
//通过userpin获取用户信息
var
actionBody
=
pobj
.
actionBody
;
if
(
!
actionBody
.
userpin
)
{
return
system
.
getResult
(
null
,
"actionBody.userpin can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
getUserLoginInfo
(
pobj
,
actionBody
);
return
result
;
if
(
!
pobj
.
actionBody
.
vcode
)
{
return
system
.
getResult
(
null
,
"actionBody.vcode can not be empty !"
);
}
async
logout
(
pobj
,
qobj
,
req
)
{
var
result
=
await
this
.
opPlatformUtils
.
logout
(
pobj
);
return
result
;
var
result
=
await
this
.
opPlatformUtils
.
getReqUserPinByLgoinVcode
(
pobj
);
return
result
;
}
async
modiPasswordByMobile
(
pobj
,
qobj
,
req
)
{
//通过手机验证码修改用户密码
var
actionBody
=
pobj
.
actionBody
;
if
(
!
actionBody
.
mobile
)
{
return
system
.
getResult
(
null
,
"actionBody.mobile can not be empty !"
);
}
async
getAppInfo
(
pobj
,
qobj
,
req
)
{
var
result
=
await
this
.
utilsappSve
.
getAppInfo
(
pobj
);
return
result
;
if
(
!
actionBody
.
vcode
)
{
return
system
.
getResult
(
null
,
"actionBody.vcode can not be empty !"
);
}
if
(
!
actionBody
.
newPwd
)
{
return
system
.
getResult
(
null
,
"actionBody.newPwd can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
putUserPwdByMobile
(
pobj
,
actionBody
);
return
result
;
}
/**
* 获取所有渠道
* @returns {Promise<void>}
*/
async
getAllChannels
(){
var
result
=
await
this
.
utilsappSve
.
getAllChannels
();
return
result
;
async
putUserMobileByVcode
(
pobj
,
qobj
,
req
)
{
//通过手机验证码修改手机号、邮箱
var
actionBody
=
pobj
.
actionBody
;
if
(
!
actionBody
.
vcode
)
{
return
system
.
getResult
(
null
,
"actionBody.vcode can not be empty !"
);
}
if
(
!
pobj
.
userInfo
)
{
return
system
.
getResult
(
null
,
"userpin can not be empty !"
)
;
}
var
result
=
await
this
.
opPlatformUtils
.
putUserMobileByVcode
(
pobj
,
actionBody
);
return
result
;
}
async
getLoginInfo
(
pobj
,
qobj
,
req
)
{
//通过userpin获取用户信息
var
actionBody
=
pobj
.
actionBody
;
if
(
!
actionBody
.
userpin
)
{
return
system
.
getResult
(
null
,
"actionBody.userpin can not be empty !"
);
}
var
result
=
await
this
.
opPlatformUtils
.
getUserLoginInfo
(
pobj
,
actionBody
);
return
result
;
}
async
logout
(
pobj
,
qobj
,
req
)
{
var
result
=
await
this
.
opPlatformUtils
.
logout
(
pobj
);
return
result
;
}
async
getAppInfo
(
pobj
,
qobj
,
req
)
{
var
result
=
await
this
.
utilsappSve
.
getAppInfo
(
pobj
);
return
result
;
}
/**
* 获取所有渠道
* @returns {Promise<void>}
*/
async
getAllChannels
()
{
var
result
=
await
this
.
utilsappSve
.
getAllChannels
();
return
result
;
}
async
getAllService
()
{
var
result
=
await
this
.
utilsappSve
.
getAllService
();
return
result
;
}
}
module
.
exports
=
AccessAuthAPI
;
\ No newline at end of file
center-app/app/base/service/impl/utilsSve/utilsappSve.js
View file @
eaf8cd17
...
...
@@ -52,12 +52,12 @@ class UtilsAppSve extends AppServiceBase {
async
getAppInfo
(
pobj
)
{
var
uapp_id
=
pobj
.
uappId
||
""
;
var
app
=
await
this
.
appDao
.
findOne
({
app_code
:
uapp_id
});
if
(
app
)
{
return
system
.
getResultSuccess
(
app
);
var
app
=
await
this
.
appDao
.
findOne
({
app_code
:
uapp_id
});
if
(
app
)
{
return
system
.
getResultSuccess
(
app
);
}
if
(
!
app
)
{
return
system
.
getResult
(
null
,
"渠道码错误"
)
if
(
!
app
)
{
return
system
.
getResult
(
null
,
"渠道码错误"
)
}
}
...
...
@@ -65,10 +65,20 @@ class UtilsAppSve extends AppServiceBase {
* 获取所有渠道
* @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/
async
getAllChannels
(){
async
getAllChannels
()
{
let
sql
=
`SELECT DISTINCT(uapp_id),app_name FROM p_app`
;
let
result
=
await
this
.
appDao
.
customQuery
(
sql
);
return
system
.
getResultSuccess
(
result
);
}
/**
* 获取所有渠道
* @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/
async
getAllService
()
{
let
sql
=
`select uapp_id,app_hosts,app_name,\`desc\` from p_app`
;
let
result
=
await
this
.
appDao
.
customQuery
(
sql
);
return
system
.
getResultSuccess
(
result
);
}
}
module
.
exports
=
UtilsAppSve
;
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