fix: 设备物模型导入bug修复及调整数组类型最大值

This commit is contained in:
godLei6
2025-08-26 10:55:02 +08:00
parent e5db19fd95
commit ad0698ea8e
2 changed files with 7 additions and 3 deletions

View File

@@ -55,6 +55,9 @@ func ruleCheck(ctx context.Context, svcCtx *svc.ServiceContext, in *dm.DeviceSch
if ok {
continue
}
if po.Tag == schema.TagOptional { //通用物模型里选取的
po.Tag = schema.TagDeviceOptional
}
if po.Tag != schema.TagDeviceOptional {
checkOptions = append(checkOptions, func(do any) error {
s := do.(*schema.Property)
@@ -85,7 +88,7 @@ func ruleCheck(ctx context.Context, svcCtx *svc.ServiceContext, in *dm.DeviceSch
}
po.Tag = schema.TagDeviceOptional
}
if v.Tag == schema.TagDeviceOptional {
if po.Tag == schema.TagDeviceOptional {
err := func() error {
//如果导入的是通用物模型
var cs *relationDB.DmCommonSchema
@@ -94,7 +97,7 @@ func ruleCheck(ctx context.Context, svcCtx *svc.ServiceContext, in *dm.DeviceSch
return err
}
if cs == nil { //如果通用物模型里面没有,则变成自定义物模型
v.Tag = schema.TagDeviceCustom
po.Tag = schema.TagDeviceCustom
checkOptions = append(checkOptions, func(do any) error {
s := do.(*schema.Property)
if utils.SliceIn(s.Define.Type, schema.DataTypeArray, schema.DataTypeStruct) {

View File

@@ -2,6 +2,7 @@ package schema
import (
"encoding/json"
"gitee.com/unitedrhino/share/def"
"gitee.com/unitedrhino/share/utils"
@@ -19,7 +20,7 @@ const (
DefineIntMax = 9999999999999
DefineIntMin = -9999999999999
DefineStringMax = 2048
DefineArrayMax = 256
DefineArrayMax = 1024
DefineSpecsLen = 20
ParamsLen = 20
)