projectDetail.go 542 B

12345678910111213141516171819202122
  1. package service
  2. import (
  3. "fmt"
  4. "sfbase/core"
  5. "sfbase/global"
  6. "sfis/db"
  7. )
  8. func ProjectDetailData(id string) map[string]interface{} {
  9. global.Logger.Info("id " + id)
  10. data := map[string]interface{}{}
  11. _query := `{"query":{"bool":{"must":[{"term":{"id":"%s"}}],"must_not":[],"should":[]}}}`
  12. query := fmt.Sprintf(_query, id)
  13. INDEX := core.GetStringConf("es.project.index")
  14. TYPE := core.GetStringConf("es.project.itype")
  15. infos := db.Es.Get(INDEX, TYPE, query)
  16. if infos != nil && len(*infos) > 0 {
  17. data = (*infos)[0]
  18. }
  19. return data
  20. }