From 18174cc9229d1656b3c6121ec70f6c84435b2ea6 Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期二, 19 十一月 2019 09:40:03 +0800 Subject: [PATCH] --- --- cache/cache.go | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cache/cache.go b/cache/cache.go index 4906057..754e1fe 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -6,6 +6,7 @@ "basic.com/pubsub/protomsg.git" "basic.com/valib/gopherdiscovery.git" "basic.com/valib/logger.git" + "encoding/json" "errors" "fmt" "github.com/gogo/protobuf/proto" @@ -59,7 +60,7 @@ initSoData() - //initDictionary() // 鍒濆鍖栧瓧鍏� + initDictionary() // 鍒濆鍖栧瓧鍏� initChan <- true } @@ -141,9 +142,13 @@ var api dbapi.DicApi flag, dics := api.FindByType("") if flag { - for key, dics1 := range dics.(map[string]interface{}) { - for _,dic := range dics1.([]interface{}) { - cMap.Set(PREFIX_DIC+key+dic.(Dic).value, dic) + var dicss map[string][]Dic + b, _ := json.Marshal(dics) + if err := json.Unmarshal(b, &dicss) ; err == nil { + for key, dics1 := range dicss { + for _,dic := range dics1 { + cMap.Set(PREFIX_DIC+key+dic.value, dic) + } } } } -- Gitblit v1.8.0