This commit is contained in:
@@ -11,10 +11,13 @@ import (
|
||||
// Device 设备模型
|
||||
// 物联网设备(如 GPS 追踪器、智能传感器)
|
||||
// 通过 shop_id 区分所有权:NULL=平台库存,有值=店铺所有
|
||||
// 标识符说明:device_no 为虚拟号/别名,imei/sn 为设备真实标识
|
||||
type Device struct {
|
||||
gorm.Model
|
||||
BaseModel `gorm:"embedded"`
|
||||
DeviceNo string `gorm:"column:device_no;type:varchar(100);uniqueIndex:idx_device_no,where:deleted_at IS NULL;not null;comment:设备编号(唯一标识)" json:"device_no"`
|
||||
DeviceNo string `gorm:"column:device_no;type:varchar(100);uniqueIndex:idx_device_no,where:deleted_at IS NULL;not null;comment:设备虚拟号/别名(用户友好的短标识)" json:"device_no"`
|
||||
IMEI string `gorm:"column:imei;type:varchar(20);comment:设备IMEI(有蜂窝网络的设备标识,用于Gateway API调用)" json:"imei"`
|
||||
SN string `gorm:"column:sn;type:varchar(100);comment:设备序列号(厂商唯一标识,预留字段)" json:"sn"`
|
||||
DeviceName string `gorm:"column:device_name;type:varchar(255);comment:设备名称" json:"device_name"`
|
||||
DeviceModel string `gorm:"column:device_model;type:varchar(100);comment:设备型号" json:"device_model"`
|
||||
DeviceType string `gorm:"column:device_type;type:varchar(50);comment:设备类型" json:"device_type"`
|
||||
|
||||
@@ -19,7 +19,9 @@ type ListDeviceRequest struct {
|
||||
|
||||
type DeviceResponse struct {
|
||||
ID uint `json:"id" description:"设备ID"`
|
||||
DeviceNo string `json:"device_no" description:"设备号"`
|
||||
DeviceNo string `json:"device_no" description:"设备虚拟号/别名"`
|
||||
IMEI string `json:"imei" description:"设备IMEI"`
|
||||
SN string `json:"sn" description:"设备序列号"`
|
||||
DeviceName string `json:"device_name" description:"设备名称"`
|
||||
DeviceModel string `json:"device_model" description:"设备型号"`
|
||||
DeviceType string `json:"device_type" description:"设备类型"`
|
||||
@@ -52,8 +54,9 @@ type GetDeviceRequest struct {
|
||||
ID uint `path:"id" description:"设备ID" required:"true"`
|
||||
}
|
||||
|
||||
type GetDeviceByIMEIRequest struct {
|
||||
DeviceNo string `path:"imei" description:"设备号(IMEI)" required:"true"`
|
||||
// GetDeviceByIdentifierRequest 通过标识符查询设备请求
|
||||
type GetDeviceByIdentifierRequest struct {
|
||||
Identifier string `path:"identifier" description:"设备标识符(支持虚拟号/IMEI/SN)" required:"true"`
|
||||
}
|
||||
|
||||
type DeleteDeviceRequest struct {
|
||||
@@ -148,21 +151,24 @@ type BatchSetDeviceSeriesBindngResponse struct {
|
||||
FailedItems []DeviceSeriesBindngFailedItem `json:"failed_items" description:"失败详情列表"`
|
||||
}
|
||||
|
||||
// SetSpeedLimitRequest 设置设备限速请求
|
||||
type SetSpeedLimitRequest struct {
|
||||
IMEI string `path:"imei" description:"设备号(IMEI)" required:"true"`
|
||||
UploadSpeed int `json:"upload_speed" validate:"required,min=1" required:"true" minimum:"1" description:"上行速率(KB/s)"`
|
||||
DownloadSpeed int `json:"download_speed" validate:"required,min=1" required:"true" minimum:"1" description:"下行速率(KB/s)"`
|
||||
Identifier string `path:"identifier" description:"设备标识符(支持虚拟号/IMEI/SN)" required:"true"`
|
||||
SpeedLimit int `json:"speed_limit" validate:"required,min=1" required:"true" minimum:"1" description:"限速值(KB/s)"`
|
||||
}
|
||||
|
||||
// SetWiFiRequest 设置设备 WiFi 请求
|
||||
type SetWiFiRequest struct {
|
||||
IMEI string `path:"imei" description:"设备号(IMEI)" required:"true"`
|
||||
SSID string `json:"ssid" validate:"required,min=1,max=32" required:"true" minLength:"1" maxLength:"32" description:"WiFi 名称"`
|
||||
Password string `json:"password" validate:"required,min=8,max=63" required:"true" minLength:"8" maxLength:"63" description:"WiFi 密码"`
|
||||
Enabled int `json:"enabled" validate:"required,oneof=0 1" required:"true" description:"启用状态(0:禁用, 1:启用)"`
|
||||
Identifier string `path:"identifier" description:"设备标识符(支持虚拟号/IMEI/SN)" required:"true"`
|
||||
CardNo string `json:"card_no" validate:"required" required:"true" description:"流量卡号(ICCID)"`
|
||||
SSID string `json:"ssid" validate:"required,min=1,max=32" required:"true" minLength:"1" maxLength:"32" description:"WiFi 名称"`
|
||||
Password string `json:"password,omitempty" description:"WiFi 密码"`
|
||||
Enabled bool `json:"enabled" description:"启用状态"`
|
||||
}
|
||||
|
||||
// SwitchCardRequest 切卡请求
|
||||
type SwitchCardRequest struct {
|
||||
IMEI string `path:"imei" description:"设备号(IMEI)" required:"true"`
|
||||
Identifier string `path:"identifier" description:"设备标识符(支持虚拟号/IMEI/SN)" required:"true"`
|
||||
TargetICCID string `json:"target_iccid" validate:"required" required:"true" description:"目标卡 ICCID"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user