dm_search.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package model
  2. import (
  3. "fmt"
  4. "strconv"
  5. )
  6. // DmSearchParams .
  7. type DmSearchParams struct {
  8. Bsp *BasicSearchParams
  9. Oid int64 `form:"oid" params:"oid" default:"-1"`
  10. Mid int64 `form:"mid" params:"mid" default:"-1"`
  11. Mode int `form:"mode" params:"mode" default:"-1"`
  12. Pool int `form:"pool" params:"pool" default:"-1"`
  13. Progress int `form:"progress" params:"progress" default:"-1"`
  14. States []int `form:"states,split" params:"states"`
  15. Type int `form:"type" params:"type" default:"-1"`
  16. AttrFormat []int `form:"attr_format,split" params:"attr_format"`
  17. CtimeFrom string `form:"ctime_from" params:"ctime_from"`
  18. CtimeTo string `form:"ctime_to" params:"ctime_to"`
  19. }
  20. // DmUptParams .
  21. type DmUptParams struct {
  22. ID int64 `json:"id"`
  23. Oid int64 `json:"oid"`
  24. Field map[string]interface{}
  25. }
  26. // IndexName .
  27. func (m *DmUptParams) IndexName() string {
  28. return "dm_search_" + strconv.FormatInt(m.Oid%1000, 10)
  29. }
  30. // IndexType .
  31. func (m *DmUptParams) IndexType() string {
  32. return "base"
  33. }
  34. // IndexID .
  35. func (m *DmUptParams) IndexID() string {
  36. return fmt.Sprintf("%d", m.ID)
  37. }
  38. // PField .
  39. func (m *DmUptParams) PField() map[string]interface{} {
  40. return m.Field
  41. }