fix: 第1批 F1、M12 换货清空客户绑定的审计写入失败
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 10m0s

- 换货清空旧资产绑定写 personal_customer.unbind_asset 时,资产资源带主体摘要却缺省为仅内部可见,
  被审计写入拒绝并静默降级(“内部事件不得写入主体投影”);资产资源改为声明结论可见级别。
  后台按虚拟号解除绑定(UnbindByVirtualNo)同样受益
- 设备换货完成审计不再把新设备已有的扫码绑定记为“新设备客户绑定”:换货已不迁移绑定
- 测试环境验证 F1(4.3)与 M12(4.4)完成

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
邹进
2026-10-12 09:21:46 +09:00
parent 868d969d8e
commit 465016a333
3 changed files with 7 additions and 13 deletions

View File

@@ -84,17 +84,19 @@ func bindingAssetReference(cards []accessauditapp.IotCardChange, devices []acces
return "", 0
}
// cardAuditChange 构造资产资源;带主体摘要必须声明结论可见级别,非主资源缺省为仅内部,会被审计写入拒绝。
func cardAuditChange(card *model.IotCard, relation, role string, beforeData, afterData map[string]any) accessauditapp.IotCardChange {
return accessauditapp.IotCardChange{
Card: card, Relation: relation, Role: role, BeforeData: beforeData, AfterData: afterData,
SubjectSummary: "个人客户资产关系已更新",
SubjectVisibility: constants.AuditSubjectResult, SubjectSummary: "个人客户资产关系已更新",
}
}
// deviceAuditChange 构造设备资源,可见级别同 cardAuditChange。
func deviceAuditChange(device *model.Device, relation, role string, beforeData, afterData map[string]any) accessauditapp.DeviceChange {
return accessauditapp.DeviceChange{
Device: device, Relation: relation, Role: role, BeforeData: beforeData, AfterData: afterData,
SubjectSummary: "个人客户资产关系已更新",
SubjectVisibility: constants.AuditSubjectResult, SubjectSummary: "个人客户资产关系已更新",
}
}

View File

@@ -205,12 +205,8 @@ func (s *Service) buildDeviceExchangeCompletionResources(
before *deviceExchangeAuditBefore,
migration *exchangeMigrationResult,
) ([]audit.ResourceInput, error) {
// 换货不迁移客户绑定,新设备没有由本次换货产生的绑定,只审计被清空的旧设备绑定。
resources := deviceExchangeOldCustomerBindingResources(before)
newBindings, err := loadDeviceExchangeCustomerBindings(ctx, tx, newDevice)
if err != nil {
return nil, err
}
resources = append(resources, deviceExchangeNewCustomerBindingResources(newBindings)...)
simResources, err := loadDeviceExchangeSIMResources(ctx, tx, oldDevice, newDevice)
if err != nil {
return nil, err
@@ -247,10 +243,6 @@ func deviceExchangeOldCustomerBindingResources(before *deviceExchangeAuditBefore
return deviceExchangeCustomerBindingResources(before.CustomerBindings, constants.AuditResourceRoleDeviceExchangeOldCustomerBinding, true)
}
func deviceExchangeNewCustomerBindingResources(rows []*model.PersonalCustomerDevice) []audit.ResourceInput {
return deviceExchangeCustomerBindingResources(rows, constants.AuditResourceRoleDeviceExchangeNewCustomerBinding, false)
}
func deviceExchangeCustomerBindingResources(rows []*model.PersonalCustomerDevice, role string, before bool) []audit.ResourceInput {
resources := make([]audit.ResourceInput, 0, len(rows))
for _, row := range rows {