This commit is contained in:
@@ -70,9 +70,16 @@ func (c *Client) RebootDevice(ctx context.Context, req *DeviceOperationReq) erro
|
||||
}
|
||||
|
||||
// SwitchMode 设置设备切卡模式
|
||||
// Gateway 实际要求 cardNo 传设备 IMEI,switch_mode 传字符串,并且必须指定目标 ICCID
|
||||
// 切换设备卡槽的自动/手动模式,0=自动切卡,1=手动切卡
|
||||
// POST /device/SwitchMode
|
||||
func (c *Client) SwitchMode(ctx context.Context, req *SwitchModeReq) error {
|
||||
if req.CardNo == "" {
|
||||
return errors.New(errors.CodeInvalidParam, "cardNo 不能为空")
|
||||
}
|
||||
if req.ICCID == "" {
|
||||
return errors.New(errors.CodeInvalidParam, "iccid 不能为空")
|
||||
}
|
||||
_, err := c.doRequest(ctx, "/device/SwitchMode", req)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -193,7 +193,8 @@ type DeviceOperationReq struct {
|
||||
// SwitchModeReq 是设置设备切卡模式的请求
|
||||
type SwitchModeReq struct {
|
||||
CardNo string `json:"cardNo" validate:"required" required:"true" description:"设备编号(IMEI)"`
|
||||
SwitchMode int `json:"switch_mode" description:"切卡模式(0:自动切卡, 1:手动切卡)"`
|
||||
SwitchMode string `json:"switch_mode" description:"切卡模式(0:自动切卡, 1:手动切卡)"`
|
||||
ICCID string `json:"iccid" validate:"required" required:"true" description:"目标卡 ICCID"`
|
||||
CallbackURL string `json:"callbackUrl,omitempty" description:"异步回调通知地址"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user