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
fcdd7d84
Commit
fcdd7d84
authored
May 30, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
dd54f122
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
0 deletions
+76
-0
center-manage/app/base/api/impl/common/channels.js
+37
-0
center-manage/app/base/db/cache/channelCache.js
+28
-0
center-manage/app/base/db/impl/common/connection.js
+1
-0
center-manage/app/base/service/impl/auth/userSve.js
+2
-0
center-manage/app/config/routes/api.js
+8
-0
No files found.
center-manage/app/base/api/impl/common/channels.js
0 → 100644
View file @
fcdd7d84
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
ChannelAPI
extends
APIBase
{
constructor
()
{
super
();
}
async
getChannels
(
hostname
){
let
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
let
channels
=
await
cacheManager
[
"ChannelCache"
].
cache
(
hostname
)
return
channels
;
}
classDesc
()
{
return
{
groupName
:
"auth"
,
groupDesc
:
"认证相关的包"
,
name
:
"AccessAuthAPI"
,
desc
:
"关于认证的类"
,
exam
:
`
post http://p.apps.com/api/auth/accessAuth/getAccessKey
{
appKey:xxxxx,
secret:yyyyyy
}
`
,
};
}
methodDescs
()
{
return
[
];
}
exam
()
{
return
``
}
}
module
.
exports
=
ChannelAPI
;
center-manage/app/base/db/cache/channelCache.js
0 → 100644
View file @
fcdd7d84
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
ChannelCache
extends
CacheBase
{
constructor
()
{
super
();
this
.
channelDao
=
system
.
getObject
(
"db.common.channelDao"
);
}
isdebug
()
{
return
settings
.
env
==
"dev"
;
}
desc
()
{
return
"缓存本地应用对象"
;
}
prefix
()
{
return
"g_channel_"
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
const
configValue
=
await
this
.
channelDao
.
model
.
findOne
(
{
where
:
{
routehost
:
inputkey
}});
if
(
configValue
)
{
return
JSON
.
stringify
(
configValue
);
}
return
null
;
}
}
module
.
exports
=
ChannelCache
;
\ No newline at end of file
center-manage/app/base/db/impl/common/connection.js
View file @
fcdd7d84
...
...
@@ -65,6 +65,7 @@ class DbFactory{
//渠道和渠道路径方法映射
this
.
db
.
models
.
pathtomethod
.
belongsTo
(
this
.
db
.
models
.
channel
,{
constraints
:
false
,});
this
.
db
.
models
.
channel
.
hasMany
(
this
.
db
.
models
.
pathtomethod
,
as
:
"pts"
,{
constraints
:
false
,});
}
//async getCon(){,用于使用替换table模型内字段数据使用
getCon
(){
...
...
center-manage/app/base/service/impl/auth/userSve.js
View file @
fcdd7d84
...
...
@@ -283,6 +283,8 @@ class UserService extends ServiceBase {
return
null
;
}
}
//plkey--对应消费者jwt身份的key,插件解码token后,获取iss-key,查询出身份,利用
//身份中的secret验证签名
async
jwtsign
(
plkey
,
secretstr
,
opts
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
jwt
.
sign
({
iss
:
plkey
},
secretstr
,
opts
,
function
(
err
,
rtn
)
{
...
...
center-manage/app/config/routes/api.js
View file @
fcdd7d84
var
url
=
require
(
"url"
);
var
System
=
require
(
"../../base/system"
);
module
.
exports
=
function
(
app
)
{
app
.
all
(
"*"
,
async
function
(
req
,
res
,
next
){
if
(
!
channels
){
next
()
}
else
{
res
.
end
(
JSON
.
stringify
({
status
:
0
,
msg
:
"ok"
}));
}
})
app
.
get
(
'/api/:gname/:qname/:method'
,
function
(
req
,
res
)
{
// var classPath = req.params["qname"];
var
methodName
=
req
.
params
[
"method"
];
...
...
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