mirror of
https://github.com/GMWalletApp/epusdt.git
synced 2026-07-07 10:16:15 +00:00
feat: add admin panel with multi-chain support and notification system
- Add full admin REST API: auth, API keys, chains, chain tokens, wallets, orders, RPC nodes, settings, dashboard stats, notifications - Add JWT-based admin authentication and API key auth middleware - Add multi-chain listeners: BSC, ETH, Polygon, Plasma, EVM WebSocket - Add RPC node health check job with automatic failover - Add Telegram notification channel for order events - Add installer for first-run database initialization - Add new DB models: admin_user, api_key, chain, chain_token, rpc_node, settings, notification_channel - Add order statistics aggregation (daily/monthly/by-chain) - Serve built admin SPA from embedded www/ assets - Add comprehensive test coverage for all new features
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package mdb
|
||||
|
||||
const (
|
||||
NotificationTypeTelegram = "telegram"
|
||||
NotificationTypeWebhook = "webhook"
|
||||
NotificationTypeEmail = "email"
|
||||
)
|
||||
|
||||
const (
|
||||
NotificationStatusEnable = 1
|
||||
NotificationStatusDisable = 2
|
||||
)
|
||||
|
||||
// Notification events (JSON keys in Events column).
|
||||
const (
|
||||
NotifyEventPaySuccess = "pay_success"
|
||||
NotifyEventOrderExpired = "order_expired"
|
||||
NotifyEventDailyReport = "daily_report"
|
||||
)
|
||||
|
||||
// NotificationChannel represents one push target instance.
|
||||
// Config/Events are JSON strings consumed by the notify dispatcher.
|
||||
// For telegram, Config = {"bot_token":"...","chat_id":"...","proxy":"..."}.
|
||||
// For webhook, Config = {"url":"...","headers":{...},"secret":"..."}.
|
||||
type NotificationChannel struct {
|
||||
Type string `gorm:"column:type;size:32;index:notification_channels_type_enabled_index,priority:1" json:"type" enums:"telegram,webhook,email" example:"telegram"`
|
||||
Name string `gorm:"column:name;size:128" json:"name" example:"主通知群"`
|
||||
Config string `gorm:"column:config;type:text" json:"config" example:"{\"bot_token\":\"123:ABC\",\"chat_id\":\"456\"}"`
|
||||
Events string `gorm:"column:events;type:text" json:"events" example:"{\"pay_success\":true,\"order_expired\":true}"`
|
||||
Enabled bool `gorm:"column:enabled;default:true;index:notification_channels_type_enabled_index,priority:2" json:"enabled" example:"true"`
|
||||
BaseModel
|
||||
}
|
||||
|
||||
func (n *NotificationChannel) TableName() string {
|
||||
return "notification_channels"
|
||||
}
|
||||
Reference in New Issue
Block a user