mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
fix: added default fields
This commit is contained in:
@@ -2,6 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/crawlab-team/crawlab/core/constants"
|
||||
"github.com/crawlab-team/crawlab/core/models/models"
|
||||
"math"
|
||||
"os"
|
||||
@@ -252,6 +253,13 @@ func PostSpider(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if s.Mode == "" {
|
||||
s.Mode = constants.RunTypeRandom
|
||||
}
|
||||
if s.Priority == 0 {
|
||||
s.Priority = 5
|
||||
}
|
||||
|
||||
// user
|
||||
u := GetUserFromContext(c)
|
||||
|
||||
|
||||
@@ -18,6 +18,12 @@ func GetPagination(c *gin.Context) (p *entity.Pagination, err error) {
|
||||
if err := c.ShouldBindQuery(&_p); err != nil {
|
||||
return GetDefaultPagination(), err
|
||||
}
|
||||
if _p.Page == 0 {
|
||||
_p.Page = constants.PaginationDefaultPage
|
||||
}
|
||||
if _p.Size == 0 {
|
||||
_p.Size = constants.PaginationDefaultSize
|
||||
}
|
||||
return &_p, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user