Browse Source

Merge branch 'ETA_1.4.5'

zwxi 1 year ago
parent
commit
3ab9b7d2a1
3 changed files with 39 additions and 0 deletions
  1. 32 0
      services/data/base_from_zhongji.go
  2. 6 0
      services/task.go
  3. 1 0
      utils/constants.go

+ 32 - 0
services/data/base_from_zhongji.go

@@ -0,0 +1,32 @@
+package data
+
+import (
+	"context"
+	"eta/eta_task/services/alarm_msg"
+	"eta/eta_task/utils"
+	"fmt"
+)
+
+// SyncZhongJiIndexList 同步中基宁波指标列表
+func SyncZhongJiIndexList(cont context.Context) (err error) {
+	defer func() {
+		if err != nil {
+			tips := "SyncJiaYueNewIndex-同步中基宁波指标列表失败, ErrMsg:\n" + err.Error()
+			utils.FileLog.Info(tips)
+			go alarm_msg.SendAlarmMsg(tips, 3)
+		}
+	}()
+
+	param := make(map[string]interface{})
+	uri := "smm/zhongji/list"
+	res, e := postRefreshEdbData(param, uri)
+	if e != nil {
+		err = fmt.Errorf("postRefreshEdbData err: %s", e.Error())
+		return
+	}
+	if res != nil && res.Ret != 200 {
+		err = fmt.Errorf("postRefreshEdbData fail")
+		return
+	}
+	return
+}

+ 6 - 0
services/task.go

@@ -102,6 +102,12 @@ func releaseTask() {
 		syncJiaYueDataBaby := task.NewTask("syncJiaYueDataBaby", "0 */30 * * * * ", data.RefreshJiaYueDataFromBridge)
 		task.AddTask("syncJiaYueDataBaby", syncJiaYueDataBaby)
 	}
+
+	if utils.BusinessCode == utils.BusinessCodeZhongJi {
+		// 每天同步一次指标列表
+		syncZhongJiIndexList := task.NewTask("syncZhongJiIndexList", "0 0 17 * * *", data.SyncZhongJiIndexList)
+		task.AddTask("定时同步中基宁波SMM指标列表", syncZhongJiIndexList)
+	}
 }
 
 func RefreshData(cont context.Context) (err error) {

+ 1 - 0
utils/constants.go

@@ -141,4 +141,5 @@ const (
 const (
 	BusinessCodeRelease = "E2023080900" // 生产环境
 	BusinessCodeJiaYue  = "E2023092201" // 嘉悦物产
+	BusinessCodeZhongJi = "E2023110300" // 中基宁波
 )