Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
open-source
/
dev-ops
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
60f59f70
authored
Jun 25, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
modify return content
parent
e80a94c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
api/v1/apiList.go
internal/service/apiDetail.go
internal/service/apiList.go
api/v1/apiList.go
View file @
60f59f70
...
...
@@ -5,7 +5,7 @@ import "github.com/gogf/gf/v2/frame/g"
type
ApiListReq
struct
{
g
.
Meta
`path:"/api/list" method:"get" summary:"查询api列表"`
Page
int
`json:"page" d:"1" dc:"请输入第几页,不传默认第1页"`
Limit
int
`json:"limit" d:"
5
0" dc:"每页限制个数"`
Limit
int
`json:"limit" d:"
3
0" dc:"每页限制个数"`
Sort
bool
`json:"sort" d:"false" dc:"按照调用次数从多到少排序"`
OffsetTime
int64
`json:"offset_time" dc:"offset_time为时间戳"`
}
...
...
internal/service/apiDetail.go
0 → 100644
View file @
60f59f70
package
service
internal/service/apiList.go
View file @
60f59f70
...
...
@@ -16,6 +16,11 @@ import (
"time"
)
type
ApiListData
struct
{
Total
int
`json:"total"`
InterfaceNameInfoList
[]
InterfaceNameInfo
`json:"interface_name_info_list"`
}
type
InterfaceNameInfo
struct
{
InterfaceName
string
`json:"interface_name"`
Version
string
`json:"version"`
...
...
@@ -40,6 +45,7 @@ func (s *sApiList) GetApiList(ctx context.Context, req *v1.ApiListReq) (interfac
for
i
:=
0
;
i
<
len
(
interfaceNameInfoList
);
i
++
{
interfaceNameInfoList
[
i
]
.
DayCallNum
=
GetNumsByInterfaceName
(
ctx
,
interfaceNameInfoList
[
i
]
.
URI
)
}
total
:=
len
(
interfaceNameInfoList
)
var
sortByCallNums
bool
=
req
.
Sort
if
sortByCallNums
{
sort
.
Slice
(
interfaceNameInfoList
,
func
(
i
,
j
int
)
bool
{
...
...
@@ -60,7 +66,10 @@ func (s *sApiList) GetApiList(ctx context.Context, req *v1.ApiListReq) (interfac
interfaceNameInfoList
=
interfaceNameInfoList
[
start
:
end
]
}
}
return
interfaceNameInfoList
,
response
.
CodeSuccess
apiListData
:=
ApiListData
{}
apiListData
.
Total
=
total
apiListData
.
InterfaceNameInfoList
=
interfaceNameInfoList
return
apiListData
,
response
.
CodeSuccess
}
// 查询某api调用总次数
...
...
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