Skip to content

Commit

Permalink
update vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
LyricTian committed Dec 5, 2018
1 parent d09e94f commit 22985f7
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 38 deletions.
10 changes: 10 additions & 0 deletions src/util/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ func (s S) String() string {
return string(s)
}

// Bytes 转换为[]byte
func (s S) Bytes() []byte {
return []byte(s)
}

// Int64 转换为int64
func (s S) Int64() int64 {
i, err := strconv.ParseInt(s.String(), 10, 64)
Expand Down Expand Up @@ -47,3 +52,8 @@ func (s S) Float64() float64 {
}
return f
}

// ToJSON 转换为JSON
func (s S) ToJSON(v interface{}) error {
return json.Unmarshal(s.Bytes(), v)
}
4 changes: 2 additions & 2 deletions src/web/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (a *Context) NewContext() context.Context {
// GetPageIndex 获取分页的页索引
func (a *Context) GetPageIndex() uint {
if v := a.Query("current"); v != "" {
if iv := util.T(v).Uint(); iv > 0 {
if iv := util.S(v).Uint(); iv > 0 {
return iv
}
}
Expand All @@ -54,7 +54,7 @@ func (a *Context) GetPageIndex() uint {
// GetPageSize 获取分页的页大小
func (a *Context) GetPageSize() uint {
if v := a.Query("pageSize"); v != "" {
if iv := util.T(v).Uint(); iv > 0 {
if iv := util.S(v).Uint(); iv > 0 {
if iv > 50 {
iv = 50
}
Expand Down
68 changes: 35 additions & 33 deletions vendor/github.com/go-session/session/session.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@
"revisionTime": "2018-10-28T14:48:24Z"
},
{
"checksumSHA1": "dH36OQigThXmmJRoFJLmRcWW9c4=",
"checksumSHA1": "gufNtKOpj7eLFn5rHYUuKdyrh4U=",
"path": "github.com/go-session/session",
"revision": "5148957874831f27a7d95f708d41eff3d76ec658",
"revisionTime": "2018-11-20T03:52:31Z"
"revision": "cdd85262bbc8417a570bbf5f26ffc3a85540f809",
"revisionTime": "2018-12-05T12:29:55Z"
},
{
"checksumSHA1": "/A5P2s8crcwfDyqHKCh16Yt9jd4=",
Expand Down

0 comments on commit 22985f7

Please sign in to comment.