package data import ( "context" "eta/eta_task/models/data_manage" "eta/eta_task/services/alarm_msg" "eta/eta_task/utils" "fmt" ) // RefreshBaseFromThsHfIndex 同花顺高频数据 func RefreshBaseFromThsHfIndex(cont context.Context) (err error) { defer func() { if err != nil { tips := fmt.Sprintf("RefreshBaseFromThsHfIndex-刷新同花顺高频数据失败, %v", err) utils.FileLog.Info(tips) go alarm_msg.SendAlarmMsg(tips, 3) } }() indexOb := new(data_manage.BaseFromThsHfIndex) indexes, e := indexOb.GetItemsByCondition(``, make([]interface{}, 0), []string{indexOb.Cols().PrimaryId, indexOb.Cols().IndexCode}, "") if e != nil { err = fmt.Errorf("获取源指标列表失败, %v", e) return } if len(indexes) == 0 { return } refreshUrl := "ths/hf/base/refresh" for _, v := range indexes { param := make(map[string]interface{}) param["BaseIndexCode"] = v.IndexCode param["RefreshType"] = 1 // 默认刷6小时前的 res, e := postRefreshEdbData(param, refreshUrl) if e != nil { utils.FileLog.Info(fmt.Sprintf("RefreshBaseFromThsHfIndex-postRefreshEdbData, code: %s, err: %v", v.IndexCode, e)) continue } if res != nil && res.Ret != 200 { utils.FileLog.Info(fmt.Sprintf("RefreshBaseFromThsHfIndex-postRefreshEdbData, code: %s, Ret: %d, ErrMsg: %s", v.IndexCode, res.Ret, res.ErrMsg)) continue } } return }