mirror of
https://gitee.com/winc-link/hummingbird.git
synced 2025-04-20 00:12:43 +00:00
修复device sn为空 bug
This commit is contained in:
parent
620b1b6af6
commit
01a1231a07
@ -171,6 +171,7 @@ type DeviceReportPropertiesValueSearchResponse struct {
|
||||
type DeviceAddRequest struct {
|
||||
DeviceId string `json:"device_id"`
|
||||
Name string `json:"name"`
|
||||
DeviceSn string `json:"device_sn"`
|
||||
ProductId string `json:"product_id"`
|
||||
Description string `json:"description"`
|
||||
Platform constants.IotPlatform `json:"platform"`
|
||||
|
@ -152,6 +152,7 @@ func (p *deviceApp) AddDevice(ctx context.Context, req dtos.DeviceAddRequest) (s
|
||||
var insertDevice models.Device
|
||||
insertDevice.Id = deviceId
|
||||
insertDevice.Name = req.Name
|
||||
insertDevice.DeviceSn = req.DeviceSn
|
||||
insertDevice.ProductId = req.ProductId
|
||||
insertDevice.Platform = constants.IotPlatform_LocalIot
|
||||
insertDevice.DriveInstanceId = req.DriverInstanceId
|
||||
|
@ -115,6 +115,8 @@ func (s *DriverDeviceServer) CreateDevice(ctx context.Context, request *device.C
|
||||
insertDevice.ProductId = productInfo.Id
|
||||
insertDevice.Platform = constants.IotPlatform_LocalIot
|
||||
insertDevice.Name = request.Device.Name
|
||||
insertDevice.DeviceSn = request.Device.DeviceSn
|
||||
//insertDevice.d
|
||||
insertDevice.DriverInstanceId = request.BaseRequest.GetDriverInstanceId()
|
||||
|
||||
deviceId, err := deviceItf.AddDevice(ctx, insertDevice)
|
||||
|
@ -32,6 +32,7 @@ type Device struct {
|
||||
CloudInstanceId string `gorm:"index;type:string;size:255;comment:云实例ID"`
|
||||
DriveInstanceId string `gorm:"index;type:string;size:255;comment:驱动实例ID"`
|
||||
Name string `gorm:"type:string;size:255;comment:名字"`
|
||||
DeviceSn string `gorm:"type:string;size:255;comment:设备唯一编码"`
|
||||
Status constants.DeviceStatus `gorm:"type:string;size:50;comment:设备状态"`
|
||||
Description string `gorm:"type:text;comment:描述"`
|
||||
ProductId string `gorm:"type:string;size:255;comment:产品ID"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user