123456789101112131415161718192021222324252627 |
- package utils
- import (
- "fmt"
- "git.getensh.com/common/gopkgs/cache"
- "property-system-gateway/errors"
- )
- const SingleSignKeyPrefix = "single_sign_"
- func GetSingleFlag(byCompany bool, cid, gardenId, uid int64) string {
- return fmt.Sprintf("%v-%v-%v-%v\n", byCompany, cid, gardenId, uid)
- }
- func SetSingleSignTime(flag string, timestamp int64) error {
- key := SingleSignKeyPrefix + fmt.Sprintf("%s", flag)
- _, err := cache.Redis().Set(key, fmt.Sprintf("%d", timestamp))
- if err != nil {
- return errors.RedisError
- }
- return nil
- }
- func GetSingleSignTime(flag string) string {
- key := SingleSignKeyPrefix + fmt.Sprintf("%s", flag)
- str, _ := cache.Redis().Get(key)
- return str
- }
|