mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-24 03:18:35 +08:00
[fix] 设备属性读取错误
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"pandax/kit/biz"
|
||||
"pandax/kit/model"
|
||||
"pandax/kit/restfulx"
|
||||
@@ -65,8 +66,9 @@ func (p *ProductTemplateApi) InsertProductTemplate(rc *restfulx.ReqCtx) {
|
||||
stable := data.Pid + "_" + data.Classify
|
||||
if data.Classify == entity.TELEMETRY_TSL {
|
||||
if data.Type == "string" {
|
||||
if maxLength, ok := data.Define["maxLength"].(float64); ok {
|
||||
len = int(maxLength)
|
||||
if maxLength, ok := data.Define["maxLength"].(json.Number); ok {
|
||||
length, _ := maxLength.Int64()
|
||||
len = int(length)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,7 +97,10 @@ func (p *ProductTemplateApi) UpdateProductTemplate(rc *restfulx.ReqCtx) {
|
||||
if data.Classify == entity.TELEMETRY_TSL {
|
||||
stable = data.Pid + "_" + entity.TELEMETRY_TSL
|
||||
if data.Type == "string" {
|
||||
len = int(data.Define["length"].(int64))
|
||||
if maxLength, ok := data.Define["maxLength"].(json.Number); ok {
|
||||
length, _ := maxLength.Int64()
|
||||
len = int(length)
|
||||
}
|
||||
}
|
||||
global.TdDb.DelSTableField(stable, one.Key)
|
||||
err := global.TdDb.AddSTableField(stable, data.Key, data.Type, len)
|
||||
|
||||
Reference in New Issue
Block a user