factor_edb_series.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package data
  2. import (
  3. "encoding/json"
  4. "eta/eta_mobile/models"
  5. "eta/eta_mobile/utils"
  6. "fmt"
  7. )
  8. // PostRefreshFactorEdbRecalculate 因子指标重计算
  9. func PostRefreshFactorEdbRecalculate(edbInfoId int, edbCode string) (resp *models.BaseResponse, err error) {
  10. param := make(map[string]interface{})
  11. param["EdbInfoId"] = edbInfoId
  12. param["EdbCode"] = edbCode
  13. postUrl := fmt.Sprintf("%s%s", utils.EDB_LIB_URL, "factor_edb_series/recalculate")
  14. postData, e := json.Marshal(param)
  15. if e != nil {
  16. err = fmt.Errorf("param json err: %v", e)
  17. return
  18. }
  19. result, e := HttpPost(postUrl, string(postData), utils.ZhLangVersion, "application/json")
  20. if e != nil {
  21. err = fmt.Errorf("http post err: %v", e)
  22. return
  23. }
  24. utils.FileLog.Info("PostRefreshFactorEdbRecalculate:" + postUrl + ";" + string(postData) + ";result:" + string(result))
  25. if e = json.Unmarshal(result, &resp); e != nil {
  26. err = fmt.Errorf("resp unmarshal err: %v", e)
  27. return
  28. }
  29. return
  30. }
  31. // PostRefreshFactorEdbChartRecalculate 因子指标图表重计算
  32. func PostRefreshFactorEdbChartRecalculate(chartInfoId int) (resp *models.BaseResponse, err error) {
  33. param := make(map[string]interface{})
  34. param["ChartInfoId"] = chartInfoId
  35. postUrl := fmt.Sprintf("%s%s", utils.EDB_LIB_URL, "factor_edb_series/chart_recalculate")
  36. postData, e := json.Marshal(param)
  37. if e != nil {
  38. err = fmt.Errorf("param json err: %v", e)
  39. return
  40. }
  41. result, e := HttpPost(postUrl, string(postData), utils.ZhLangVersion, "application/json")
  42. if e != nil {
  43. err = fmt.Errorf("http post err: %v", e)
  44. return
  45. }
  46. utils.FileLog.Info("PostRefreshFactorEdbChartRecalculate:" + postUrl + ";" + string(postData) + ";result:" + string(result))
  47. if e = json.Unmarshal(result, &resp); e != nil {
  48. err = fmt.Errorf("resp unmarshal err: %v", e)
  49. return
  50. }
  51. return
  52. }