2021-05-23 23:27:41 +00:00
|
|
|
package common
|
2017-08-23 02:05:47 +00:00
|
|
|
|
2021-05-24 21:08:17 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
2017-08-23 02:05:47 +00:00
|
|
|
|
2021-05-23 23:27:41 +00:00
|
|
|
type ContextBase struct {
|
2021-05-24 21:08:17 +00:00
|
|
|
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
|
|
|
}
|