1 Star 0 Fork 0

h79/gothird

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
access.go 685 Bytes
Copy Edit Raw Blame History
huqiuyun authored 2023-07-28 16:16 +08:00 . 还是把 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
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/h79/gothird.git
git@gitee.com:h79/gothird.git
h79
gothird
gothird
v1.8.66

Search