edbinfo.go 728 B

1234567891011121314151617181920212223242526
  1. package logic
  2. import (
  3. "eta/eta_index_lib/models"
  4. "eta/eta_index_lib/services/elastic"
  5. "eta/eta_index_lib/utils"
  6. "fmt"
  7. "strconv"
  8. )
  9. // UpdateEs 更新ES的指标数据
  10. func UpdateEs(edbInfoId int) {
  11. //添加es
  12. itemInfo, _ := models.GetEdbInfoItemByCondition("AND edb_info_id=?", []interface{}{edbInfoId})
  13. elastic.EsAddOrEditEdbInfoData(utils.DATA_INDEX_NAME, strconv.Itoa(itemInfo.EdbInfoId), itemInfo)
  14. }
  15. // UpdateAllEdbInfoEs 更新所有的指标ES的信息
  16. func UpdateAllEdbInfoEs() {
  17. //添加es
  18. list, _ := models.GetEdbInfoItemListByCondition()
  19. for _, itemInfo := range list {
  20. elastic.EsAddOrEditEdbInfoData(utils.DATA_INDEX_NAME, strconv.Itoa(itemInfo.EdbInfoId), itemInfo)
  21. }
  22. fmt.Println("修复完成")
  23. }