模板 / classDiagram

通知渠道类图

可插拔通知渠道(邮件、短信、推送)的策略模式,统一封装在一个接口之下。

在 Studio 中打开

预览

Mermaid 11 渲染器

正在渲染预览...

Mermaid 源码

classDiagram

classDiagram
    class User {
        +int id
        +string email
        +NotificationPreference preference
    }
    class NotificationPreference {
        +bool emailEnabled
        +bool smsEnabled
        +bool pushEnabled
        +muteChannel(channel)
    }
    class NotificationChannel {
        <<interface>>
        +send(message)
    }
    class EmailChannel {
        +send(message)
    }
    class SmsChannel {
        +send(message)
    }
    class PushChannel {
        +send(message)
    }
    NotificationChannel <|.. EmailChannel
    NotificationChannel <|.. SmsChannel
    NotificationChannel <|.. PushChannel
    User "1" --> "1" NotificationPreference

更多模板