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
f032ecab
Commit
f032ecab
authored
May 06, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
fec9a8d6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
center-manage/app/base/controller/impl/common/routeCtl.js
+5
-3
center-manage/app/base/db/models/common/route.js
+8
-0
center-manage/app/base/service/impl/common/appSve.js
+6
-4
No files found.
center-manage/app/base/controller/impl/common/routeCtl.js
View file @
f032ecab
...
...
@@ -16,10 +16,12 @@ class RouteCtl extends CtlBase {
let
apptmp
=
await
this
.
appS
.
findById
(
appid
)
let
routedata
=
{
name
:
p
.
name
,
hosts
:
p
.
hosts
.
split
(
","
),
paths
:
p
.
paths
.
split
(
","
),
hosts
:
p
.
s
hosts
.
split
(
","
),
paths
:
p
.
s
paths
.
split
(
","
),
isstrip
:
false
,
app_id
:
appid
app_id
:
appid
,
shosts
:
p
.
shosts
,
spaths
:
p
.
spaths
}
let
rtn
=
await
this
.
service
.
create
(
apptmp
.
name
,
routedata
,
req
);
return
system
.
getResult
(
rtn
)
...
...
center-manage/app/base/db/models/common/route.js
View file @
f032ecab
...
...
@@ -11,6 +11,14 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
//和user的from相同,在注册user时,去创建
shosts
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
},
spaths
:{
type
:
DataTypes
.
STRING
,
allowNull
:
false
,
}
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
...
...
center-manage/app/base/service/impl/common/appSve.js
View file @
f032ecab
...
...
@@ -53,11 +53,13 @@ class AppService extends ServiceBase {
//创建后台应用服务
let
svobj
=
await
self
.
cjsonregister
(
AppService
.
newServiceUrl
(),{
name
:
app
.
name
,
url
:
"http://"
+
app
.
backend
})
//添加路由
let
ps
=
[
"/web/auth/userCtl/pmlogin"
,
"/web/auth/userCtl/pmregister"
,
"/web/auth/userCtl/pmSendVCode"
,
"/web/auth/userCtl/pmloginByVCode"
]
let
routeobj
=
await
self
.
cjsonregister
(
AppService
.
newRouteUrl
(
app
.
name
),
{
name
:
app
.
name
,
paths
:[
"/web/auth/userCtl/pmlogin"
,
"/web/auth/userCtl/pmregister"
,
"/web/auth/userCtl/pmSendVCode"
,
"/web/auth/userCtl/pmloginByVCode"
],
hosts
:[
app
.
domainName
],
strip_path
:
false
})
let
routeapi
=
await
self
.
cjsonregister
(
AppService
.
newRouteUrl
(
app
.
name
),{
name
:
app
.
name
+
"_api"
,
hosts
:[
app
.
domainName
],
paths
:[
"/api"
,
"/web"
],
strip_path
:
false
})
let
r1
=
await
self
.
routeDao
.
create
({
name
:
app
.
name
,
center_id
:
routeobj
.
id
,
app_id
:
app
.
id
},
t
);
let
r2
=
await
self
.
routeDao
.
create
({
name
:
app
.
name
+
"_api"
,
center_id
:
routeapi
.
id
,
app_id
:
app
.
id
},
t
);
{
name
:
app
.
name
,
paths
:
ps
,
hosts
:[
app
.
domainName
],
strip_path
:
false
})
let
ps2
=
[
"/api"
,
"/web"
]
let
routeapi
=
await
self
.
cjsonregister
(
AppService
.
newRouteUrl
(
app
.
name
),{
name
:
app
.
name
+
"_api"
,
hosts
:[
app
.
domainName
],
paths
:
ps2
,
strip_path
:
false
})
let
r1
=
await
self
.
routeDao
.
create
({
name
:
app
.
name
,
center_id
:
routeobj
.
id
,
app_id
:
app
.
id
,
shosts
:
app
.
domainName
,
spaths
:
ps
.
join
(
","
)},
t
);
let
r2
=
await
self
.
routeDao
.
create
({
name
:
app
.
name
+
"_api"
,
center_id
:
routeapi
.
id
,
app_id
:
app
.
id
,
shosts
:
app
.
domainName
,
spaths
:
ps2
.
join
(
","
)},
t
);
//给api路由启动插件
await
self
.
cjsonregister
(
AppService
.
bindPluginUrl
(
app
.
name
+
"_api"
),{
name
:
"jwt"
})
if
(
svobj
&&
routeobj
&&
r1
&&
r2
){
...
...
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