From 58f4f47e7b63ecd78a3467d537354926c6a39b3a Mon Sep 17 00:00:00 2001 From: PandaX <18610165312@163.com> Date: Fri, 24 Nov 2023 13:29:46 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E9=81=A5=E6=B5=8B=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=98=AF=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=97=B6=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/device/api/product_template.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/device/api/product_template.go b/apps/device/api/product_template.go index 681bb34..06de658 100644 --- a/apps/device/api/product_template.go +++ b/apps/device/api/product_template.go @@ -58,11 +58,13 @@ func (p *ProductTemplateApi) InsertProductTemplate(rc *restfulx.ReqCtx) { data.Id = model2.GenerateID() if data.Classify == entity.ATTRIBUTES_TSL || data.Classify == entity.TELEMETRY_TSL { // 向超级表及子表中添加字段 - len := 0 + len := 100 stable := data.Pid + "_" + data.Classify if data.Classify == entity.TELEMETRY_TSL { if data.Type == "string" { - len = int(data.Define["length"].(int64)) + if maxLength, ok := data.Define["maxLength"].(float64); ok { + len = int(maxLength) + } } } err := global.TdDb.AddSTableField(stable, data.Key, data.Type, len)