1 Star 0 Fork 0

h79 / gothird

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
access.go 685 Bytes
一键复制 编辑 原始数据 按行查看 历史
huqiuyun 提交于 2023-07-28 16:16 . 还是把 token 放在这里
package access
import (
"time"
)
// Nanosecond,纳秒
const refExpire = time.Hour * time.Duration(24*6)
// ExpireSecond
/**
* @param expire 秒
* @return Nanosecond,纳秒
*/
func ExpireSecond(expire int64) int64 {
return (time.Second * time.Duration(expire)).Nanoseconds()
}
// RefExpireSecond
/**
* @param expire 秒
* @return Nanosecond,纳秒
*/
func RefExpireSecond(expire int64) int64 {
ex := ExpireSecond(expire)
if ex == 0 {
ex = refExpire.Nanoseconds()
}
return ex
}
type Value struct {
Data string
ExpireIn int64
}
func (v Value) IsValidOf() bool {
return v.Data != ""
}
type Token interface {
GetAccessToken() Value
GetRefAccessToken() Value
}
1
https://gitee.com/h79/gothird.git
git@gitee.com:h79/gothird.git
h79
gothird
gothird
v1.8.101

搜索帮助