base.go 598 B

123456789101112131415161718192021222324252627282930
  1. package model
  2. import (
  3. "fmt"
  4. "math/rand"
  5. )
  6. const (
  7. //CacheKeyBase is.
  8. CacheKeyBase = "bs_%d" // key of baseInfo
  9. //CacheKeyMoral is.
  10. CacheKeyMoral = "moral_%d" // key of detail
  11. //CacheKeyInfo is.
  12. CacheKeyInfo = "i_"
  13. //URLNoFace is.
  14. URLNoFace = "http://static.hdslb.com/images/member/noface.gif"
  15. //TableExpLog is.
  16. TableExpLog = "ugc:ExpLog"
  17. //TableMoralLog is.
  18. TableMoralLog = "ugc:MoralLog"
  19. )
  20. // RandFaceURL get face URL
  21. func (b *BaseInfo) RandFaceURL() {
  22. if b.Face == "" {
  23. b.Face = URLNoFace
  24. return
  25. }
  26. b.Face = fmt.Sprintf("http://i%d.hdslb.com%s", rand.Int63n(3), b.Face)
  27. }