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
06f74711
Commit
06f74711
authored
Jan 14, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
f098e32d
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
168 additions
and
180 deletions
+168
-180
igirl-channel/app/base/api/api.base.js
+9
-18
igirl-channel/app/base/api/apidoc.base.js
+1
-11
igirl-channel/app/base/api/impl/auth/accessAuth.js
+18
-14
igirl-channel/app/base/db/cache/apiAccessKeyCheckCache.js
+0
-39
igirl-channel/app/base/db/cache/apiUserCache.js
+4
-4
igirl-channel/app/base/db/cache/appTokenByHostsCache.js
+18
-11
igirl-channel/app/base/db/cache/appUserPinByLoginVcodeCache.js
+13
-3
igirl-channel/app/base/db/impl/dbapp/appDao.js
+25
-0
igirl-channel/app/base/service/sve.base.js
+0
-32
igirl-channel/app/base/system.js
+4
-0
igirl-channel/app/base/utils/businessManager/opPlatformUtils.js
+38
-10
igirl-channel/app/config/settings.js
+37
-37
igirl-channel/app/front/entry/public/apidoc/user/user.md
+1
-1
No files found.
igirl-channel/app/base/api/api.base.js
View file @
06f74711
...
@@ -70,8 +70,8 @@ class APIBase {
...
@@ -70,8 +70,8 @@ class APIBase {
return
x
>=
0
;
return
x
>=
0
;
}
}
async
checkAcck
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
async
checkAcck
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
var
uAppInfo
=
null
;
//
var uAppInfo = null;
var
selfAppInfo
=
null
;
//
var selfAppInfo = null;
var
ispass
=
await
this
.
isCheckWhiteList
(
gname
,
methodname
);
var
ispass
=
await
this
.
isCheckWhiteList
(
gname
,
methodname
);
if
(
ispass
)
{
if
(
ispass
)
{
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
...
@@ -80,21 +80,13 @@ class APIBase {
...
@@ -80,21 +80,13 @@ class APIBase {
if
(
!
token
)
{
if
(
!
token
)
{
return
system
.
getResult
(
null
,
"token不能为空"
);
return
system
.
getResult
(
null
,
"token不能为空"
);
}
}
uAppInfo
=
await
this
.
cacheManager
[
"ApiAccessKeyCheckCache"
].
cache
(
token
,
{
status
:
true
},
this
.
exTime
);
if
(
!
uAppInfo
||
(
uAppInfo
.
status
&&
uAppInfo
.
status
!=
0
))
{
var
selfAppInfo
=
await
this
.
cacheManager
[
"AppTokenByHostsCache"
].
getCache
(
token
,
system
.
exTime
);
return
uAppInfo
;
if
(
selfAppInfo
.
status
!=
0
)
{
}
return
result
;
var
selfAppInfo
=
await
this
.
cacheManager
[
"ApiAppKeyCheckCache"
].
cache
(
uAppInfo
.
data
.
app
.
appkey
,
null
,
this
.
exTime
);
if
(
!
selfAppInfo
||
(
selfAppInfo
.
status
&&
selfAppInfo
.
status
!=
0
))
{
return
selfAppInfo
;
}
}
// if (!appInfo) {
req
.
app
=
selfAppInfo
.
data
;
// return system.getResult(null, "通过token获取sign的密钥信息失败,请重新获取");
// }
// var signResult = await this.verifySign(pobj.action_body, appInfo.appSecret);
// if (signResult.status != 0) {
// return system.getResultFail(system.signFail, signResult.msg);
// }
if
(
pobj
.
isUser
&&
pobj
.
isUser
==
"yes"
)
{
if
(
pobj
.
isUser
&&
pobj
.
isUser
==
"yes"
)
{
var
channelUserId
=
pobj
.
channelUserId
?
pobj
.
channelUserId
:
pobj
.
actionBody
.
channelUserId
||
""
;
var
channelUserId
=
pobj
.
channelUserId
?
pobj
.
channelUserId
:
pobj
.
actionBody
.
channelUserId
||
""
;
if
(
!
channelUserId
&&
pobj
.
actionBody
.
channelUser
)
{
if
(
!
channelUserId
&&
pobj
.
actionBody
.
channelUser
)
{
...
@@ -105,7 +97,7 @@ class APIBase {
...
@@ -105,7 +97,7 @@ class APIBase {
}
}
var
userCacheKey
=
selfAppInfo
.
data
.
uappKey
+
"_"
+
channelUserId
;
var
userCacheKey
=
selfAppInfo
.
data
.
uappKey
+
"_"
+
channelUserId
;
var
userInfo
=
await
this
.
cacheManager
[
"ApiUserCache"
].
cache
(
userCacheKey
,
channelUserId
,
var
userInfo
=
await
this
.
cacheManager
[
"ApiUserCache"
].
cache
(
userCacheKey
,
channelUserId
,
this
.
exTime
,
pobj
.
actionBody
,
selfAppInfo
,
uAppInfo
.
data
.
app
.
i
d
);
this
.
exTime
,
pobj
.
actionBody
,
selfAppInfo
,
selfAppInfo
.
data
.
uAppI
d
);
if
(
!
userInfo
||
(
userInfo
.
status
&&
userInfo
.
status
!=
0
))
{
if
(
!
userInfo
||
(
userInfo
.
status
&&
userInfo
.
status
!=
0
))
{
return
userInfo
;
return
userInfo
;
}
}
...
@@ -115,7 +107,6 @@ class APIBase {
...
@@ -115,7 +107,6 @@ class APIBase {
req
.
user
=
userInfo
.
data
;
req
.
user
=
userInfo
.
data
;
pobj
.
actionBody
.
channelUserId
=
channelUserId
;
pobj
.
actionBody
.
channelUserId
=
channelUserId
;
}
}
req
.
app
=
selfAppInfo
.
data
;
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
...
...
igirl-channel/app/base/api/apidoc.base.js
View file @
06f74711
...
@@ -71,17 +71,7 @@ class APIBase extends DocBase {
...
@@ -71,17 +71,7 @@ class APIBase extends DocBase {
if
(
ispass
)
{
if
(
ispass
)
{
return
result
;
return
result
;
}
//在百名单里面
}
//在百名单里面
if
(
appkey
)
{
appInfo
=
await
this
.
cacheManager
[
"ApiAccessKeyCheckCache"
].
cache
(
appkey
,
{
status
:
true
},
3000
);
if
(
!
appInfo
||
!
appInfo
.
app
)
{
result
.
status
=
system
.
tokenFail
;
result
.
msg
=
"请求头accesskey失效,请重新获取"
;
}
}
//验证accesskey
else
{
result
.
status
=
-
1
;
result
.
msg
=
"请求头没有相关访问参数,请验证后在进行请求"
;
}
return
result
;
return
result
;
}
}
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
...
...
igirl-channel/app/base/api/impl/auth/accessAuth.js
View file @
06f74711
...
@@ -5,6 +5,7 @@ class AccessAuthAPI extends APIBase {
...
@@ -5,6 +5,7 @@ class AccessAuthAPI extends APIBase {
super
();
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
toolSve
=
system
.
getObject
(
"service.trademark.toolSve"
);
this
.
toolSve
=
system
.
getObject
(
"service.trademark.toolSve"
);
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
}
}
/**
/**
* 接口跳转-POST请求
* 接口跳转-POST请求
...
@@ -52,7 +53,7 @@ class AccessAuthAPI extends APIBase {
...
@@ -52,7 +53,7 @@ class AccessAuthAPI extends APIBase {
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
break
;
break
;
case
"getVerifyCode"
:
case
"getVerifyCode"
:
opResult
=
await
this
.
opPlatformUtils
.
getVerifyCodeByMoblie
(
action_body
);
opResult
=
await
this
.
opPlatformUtils
.
getVerifyCodeByMoblie
(
action_
process
,
action_
body
);
if
(
opResult
.
status
==
0
)
{
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
()
return
system
.
getResultSuccess
()
}
}
...
@@ -109,22 +110,25 @@ class AccessAuthAPI extends APIBase {
...
@@ -109,22 +110,25 @@ class AccessAuthAPI extends APIBase {
}
}
async
getToken
(
pobj
,
qobj
,
req
)
{
async
getToken
(
pobj
,
qobj
,
req
)
{
var
appkey
=
pobj
.
appkey
;
if
(
!
pobj
.
appkey
)
{
var
secret
=
pobj
.
secret
;
return
system
.
getResult
(
null
,
"pobj.appkey参数不能为空"
);
if
(
!
appkey
)
{
return
system
.
getResult
(
null
,
"appkey参数不能为空"
);
}
}
if
(
!
secret
)
{
if
(
!
pobj
.
secret
)
{
return
system
.
getResult
(
null
,
"secret参数不能为空"
);
return
system
.
getResult
(
null
,
"
pobj.
secret参数不能为空"
);
}
}
var
result
=
await
this
.
opPlatformUtils
.
getReqApiAccessKey
(
appkey
,
secret
);
var
cacheKey
=
"getToken:appkey_"
+
pobj
.
appkey
;
if
(
result
&&
result
.
status
&&
result
.
status
!=
0
)
{
var
jsonToken
=
await
this
.
redisClient
.
get
(
cacheKey
);
return
result
;
if
(
jsonToken
)
{
return
JSON
.
parse
(
jsonToken
);
}
}
var
resultData
=
{
var
token
=
this
.
getUUID
();
token
:
result
&&
result
.
data
?
result
.
data
.
accessKey
:
""
var
opResult
=
await
this
.
opPlatformUtils
.
getReqTokenByHosts
(
pobj
,
token
);
};
if
(
opResult
.
status
!=
0
)
{
return
system
.
getResultSuccess
(
resultData
);
return
opResult
;
}
var
result
=
system
.
getResultSuccess
({
token
:
token
});
this
.
redisClient
.
setWithEx
(
cacheKey
,
JSON
.
stringify
(
result
),
system
.
shortExTime
);
return
result
;
}
}
/**
/**
* 开放平台回调处理
* 开放平台回调处理
...
...
igirl-channel/app/base/db/cache/apiAccessKeyCheckCache.js
deleted
100644 → 0
View file @
f098e32d
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
//缓存首次登录的赠送的宝币数量
class
ApiAccessKeyCheckCache
extends
CacheBase
{
constructor
()
{
super
();
this
.
restS
=
system
.
getObject
(
"util.restClient"
);
}
desc
()
{
return
"应用中来访访问token缓存"
;
}
prefix
()
{
return
settings
.
cacheprefix
+
"_verify_reqaccesskey:"
;
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
//当来访key缓存不存在时,需要去开放平台检查是否存在来访key缓存
var
acckapp
=
await
cacheManager
[
"ApiAccessKeyCache"
].
cache
(
settings
.
appKey
,
null
,
ex
);
//先获取本应用accessKey
if
(
acckapp
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
"获取本应用accessKey错误"
);
}
var
checkresult
=
await
this
.
restS
.
execPostWithAK
({
checkAccessKey
:
inputkey
},
settings
.
paasUrl
()
+
"api/auth/accessAuth/authAccessKey"
,
acckapp
.
data
.
accessKey
);
if
(
checkresult
.
status
==
0
)
{
return
checkresult
;
// var s = checkresult.data;
// return JSON.stringify(s);
}
else
{
await
cacheManager
[
"ApiAccessKeyCache"
].
invalidate
(
settings
.
appKey
);
var
acckapp
=
await
cacheManager
[
"ApiAccessKeyCache"
].
cache
(
settings
.
appKey
,
null
,
ex
);
//先获取本应用accessKey
var
checkresult
=
await
this
.
restS
.
execPostWithAK
({
checkAccessKey
:
inputkey
},
settings
.
paasUrl
()
+
"api/auth/accessAuth/authAccessKey"
,
acckapp
.
data
.
accessKey
);
return
checkresult
;
// var s = checkresult.data;
// return JSON.stringify(s);
}
}
}
module
.
exports
=
ApiAccessKeyCheckCache
;
igirl-channel/app/base/db/cache/apiUserCache.js
View file @
06f74711
...
@@ -23,16 +23,16 @@ class ApiUserCache extends CacheBase {
...
@@ -23,16 +23,16 @@ class ApiUserCache extends CacheBase {
var
uAppId
=
items
[
2
];
var
uAppId
=
items
[
2
];
var
channelUserId
=
val
||
""
;
var
channelUserId
=
val
||
""
;
var
uUserName
=
channelUserId
+
"$"
+
selfAppInfo
.
data
.
uappKey
;
//uUserName
// var uUserName = channelUserId;//
channelUserId + "$" + selfAppInfo.data.uappKey;//uUserName
var
createUserPwd
=
inputkey
;
//(格式:selfAppInfo.data.uappKey+”_“+channelUserId)
var
createUserPwd
=
inputkey
;
//(格式:selfAppInfo.data.uappKey+”_“+channelUserId)
var
userInfo
=
await
this
.
appuserDao
.
getItemByUUserId
(
uUserName
,
selfAppInfo
.
data
.
id
);
var
userInfo
=
await
this
.
appuserDao
.
getItemByUUserId
(
channelUserId
,
selfAppInfo
.
data
.
id
);
if
(
userInfo
)
{
if
(
userInfo
)
{
var
loginNum
=
Number
(
userInfo
.
loginNum
||
0
)
+
1
;
var
loginNum
=
Number
(
userInfo
.
loginNum
||
0
)
+
1
;
this
.
appuserDao
.
updateByWhere
({
lastLoginTime
:
new
Date
(),
loginNum
:
loginNum
},
{
where
:
{
id
:
userInfo
.
id
}
});
this
.
appuserDao
.
updateByWhere
({
lastLoginTime
:
new
Date
(),
loginNum
:
loginNum
},
{
where
:
{
id
:
userInfo
.
id
}
});
return
system
.
getResultSuccess
(
userInfo
);
return
system
.
getResultSuccess
(
userInfo
);
}
}
var
uUserInfo
=
await
this
.
opPlatformUtils
.
createUserInfo
(
uUserName
,
actionBody
.
channelUserMoblie
||
"15010888888"
,
var
uUserInfo
=
await
this
.
opPlatformUtils
.
createUserInfo
(
channelUserId
,
actionBody
.
channelUserMoblie
||
"15010888888"
,
createUserPwd
,
selfAppInfo
.
data
.
uappKey
,
selfAppInfo
.
data
.
appSecret
);
createUserPwd
,
selfAppInfo
.
data
.
uappKey
,
selfAppInfo
.
data
.
appSecret
);
if
(
uUserInfo
.
status
!=
2000
&&
uUserInfo
.
status
!=
0
)
{
if
(
uUserInfo
.
status
!=
2000
&&
uUserInfo
.
status
!=
0
)
{
return
uUserInfo
;
return
uUserInfo
;
...
@@ -47,7 +47,7 @@ class ApiUserCache extends CacheBase {
...
@@ -47,7 +47,7 @@ class ApiUserCache extends CacheBase {
orgName
:
actionBody
.
orgName
||
""
,
orgName
:
actionBody
.
orgName
||
""
,
orgPath
:
actionBody
.
orgPath
||
""
,
orgPath
:
actionBody
.
orgPath
||
""
,
uUserName
:
uUserName
,
uUserName
:
channelUserId
,
uAppId
:
uAppId
,
uAppId
:
uAppId
,
isEnabled
:
1
,
isEnabled
:
1
,
lastLoginTime
:
new
Date
()
lastLoginTime
:
new
Date
()
...
...
igirl-channel/app/base/db/cache/appTokenByHostsCache.js
View file @
06f74711
...
@@ -4,27 +4,34 @@ const settings = require("../../../config/settings");
...
@@ -4,27 +4,34 @@ const settings = require("../../../config/settings");
class
AppTokenByHostsCache
extends
CacheBase
{
class
AppTokenByHostsCache
extends
CacheBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
appDao
=
system
.
getObject
(
"db.dbapp.appDao"
);
}
}
desc
()
{
desc
()
{
return
"应用中缓存访问token"
;
return
"应用中缓存访问token"
;
}
}
prefix
()
{
prefix
()
{
return
settings
.
cacheprefix
+
"_access
k
ey:"
;
return
settings
.
cacheprefix
+
"_access
TokenK
ey:"
;
}
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
app_hosts
=
val
;
var
pobj
=
val
;
if
(
!
app_hosts
)
{
var
item
=
await
this
.
appDao
.
getItemByUappKey
(
pobj
.
appkey
,
pobj
.
secret
);
return
system
.
getResult
(
null
,
"app_hosts can not be empty"
);
if
(
!
item
)
{
return
system
.
getResult
(
null
,
"params to data is empty !"
);
}
}
var
acckapp
=
await
this
.
restClient
.
execPost
({
app_hosts
:
app_hosts
},
settings
.
centerAppUrl
()
+
"auth/accessAuth/getTokenByHosts"
);
if
(
item
.
status
!=
1
)
{
var
result
=
acckapp
.
stdout
;
return
system
.
getResult
(
null
,
"params to item is Disable !"
);
console
.
log
(
acckapp
.
stdout
,
"AppTokenByHostsCache............. acckapp.stdout.........."
)
if
(
result
)
{
var
tmp
=
JSON
.
parse
(
result
);
return
tmp
;
}
}
return
system
.
getResult
(
null
,
"data is empty"
);
var
result
=
await
this
.
opPlatformUtils
.
getReqApiAccessKey
(
pobj
.
appkey
,
pobj
.
secret
);
if
(
!
result
)
{
return
system
.
getResult
(
null
,
"platform to data is empty !"
);
}
if
(
result
.
status
!=
0
)
{
return
result
;
}
item
.
token
=
result
.
data
.
accessKey
;
return
system
.
getResultSuccess
(
item
);
}
}
}
}
module
.
exports
=
AppTokenByHostsCache
;
module
.
exports
=
AppTokenByHostsCache
;
igirl-channel/app/base/db/cache/appUserPinByLoginVcodeCache.js
View file @
06f74711
...
@@ -16,16 +16,26 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
...
@@ -16,16 +16,26 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
}
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
actionBody
=
val
;
var
actionBody
=
val
;
var
userInfo
=
null
;
if
(
actionBody
.
reqType
==
"reg"
)
{
userInfo
=
await
this
.
appuserDao
.
getItemByUUserId
(
actionBody
.
mobile
,
actionBody
.
appInfo
.
id
);
if
(
userInfo
)
{
if
(
userInfo
.
isEnabled
!=
1
)
{
return
system
.
getResultFail
(
system
.
userDisable
,
"用户信息禁用 !"
);
}
return
system
.
getResultFail
(
system
.
existUser
,
"用户已存在,请勿重复注册"
);
}
}
var
uUserInfo
=
await
this
.
opPlatformUtils
.
loginByVCode
(
actionBody
.
mobile
,
actionBody
.
vcode
,
actionBody
.
password
,
var
uUserInfo
=
await
this
.
opPlatformUtils
.
loginByVCode
(
actionBody
.
mobile
,
actionBody
.
vcode
,
actionBody
.
password
,
actionBody
.
appInfo
.
uappKey
,
actionBody
.
appInfo
.
appSecret
);
actionBody
.
appInfo
.
uappKey
,
actionBody
.
appInfo
.
appSecret
);
if
(
uUserInfo
.
status
!=
0
)
{
if
(
uUserInfo
.
status
!=
0
)
{
return
uUserInfo
;
return
uUserInfo
;
}
//2030验证码校验不成功 或 注册失败
}
//2030验证码校验不成功 或 注册失败
var
userInfo
=
await
this
.
appuserDao
.
getItemByUUserId
(
actionBody
.
mobile
,
actionBody
.
appInfo
.
id
);
userInfo
=
await
this
.
appuserDao
.
getItemByUUserId
(
actionBody
.
mobile
,
actionBody
.
appInfo
.
id
);
if
(
userInfo
)
{
if
(
userInfo
)
{
if
(
userInfo
.
is
_e
nabled
!=
1
)
{
if
(
userInfo
.
is
E
nabled
!=
1
)
{
return
system
.
getResult
(
null
,
"user to item is Disable
!"
);
return
system
.
getResult
Fail
(
system
.
userDisable
,
"用户信息禁用 !
!"
);
}
}
return
system
.
getResultSuccess
(
userInfo
);
return
system
.
getResultSuccess
(
userInfo
);
}
}
...
...
igirl-channel/app/base/db/impl/dbapp/appDao.js
View file @
06f74711
...
@@ -28,5 +28,30 @@ class AppDao extends Dao {
...
@@ -28,5 +28,30 @@ class AppDao extends Dao {
raw
:
true
raw
:
true
});
});
}
}
async
getItemByUappKey
(
uAppKey
,
secret
)
{
return
this
.
model
.
findOne
({
where
:
{
uappKey
:
uAppKey
,
appSecret
:
secret
},
attributes
:
[
"id"
,
"name"
,
// 应用名称
"appDataOpType"
,
// 应用数据操作类型:00独立,10全委托,20部分委托
"appPayType"
,
// 支付类型:00第三方应用自己支付,10平台代收款
"contactName"
,
// 联系人姓名
"contactMobile"
,
// 联系人手机
"contactEmail"
,
// 联系人邮箱
"uappKey"
,
// 平台应用key
"appSecret"
,
// 密钥信息,用于进行签名请求接口
"status"
,
// 状态 0禁用 1启用
"uAppId"
,
"channelAppId"
,
// 渠道appID
"channelAppKey"
,
// 渠道appKey
"pushOrderUrl"
,
//获取渠道推送订单的url
"appSourceCode"
,
//app来源code
"notes"
],
raw
:
true
});
}
}
}
module
.
exports
=
AppDao
;
module
.
exports
=
AppDao
;
igirl-channel/app/base/service/sve.base.js
View file @
06f74711
...
@@ -139,38 +139,6 @@ class ServiceBase {
...
@@ -139,38 +139,6 @@ class ServiceBase {
}
}
return
tResult
;
return
tResult
;
}
}
async
apiCallWithAk
(
url
,
params
)
{
var
acckapp
=
await
this
.
cacheManager
[
"ApiAccessKeyCache"
].
cache
(
settings
.
appKey
);
var
acck
=
acckapp
.
accessKey
;
//按照访问token
var
restResult
=
await
this
.
restS
.
execPostWithAK
(
params
,
url
,
acck
);
if
(
restResult
)
{
if
(
restResult
.
status
==
0
)
{
var
resultRtn
=
restResult
.
data
;
return
resultRtn
;
}
else
{
await
this
.
cacheManager
[
"ApiAccessKeyCache"
].
invalidate
(
settings
.
appKey
);
return
null
;
}
}
return
null
;
}
// async apiCallWithAkNoWait(url,params){
// var acckapp=await this.cacheManager["ApiAccessKeyCache"].cache(settings.appKey);
// var acck=acckapp.accessKey;
// //按照访问token
// var restResult=await this.restS.execPostWithAK(params,url,acck);
// if(restResult){
// if(restResult.status==0){
// var resultRtn=restResult.data;
// return resultRtn;
// }else{
// await this.cacheManager["ApiAccessKeyCache"].invalidate(settings.appKey);
// return null;
// }
// }
// return null;
// }
static
getDaoName
(
ClassObj
)
{
static
getDaoName
(
ClassObj
)
{
return
ClassObj
[
"name"
].
substring
(
0
,
ClassObj
[
"name"
].
lastIndexOf
(
"Service"
)).
toLowerCase
()
+
"Dao"
;
return
ClassObj
[
"name"
].
substring
(
0
,
ClassObj
[
"name"
].
lastIndexOf
(
"Service"
)).
toLowerCase
()
+
"Dao"
;
}
}
...
...
igirl-channel/app/base/system.js
View file @
06f74711
...
@@ -292,6 +292,7 @@ Date.prototype.Format = function (fmt) { //author: meizz
...
@@ -292,6 +292,7 @@ Date.prototype.Format = function (fmt) { //author: meizz
return
fmt
;
return
fmt
;
}
}
System
.
exTime
=
4
*
3600
;
//缓存过期时间,4小时
System
.
exTime
=
4
*
3600
;
//缓存过期时间,4小时
System
.
shortExTime
=
1
*
3600
;
//缓存过期时间,4小时
System
.
objTable
=
{};
System
.
objTable
=
{};
...
@@ -323,5 +324,7 @@ System.existData = 1400;
...
@@ -323,5 +324,7 @@ System.existData = 1400;
System
.
noUserFail
=
2070
;
System
.
noUserFail
=
2070
;
//用户信息禁用
//用户信息禁用
System
.
userDisable
=
2080
;
System
.
userDisable
=
2080
;
//用户已存在,请勿重复注册
System
.
existUser
=
2000
;
module
.
exports
=
System
;
module
.
exports
=
System
;
\ No newline at end of file
igirl-channel/app/base/utils/businessManager/opPlatformUtils.js
View file @
06f74711
...
@@ -8,6 +8,7 @@ class OpPlatformUtils {
...
@@ -8,6 +8,7 @@ class OpPlatformUtils {
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
createUserUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/register"
;
this
.
createUserUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/register"
;
this
.
fetchDefaultVCodeUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/fetchDefaultVCode"
;
this
.
fetchDefaultVCodeUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/fetchDefaultVCode"
;
this
.
fetchOtherVCodeUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/fetchOtherVCode"
;
this
.
loginUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/loginByMd5Password"
;
this
.
loginUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/loginByMd5Password"
;
this
.
authByCodeUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/authByCode"
;
this
.
authByCodeUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/authByCode"
;
this
.
loginByVCodeUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/loginByVCode"
;
this
.
loginByVCodeUrl
=
settings
.
paasUrl
()
+
"api/auth/accessAuth/loginByVCode"
;
...
@@ -20,13 +21,14 @@ class OpPlatformUtils {
...
@@ -20,13 +21,14 @@ class OpPlatformUtils {
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
return
u
;
}
}
async
getReqApiAccessKey
(
appKey
,
secret
)
{
async
getReqApiAccessKey
(
appKey
,
secret
)
{
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
reqApiAccessKey
=
null
;
var
reqApiAccessKey
=
null
;
if
(
appKey
&&
secret
)
{
if
(
appKey
&&
secret
)
{
reqApiAccessKey
=
await
cacheManager
[
"ApiAccessKeyCache"
].
cache
(
appKey
,
null
,
1
,
secret
);
reqApiAccessKey
=
await
cacheManager
[
"ApiAccessKeyCache"
].
cache
(
appKey
,
null
,
1
0
,
secret
);
}
else
{
}
else
{
reqApiAccessKey
=
await
cacheManager
[
"ApiAccessKeyCache"
].
cache
(
settings
.
appKey
,
null
,
1
);
reqApiAccessKey
=
await
cacheManager
[
"ApiAccessKeyCache"
].
cache
(
settings
.
appKey
,
null
,
1
0
);
}
}
if
(
!
reqApiAccessKey
||
!
reqApiAccessKey
.
data
)
{
if
(
!
reqApiAccessKey
||
!
reqApiAccessKey
.
data
)
{
return
system
.
getResult
(
null
,
"获取请求token失败"
);
return
system
.
getResult
(
null
,
"获取请求token失败"
);
...
@@ -72,7 +74,22 @@ class OpPlatformUtils {
...
@@ -72,7 +74,22 @@ class OpPlatformUtils {
}
}
return
system
.
getResultSuccess
(
restResult
.
data
);
return
system
.
getResultSuccess
(
restResult
.
data
);
}
}
async
fetchVCode
(
mobile
,
appKey
,
secret
)
{
async
fetchOtherVCode
(
param
,
appKey
,
secret
)
{
var
reqApiAccessKey
=
await
this
.
getReqApiAccessKey
(
appKey
,
secret
);
if
(
reqApiAccessKey
.
status
!=
0
)
{
return
reqApiAccessKey
;
}
//按照访问token
var
restResult
=
await
this
.
restClient
.
execPostWithAK
(
param
,
this
.
fetchOtherVCodeUrl
,
reqApiAccessKey
.
data
.
accessKey
);
if
(
restResult
.
status
!=
0
||
!
restResult
.
data
)
{
return
system
.
getResult
(
null
,
restResult
.
msg
);
}
return
system
.
getResultSuccess
();
}
async
fetchDefaultVCode
(
mobile
,
appKey
,
secret
)
{
var
reqApiAccessKey
=
await
this
.
getReqApiAccessKey
(
appKey
,
secret
);
var
reqApiAccessKey
=
await
this
.
getReqApiAccessKey
(
appKey
,
secret
);
if
(
reqApiAccessKey
.
status
!=
0
)
{
if
(
reqApiAccessKey
.
status
!=
0
)
{
return
reqApiAccessKey
;
return
reqApiAccessKey
;
...
@@ -205,12 +222,9 @@ class OpPlatformUtils {
...
@@ -205,12 +222,9 @@ class OpPlatformUtils {
return
restResult
;
return
restResult
;
}
}
//------------------------新的方式------------------------------------------------------------------------------------
//------------------------新的方式------------------------------------------------------------------------------------
async
getReqTokenByHosts
(
appHosts
,
tokenValue
)
{
async
getReqTokenByHosts
(
pobj
,
tokenValue
)
{
//通过密钥进行获取token,跟平台的token没有关系
if
(
!
appHosts
)
{
return
system
.
getResult
(
null
,
"appHosts can not be empty"
);
}
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
result
=
await
cacheManager
[
"AppTokenByHostsCache"
].
cache
(
tokenValue
,
appHosts
,
system
.
exTime
);
var
result
=
await
cacheManager
[
"AppTokenByHostsCache"
].
cache
(
tokenValue
,
pobj
,
system
.
exTime
);
return
result
;
return
result
;
}
}
...
@@ -247,18 +261,32 @@ class OpPlatformUtils {
...
@@ -247,18 +261,32 @@ class OpPlatformUtils {
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
return
system
.
getResult
(
null
,
"actionBody.password can not be empty"
);
}
}
}
}
actionBody
.
reqType
=
reqType
;
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
result
=
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
cache
(
userPinValue
,
actionBody
,
system
.
exTime
);
var
result
=
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
cache
(
userPinValue
,
actionBody
,
system
.
exTime
);
return
result
;
return
result
;
}
}
async
getVerifyCodeByMoblie
(
actionBody
)
{
async
getVerifyCodeByMoblie
(
action
_process
,
action
Body
)
{
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 !"
);
}
}
if
(
!
actionBody
.
appInfo
)
{
if
(
!
actionBody
.
appInfo
)
{
return
system
.
getResult
(
null
,
"pobj.appInfo can not be empty !"
);
return
system
.
getResult
(
null
,
"pobj.appInfo can not be empty !"
);
}
}
var
acckapp
=
await
this
.
fetchVCode
(
actionBody
.
mobile
,
actionBody
.
appInfo
.
uappKey
,
actionBody
.
appInfo
.
appSecret
);
var
acckapp
=
null
;
if
(
action_process
==
"bw"
)
{
var
param
=
{
mobile
:
actionBody
.
mobile
,
tmplCode
:
"SMS_151685065"
,
signName
:
"小望科技"
,
accessKeyId
:
"LTAI4Fjk6qBh4GELjkBxfyJF"
,
accessKeySecret
:
"Z3wUHmZ0hnQst6uaTY3GzOYVoWwxb9"
}
acckapp
=
await
this
.
fetchOtherVCode
(
param
,
actionBody
.
appInfo
.
uappKey
,
actionBody
.
appInfo
.
appSecret
);
}
else
{
acckapp
=
await
this
.
fetchDefaultVCode
(
actionBody
.
mobile
,
actionBody
.
appInfo
.
uappKey
,
actionBody
.
appInfo
.
appSecret
);
}
return
acckapp
;
return
acckapp
;
}
}
async
putUserPwdByMobile
(
actionBody
)
{
async
putUserPwdByMobile
(
actionBody
)
{
...
...
igirl-channel/app/config/settings.js
View file @
06f74711
var
path
=
require
(
'path'
);
var
path
=
require
(
'path'
);
var
ENVINPUT
=
{
var
ENVINPUT
=
{
DB_HOST
:
process
.
env
.
DB_HOST
,
DB_HOST
:
process
.
env
.
DB_HOST
,
DB_PORT
:
process
.
env
.
DB_PORT
,
DB_PORT
:
process
.
env
.
DB_PORT
,
DB_USER
:
process
.
env
.
DB_USER
,
DB_USER
:
process
.
env
.
DB_USER
,
DB_PWD
:
process
.
env
.
DB_PWD
,
DB_PWD
:
process
.
env
.
DB_PWD
,
DB_NAME
:
process
.
env
.
ZC_CHANNEL_DB_NAME
,
DB_NAME
:
process
.
env
.
ZC_CHANNEL_DB_NAME
,
REDIS_HOST
:
process
.
env
.
REDIS_HOST
,
REDIS_HOST
:
process
.
env
.
REDIS_HOST
,
REDIS_PORT
:
process
.
env
.
REDIS_PORT
,
REDIS_PORT
:
process
.
env
.
REDIS_PORT
,
REDIS_PWD
:
process
.
env
.
REDIS_PWD
,
REDIS_PWD
:
process
.
env
.
REDIS_PWD
,
REDIS_DB
:
process
.
env
.
ZC_CHANNEL_REDIS_DB
,
REDIS_DB
:
process
.
env
.
ZC_CHANNEL_REDIS_DB
,
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"dev"
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"dev"
};
};
var
settings
=
{
var
settings
=
{
env
:
ENVINPUT
.
APP_ENV
,
env
:
ENVINPUT
.
APP_ENV
,
appKey
:
"201911061250"
,
appKey
:
"201911061250"
,
secret
:
"f99d413b767f09b5dff0b3610366cc46"
,
secret
:
"f99d413b767f09b5dff0b3610366cc46"
,
salt
:
"%iatpD1gcxz7iF#B"
,
salt
:
"%iatpD1gcxz7iF#B"
,
cacheprefix
:
"
center
Channel"
,
cacheprefix
:
"
igirl
Channel"
,
usertimeout
:
3600
,
//单位秒
usertimeout
:
3600
,
//单位秒
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
4003
,
port
:
process
.
env
.
NODE_PORT
||
4003
,
...
@@ -33,14 +33,14 @@ var settings = {
...
@@ -33,14 +33,14 @@ var settings = {
}
else
{
}
else
{
return
"http://center-app-service/"
;
return
"http://center-app-service/"
;
}
}
},
},
centerChannelUrl
:
function
()
{
centerChannelUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
return
"http://gsb.qifu.gongsibao.com:4011/"
;
return
"http://gsb.qifu.gongsibao.com:4011/"
;
}
else
{
}
else
{
return
"http://center-channel-service/"
;
return
"http://center-channel-service/"
;
}
}
},
},
reqTransferurl
:
function
()
{
reqTransferurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
return
"http://192.168.18.61:3003/"
;
return
"http://192.168.18.61:3003/"
;
...
@@ -93,10 +93,10 @@ var settings = {
...
@@ -93,10 +93,10 @@ var settings = {
return
localsettings
.
redis
;
return
localsettings
.
redis
;
}
else
{
}
else
{
return
{
return
{
host
:
ENVINPUT
.
REDIS_HOST
,
host
:
ENVINPUT
.
REDIS_HOST
,
port
:
ENVINPUT
.
REDIS_PORT
,
port
:
ENVINPUT
.
REDIS_PORT
,
password
:
ENVINPUT
.
REDIS_PWD
,
password
:
ENVINPUT
.
REDIS_PWD
,
db
:
ENVINPUT
.
REDIS_DB
,
db
:
ENVINPUT
.
REDIS_DB
,
};
};
}
}
},
},
...
@@ -106,24 +106,24 @@ var settings = {
...
@@ -106,24 +106,24 @@ var settings = {
return
localsettings
.
database
;
return
localsettings
.
database
;
}
else
{
}
else
{
return
{
return
{
dbname
:
ENVINPUT
.
DB_NAME
,
dbname
:
ENVINPUT
.
DB_NAME
,
user
:
ENVINPUT
.
DB_USER
,
user
:
ENVINPUT
.
DB_USER
,
password
:
ENVINPUT
.
DB_PWD
,
password
:
ENVINPUT
.
DB_PWD
,
config
:
{
config
:
{
host
:
ENVINPUT
.
DB_HOST
,
host
:
ENVINPUT
.
DB_HOST
,
dialect
:
'mysql'
,
dialect
:
'mysql'
,
operatorsAliases
:
false
,
operatorsAliases
:
false
,
pool
:
{
pool
:
{
max
:
5
,
max
:
5
,
min
:
0
,
min
:
0
,
acquire
:
90000000
,
acquire
:
90000000
,
idle
:
1000000
idle
:
1000000
},
},
debug
:
false
,
debug
:
false
,
dialectOptions
:
{
dialectOptions
:
{
requestTimeout
:
999999
,
requestTimeout
:
999999
,
// instanceName:'DEV'
// instanceName:'DEV'
}
//设置MSSQL超时时间
}
//设置MSSQL超时时间
},
},
};
};
}
}
...
...
igirl-channel/app/front/entry/public/apidoc/user/user.md
View file @
06f74711
...
@@ -111,7 +111,7 @@
...
@@ -111,7 +111,7 @@
#### 返回结果
#### 返回结果
```
javascript
```
javascript
{
{
"status"
:
0
,
// 0为成功,20
30为验证码错误,2060为重复登录
,否则失败
"status"
:
0
,
// 0为成功,20
00用户已存在,2030为验证码错误,2080用户信息禁用,请勿重复注册
,否则失败
"msg"
:
"success"
,
"msg"
:
"success"
,
"data"
:
{
"data"
:
{
"userpin"
:
"230ecdf3333944ff834f56fba10a02aa"
,
//用户登录后的凭证,增、删、改、查、涉及用户的需要传递此值在请求头中
"userpin"
:
"230ecdf3333944ff834f56fba10a02aa"
,
//用户登录后的凭证,增、删、改、查、涉及用户的需要传递此值在请求头中
...
...
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