mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-13 15:12:09 +08:00
更改规则链缓存
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"pandax/apps/device/services"
|
||||
"pandax/pkg/events"
|
||||
"pandax/pkg/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 初始化事件监听
|
||||
@@ -18,10 +17,7 @@ func InitEvents() {
|
||||
})
|
||||
if list != nil {
|
||||
for _, product := range *list {
|
||||
err := global.RedisDb.Set(product.Id, codeData, time.Hour*24*365)
|
||||
if err != nil {
|
||||
global.Log.Errorf("事件监听执行错误:%s", err.Error())
|
||||
}
|
||||
global.Cache.Put(product.Id, codeData)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -92,3 +92,11 @@ func InterfaceToStruct(m interface{}, s interface{}) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func StringToStruct(m string, s interface{}) error {
|
||||
err := json.Unmarshal([]byte(m), s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user