完善退款审批材料与恢复流程
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m35s

This commit is contained in:
2026-09-20 17:59:52 +08:00
parent 4a6cec2730
commit b063617153
29 changed files with 1119 additions and 156 deletions

View File

@@ -36,3 +36,17 @@ func (w *SubmissionEventWriter) Append(ctx context.Context, tx *gorm.DB, event a
})
return err
}
type UnknownRecoveryEventWriter struct{ outbox *outbox.Repository }
func NewUnknownRecoveryEventWriter(repository *outbox.Repository) *UnknownRecoveryEventWriter {
return &UnknownRecoveryEventWriter{outbox: repository}
}
func (w *UnknownRecoveryEventWriter) Append(ctx context.Context, tx *gorm.DB, instanceID uint) error {
if w == nil || w.outbox == nil || instanceID == 0 {
return errors.New(errors.CodeInternalError, "审批未知恢复 Outbox Writer 未配置")
}
eventID := "approval:" + strconv.FormatUint(uint64(instanceID), 10) + ":unknown-recovery"
_, err := w.outbox.AppendIdempotent(ctx, tx, outbox.Envelope{EventID: eventID, EventType: constants.OutboxEventTypeApprovalUnknownRecoveryRequested, PayloadVersion: 1, AggregateType: "approval", AggregateID: strconv.FormatUint(uint64(instanceID), 10), ResourceType: "approval", ResourceID: strconv.FormatUint(uint64(instanceID), 10), BusinessKey: eventID, Payload: map[string]any{"instance_id": instanceID}})
return err
}