修复解绑卡没有iccid的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m56s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m56s
This commit is contained in:
@@ -421,6 +421,24 @@ func (s *Service) UnbindCard(ctx context.Context, deviceID uint, cardID uint) (*
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cardAudit map[string]any
|
||||||
|
if card, cardErr := s.iotCardStore.GetByID(ctx, binding.IotCardID); cardErr == nil {
|
||||||
|
cardAudit = map[string]any{
|
||||||
|
"id": card.ID,
|
||||||
|
"iccid": card.ICCID,
|
||||||
|
"status": card.Status,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeAuditData := map[string]any{
|
||||||
|
"device": deviceSnapshot(device),
|
||||||
|
"binding_id": binding.ID,
|
||||||
|
"iot_card_id": binding.IotCardID,
|
||||||
|
}
|
||||||
|
if cardAudit != nil {
|
||||||
|
beforeAuditData["card"] = cardAudit
|
||||||
|
}
|
||||||
|
|
||||||
if err := s.deviceSimBindingStore.Unbind(ctx, binding.ID); err != nil {
|
if err := s.deviceSimBindingStore.Unbind(ctx, binding.ID); err != nil {
|
||||||
s.logDeviceOperation(
|
s.logDeviceOperation(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -428,11 +446,7 @@ func (s *Service) UnbindCard(ctx context.Context, deviceID uint, cardID uint) (*
|
|||||||
"设备解绑卡失败",
|
"设备解绑卡失败",
|
||||||
constants.AssetAuditResultFailed,
|
constants.AssetAuditResultFailed,
|
||||||
device,
|
device,
|
||||||
map[string]any{
|
beforeAuditData,
|
||||||
"device": deviceSnapshot(device),
|
|
||||||
"binding_id": binding.ID,
|
|
||||||
"iot_card_id": binding.IotCardID,
|
|
||||||
},
|
|
||||||
nil,
|
nil,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -451,21 +465,22 @@ func (s *Service) UnbindCard(ctx context.Context, deviceID uint, cardID uint) (*
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
afterAuditData := map[string]any{
|
||||||
|
"iot_card_id": cardID,
|
||||||
|
"unbind": true,
|
||||||
|
}
|
||||||
|
if cardAudit != nil {
|
||||||
|
afterAuditData["card"] = cardAudit
|
||||||
|
}
|
||||||
|
|
||||||
s.logDeviceOperation(
|
s.logDeviceOperation(
|
||||||
ctx,
|
ctx,
|
||||||
constants.AssetAuditOpDeviceUnbindCard,
|
constants.AssetAuditOpDeviceUnbindCard,
|
||||||
"设备解绑卡",
|
"设备解绑卡",
|
||||||
constants.AssetAuditResultSuccess,
|
constants.AssetAuditResultSuccess,
|
||||||
device,
|
device,
|
||||||
map[string]any{
|
beforeAuditData,
|
||||||
"device": deviceSnapshot(device),
|
afterAuditData,
|
||||||
"binding_id": binding.ID,
|
|
||||||
"iot_card_id": binding.IotCardID,
|
|
||||||
},
|
|
||||||
map[string]any{
|
|
||||||
"iot_card_id": cardID,
|
|
||||||
"unbind": true,
|
|
||||||
},
|
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user