修复设备WiFi上游请求参数
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m40s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m40s
This commit is contained in:
@@ -470,27 +470,30 @@ fmt.Println("限速设置成功")
|
||||
|
||||
### 4. 设置设备 WiFi
|
||||
|
||||
设置设备的 WiFi 名称、密码和启用状态。
|
||||
设置设备的 WiFi 信息。
|
||||
|
||||
**方法**: `SetWiFi`
|
||||
|
||||
**请求参数**:
|
||||
```go
|
||||
type WiFiReq struct {
|
||||
DeviceID string `json:"deviceId" validate:"required"`
|
||||
SSID string `json:"ssid" validate:"required,min=1,max=32"`
|
||||
Password string `json:"password" validate:"required,min=8,max=63"`
|
||||
Enabled int `json:"enabled" validate:"required,oneof=0 1"`
|
||||
Extend string `json:"extend,omitempty"`
|
||||
CardNo string `json:"cardNo" validate:"required"`
|
||||
Params WiFiParams `json:"params" validate:"required"`
|
||||
Extend string `json:"extend,omitempty"`
|
||||
}
|
||||
|
||||
type WiFiParams struct {
|
||||
SSIDName string `json:"ssidName" validate:"required,min=1,max=32"`
|
||||
SSIDPassword string `json:"ssidPassword,omitempty"`
|
||||
}
|
||||
```
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| DeviceID | string | ✅ | 设备 ID/IMEI |
|
||||
| SSID | string | ✅ | WiFi 名称(1-32字符) |
|
||||
| Password | string | ✅ | WiFi 密码(8-63字符) |
|
||||
| Enabled | int | ✅ | 启用状态(0:禁用, 1:启用) |
|
||||
| CardNo | string | ✅ | 设备 IMEI |
|
||||
| Params | object | ✅ | WiFi 配置参数 |
|
||||
| SSIDName | string | ✅ | WiFi 名称(1-32字符) |
|
||||
| SSIDPassword | string | ❌ | WiFi 密码 |
|
||||
| Extend | string | ❌ | 扩展字段 |
|
||||
|
||||
**响应参数**: 无(成功返回 nil,失败返回 error)
|
||||
@@ -498,10 +501,11 @@ type WiFiReq struct {
|
||||
**使用示例**:
|
||||
```go
|
||||
err := client.SetWiFi(ctx, &gateway.WiFiReq{
|
||||
DeviceID: "123456789012345",
|
||||
SSID: "MyWiFi",
|
||||
Password: "password123",
|
||||
Enabled: 1,
|
||||
CardNo: "123456789012345",
|
||||
Params: gateway.WiFiParams{
|
||||
SSIDName: "MyWiFi",
|
||||
SSIDPassword: "password123",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user