This commit is contained in:
tfl
2024-08-20 17:46:15 +08:00
parent 1467b349a2
commit 8b167d8c02
16 changed files with 182 additions and 160 deletions

31
pkg/cache/sub_device.go vendored Normal file
View File

@@ -0,0 +1,31 @@
package cache
import (
"pandax/kit/cache"
"strings"
"time"
)
var SubDeviceField = cache.NewTimedCache(cache.NoExpiration, 24*time.Hour)
var SUBDEVICEKEY = "SUBDEVICEKEY"
func CheckSubDeviceField(field string) bool {
fields, bool := SubDeviceField.Get(SUBDEVICEKEY)
if !bool {
return false
}
if !strings.Contains(fields.(string), field) {
return false
}
return true
}
func SetSubDeviceField(data string) {
fields, bool := SubDeviceField.Get(SUBDEVICEKEY)
if !bool {
fields = data
} else {
fields = fields.(string) + "," + data
}
ProductCache.Put(SUBDEVICEKEY, fields)
}