mirror of
https://github.com/GMWalletApp/epusdt.git
synced 2026-07-07 02:06:16 +00:00
6bb47d4b00
- 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
30 lines
1.2 KiB
Go
30 lines
1.2 KiB
Go
package mdb
|
|
|
|
import "github.com/dromara/carbon/v2"
|
|
|
|
const (
|
|
ApiKeyStatusEnable = 1
|
|
ApiKeyStatusDisable = 2
|
|
)
|
|
|
|
// ApiKey stores a universal merchant credential (PID + secret) that is
|
|
// valid for both EPAY and GMPAY payment flows. Identification at
|
|
// request time is always by PID; the gateway flow is chosen by the
|
|
// route (not by any property of the row).
|
|
type ApiKey struct {
|
|
Name string `gorm:"column:name;size:128" json:"name" example:"My API Key"`
|
|
Pid string `gorm:"column:pid;size:128;uniqueIndex:api_keys_pid_uindex" json:"pid" example:"1000"`
|
|
SecretKey string `gorm:"column:secret_key;size:255" json:"-"`
|
|
IpWhitelist string `gorm:"column:ip_whitelist;type:text" json:"ip_whitelist" example:"192.168.1.0/24,10.0.0.1"`
|
|
NotifyUrl string `gorm:"column:notify_url;size:512" json:"notify_url" example:"https://example.com/notify"`
|
|
// 状态 1=启用 2=禁用
|
|
Status int `gorm:"column:status;default:1" json:"status" enums:"1,2" example:"1"`
|
|
CallCount int64 `gorm:"column:call_count;default:0" json:"call_count" example:"342"`
|
|
LastUsedAt carbon.Time `gorm:"column:last_used_at" json:"last_used_at" example:"2026-04-16 12:00:00"`
|
|
BaseModel
|
|
}
|
|
|
|
func (a *ApiKey) TableName() string {
|
|
return "api_keys"
|
|
}
|