34 lines
543 B
Go
34 lines
543 B
Go
package cache
|
|
|
|
import (
|
|
"fmt"
|
|
"yintai-api/app/common/model"
|
|
|
|
"github.com/smbrave/goutil"
|
|
)
|
|
|
|
type Keys struct{}
|
|
|
|
func NewKeys() *Keys {
|
|
return &Keys{}
|
|
}
|
|
|
|
func (k Keys) User() string {
|
|
key := "home:user:info:"
|
|
return key
|
|
}
|
|
|
|
func (k Keys) User2Token() string {
|
|
key := "home:user:u2token:"
|
|
return key
|
|
}
|
|
|
|
func (k Keys) UserToken(account string) string {
|
|
key := fmt.Sprintf("%s_%s_%s", account, model.Salt, account)
|
|
return goutil.Md5(key)
|
|
}
|
|
|
|
func (k Keys) Api(roleID int64) string {
|
|
return fmt.Sprintf("%s%d", "home:user:api:", roleID)
|
|
}
|