hotime/common/context_base.go

19 lines
247 B
Go
Raw Normal View History

2021-05-23 23:27:41 +00:00
package common
2017-08-23 02:05:47 +00:00
import (
"time"
)
2017-08-23 02:05:47 +00:00
2021-05-23 23:27:41 +00:00
type ContextBase struct {
tag string
2017-08-23 02:05:47 +00:00
}
//唯一标志
2022-03-12 17:48:54 +00:00
func (that *ContextBase) GetTag() string {
2017-08-23 02:05:47 +00:00
2022-03-12 17:48:54 +00:00
if that.tag == "" {
that.tag = ObjToStr(time.Now().Unix()) + ":" + ObjToStr(Random())
2017-08-23 02:05:47 +00:00
}
2022-03-12 17:48:54 +00:00
return that.tag
2017-08-23 02:05:47 +00:00
}