Procházet zdrojové kódy

Merge branch 'ETA_1.6.4'

zwxi před 1 rokem
rodič
revize
353f929082
4 změnil soubory, kde provedl 31 přidání a 3 odebrání
  1. binární
      eta_data_analysis
  2. 19 0
      services/mail_attachment.go
  3. 5 0
      services/task.go
  4. 7 3
      utils/config.go

binární
eta_data_analysis


+ 19 - 0
services/mail_attachment.go

@@ -0,0 +1,19 @@
+package services
+
+import (
+	"context"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"os/exec"
+)
+
+func MailAttachment(context.Context) (err error)  {
+	cmd := exec.Command("python3", utils.CoalMailAttachmentScriptPath)
+	outputByte, err := cmd.Output()
+	fmt.Println("start")
+	if err != nil {
+		return
+	}
+	fmt.Println(string(outputByte))
+	return
+}

+ 5 - 0
services/task.go

@@ -61,6 +61,11 @@ func Task() {
 		c.Start()
 	}
 
+	if utils.CoalMailAttachmentOpen == "1" {
+		mailAttachment := task.NewTask("MailAttachment", "0 0 */1 * * *", MailAttachment)
+		task.AddTask("启动获取邮件附件脚本", mailAttachment)
+	}
+
 	task.StartTask()
 
 	fmt.Println("task end")

+ 7 - 3
utils/config.go

@@ -44,8 +44,10 @@ var (
 
 // 中国煤炭网
 var (
-	CoalMineFilePath string //excel文件地址
-	CoalMineOpen     string //是否配置中国煤炭网数据源,1已配置
+	CoalMineFilePath             string //excel文件地址
+	CoalMineOpen                 string //是否配置中国煤炭网数据源,1已配置
+	CoalMailAttachmentScriptPath string // 获取邮件附件的脚本目录
+	CoalMailAttachmentOpen string // 获取邮件附件功能,1已配置
 )
 
 // 汾渭煤炭
@@ -58,7 +60,7 @@ var (
 // 煤炭江湖
 var (
 	MtjhFilePath string //excel文件地址
-	MtjhOpen string //是否配置煤炭江湖数据源,1已配置
+	MtjhOpen     string //是否配置煤炭江湖数据源,1已配置
 )
 
 var TerminalCode string
@@ -110,6 +112,8 @@ func init() {
 	{
 		CoalMineFilePath = config["coal_mine_file_path"]
 		CoalMineOpen = config["coal_mine_open"]
+		CoalMailAttachmentScriptPath = config["coal_mail_attachment_script_path"]
+		CoalMailAttachmentOpen = config["coal_mail_attachment_open"]
 	}
 
 	// 汾渭配置