123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package services
- import (
- "eta/eta_forum_hub/models"
- "eta/eta_forum_hub/services/elastic"
- "eta/eta_forum_hub/utils"
- "fmt"
- "strconv"
- )
- // EsAddOrEditChartInfo 新增和修改ES中的图表数据
- func EsAddOrEditChartInfo(chartInfoId int) {
- var err error
- defer func() {
- if err != nil {
- fmt.Println("新增和修改ES中的图表数据失败:", err.Error())
- }
- }()
- itemInfo, _ := models.GetChartInfoById(chartInfoId)
- //添加es
- err = elastic.EsAddOrEditChartInfoData(utils.CHART_INDEX_NAME, strconv.Itoa(itemInfo.ChartInfoId), itemInfo)
- return
- }
- // DeleteEdbInfoToEs 删除ES中的指标
- func DeleteEdbInfoToEs(edbInfoId int) {
- //添加es
- go elastic.EsDeleteEdbInfoData(utils.DATA_INDEX_NAME, strconv.Itoa(edbInfoId))
- }
- // EsDeleteChartInfo 删除ES中的图表数据
- func EsDeleteChartInfo(chartInfoId int) {
- var err error
- defer func() {
- if err != nil {
- fmt.Println("删除ES中的图表数据失败:", err.Error())
- }
- }()
- //添加es
- err = elastic.EsDeleteDataV2(utils.CHART_INDEX_NAME, strconv.Itoa(chartInfoId))
- return
- }
- // EsSearchChartInfo 搜索图表信息
- func EsSearchChartInfo(keyword string, showSysId []int, sourceList []int, permissionClassifyIdList []int, startSize, pageSize int) (list []*models.ChartInfo, total int64, err error) {
- list, total, err = elastic.SearchChartInfoData(utils.CHART_INDEX_NAME, keyword, showSysId, sourceList, permissionClassifyIdList, startSize, pageSize)
- return
- }
|