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
85b82ade
authored
Dec 24, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
比价
parent
1f627a1f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
5 deletions
doc/test/sic1.go
doc/test/time1.go
go.mod
service/parity_service.go
doc/test/sic1.go
View file @
85b82ade
...
@@ -5,8 +5,9 @@ import "fmt"
...
@@ -5,8 +5,9 @@ import "fmt"
func
main
()
{
func
main
()
{
s
:=
[]
int
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
}
s
:=
[]
int
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
}
//s := []int{33}
fmt
.
Println
(
len
(
s
))
fmt
.
Println
(
len
(
s
))
s
=
s
[
3
:
9
]
s
=
s
[
1
:
10
]
fmt
.
Println
(
s
)
fmt
.
Println
(
s
)
fmt
.
Println
(
len
(
s
))
fmt
.
Println
(
len
(
s
))
fmt
.
Println
(
cap
(
s
))
fmt
.
Println
(
cap
(
s
))
...
...
doc/test/time1.go
0 → 100644
View file @
85b82ade
package
main
import
(
"net/http"
"time"
"github.com/gin-contrib/timeout"
"github.com/gin-gonic/gin"
)
func
emptySuccessResponse
(
c
*
gin
.
Context
)
{
time
.
Sleep
(
2
*
time
.
Second
)
c
.
String
(
http
.
StatusOK
,
""
)
}
func
errorResponse
(
c
*
gin
.
Context
)
{
c
.
String
(
http
.
StatusRequestTimeout
,
"超时"
)
}
func
main
()
{
r
:=
gin
.
New
()
r
.
GET
(
"/"
,
timeout
.
New
(
timeout
.
WithTimeout
(
100
*
time
.
Microsecond
),
timeout
.
WithHandler
(
emptySuccessResponse
),
timeout
.
WithResponse
(
errorResponse
),
))
// Listen and Server in 0.0.0.0:8080
r
.
Run
(
":8080"
)
}
\ No newline at end of file
go.mod
View file @
85b82ade
...
@@ -6,6 +6,7 @@ require (
...
@@ -6,6 +6,7 @@ require (
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd // indirect
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd // indirect
github.com/elliotchance/orderedmap v1.3.0 // indirect
github.com/elliotchance/orderedmap v1.3.0 // indirect
github.com/gin-contrib/cors v1.3.1
github.com/gin-contrib/cors v1.3.1
github.com/gin-contrib/timeout v0.0.1 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/gin-gonic/gin v1.6.3
github.com/go-ini/ini v1.57.0
github.com/go-ini/ini v1.57.0
github.com/go-playground/validator/v10 v10.4.0 // indirect
github.com/go-playground/validator/v10 v10.4.0 // indirect
...
@@ -34,7 +35,6 @@ require (
...
@@ -34,7 +35,6 @@ require (
github.com/prometheus/procfs v0.0.11 // indirect
github.com/prometheus/procfs v0.0.11 // indirect
github.com/sirupsen/logrus v1.5.0
github.com/sirupsen/logrus v1.5.0
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/stretchr/testify v1.5.1 // indirect
github.com/syyongx/php2go v0.9.4
github.com/syyongx/php2go v0.9.4
github.com/tidwall/gjson v1.6.1
github.com/tidwall/gjson v1.6.1
github.com/tidwall/sjson v1.1.1 // indirect
github.com/tidwall/sjson v1.1.1 // indirect
...
...
service/parity_service.go
View file @
85b82ade
...
@@ -152,11 +152,9 @@ func (qs *ParityService) GetParity(ctx *gin.Context) (results model.LyResponse)
...
@@ -152,11 +152,9 @@ func (qs *ParityService) GetParity(ctx *gin.Context) (results model.LyResponse)
}
}
}
}
offset
:=
page_from
+
gconv
.
Int
(
page_size
)
offset
:=
page_from
+
gconv
.
Int
(
page_size
)
if
offset
>
allCount
||
page_from
>
allCount
{
if
offset
>
allCount
{
page_from
=
allCount
offset
=
allCount
offset
=
allCount
}
}
slicNew
:=
slic
[
page_from
:
offset
]
slicNew
:=
slic
[
page_from
:
offset
]
pageData
:=
PageClear
(
ctx
,
gconv
.
Int64
(
allCount
));
pageData
:=
PageClear
(
ctx
,
gconv
.
Int64
(
allCount
));
pageData
[
"took"
]
=
gjson
.
Get
(
esResult
,
"took"
)
.
Int
()
pageData
[
"took"
]
=
gjson
.
Get
(
esResult
,
"took"
)
.
Int
()
...
...
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