Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-group
Commits
e0ecdb1b
Commit
e0ecdb1b
authored
Mar 13, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into feature/3.5_cwj
parents
d19b7c94
cd9c8da7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
response.go
resp/response.go
+26
-0
No files found.
resp/response.go
View file @
e0ecdb1b
...
@@ -135,3 +135,29 @@ func ResponsePageOk(c *gin.Context, data interface{}, total uint, index int) {
...
@@ -135,3 +135,29 @@ func ResponsePageOk(c *gin.Context, data interface{}, total uint, index int) {
traceId
,
_
:=
c
.
Get
(
mycontext
.
TRACEID
)
traceId
,
_
:=
c
.
Get
(
mycontext
.
TRACEID
)
mylogrus
.
MyLog
.
Infof
(
"ResponsePageOk traceId: %s, JSON takes %v"
,
traceId
,
timeDiff
)
mylogrus
.
MyLog
.
Infof
(
"ResponsePageOk traceId: %s, JSON takes %v"
,
traceId
,
timeDiff
)
}
}
type
PageRespBase
struct
{
NextPageIndex
int
`json:"nextPageIndex"`
HasNextPage
bool
`json:"hasNextPage"`
Data
interface
{}
`json:"data"`
// 需要具体自定义
}
// 分页返回
// 客户端入参 PageReqBase
// 服务端返回 PageRespBase
func
ResponsePageBaseOk
(
c
*
gin
.
Context
,
data
interface
{},
nextPageIndex
int
,
hasNextPage
bool
)
{
if
data
==
nil
{
data
=
make
([]
interface
{},
0
)
}
response
:=
Response
{
Code
:
myerr
.
GetSuccessCode
(),
Message
:
myerr
.
GetSuccessMsg
(),
OperationMessage
:
myerr
.
GetSuccessMsg
(),
Data
:
PageRespBase
{
NextPageIndex
:
nextPageIndex
,
HasNextPage
:
hasNextPage
,
Data
:
data
,
},
}
c
.
JSON
(
http
.
StatusOK
,
response
)
}
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