更新scrapy参数

This commit is contained in:
marvzhang
2020-02-16 10:38:41 +08:00
parent 0a9dcd707a
commit fc4d92c4d6
3 changed files with 15 additions and 18 deletions

View File

@@ -12,19 +12,20 @@ import (
)
type Schedule struct {
Id bson.ObjectId `json:"_id" bson:"_id"`
Name string `json:"name" bson:"name"`
Description string `json:"description" bson:"description"`
SpiderId bson.ObjectId `json:"spider_id" bson:"spider_id"`
Cron string `json:"cron" bson:"cron"`
EntryId cron.EntryID `json:"entry_id" bson:"entry_id"`
Param string `json:"param" bson:"param"`
RunType string `json:"run_type" bson:"run_type"`
NodeIds []bson.ObjectId `json:"node_ids" bson:"node_ids"`
Status string `json:"status" bson:"status"`
Enabled bool `json:"enabled" bson:"enabled"`
UserId bson.ObjectId `json:"user_id" bson:"user_id"`
ScrapySpider string `json:"scrapy_spider" bson:"scrapy_spider"`
Id bson.ObjectId `json:"_id" bson:"_id"`
Name string `json:"name" bson:"name"`
Description string `json:"description" bson:"description"`
SpiderId bson.ObjectId `json:"spider_id" bson:"spider_id"`
Cron string `json:"cron" bson:"cron"`
EntryId cron.EntryID `json:"entry_id" bson:"entry_id"`
Param string `json:"param" bson:"param"`
RunType string `json:"run_type" bson:"run_type"`
NodeIds []bson.ObjectId `json:"node_ids" bson:"node_ids"`
Status string `json:"status" bson:"status"`
Enabled bool `json:"enabled" bson:"enabled"`
UserId bson.ObjectId `json:"user_id" bson:"user_id"`
ScrapySpider string `json:"scrapy_spider" bson:"scrapy_spider"`
ScrapyLogLevel string `json:"scrapy_log_level" bson:"scrapy_log_level"`
// 前端展示
SpiderName string `json:"spider_name" bson:"spider_name"`

View File

@@ -38,8 +38,7 @@ func AddScheduleTask(s model.Schedule) func() {
debug.PrintStack()
return
}
param = s.ScrapySpider + " " + s.Param
param = s.ScrapySpider + " -L " + s.ScrapyLogLevel + " " + s.Param
} else {
param = s.Param
}

View File

@@ -466,9 +466,6 @@ export default {
if (res) {
const form = JSON.parse(JSON.stringify(this.scheduleForm))
form.cron = '0 ' + this.scheduleForm.cron
if (this.spiderForm.is_scrapy) {
form.param += form.param + ' --loglevel=' + form.scrapy_log_level
}
if (this.isEdit) {
request.post(`/schedules/${this.scheduleForm._id}`, form).then(response => {
if (response.data.error) {