七月迭代短暂完结,还有很多后端的关键东西没有弄,这是一版赶时间做的东西
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s
This commit is contained in:
@@ -27,14 +27,6 @@ func (c *Client) GetSlotInfo(ctx context.Context, req *DeviceInfoReq) (*SlotInfo
|
||||
return doRequestWithResponse[SlotInfoResp](c, ctx, "/device/slot-info", req)
|
||||
}
|
||||
|
||||
// SetSpeedLimit 设置设备限速
|
||||
// 设置设备的统一限速值(单位 KB/s)
|
||||
// POST /device/speed-limit
|
||||
func (c *Client) SetSpeedLimit(ctx context.Context, req *SpeedLimitReq) error {
|
||||
_, err := c.doRequest(ctx, "/device/speed-limit", req)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetWiFi 设置设备 WiFi
|
||||
// Gateway 实际要求 cardNo 传设备 IMEI,并搭配内层 params 下发 WiFi 名称和密码
|
||||
// POST /device/wifi-config
|
||||
|
||||
@@ -45,6 +45,19 @@ func (c *Client) GetRealnameLink(ctx context.Context, req *CardStatusReq) (*Real
|
||||
return doRequestWithResponse[RealnameLinkResp](c, ctx, "/flow-card/RealNameVerification", req)
|
||||
}
|
||||
|
||||
// SetCardSpeedTier 设置或恢复流量卡固定限速档位。
|
||||
// POST /flow-card/speedLimit
|
||||
func (c *Client) SetCardSpeedTier(ctx context.Context, req *CardSpeedTierReq) error {
|
||||
if req == nil || req.CardNo == "" || req.Code == "" {
|
||||
return errors.New(errors.CodeInvalidParam, "流量卡号和限速档位不能为空")
|
||||
}
|
||||
// 限速是外部状态写入,网络错误或超时后实际结果不可确定,禁止沿用查询接口的自动重试。
|
||||
requestClient := *c
|
||||
requestClient.maxRetries = 0
|
||||
_, err := requestClient.doRequest(ctx, "/flow-card/speedLimit", req)
|
||||
return err
|
||||
}
|
||||
|
||||
// BatchQuery 批量查询(预留接口,暂未实现)
|
||||
func (c *Client) BatchQuery(ctx context.Context, req *BatchQueryReq) (*BatchQueryResp, error) {
|
||||
return nil, errors.New(errors.CodeGatewayError, "批量查询接口暂未实现")
|
||||
|
||||
@@ -187,12 +187,10 @@ type DeviceInfoResp struct {
|
||||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||||
}
|
||||
|
||||
// SpeedLimitReq 是设置设备限速的请求
|
||||
type SpeedLimitReq struct {
|
||||
CardNo string `json:"cardNo,omitempty" description:"流量卡号(与 DeviceID 二选一)"`
|
||||
DeviceID string `json:"deviceId,omitempty" description:"设备 ID/IMEI(与 CardNo 二选一)"`
|
||||
SpeedLimit int `json:"speedLimit" validate:"required,min=1" required:"true" minimum:"1" description:"限速值(KB/s)"`
|
||||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||||
// CardSpeedTierReq 是流量卡固定限速档位请求。
|
||||
type CardSpeedTierReq struct {
|
||||
CardNo string `json:"cardNo" validate:"required" required:"true" description:"流量卡 ICCID"`
|
||||
Code string `json:"code" validate:"required" required:"true" description:"限速档位编码 (-1:恢复不限速, 0:0kbps, 1:128Kbps, 2:512Kbps, 3:1Mbps, 4:2Mbps, 5:10Mbps, 6:20Mbps, 7:50Mbps, 8:100Mbps)"`
|
||||
}
|
||||
|
||||
// WiFiParams 是设置设备 WiFi 的内层参数
|
||||
|
||||
Reference in New Issue
Block a user