Files
crawlab/backend/services/challenge/create_configurable_spider.go
2020-03-19 18:56:59 +08:00

24 lines
442 B
Go

package challenge
import (
"crawlab/constants"
"crawlab/model"
"github.com/globalsign/mgo/bson"
)
type CreateConfigurableSpiderService struct {
UserId bson.ObjectId
}
func (s *CreateConfigurableSpiderService) Check() (bool, error) {
query := bson.M{
"user_id": s.UserId,
"type": constants.Configurable,
}
_, count, err := model.GetSpiderList(query, 0, 1, "-_id")
if err != nil {
return false, err
}
return count > 0, nil
}