common.go 797 B

12345678910111213141516171819202122232425262728293031323334
  1. package api
  2. import (
  3. "context"
  4. "encoding/json"
  5. "go-common/library/log"
  6. )
  7. // Transform2Interface 转换成interface
  8. func Transform2Interface(ctx context.Context, data []byte) (inter interface{}, err error) {
  9. err = json.Unmarshal(data, &inter)
  10. if err != nil {
  11. log.Errorw(ctx, "log", "transform to interface fail", "data", string(data))
  12. return
  13. }
  14. return
  15. }
  16. // 话题的状态
  17. const (
  18. TopicStateAvailable = 0
  19. TopicStateUnAvailable = 1
  20. TopicVideoStateAvailable = 0
  21. TopicVideoStateUnAvailable = 1
  22. )
  23. // 话题热门类型的enum,用于TopicInfo->HotType字段
  24. // 开始时使用了hot_type,但其实就是表示特殊的话题状态
  25. const (
  26. TopicHotTypeHot = 1 // 热门
  27. TopicHotTypeHistory = 2 // 历史,暂时只有客户端使用
  28. TopicHotTypeStick = 4 // 置顶
  29. )