Kaynağa Gözat

Merge branch 'refs/heads/eta_2.0.8_ly_0804@guomengyuan'

gmy 3 ay önce
ebeveyn
işleme
56762a043c
2 değiştirilmiş dosya ile 17 ekleme ve 7 silme
  1. 8 3
      services/task.go
  2. 9 4
      utils/config.go

+ 8 - 3
services/task.go

@@ -2,6 +2,7 @@ package services
 
 import (
 	"context"
+	"eta/eta_crawler/services/liangyou"
 	"eta/eta_crawler/services/sci99"
 	"eta/eta_crawler/utils"
 	"fmt"
@@ -34,8 +35,6 @@ func Task() {
 
 		crawlerIcpi := task.NewTask("refreshData", "0 0,30 16-23 * * *", CrawlerIcpi) //居民消费价格指数
 
-		//lyData := task.NewTask("refreshData", "0 0,30 16-23 * * *", liangyou.LyDataDeal) //todo 粮油商务网 时间上线定
-
 		// 统计局-分月季年爬
 		//refreshNationalMonthA := task.NewTask("RefreshNationalMonthDbA", "0 15 2 10 * *", national_data.RefreshNationalMonthDbA)
 		//refreshNationalMonthB := task.NewTask("RefreshNationalMonthDbB", "0 15 2 16 * *", national_data.RefreshNationalMonthDbB)
@@ -53,7 +52,13 @@ func Task() {
 		task.AddTask("UN月度数据", syncYearMonthComTrade) //每月1号的3点同步
 
 		task.AddTask("居民消费价格指数", crawlerIcpi) //每月1号的3点同步
-		//task.AddTask("粮油商务网", lyData)
+
+	}
+
+	if utils.LY_OPEN == "1" {
+		lyData := task.NewTask("refreshData", "0 0 12 * * *", liangyou.LyDataDeal) // 粮油商务网
+
+		task.AddTask("粮油商务网", lyData)
 	}
 
 	if utils.BusinessCode == utils.BusinessCodeFuBang {

+ 9 - 4
utils/config.go

@@ -38,6 +38,7 @@ var (
 	LY_USERNAME  string
 	LY_PASSWORD  string
 	LY_JSON_PATH string
+	LY_OPEN      string
 )
 
 var (
@@ -102,10 +103,7 @@ func init() {
 	if RunMode == "release" {
 
 	} else {
-		// todo 粮油商务网 上线再根据环境做配置
-		LY_USERNAME = config["ly_username"]
-		LY_PASSWORD = config["ly_password"]
-		LY_JSON_PATH = config["ly_json_path"]
+
 	}
 	//日志配置
 	{
@@ -118,4 +116,11 @@ func init() {
 		logMaxDaysStr := config["log_max_day"]
 		LogMaxDays, _ = strconv.Atoi(logMaxDaysStr)
 	}
+
+	{
+		LY_USERNAME = config["ly_username"]
+		LY_PASSWORD = config["ly_password"]
+		LY_JSON_PATH = config["ly_json_path"]
+		LY_OPEN = config["ly_open"]
+	}
 }