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

@@ -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 {