Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
0110717b
Commit
0110717b
authored
Jun 30, 2023
by
陈子龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-czl' into dev
parents
e913199c
b17036ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
6 deletions
+44
-6
src/bean/vo/response/host_manage.go
src/bean/vo/response/host_manage.go
+5
-0
src/controller/host_manage.go
src/controller/host_manage.go
+15
-3
src/router/automatedmaintenrouter.go
src/router/automatedmaintenrouter.go
+2
-1
src/service/host_manage.go
src/service/host_manage.go
+22
-2
No files found.
src/bean/vo/response/host_manage.go
View file @
0110717b
...
...
@@ -49,6 +49,11 @@ type HostManagesRes struct {
IpCnt
int
`json:"ip_cnt"`
// ip数量(全部)
}
type
HostManagesListRes
struct
{
Id
int
`json:"id"`
// id
HostName
string
`json:"host_name"`
// 主机分组名称
}
type
HostManageListRes
struct
{
Id
int
`json:"id"`
// id
Ip
string
`json:"ip"`
// ip
...
...
src/controller/host_manage.go
View file @
0110717b
...
...
@@ -179,8 +179,8 @@ func DetailsHostManage(c *gin.Context) {
SendJsonResponse
(
c
,
resp
.
OK
,
data
)
}
//
ListHostManage 列表
func
ListHostManage
(
c
*
gin
.
Context
)
{
//
PageListHostManage 列表-分页
func
Page
ListHostManage
(
c
*
gin
.
Context
)
{
var
req
request
.
ListHostManageReq
if
err
:=
c
.
ShouldBindJSON
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
nil
)
...
...
@@ -188,7 +188,7 @@ func ListHostManage(c *gin.Context) {
}
hostManageSvc
:=
service
.
HostManageSvc
{}
total
,
list
,
err
:=
hostManageSvc
.
ListHostManage
(
req
)
total
,
list
,
err
:=
hostManageSvc
.
Page
ListHostManage
(
req
)
if
err
!=
nil
{
SendJsonPageResponse
(
c
,
err
,
nil
,
0
)
return
...
...
@@ -344,3 +344,15 @@ func ExportIp(c *gin.Context) {
c
.
File
(
conf
.
Options
.
TempDirPrefix
+
fileName
)
}
// ListHostManage 列表
func
ListHostManage
(
c
*
gin
.
Context
)
{
hostManageSvc
:=
service
.
HostManageSvc
{}
list
,
err
:=
hostManageSvc
.
ListHostManage
()
if
err
!=
nil
{
SendJsonResponse
(
c
,
err
,
nil
)
return
}
SendJsonResponse
(
c
,
resp
.
OK
,
list
)
}
src/router/automatedmaintenrouter.go
View file @
0110717b
...
...
@@ -27,9 +27,10 @@ func InitAutomatedMaintenRouter(e *gin.Engine) {
host
.
PUT
(
"/edit"
,
controller
.
EditHostManage
)
// 编辑
host
.
DELETE
(
"/del"
,
controller
.
DelHostManage
)
// 删除
host
.
GET
(
"/details"
,
controller
.
DetailsHostManage
)
// 详情
host
.
GET
(
"/
list"
,
controller
.
ListHostManage
)
// 列表
host
.
GET
(
"/
page_list"
,
controller
.
PageListHostManage
)
// 列表-分页
host
.
POST
(
"/state"
,
controller
.
StateHostManage
)
// 状态检测
host
.
GET
(
"/ip_exception_list"
,
controller
.
HostIpExceptionList
)
// 主机ip异常列表
host
.
GET
(
"/export"
,
controller
.
ExportIp
)
// 导出ip列表
host
.
GET
(
"/list"
,
controller
.
ListHostManage
)
// 主机分组列表
}
}
src/service/host_manage.go
View file @
0110717b
...
...
@@ -294,8 +294,8 @@ func (h *HostManageSvc) DetailsHostManage(id int) (hostManageRes response.HostMa
return
}
//
ListHostManage 列表
func
(
h
*
HostManageSvc
)
ListHostManage
(
req
request
.
ListHostManageReq
)
(
total
int64
,
hostManageListRes
[]
response
.
HostManagesRes
,
err
error
)
{
//
PageListHostManage 列表-分页
func
(
h
*
HostManageSvc
)
Page
ListHostManage
(
req
request
.
ListHostManageReq
)
(
total
int64
,
hostManageListRes
[]
response
.
HostManagesRes
,
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
WithError
(
err
)
...
...
@@ -634,3 +634,23 @@ func generatePushExportXlsx(push []ExportIpStr) (string, error) {
err
:=
file
.
Save
(
conf
.
Options
.
TempDirPrefix
+
saveFileName
)
return
saveFileName
,
err
}
// ListHostManage 列表
func
(
h
*
HostManageSvc
)
ListHostManage
()
(
hostManagesListRes
[]
response
.
HostManagesListRes
,
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
err
=
resp
.
DbConnectError
.
WithError
(
err
)
return
}
finder
:=
db
.
Table
(
"host_manage"
)
.
Where
(
"is_delete = 0"
)
finder
.
OrderBy
(
"id"
)
//查询任务
err
=
finder
.
Select
(
"id,host_name"
)
.
Find
(
&
hostManagesListRes
)
if
err
!=
nil
{
err
=
resp
.
DbSelectError
.
WithError
(
err
)
return
}
return
}
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