123456789101112131415161718192021222324252627282930 |
- package handler
- import (
- "GtDataStore/app/cmd/organization/internal/config"
- "encoding/json"
- "github.com/go-redis/redis/v8"
- "github.com/zeromicro/go-zero/core/conf"
- "metawant.greentech.com.cn/gaoyagang/gt-common/envitem"
- "testing"
- )
- func Test_transDeviceUfData(t *testing.T) {
- var c config.Config
- conf.MustLoad("../../../etc/organization.test.yaml", &c)
- //ctx := svc.NewServiceContext(c)
- envitem.SetOptions(envitem.Options{GtServerIp: c.GtServerIp, AdjustValue: true, Cache: redis.NewClient(&redis.Options{Addr: c.Cache[0].Host, Password: c.Cache[0].Pass, MaxRetries: 5})})
- j := `{"tmp":{"project_id":92,"item":"C.M.UF1_DB@press_PV","default_val":0},"feed_flow":{"project_id":92,"item":"C.M.UF1_FT_JS@out","default_val":0},"feed_pressure":{"project_id":92,"item":"C.M.UF1_PT_JS@out","default_val":0},"product_pressure":{"project_id":92,"item":"C.M.UF1_PT_CS@out","default_val":0},"feed_wq_turbidity":{"project_id":92,"item":"C.M.UF_Tur_ZJS@out","default_val":0},"water_temperature":{"project_id":92,"item":"C.M.RO_TT_ZJS@out","default_val":0},"product_wq_ph":{"project_id":92,"item":"C.M.UF_PH_ZCS@out","default_val":0},"step":{"project_id":92,"item":"C.M.UF1_DB@word_control","default_val":0},"filter_time":{"project_id":92,"item":"C.M.UF1_DB@time_production_display"},"filter_cycle":{"project_id":92,"item":"C.M.UF1_DB@cycle_out"},"permeability":{"project_id":92,"item":"UF1Per"},"flux":{"project_id":92,"item":"UF1_FluxF"}}`
- mulItems := envitem.MultiEnvItem{}
- json.Unmarshal([]byte(j), &mulItems)
- step := mulItems.GetItemInt64Value("filter_cycle")
- t.Log(step)
- //t.Log(mulItems)
- }
|