driver add product key filed
parent
d6d281220b
commit
f5467ac7e0
2
go.mod
2
go.mod
|
@ -49,7 +49,7 @@ require (
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.617
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.617
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.617
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.617
|
||||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.39
|
github.com/tencentyun/cos-go-sdk-v5 v0.7.39
|
||||||
github.com/winc-link/edge-driver-proto v0.0.0-20231023113502-daf15ee41883
|
github.com/winc-link/edge-driver-proto v0.0.0-20231026095244-f5aaece7aee1
|
||||||
github.com/xuri/excelize/v2 v2.5.0
|
github.com/xuri/excelize/v2 v2.5.0
|
||||||
go.uber.org/atomic v1.9.0
|
go.uber.org/atomic v1.9.0
|
||||||
go.uber.org/zap v1.21.0
|
go.uber.org/zap v1.21.0
|
||||||
|
|
|
@ -157,11 +157,11 @@ func (p *productApp) AddProduct(ctx context.Context, req dtos.ProductAddRequest)
|
||||||
properties, events, actions = dtos.GetModelPropertyEventActionByThingModelTemplate(thingModelTemplateInfo.ThingModelJSON)
|
properties, events, actions = dtos.GetModelPropertyEventActionByThingModelTemplate(thingModelTemplateInfo.ThingModelJSON)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
secret := utils.GenerateDeviceSecret(15)
|
||||||
var insertProduct models.Product
|
var insertProduct models.Product
|
||||||
insertProduct.Id = utils.RandomNum()
|
insertProduct.Id = utils.RandomNum()
|
||||||
insertProduct.Name = req.Name
|
insertProduct.Name = req.Name
|
||||||
insertProduct.CloudProductId = utils.GenerateDeviceSecret(15)
|
insertProduct.CloudProductId = secret
|
||||||
insertProduct.Platform = constants.IotPlatform_LocalIot
|
insertProduct.Platform = constants.IotPlatform_LocalIot
|
||||||
insertProduct.Protocol = req.Protocol
|
insertProduct.Protocol = req.Protocol
|
||||||
insertProduct.NodeType = constants.ProductNodeType(req.NodeType)
|
insertProduct.NodeType = constants.ProductNodeType(req.NodeType)
|
||||||
|
@ -169,7 +169,7 @@ func (p *productApp) AddProduct(ctx context.Context, req dtos.ProductAddRequest)
|
||||||
insertProduct.DataFormat = req.DataFormat
|
insertProduct.DataFormat = req.DataFormat
|
||||||
insertProduct.Factory = req.Factory
|
insertProduct.Factory = req.Factory
|
||||||
insertProduct.Description = req.Description
|
insertProduct.Description = req.Description
|
||||||
insertProduct.Key = req.Key
|
insertProduct.Key = secret
|
||||||
insertProduct.Status = constants.ProductUnRelease
|
insertProduct.Status = constants.ProductUnRelease
|
||||||
insertProduct.Properties = properties
|
insertProduct.Properties = properties
|
||||||
insertProduct.Events = events
|
insertProduct.Events = events
|
||||||
|
|
|
@ -59,6 +59,7 @@ func (d *Product) TransformToDriverProduct() *driverproduct.Product {
|
||||||
driverProduct.Platform = d.Platform.TransformToDriverDevicePlatform()
|
driverProduct.Platform = d.Platform.TransformToDriverDevicePlatform()
|
||||||
driverProduct.NetType = d.NetType.TransformToDriverProductNetType()
|
driverProduct.NetType = d.NetType.TransformToDriverProductNetType()
|
||||||
driverProduct.ProtocolType = d.Protocol
|
driverProduct.ProtocolType = d.Protocol
|
||||||
|
driverProduct.Key = d.Key
|
||||||
driverProduct.CreateAt = uint64(d.Created)
|
driverProduct.CreateAt = uint64(d.Created)
|
||||||
var p []*driverproduct.Properties
|
var p []*driverproduct.Properties
|
||||||
var e []*driverproduct.Events
|
var e []*driverproduct.Events
|
||||||
|
|
Loading…
Reference in New Issue