- 时间戳从 UnixMilli (13位) 改为 Unix (10位秒级) - 实名状态接口路径 /realname-status → /realName - 实名链接接口路径 /realname-link → /RealNameVerification - RealnameStatusResp: status string → realStatus bool + iccid - FlowUsageResp: usedFlow int64 → used float64 + iccid - RealnameLinkResp: link → url
132 lines
6.2 KiB
Go
132 lines
6.2 KiB
Go
// Package gateway 定义 Gateway API 的请求和响应数据传输对象(DTO)
|
||
package gateway
|
||
|
||
import "encoding/json"
|
||
|
||
// GatewayResponse 是 Gateway API 的通用响应结构
|
||
type GatewayResponse struct {
|
||
Code int `json:"code" description:"业务状态码(200 = 成功)"`
|
||
Msg string `json:"msg" description:"业务提示信息"`
|
||
Data json.RawMessage `json:"data" description:"业务数据(原始 JSON)"`
|
||
TraceID string `json:"trace_id" description:"链路追踪 ID"`
|
||
}
|
||
|
||
// ============ 流量卡相关 DTO ============
|
||
|
||
// CardStatusReq 是查询流量卡状态的请求
|
||
type CardStatusReq struct {
|
||
CardNo string `json:"cardNo" validate:"required" required:"true" description:"流量卡号"`
|
||
}
|
||
|
||
// CardStatusResp 是查询流量卡状态的响应
|
||
type CardStatusResp struct {
|
||
ICCID string `json:"iccid" description:"ICCID"`
|
||
CardStatus string `json:"cardStatus" description:"卡状态(准备、正常、停机)"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// FlowQueryReq 是查询流量使用的请求
|
||
type FlowQueryReq struct {
|
||
CardNo string `json:"cardNo" validate:"required" required:"true" description:"流量卡号"`
|
||
}
|
||
|
||
// FlowUsageResp 是查询流量使用的响应
|
||
type FlowUsageResp struct {
|
||
ICCID string `json:"iccid" description:"ICCID"`
|
||
Used float64 `json:"used" description:"当月已用流量(MB)"`
|
||
Unit string `json:"unit" description:"流量单位(MB)"`
|
||
}
|
||
|
||
// CardOperationReq 是停机/复机请求
|
||
type CardOperationReq struct {
|
||
CardNo string `json:"cardNo" validate:"required" required:"true" description:"流量卡号"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// RealnameStatusResp 是实名认证状态的响应
|
||
type RealnameStatusResp struct {
|
||
ICCID string `json:"iccid" description:"ICCID"`
|
||
RealStatus bool `json:"realStatus" description:"实名状态(true=已实名, false=未实名)"`
|
||
}
|
||
|
||
// RealnameLinkResp 是实名认证链接的响应
|
||
type RealnameLinkResp struct {
|
||
URL string `json:"url" description:"实名认证跳转链接(HTTPS URL)"`
|
||
}
|
||
|
||
// BatchQueryReq 是批量查询的请求
|
||
type BatchQueryReq struct {
|
||
CardNos []string `json:"cardNos" validate:"required,min=1,max=100" required:"true" description:"流量卡号列表(最多100个)"`
|
||
}
|
||
|
||
// BatchQueryResp 是批量查询的响应
|
||
type BatchQueryResp struct {
|
||
Results []CardStatusResp `json:"results" description:"查询结果列表"`
|
||
}
|
||
|
||
// ============ 设备相关 DTO ============
|
||
|
||
// DeviceInfoReq 是查询设备信息的请求
|
||
type DeviceInfoReq struct {
|
||
CardNo string `json:"cardNo,omitempty" description:"流量卡号(与 DeviceID 二选一)"`
|
||
DeviceID string `json:"deviceId,omitempty" description:"设备 ID/IMEI(与 CardNo 二选一)"`
|
||
}
|
||
|
||
// DeviceInfoResp 是查询设备信息的响应
|
||
type DeviceInfoResp struct {
|
||
IMEI string `json:"imei" description:"设备 IMEI"`
|
||
OnlineStatus int `json:"onlineStatus" description:"在线状态(0:离线, 1:在线)"`
|
||
SignalLevel int `json:"signalLevel" description:"信号强度(0-31)"`
|
||
WiFiSSID string `json:"wifiSsid,omitempty" description:"WiFi 名称"`
|
||
WiFiEnabled int `json:"wifiEnabled" description:"WiFi 启用状态(0:禁用, 1:启用)"`
|
||
UploadSpeed int `json:"uploadSpeed" description:"上行速率(KB/s)"`
|
||
DownloadSpeed int `json:"downloadSpeed" description:"下行速率(KB/s)"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// SpeedLimitReq 是设置设备限速的请求
|
||
type SpeedLimitReq struct {
|
||
DeviceID string `json:"deviceId" validate:"required" required:"true" description:"设备 ID/IMEI"`
|
||
UploadSpeed int `json:"uploadSpeed" validate:"required,min=1" required:"true" minimum:"1" description:"上行速率(KB/s)"`
|
||
DownloadSpeed int `json:"downloadSpeed" validate:"required,min=1" required:"true" minimum:"1" description:"下行速率(KB/s)"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// WiFiReq 是设置设备 WiFi 的请求
|
||
type WiFiReq struct {
|
||
DeviceID string `json:"deviceId" validate:"required" required:"true" description:"设备 ID/IMEI"`
|
||
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:启用)"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// SwitchCardReq 是设备切换卡的请求
|
||
type SwitchCardReq struct {
|
||
DeviceID string `json:"deviceId" validate:"required" required:"true" description:"设备 ID/IMEI"`
|
||
TargetICCID string `json:"targetIccid" validate:"required" required:"true" description:"目标卡 ICCID"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// DeviceOperationReq 是设备操作(重启、恢复出厂)的请求
|
||
type DeviceOperationReq struct {
|
||
DeviceID string `json:"deviceId" validate:"required" required:"true" description:"设备 ID/IMEI"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// SlotInfo 是单个卡槽信息
|
||
type SlotInfo struct {
|
||
SlotNo int `json:"slotNo" description:"卡槽编号"`
|
||
ICCID string `json:"iccid" description:"卡槽中的 ICCID"`
|
||
CardStatus string `json:"cardStatus" description:"卡状态(准备、正常、停机)"`
|
||
IsActive int `json:"isActive" description:"是否为当前使用的卡槽(0:否, 1:是)"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|
||
|
||
// SlotInfoResp 是查询设备卡槽信息的响应
|
||
type SlotInfoResp struct {
|
||
IMEI string `json:"imei" description:"设备 IMEI"`
|
||
Slots []SlotInfo `json:"slots" description:"卡槽信息列表"`
|
||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||
}
|