package data import ( "encoding/json" "eta/eta_task/models/data_manage/future_good" "eta/eta_task/services/alarm_msg" "eta/eta_task/utils" "fmt" ) // RefreshFutureGoodProfitChart 刷新商品利润曲线图 func RefreshFutureGoodProfitChart() (err error) { defer func() { if err != nil { tips := fmt.Sprintf("RefreshFactorEdbCalculateData ErrMsg: %v", err) utils.FileLog.Info(tips) go alarm_msg.SendAlarmMsg(tips, 3) } }() profitOb := new(future_good.ChartInfoFutureGoodProfit) list, e := profitOb.GetItemsByCondition(``, make([]interface{}, 0), []string{}, "") if e != nil { err = fmt.Errorf("获取系列因子指标失败, err: %v", e) return } if len(list) == 0 { return } for _, v := range list { e = PostRefreshFutureGoodProfitChart(v.ChartInfoId) if e != nil { utils.FileLog.Info(fmt.Sprintf("PostRefreshFutureGoodProfitChart err, ChartInfoId: %d, err: %v", v.ChartInfoId, e)) continue } } return } // PostRefreshFutureGoodProfitChart 因子指标图表重计算 func PostRefreshFutureGoodProfitChart(chartInfoId int) (err error) { param := make(map[string]interface{}) param["ChartInfoId"] = chartInfoId postUrl := fmt.Sprintf("%s%s", utils.EDB_LIB_URL, "future_good/relation/refresh") postData, e := json.Marshal(param) if e != nil { err = fmt.Errorf("param json err: %v", e) return } result, e := HttpPost(postUrl, string(postData), "application/json") if e != nil { err = fmt.Errorf("http post err: %v", e) return } utils.FileLog.Info("PostRefreshFutureGoodProfitChart:" + postUrl + ";" + string(postData) + ";result:" + string(result)) return }