Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_server
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
172abb9f
authored
Feb 19, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新商品分页
parent
7820ab56
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
service/optimum_service.go
service/optimum_service.go
View file @
172abb9f
...
@@ -301,6 +301,7 @@ func PageClear(ctx *gin.Context,total int64) map[string]interface{}{
...
@@ -301,6 +301,7 @@ func PageClear(ctx *gin.Context,total int64) map[string]interface{}{
page
[
"total"
]
=
strconv
.
FormatInt
(
total
,
10
)
page
[
"total"
]
=
strconv
.
FormatInt
(
total
,
10
)
page
[
"current_page"
]
=
p
page
[
"current_page"
]
=
p
page
[
"offset"
]
=
page_size
page
[
"offset"
]
=
page_size
if
total
==
10000
{
if
total
==
10000
{
page
[
"total_page"
]
=
math
.
Ceil
(
float64
(
total
)
/
common
.
MyFloat64
(
page_size
))
page
[
"total_page"
]
=
math
.
Ceil
(
float64
(
total
)
/
common
.
MyFloat64
(
page_size
))
}
else
{
}
else
{
...
@@ -318,7 +319,8 @@ func PageClear(ctx *gin.Context,total int64) map[string]interface{}{
...
@@ -318,7 +319,8 @@ func PageClear(ctx *gin.Context,total int64) map[string]interface{}{
if
pInt
>
1000
{
if
pInt
>
1000
{
pInt
=
1000
pInt
=
1000
}
}
if
pInt
>
996
{
checkPage
:=
gconv
.
Int
(
page
[
"total_page"
])
if
pInt
>=
checkPage
{
for
i
:=
pInt
-
10
;
i
<=
pInt
;
i
++
{
for
i
:=
pInt
-
10
;
i
<=
pInt
;
i
++
{
//原始查询参数拼接
//原始查询参数拼接
pageData
[
i
]
=
i
pageData
[
i
]
=
i
...
@@ -329,7 +331,7 @@ func PageClear(ctx *gin.Context,total int64) map[string]interface{}{
...
@@ -329,7 +331,7 @@ func PageClear(ctx *gin.Context,total int64) map[string]interface{}{
if
pageNum
==
10
{
if
pageNum
==
10
{
break
break
}
}
if
pInt
>
6
&&
pInt
<=
996
{
if
pInt
>
6
&&
pInt
<=
checkPage
{
//大于10页只获取中间10页
//大于10页只获取中间10页
if
i
<
pInt
-
5
||
i
>
pInt
+
5
{
if
i
<
pInt
-
5
||
i
>
pInt
+
5
{
continue
continue
...
...
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