common.go 677 B

1234567891011121314151617181920212223242526272829303132333435
  1. package model
  2. // const common
  3. const (
  4. TimeFormatSec = "2006-01-02 15:04:05"
  5. TimeFormatDay = "2006-01-02"
  6. )
  7. // MangerInfo struct
  8. type MangerInfo struct {
  9. OID int64 `json:"id"`
  10. Uname string `json:"username"`
  11. }
  12. // EmptyList struct
  13. type EmptyList struct {
  14. Count int `json:"total_count"`
  15. Order string `json:"order"`
  16. Sort string `json:"sort"`
  17. PN int `json:"pn"`
  18. PS int `json:"ps"`
  19. List struct{} `json:"list"`
  20. }
  21. // ArrayUnique struct
  22. func ArrayUnique(ids []int64) (res []int64) {
  23. length := len(ids)
  24. for i := 0; i < length; i++ {
  25. if (i > 0 && ids[i-1] == ids[i]) || ids[i] == 0 {
  26. continue
  27. }
  28. res = append(res, ids[i])
  29. }
  30. return
  31. }