From fc4d92c4d600af31dfb521cc14399e96dcea36b6 Mon Sep 17 00:00:00 2001 From: marvzhang Date: Sun, 16 Feb 2020 10:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0scrapy=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/model/schedule.go | 27 ++++++++++---------- backend/services/schedule.go | 3 +-- frontend/src/views/schedule/ScheduleList.vue | 3 --- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/backend/model/schedule.go b/backend/model/schedule.go index 1b988f2a..a23b6973 100644 --- a/backend/model/schedule.go +++ b/backend/model/schedule.go @@ -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"` diff --git a/backend/services/schedule.go b/backend/services/schedule.go index ab47d7e3..ad41b969 100644 --- a/backend/services/schedule.go +++ b/backend/services/schedule.go @@ -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 } diff --git a/frontend/src/views/schedule/ScheduleList.vue b/frontend/src/views/schedule/ScheduleList.vue index 7835fdb0..997488b8 100644 --- a/frontend/src/views/schedule/ScheduleList.vue +++ b/frontend/src/views/schedule/ScheduleList.vue @@ -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) {