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:
line-6000
2026-04-22 02:28:31 +08:00
parent 097c716714
commit 6bb47d4b00
247 changed files with 9933 additions and 1279 deletions
+10 -5
View File
@@ -58,16 +58,21 @@ func (r *Resp) SucJsonPage(e echo.Context, data interface{}, pagination page.Pag
return r.SucJson(e, pageDate, message...)
}
// FailJson 失败json
// FailJson 失败json — Propagates semantic HTTP status codes to the
// wire. RspError.Code in the 4xx/5xx range is used directly; business
// codes (>=1000) map to HTTP 400 with the specific code still visible
// in the body's status_code field.
func (r *Resp) FailJson(e echo.Context, err error) error {
rr := new(Response)
switch err.(type) {
httpStatus := http.StatusBadRequest
switch t := err.(type) {
case *constant.RspError:
rr.StatusCode, rr.Message = err.(*constant.RspError).Render()
rr.StatusCode, rr.Message = t.Render()
httpStatus = t.HttpStatus()
default:
rr.StatusCode = 400
rr.StatusCode = http.StatusBadRequest
rr.Message = err.Error()
}
rr.RequestID = e.Request().Header.Get(echo.HeaderXRequestID)
return r.Json(e, http.StatusOK, &rr)
return r.Json(e, httpStatus, &rr)
}