fix:电表型号联动

main
Rice 1 month ago
parent 6471e68928
commit 354ef31933

@ -29,7 +29,7 @@
"baudRate": "9600" "baudRate": "9600"
}, },
"deviceInfo": { "deviceInfo": {
"deviceId": "866749078669632", "deviceId": "862809073336480",
"version": "1.0.2", "version": "1.0.2",
"meterAddr": "0x04", "meterAddr": "0x04",
"meterFirm": "ADL400" "meterFirm": "ADL400"

@ -30,7 +30,7 @@ func ScanM9z() {
} }
defer l.Unlock() defer l.Unlock()
/** 挨个查询是否有报警*/ /** 挨个查询是否有报警*/
cuid := deviceInfo["deviceId"].(string) cuid := g.Config().DeviceInfo.DeviceId
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
read, err := m9z.SubLoopParametersRead(cuid, uint(i)) read, err := m9z.SubLoopParametersRead(cuid, uint(i))
if err != nil { if err != nil {

@ -1,18 +1,15 @@
package m9zApi package m9zApi
import ( import (
"encoding/json"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"tgk-touch/internal/module/meterFirm"
"github.com/towgo/towgo/towgo" "github.com/towgo/towgo/towgo"
"tgk-touch/internal/global" "tgk-touch/internal/global"
) )
var deviceInfo map[string]interface{}
func Init() { func Init() {
marshal, _ := json.Marshal(g.Config().DeviceInfo)
json.Unmarshal(marshal, &deviceInfo)
towgo.SetFunc("/m9z/fault/list", faultList) towgo.SetFunc("/m9z/fault/list", faultList)
towgo.SetFunc("/m9z/fault/batchExec", execFailByIds) towgo.SetFunc("/m9z/fault/batchExec", execFailByIds)
// 获取设备输出状态参数 // 获取设备输出状态参数
@ -81,7 +78,8 @@ func Init() {
} }
func getTouchDeviceId(rpc towgo.JsonRpcConnection) { func getTouchDeviceId(rpc towgo.JsonRpcConnection) {
deviceInfo := g.Config().DeviceInfo
deviceInfo.MeterFirm = meterFirm.Manager().Get()
rpc.WriteResult(deviceInfo) rpc.WriteResult(deviceInfo)
} }
func faultDelete(rpc towgo.JsonRpcConnection) { func faultDelete(rpc towgo.JsonRpcConnection) {

Loading…
Cancel
Save