| | |
| | | "basic.com/pubsub/protomsg.git" |
| | | "basic.com/valib/gopherdiscovery.git" |
| | | "basic.com/valib/logger.git" |
| | | "encoding/json" |
| | | "errors" |
| | | "fmt" |
| | | "github.com/gogo/protobuf/proto" |
| | |
| | | var api dbapi.DicApi |
| | | flag, dics := api.FindByType("") |
| | | if flag { |
| | | for key, dics := range dics.(map[string][]Dic) { |
| | | for _,dic := range dics { |
| | | cMap.Set(PREFIX_DIC+key+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) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return sdk, errors.New("sdk not found") |
| | | } |
| | | } |
| | | |
| | | // 获取字典值 |
| | | func GetDic(key string) (value string) { |
| | | obj, b := cMap.Get(PREFIX_SDK + key) |
| | | func GetDic(key string) (name string) { |
| | | obj, b := cMap.Get(PREFIX_DIC + key) |
| | | if b { |
| | | return obj.(Dic).value |
| | | return obj.(Dic).Name |
| | | } else { |
| | | return "" |
| | | } |
| | | } |
| | | |
| | | |
| | | func initSoData() { |
| | | var api dbapi.SoApi |
| | |
| | | } |
| | | |
| | | type Dic struct { |
| | | Id string |
| | | value string |
| | | Name string |
| | | Type string |
| | | Description string |
| | | Sort int |
| | | Parent_id string |
| | | Id string `json:"id"` |
| | | Value string `json:"value"` |
| | | Name string `json:"name"` |
| | | Type string `json:"type"` |
| | | Description string `json:"description"` |
| | | Sort int `json:"sort"` |
| | | Parent_id string `json:"parent_id"` |
| | | } |