2024-02-13 04:11:30 +08:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/google/uuid"
|
2024-03-28 22:26:56 +08:00
|
|
|
"sync"
|
2024-02-13 04:11:30 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var uniqueID string
|
|
|
|
|
|
|
|
func InitUniqueID() {
|
|
|
|
uniqueID = uuid.New().String()
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetUniqueID() string {
|
|
|
|
return uniqueID
|
|
|
|
}
|
2024-03-28 22:26:56 +08:00
|
|
|
|
|
|
|
var activitiesOverview = make(map[string]int64)
|
|
|
|
var activitiesOverviewMux = sync.Mutex{}
|
|
|
|
|
|
|
|
func ActivitiesOverviewIncIndex(index string) {
|
|
|
|
activitiesOverviewMux.Lock()
|
|
|
|
defer activitiesOverviewMux.Unlock()
|
|
|
|
|
|
|
|
if _, exists := activitiesOverview[index]; !exists {
|
|
|
|
activitiesOverview[index] = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
activitiesOverview[index]++
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetActivitiesOverview() map[string]int64 {
|
|
|
|
activitiesOverviewMux.Lock()
|
|
|
|
defer activitiesOverviewMux.Unlock()
|
|
|
|
|
|
|
|
return activitiesOverview
|
|
|
|
}
|