excel_elastic.go 667 B

12345678910111213141516171819202122232425262728
  1. package excel
  2. import (
  3. excel2 "eta/eta_api/models/data_manage/excel"
  4. "eta/eta_api/services/elastic"
  5. "eta/eta_api/utils"
  6. "fmt"
  7. "strconv"
  8. )
  9. // EsAddOrEditExcel 新增和修改ES中的表格
  10. func EsAddOrEditExcel(excelId int) {
  11. var err error
  12. defer func() {
  13. if err != nil {
  14. tips := fmt.Sprintf("EsAddOrEditExcel, excelId: %d, err: %v", excelId, err)
  15. utils.FileLog.Info(tips)
  16. }
  17. }()
  18. item, e := excel2.GetExcelInfoById(excelId)
  19. if e != nil {
  20. err = fmt.Errorf("获取表格失败, %v", e)
  21. return
  22. }
  23. item.Content = "" // 内容没必要写进去
  24. err = elastic.EsAddOrEditExcelInfoData(utils.EsExcelIndexName, strconv.Itoa(excelId), item)
  25. return
  26. }