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
dd54f122
Commit
dd54f122
authored
May 30, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
80966324
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
257 additions
and
0 deletions
+257
-0
center-manage/app/base/controller/impl/common/channelCtl.js
+12
-0
center-manage/app/base/controller/impl/common/pathtomethodCtl.js
+12
-0
center-manage/app/base/db/impl/common/connection.js
+3
-0
center-manage/app/base/db/models/common/channel.js
+61
-0
center-manage/app/base/db/models/common/pathtomethod.js
+61
-0
center-manage/app/base/service/impl/common/channelSve.js
+57
-0
center-manage/app/base/service/impl/common/pathtomethodSve.js
+11
-0
center-manage/app/base/service/sve.base.js
+19
-0
center-manage/app/config/settings.js
+1
-0
center-manage/plan.txt
+20
-0
No files found.
center-manage/app/base/controller/impl/common/channelCtl.js
0 → 100644
View file @
dd54f122
var
system
=
require
(
"../../../system"
)
const
http
=
require
(
"http"
)
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
class
ChannelCtl
extends
CtlBase
{
constructor
()
{
super
(
"common"
,
CtlBase
.
getServiceName
(
ChannelCtl
));
this
.
appS
=
system
.
getObject
(
"service.common.appSve"
)
}
}
module
.
exports
=
ChannelCtl
;
center-manage/app/base/controller/impl/common/pathtomethodCtl.js
0 → 100644
View file @
dd54f122
var
system
=
require
(
"../../../system"
)
const
http
=
require
(
"http"
)
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
class
PathtomethodCtl
extends
CtlBase
{
constructor
()
{
super
(
"common"
,
CtlBase
.
getServiceName
(
PathtomethodCtl
));
this
.
appS
=
system
.
getObject
(
"service.common.appSve"
)
}
}
module
.
exports
=
PathtomethodCtl
;
center-manage/app/base/db/impl/common/connection.js
View file @
dd54f122
...
...
@@ -62,6 +62,9 @@ class DbFactory{
this
.
db
.
models
.
route
.
belongsTo
(
this
.
db
.
models
.
app
,{
constraints
:
false
,});
this
.
db
.
models
.
plugin
.
belongsTo
(
this
.
db
.
models
.
app
,{
constraints
:
false
,});
//渠道和渠道路径方法映射
this
.
db
.
models
.
pathtomethod
.
belongsTo
(
this
.
db
.
models
.
channel
,{
constraints
:
false
,});
}
//async getCon(){,用于使用替换table模型内字段数据使用
getCon
(){
...
...
center-manage/app/base/db/models/common/channel.js
0 → 100644
View file @
dd54f122
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"channel"
,
{
code
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
name
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
//和user的from相同,在注册user时,去创建
routehost
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
}
//和user的from相同,在注册user时,去创建
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'p_channel'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
center-manage/app/base/db/models/common/pathtomethod.js
0 → 100644
View file @
dd54f122
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"pathtomethod"
,
{
path
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
method
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
//和user的from相同,在注册user时,去创建
desc
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'p_pathtomethod'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
center-manage/app/base/service/impl/common/channelSve.js
0 → 100644
View file @
dd54f122
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
class
ChannelService
extends
ServiceBase
{
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
ChannelService
));
}
async
create
(
p
,
q
,
req
){
let
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
)
{
let
u
=
await
self
.
dao
.
create
(
p
,
t
)
//创建路由--针对于特定来源渠道域名的路由,给中台服务添加路由
try
{
let
ps
=
[
"/"
]
let
routeobj
=
await
self
.
cjsonregister
(
ChannelService
.
newRouteUrl
(
settings
.
pmappname
),
{
name
:
p
.
code
,
paths
:
ps
,
hosts
:
[
p
.
routehost
],
strip_path
:
false
})
}
catch
(
e
){
await
self
.
cdel
(
ChannelService
.
routeUrl
(
p
.
code
))
throw
new
Error
(
"创建渠道报错"
)
}
return
u
})
}
async
update
(
p
,
q
,
req
){
let
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
)
{
let
old
=
await
self
.
dao
.
findOne
({
id
:
p
.
id
})
let
u
=
await
self
.
dao
.
update
(
p
,
t
)
//创建路由--针对于特定来源渠道域名的路由,给中台服务添加路由
try
{
await
self
.
cdel
(
ChannelService
.
routeUrl
(
old
.
code
))
let
ps
=
[
"/"
]
let
routeobj
=
await
self
.
cjsonregister
(
ChannelService
.
newRouteUrl
(
settings
.
pmappname
),
{
name
:
p
.
code
,
paths
:
ps
,
hosts
:
[
p
.
routehost
],
strip_path
:
false
})
}
catch
(
e
){
throw
new
Error
(
"创建渠道报错"
)
}
return
u
})
}
async
delete
(
p
,
q
,
req
){
let
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
)
{
let
u
=
await
self
.
dao
.
delete
(
p
,
t
)
//创建路由--针对于特定来源渠道域名的路由,给中台服务添加路由
try
{
await
self
.
cdel
(
ChannelService
.
routeUrl
(
u
.
code
))
}
catch
(
e
){
throw
new
Error
(
"创建渠道报错"
)
}
return
u
})
}
}
module
.
exports
=
ChannelService
;
\ No newline at end of file
center-manage/app/base/service/impl/common/pathtomethodSve.js
0 → 100644
View file @
dd54f122
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
class
PathtomethodService
extends
ServiceBase
{
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
PathtomethodService
));
}
}
module
.
exports
=
PathtomethodService
;
\ No newline at end of file
center-manage/app/base/service/sve.base.js
View file @
dd54f122
...
...
@@ -159,6 +159,25 @@ class ServiceBase {
return
null
;
}
}
async
cjsonupate
(
opurl
,
opts
){
try
{
let
rtn
=
await
system
.
postJsonTypeReq
(
opurl
,
opts
,
"PATCH"
)
console
.
log
(
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
,
rtn
);
if
(
rtn
.
statusCode
==
409
){
//return new Error("已经存在相同的统一账号名称!");
return
null
;
}
if
(
rtn
.
statusCode
==
201
){
return
rtn
.
data
;
}
else
{
throw
new
Error
(
rtn
.
data
);
}
return
null
;
}
catch
(
e
){
console
.
log
(
e
);
return
null
;
}
}
async
cdel
(
opurl
){
try
{
let
rtn
=
await
system
.
delReq
(
opurl
)
...
...
center-manage/app/config/settings.js
View file @
dd54f122
...
...
@@ -26,6 +26,7 @@ var settings = {
return
ENVINPUT
.
KONG_ADMIAN
;
}
},
pmappname
:
"center-app"
,
pmappid
:
1
,
pmcompanyid
:
1
,
pmroleid
:{
"ta"
:
1
,
"pr"
:
2
},
...
...
center-manage/plan.txt
0 → 100644
View file @
dd54f122
1.渠道管理
-建立渠道( 简码 名称 域名 )
--同时给中台服务建立一个新的路由
--建立路径与方法名的映射表,从属于渠道
--在中台建立新的 拦截器,读取渠道缓存,判断req.host,如果在渠道域名范围内,就
调用统一的渠道流入处理接口,解析出chanel-code,根据req.path,解析出方法名,method,调用生成者服务接口
添加数据{
channelcode:T,
method:'createChance',
bodydata:'xxx'
}
-建立消费者微服务
2.产品中心
3、交付商管理
---技能标签
---地区区域-----------组件----路径
4、日志服务调用
5、K8s环境搭建
--提供k8集群/镜像服务--git push tag--自动打包
--我们提供yaml上线文件/Dockerfile
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