完善续期通知与前端界面
This commit is contained in:
1 parent
25419c027f
commit
45f895d0c4
64 files changed
+2948
-487
No files matched your search
@@ -7,10 +7,11 @@ import (
|
||||
|
||||
// NotificationChannel 通知渠道(含配置 JSON)。
|
||||
type NotificationChannel struct {
|
||||
ID int64
|
||||
Name string
|
||||
Type string
|
||||
Config string // JSON
|
||||
ID int64
|
||||
Name string
|
||||
Type string
|
||||
Config string // JSON
|
||||
EventTypes string // JSON array or comma-separated event codes
|
||||
}
|
||||
|
||||
// Notifications 通知绑定操作。
|
||||
@@ -23,7 +24,8 @@ type Notifications struct {
|
||||
// 移植自 get_account_notifications。
|
||||
func (n *Notifications) AccountChannels(ctx context.Context, cookieID string) ([]NotificationChannel, error) {
|
||||
rows, err := n.DB.QueryContext(ctx,
|
||||
`SELECT nc.id, nc.name, nc.type, nc.config
|
||||
`SELECT nc.id, nc.name, nc.type, nc.config,
|
||||
COALESCE(NULLIF(mn.event_types,''), nc.event_types, '')
|
||||
FROM message_notifications mn
|
||||
JOIN cookies c ON c.id=mn.cookie_id
|
||||
JOIN notification_channels nc ON mn.channel_id = nc.id AND nc.user_id=c.user_id
|
||||
@@ -36,7 +38,7 @@ func (n *Notifications) AccountChannels(ctx context.Context, cookieID string) ([
|
||||
var out []NotificationChannel
|
||||
for rows.Next() {
|
||||
var c NotificationChannel
|
||||
if err := rows.Scan(&c.ID, &c.Name, &c.Type, &c.Config); err != nil {
|
||||
if err := rows.Scan(&c.ID, &c.Name, &c.Type, &c.Config, &c.EventTypes); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out = append(out, c)
|
||||
|
||||
Reference in new issue
Block a user