single_sign.go 531 B

12345678910111213141516171819202122
  1. package utils
  2. import (
  3. "fmt"
  4. "git.getensh.com/common/gopkgs/cache"
  5. "property-applete-gateway/errors"
  6. )
  7. const SingleSignKeyPrefix = "single_sign_"
  8. func SetSingleSignTime(uid int64, timestamp int64) error {
  9. key := SingleSignKeyPrefix + fmt.Sprintf("%d", uid)
  10. _, err := cache.Redis().Set(key, fmt.Sprintf("%d", timestamp))
  11. if err != nil {
  12. return errors.RedisError
  13. }
  14. return nil
  15. }
  16. func GetSingleSignTime(uid int64) string{
  17. key := SingleSignKeyPrefix + fmt.Sprintf("%d", uid)
  18. str, _ := cache.Redis().Get(key)
  19. return str
  20. }