feat: 下线设备保护期
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m30s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m30s
- 后台设备停复机不再设置 1 小时保护期,也不再因保护期拒绝相反操作;单卡手动停复机去掉保护期检查 - 删除保护期一致性轮询(polling:protect)及其强制停复机方法;调度、初始化、监控、匹配预览不再包含保护期;已入队的旧任务由空处理函数直接确认,下一次发布移除 - 轮询配置接口不再接受与返回 protect_check_interval;并发配置不再返回 protect,查询、更新、重置该类型时拒绝 - 资产详情 device_protect_status 固定返回 none 并标记废弃,兼容老版本客户端 - 删除保护期 Redis key 与时长常量;停机原因 protect_period 保留供历史数据与开放接口映射 - 迁移 000249 只把 protect_check_interval、last_protect_check_at 列注释标记为已废弃,不删列不改数据
This commit is contained in:
@@ -295,8 +295,8 @@ func (s *Service) buildDeviceResolveResponse(ctx context.Context, device *model.
|
||||
// 查套餐系列名称
|
||||
s.fillSeriesName(ctx, resp)
|
||||
|
||||
// 查 Redis 保护期
|
||||
resp.DeviceProtectStatus = s.getDeviceProtectStatus(ctx, device.ID)
|
||||
// 保护期已下线,字段固定返回无保护期,兼容老版本客户端。
|
||||
resp.DeviceProtectStatus = constants.DeviceProtectStatusNone
|
||||
|
||||
// 关联手机号:详情为单资产单次查询,按数据范围返回完整手机号。
|
||||
phones, err := s.resolveAssociatedPhones(ctx, constants.AssetTypeDevice, device.ID)
|
||||
@@ -525,7 +525,7 @@ func (s *Service) GetRealtimeStatus(ctx context.Context, assetType string, id ui
|
||||
})
|
||||
}
|
||||
}
|
||||
resp.DeviceProtectStatus = s.getDeviceProtectStatus(ctx, id)
|
||||
resp.DeviceProtectStatus = constants.DeviceProtectStatusNone
|
||||
|
||||
// 实时查询 Gateway 设备状态(不缓存,per D-05)
|
||||
// Gateway 失败不阻断主流程,DeviceRealtime 始终非 nil,失败时仅填 GatewayMsg(per D-06)
|
||||
@@ -1035,19 +1035,6 @@ func (s *Service) UpdatePackageUsage(ctx context.Context, assetType string, asse
|
||||
return s.buildAssetPackageResponse(ctx, updated, constants.OwnerTypePlatform), nil
|
||||
}
|
||||
|
||||
// getDeviceProtectStatus 查询设备保护期状态
|
||||
func (s *Service) getDeviceProtectStatus(ctx context.Context, deviceID uint) string {
|
||||
stopKey := constants.RedisDeviceProtectKey(deviceID, "stop")
|
||||
startKey := constants.RedisDeviceProtectKey(deviceID, "start")
|
||||
if s.redis.Exists(ctx, stopKey).Val() > 0 {
|
||||
return "stop"
|
||||
}
|
||||
if s.redis.Exists(ctx, startKey).Val() > 0 {
|
||||
return "start"
|
||||
}
|
||||
return "none"
|
||||
}
|
||||
|
||||
// nonZeroTimePtr 将非零时间转为指针,零值返回 nil(避免序列化出历史时区偏移 +08:05)
|
||||
func nonZeroTimePtr(t time.Time) *time.Time {
|
||||
if t.IsZero() {
|
||||
|
||||
Reference in New Issue
Block a user