Compare commits

...
54 Commits
Author SHA1 Message Date
v03413 eeb7ac1f79 fix: update pnpm version in Dockerfile
现在 pnpm 已经更新到v11, v10 和 v11 有兼容问题;懒得折腾,先这样吧。
2026-05-12 15:27:19 +08:00
莫名 468fe8b0c2 Merge pull request #191 from betaxab/pr-update-packages
update: web: update package
2026-05-11 08:53:28 +08:00
betaxab 48b7c0b414 update: web: update package
Update packages using pnpm up
Remove unexpected color schemes from the chart
Update the Stylelint config to match the upstream changes
2026-05-10 22:53:52 +08:00
v03413 c8304a05cd chore: update golang version & rename Dockerfile
fix: https://github.com/v03413/BEpusdt/actions/runs/25508875970/job/74861939552
2026-05-08 09:17:22 +08:00
莫名 34127df014 Merge pull request #190 from betaxab/pr-update-dependencies
Update dependencies
2026-05-07 20:32:50 +08:00
betaxab f4a225baea update: upgrade to Go 1.26.2 && upgrade dependencies 2026-05-07 01:21:09 +08:00
betaxab 126905400d update: Update dependencies based on upstream changes
update: git ignore static/secure folder
remove: mock data
remove: vite-plugin-eslint plugin
update: follow the upstream updates for Vite 7
fix: Chart rendering issue in dark mode
2026-05-07 01:20:55 +08:00
莫名 89bd4caba4 Merge pull request #189 from betaxab/pr-standardize-line-endings
misc: Unify line endings to Unix LF format
2026-05-06 13:39:05 +08:00
betaxab c84ca4ab30 misc: Unify line endings to Unix LF format
by run:
find . -type f -exec dos2unix {} +

find:
find . -type f -exec file {} + | grep "CRLF"
2026-05-06 11:18:40 +08:00
莫名 3be13ebb6f Merge pull request #187 from betaxab/pr-enhanced-dashboard
feat: dashboard: Enhanced dashboard displays more statistics
2026-05-06 08:45:02 +08:00
莫名 584998bf02 Merge pull request #188 from betaxab/pr-mobile-optimization
style: Optimize web pages for mobile devices
2026-05-06 08:44:50 +08:00
betaxab f14a7680af style: Optimize web pages for mobile devices 2026-05-05 20:52:31 +08:00
betaxab cd6994d611 feat: dashboard: Enhanced dashboard displays more statistics 2026-05-05 20:06:06 +08:00
莫名 64ab143e0e Merge pull request #186 from betaxab/pr-fix-order-notify-slow-query
perf: add order notify retry index
2026-05-05 18:03:18 +08:00
莫名 8525dd4722 Merge pull request #185 from betaxab/pr-optimize-night-mode
style: Optimize night mode display
2026-05-05 18:03:02 +08:00
betaxab 90e672f7f8 style: Optimize night mode display 2026-05-02 18:30:33 +08:00
betaxab cb5aed93c6 perf: add order notify retry index 2026-05-02 17:18:05 +08:00
v03413 e46706370c refactor: optimize type casting and formatting logic
fix: https://github.com/v03413/BEpusdt/issues/184
2026-04-30 22:27:25 +08:00
莫名 34e7dc6b81 Merge pull request #183 from 34892002/edge-key
docs: 添加 EdgeKey 对接文档
2026-04-30 20:55:00 +08:00
ggyy 5a0d333f71 feat: 新增项目对接说明 2026-04-30 18:43:21 +08:00
莫名 9f89015722 Merge pull request #182 from betaxab/pr-minor-update
update: minor adjustments to order confirmation
2026-04-29 21:39:06 +08:00
betaxab 609a850e61 update: minor adjustments to order confirmation 2026-04-29 18:52:19 +08:00
莫名 43614ee3c5 Merge pull request #181 from betaxab/pr-zoom-in-page
style: Enlarge the entire page by about 20%
2026-04-27 17:07:27 +08:00
betaxab a603e201c1 style: Enlarge the entire page by about 20% 2026-04-27 16:43:07 +08:00
莫名 4081e7e5ab Merge pull request #180 from betaxab/pr-try-to-fix-tron-task
fix: Try to resolve the failed queue blocking web issue in Tron
2026-04-27 09:11:28 +08:00
betaxab 17b0d1cad1 fix: Try to resolve the failed queue blocking web issue in Tron 2026-04-27 08:48:58 +08:00
莫名 742d05d253 Merge pull request #179 from luoyanglang/wolf/web-dayjs-direct-dependency
fix(web): declare dayjs dependency
2026-04-26 19:56:17 +08:00
Codex 1b0df627a5 fix(web): declare dayjs dependency 2026-04-26 11:24:52 +00:00
v03413 94ba4b7c5b perf: remove default currency limit setting in BuildOrder
fix: https://github.com/v03413/BEpusdt/issues/178
2026-04-25 21:15:30 +08:00
v03413 14644e00a5 refactor: add logging for MQTT publish errors 2026-04-23 16:01:00 +08:00
v03413 be2ef02923 docs: update 2026-04-21 10:06:48 +08:00
v03413 6ccd93a161 feat: 增加支持历史汇率自动清理 2026-04-16 10:57:57 +08:00
v03413 2edf71dee1 feat: 增加支持自定义Topic 路径前缀 2026-04-15 21:44:34 +08:00
v03413 86251ac054 perf: unify mqtt subscription logic across modules 2026-04-15 16:30:05 +08:00
v03413 2f4915a808 docs: readme update 2026-04-15 16:23:54 +08:00
v03413 a596ebc875 style: 页面提示信息优化调整 2026-04-15 16:15:55 +08:00
v03413 5e7f9ca701 docs: MQTT 消息发布对接开发说明 2026-04-15 15:37:33 +08:00
v03413 0f4346cd5f fix: 补漏Tron 网络 MQTT 广播判断 2026-04-15 15:10:47 +08:00
v03413 c4d5e20c7a feat: 实现交易监听 MQTT服务器广播 2026-04-15 14:58:24 +08:00
莫名 56bf320588 Merge pull request #173 from tanaer/fix/nonblocking-bepusdt-notify
fix: 避免 BEpusdt 回调长时间占用数据库事务
2026-04-14 15:38:28 +08:00
v03413 e6f8112df2 docs: 文档更新 2026-04-14 15:19:30 +08:00
v03413 30eb6659d8 feat: 实现钱包地址独占模式 & 安全优化 2026-04-14 13:36:54 +08:00
Jason.li 240da52d11 fix(notify): avoid holding db during BEpusdt callbacks
Move the BEpusdt status callback path out of an open database transaction so slow merchant callback endpoints do not block unrelated requests such as admin login.

Add a regression test that keeps the callback HTTP request pending and verifies a concurrent database query can still complete.
2026-04-14 11:07:44 +08:00
v03413 a45003ce3d fix: Telegram 通知自适应法币单位 2026-04-12 23:42:15 +08:00
v03413 f9bdf1f18a chore: update stale action issue timing 2026-04-09 16:29:23 +08:00
v03413 a5467d3fbb docs: 独角Dujiao-Next 对接说明 2026-04-07 22:49:29 +08:00
v03413 f866db9f1b feat: 配置支持多个 trongrid key
多个用半角符逗号隔开,使用的时候随机抽取
feat: https://github.com/v03413/BEpusdt/issues/171
2026-04-07 14:05:34 +08:00
v03413 b8df9d1d72 docs: EVM RPC 节点稳定性说明指南 2026-03-24 11:23:22 +08:00
v03413 0e1e22cebb chore: update bug report template with new checkboxes 2026-03-13 14:56:21 +08:00
v03413 9cfd4b6e1c docs: update database configuration in Docker guide 2026-02-27 15:31:03 +08:00
v03413 8c4ead0169 fix: ensure Datetime uses local time zone 2026-02-27 15:20:34 +08:00
v03413 2992a1f032 perf: remove redundant quotes in SQL queries 2026-02-27 14:27:01 +08:00
v03413 9e7707588f perf: remove hardcoded secret 2026-02-27 14:22:29 +08:00
v03413 0db728dc52 fix: synchronize BuildOrder correctly 2026-02-27 14:00:54 +08:00
183 changed files with 14492 additions and 16132 deletions
+2
View File
@@ -19,6 +19,8 @@ body:
required: true required: true
- label: 我明白任何人针对我提交的问题没有义务提供帮助,包括项目维护者。 - label: 我明白任何人针对我提交的问题没有义务提供帮助,包括项目维护者。
required: true required: true
- label: 我没有阅读这个清单,只是闭眼选中了所有的复选框,请关闭这个 Issue 。
required: true
- type: dropdown - type: dropdown
attributes: attributes:
label: 问题类型 label: 问题类型
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
steps: steps:
- uses: actions/stale@v9 - uses: actions/stale@v9
with: with:
days-before-issue-stale: 30 days-before-issue-stale: 3
days-before-issue-close: 7 days-before-issue-close: 7
stale-issue-label: "stale" stale-issue-label: "stale"
stale-issue-message: "此议题由于30天内没有任何活动,现在标记为过时。" stale-issue-message: "此议题由于30天内没有任何活动,现在标记为过时。"
+2 -2
View File
@@ -23,7 +23,7 @@ jobs:
with: with:
node-version: '25' node-version: '25'
- name: Install pnpm - name: Install pnpm
run: npm install -g pnpm run: npm install -g pnpm@10
- name: Install frontend dependencies - name: Install frontend dependencies
working-directory: ./web working-directory: ./web
run: pnpm install --frozen-lockfile --shamefully-hoist run: pnpm install --frozen-lockfile --shamefully-hoist
@@ -40,7 +40,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: '1.25.4' go-version: '1.26.2'
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6 uses: goreleaser/goreleaser-action@v6
with: with:
+2 -1
View File
@@ -7,4 +7,5 @@ conf.toml
# Added by goreleaser init: # Added by goreleaser init:
dist/ dist/
static/web static/web
*.log static/secure
*.log
+5 -2
View File
@@ -49,6 +49,8 @@
- ✅ 原生兼容`易支付`收单 接入便捷 - ✅ 原生兼容`易支付`收单 接入便捷
- ✅ 完整独立WEB后台 方便配置管理 - ✅ 完整独立WEB后台 方便配置管理
- ✅ 收银台支持中英适配 助力出海需求 - ✅ 收银台支持中英适配 助力出海需求
- ✅ 地址独占模式 底层支持不定额收款
- ✅ 支持MQTT消息发布 交易信息即时广播
- ✅ 快速迭代期 超多实用特性功能等你发现 - ✅ 快速迭代期 超多实用特性功能等你发现
## 🚀 快捷启动 ## 🚀 快捷启动
@@ -62,7 +64,7 @@ docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
- 安装:[Docker](docs/docker/docker.md) [Linux](docs/linux/install.md) [1Panel](./docs/1panel/README.md) [宝塔](./docs/bt_panel/README.md) - 安装:[Docker](docs/docker/docker.md) [Linux](docs/linux/install.md) [1Panel](./docs/1panel/README.md) [宝塔](./docs/bt_panel/README.md)
- 开发:[API对接](docs/api/api.md) [订单回调](docs/notify/readme.md) [Python](https://github.com/luoyanglang/bepusdt-python-sdk) [PHP](https://github.com/v03413/bepusdt-php-sdk) - 开发:[API对接](docs/api/api.md) [订单回调](docs/notify/readme.md) [Python](https://github.com/luoyanglang/bepusdt-python-sdk) [PHP](https://github.com/v03413/bepusdt-php-sdk)
- 对接:[独角数卡](docs/api/dujiaoka/dujiaoka.md) [彩虹易支付](https://github.com/v03413/Epay-BEpusdt) [whmcs](https://github.com/v03413/whmcs-gateway-epusdt) [其它](docs/api/other.md) - 对接:[独角Next](docs/api/dujiao-next/dujiao-next.md) [彩虹易支付](https://github.com/v03413/Epay-BEpusdt) [whmcs](https://github.com/v03413/whmcs-gateway-epusdt) [EdgeKey](docs/api/edge-key/edge-key.md) [其它](docs/api/other.md)
- 其它:[https 配置](./docs/ssl.md) [时钟同步](docs/linux/systemd-timesyncd.md) [收银台修改](docs/payment-template/README.md) - 其它:[https 配置](./docs/ssl.md) [时钟同步](docs/linux/systemd-timesyncd.md) [收银台修改](docs/payment-template/README.md)
## 🖼 功能截图 ## 🖼 功能截图
@@ -78,6 +80,7 @@ docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
- [后台入口账密忘记重置教程](./docs/faq/login-reset.md) - [后台入口账密忘记重置教程](./docs/faq/login-reset.md)
- [Telegram 通知 Chat ID 获取教程](docs/faq/telegram-chat-id.md) - [Telegram 通知 Chat ID 获取教程](docs/faq/telegram-chat-id.md)
- [推荐配置提高 Tron 扫块稳定性‼️](./docs/tron-grid/readme.md) - [推荐配置提高 Tron 扫块稳定性‼️](./docs/tron-grid/readme.md)
- [EVM RPC 节点稳定性说明指南‼️](./docs/faq/evm-rpc-endpoint.md)
## ⚠️ 重要提示 ## ⚠️ 重要提示
@@ -91,7 +94,7 @@ docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
## 🙏 致谢 ## 🙏 致谢
- [Epusdt](https://github.com/assimon/epusdt) - [EPusdt](./docs/faq/epusdt.md)
## 🌟 Star 历史 ## 🌟 Star 历史
-1
View File
@@ -1,7 +1,6 @@
package conf package conf
const ( const (
Secret = "BEpusdt, a more user-friendly personal cryptocurrency payment gateway!"
AdminTokenK = "admin_token" AdminTokenK = "admin_token"
AdminSecureK = "admin_secure" AdminSecureK = "admin_secure"
) )
+4 -4
View File
@@ -65,7 +65,7 @@ func (Conf) Del(ctx *gin.Context) {
return return
} }
model.Db.Where("`k` = ?", req.Key).Delete(&model.Conf{}) model.Db.Where("k = ?", req.Key).Delete(&model.Conf{})
base.Ok(ctx, "删除成功") base.Ok(ctx, "删除成功")
} }
@@ -79,7 +79,7 @@ func (Conf) Gets(ctx *gin.Context) {
} }
var items = make([]model.Conf, 0) var items = make([]model.Conf, 0)
model.Db.Where("`k` IN ?", req.Keys).Find(&items) model.Db.Where("k IN ?", req.Keys).Find(&items)
var data = gin.H{} var data = gin.H{}
for _, item := range items { for _, item := range items {
@@ -119,7 +119,7 @@ func (Conf) Sets(ctx *gin.Context) {
} }
} }
model.Db.Where("`k` IN ?", keys).Delete(&model.Conf{}) model.Db.Where("k IN ?", keys).Delete(&model.Conf{})
model.Db.Create(&data) model.Db.Create(&data)
defer model.RefreshC() defer model.RefreshC()
@@ -136,7 +136,7 @@ func (Conf) Notifier(ctx *gin.Context) {
} }
var keys = []string{string(model.NotifierChannel), string(model.NotifierParams)} var keys = []string{string(model.NotifierChannel), string(model.NotifierParams)}
model.Db.Where("`k` IN ?", keys).Delete(&model.Conf{}) model.Db.Where("k IN ?", keys).Delete(&model.Conf{})
model.Db.Create(&[]model.Conf{ model.Db.Create(&[]model.Conf{
{K: model.NotifierChannel, V: req.Channel}, {K: model.NotifierChannel, V: req.Channel},
{K: model.NotifierParams, V: string(req.Params)}, {K: model.NotifierParams, V: string(req.Params)},
+227 -29
View File
@@ -1,19 +1,37 @@
package admin package admin
import ( import (
"errors"
"fmt"
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
"github.com/spf13/cast" "github.com/spf13/cast"
"github.com/v03413/bepusdt/app/handler/base" "github.com/v03413/bepusdt/app/handler/base"
"github.com/v03413/bepusdt/app/model" "github.com/v03413/bepusdt/app/model"
"github.com/v03413/go-cache"
) )
type Dashboard struct { type Dashboard struct {
} }
type homeReq struct { type homeReq struct {
Fiat string `json:"fiat" binding:"required"` Fiat string `json:"fiat" binding:"required"`
Range string `json:"range"`
TZ string `json:"tz"`
From string `json:"from"`
To string `json:"to"`
Force bool `json:"force"`
}
type dashboardPoint struct {
Date string `json:"date"`
OrdersTotal int64 `json:"orders_total"`
OrdersPaid int64 `json:"orders_paid"`
OrdersSuccess int64 `json:"orders_success"`
OrdersFailed int64 `json:"orders_failed"`
GMVPaid string `json:"gmv_paid"`
} }
func (Dashboard) Home(ctx *gin.Context) { func (Dashboard) Home(ctx *gin.Context) {
@@ -24,13 +42,33 @@ func (Dashboard) Home(ctx *gin.Context) {
return return
} }
var rows = make([]model.Order, 0) rangeKey, from, to, loc, err := resolveDashboardRange(req)
model.Db.Where("fiat = ? and status = ?", req.Fiat, model.OrderStatusSuccess).Find(&rows) if err != nil {
base.BadRequest(ctx, err.Error())
var today = time.Now().Format("2006-01-02") return
var totalMoney, todayMoney float64 }
var totalCount, todayCount int64
var monthly = make(map[string]float64) cacheKey := dashboardCacheKey(req.Fiat, rangeKey, loc.String(), from, to)
if !req.Force {
if data, ok := cache.Get(cacheKey); ok {
base.Ok(ctx, data)
return
}
}
data := buildDashboardHome(req, rangeKey, from, to, loc)
cache.Set(cacheKey, data, dashboardCacheTTL(rangeKey, to, loc))
base.Ok(ctx, data)
}
func buildDashboardHome(req homeReq, rangeKey string, from, to time.Time, loc *time.Location) gin.H {
var rows = make([]model.Order, 0)
model.Db.Where("fiat = ? and created_at >= ? and created_at <= ?", req.Fiat, from, to).Find(&rows)
var totalCount, pendingCount, confirmingCount, successCount, expiredCount, failedCount, notifyFailedCount int64
gmvPaid := decimal.Zero
var tokenMap = map[model.Crypto]float64{ var tokenMap = map[model.Crypto]float64{
model.USDT: 0, model.USDT: 0,
model.USDC: 0, model.USDC: 0,
@@ -38,38 +76,198 @@ func (Dashboard) Home(ctx *gin.Context) {
model.BNB: 0, model.BNB: 0,
model.ETH: 0, model.ETH: 0,
} }
points := make([]dashboardPoint, 0)
pointMap := make(map[string]int)
for day := dayStart(from, loc); !day.After(dayStart(to, loc)); day = day.AddDate(0, 0, 1) {
date := day.Format("2006-01-02")
point := dashboardPoint{
Date: date,
GMVPaid: "0.00",
}
points = append(points, point)
pointMap[date] = len(points) - 1
}
for _, itm := range rows { for _, itm := range rows {
money := cast.ToFloat64(itm.Money)
totalMoney += money
totalCount++ totalCount++
if itm.CreatedAt.Format("2006-01-02") == today { createdAt := time.Now().In(loc)
todayMoney += money if itm.CreatedAt != nil {
todayCount++ createdAt = time.Time(*itm.CreatedAt).In(loc)
} }
date := createdAt.Format("2006-01-02")
pointIndex, ok := pointMap[date]
if !ok {
continue
}
point := &points[pointIndex]
if crypto, err := model.GetCrypto(itm.TradeType); err == nil { point.OrdersTotal++
switch itm.Status {
case model.OrderStatusWaiting:
pendingCount++
case model.OrderStatusConfirming:
confirmingCount++
case model.OrderStatusExpired:
expiredCount++
case model.OrderStatusSuccess:
successCount++
point.OrdersSuccess++
point.OrdersPaid++
money, _ := decimal.NewFromString(itm.Money)
gmvPaid = gmvPaid.Add(money)
pointMoney, _ := decimal.NewFromString(point.GMVPaid)
point.GMVPaid = pointMoney.Add(money).Round(2).StringFixed(2)
crypto := itm.Crypto
if crypto == "" {
if tradeCrypto, err := model.GetCrypto(itm.TradeType); err == nil {
crypto = tradeCrypto
}
}
if _, ok := tokenMap[crypto]; !ok { if _, ok := tokenMap[crypto]; !ok {
tokenMap[crypto] = 0 tokenMap[crypto] = 0
} }
tokenAmount := cast.ToFloat64(itm.Amount)
if tokenAmount == 0 {
tokenAmount = cast.ToFloat64(itm.Money)
}
tokenMap[crypto] += tokenAmount
tokenMap[crypto] += money if itm.NotifyState == model.OrderNotifyStateFail {
notifyFailedCount++
}
case model.OrderStatusFailed:
failedCount++
point.OrdersFailed++
} }
var month = itm.CreatedAt.Time().Format("2006/01")
if _, ok := monthly[month]; !ok {
monthly[month] = 0
}
monthly[month] += money
} }
base.Ok(ctx, gin.H{ successRate := "0.00"
"total_money": totalMoney, finishedCount := successCount + expiredCount + failedCount
"total_count": totalCount, if finishedCount > 0 {
"today_money": todayMoney, rate := decimal.NewFromInt(successCount).Div(decimal.NewFromInt(finishedCount)).Mul(decimal.NewFromInt(100))
"today_count": todayCount, successRate = rate.Round(2).StringFixed(2)
"token_map": tokenMap, }
"monthly": monthly,
}) return gin.H{
"range": rangeKey,
"from": from.In(loc).Format(time.RFC3339),
"to": to.In(loc).Format(time.RFC3339),
"timezone": loc.String(),
"currency": req.Fiat,
"kpi": gin.H{
"orders_total": totalCount,
"orders_pending": pendingCount,
"orders_confirming": confirmingCount,
"gmv_paid": gmvPaid.Round(2).StringFixed(2),
"orders_success": successCount,
"orders_failed": failedCount,
"notify_failed": notifyFailedCount,
"order_success_rate": successRate,
},
"token_map": tokenMap,
"points": points,
}
}
func dashboardCacheKey(fiat, rangeKey, timezone string, from, to time.Time) string {
return fmt.Sprintf("dashboard:home:v1:%s:%s:%s:%d:%d", fiat, rangeKey, timezone, from.Unix(), to.Unix())
}
func dashboardCacheTTL(rangeKey string, to time.Time, loc *time.Location) time.Duration {
switch rangeKey {
case "today":
return 10 * time.Second
case "30d":
return time.Minute
case "custom":
if to.Before(dayStart(time.Now().In(loc), loc)) {
return 5 * time.Minute
}
return 30 * time.Second
default:
return 30 * time.Second
}
}
func resolveDashboardRange(req homeReq) (string, time.Time, time.Time, *time.Location, error) {
loc := time.Local
if req.TZ != "" {
if loadedLoc, err := time.LoadLocation(req.TZ); err == nil {
loc = loadedLoc
}
}
rangeKey := req.Range
if rangeKey == "" {
rangeKey = "7d"
}
now := time.Now().In(loc)
switch rangeKey {
case "today":
start := dayStart(now, loc)
return rangeKey, start, dayEnd(start), loc, nil
case "30d":
yesterday := dayStart(now, loc).AddDate(0, 0, -1)
start := yesterday.AddDate(0, 0, -29)
return rangeKey, start, dayEnd(yesterday), loc, nil
case "custom":
from, err := parseDashboardDate(req.From, loc, true)
if err != nil {
return "", time.Time{}, time.Time{}, nil, err
}
to, err := parseDashboardDate(req.To, loc, false)
if err != nil {
return "", time.Time{}, time.Time{}, nil, err
}
if to.Before(from) {
return "", time.Time{}, time.Time{}, nil, errors.New("自定义统计周期结束时间不能早于开始时间")
}
return rangeKey, from, to, loc, nil
case "7d":
fallthrough
default:
yesterday := dayStart(now, loc).AddDate(0, 0, -1)
start := yesterday.AddDate(0, 0, -6)
return "7d", start, dayEnd(yesterday), loc, nil
}
}
func parseDashboardDate(value string, loc *time.Location, start bool) (time.Time, error) {
if value == "" {
return time.Time{}, errors.New("请选择自定义统计周期")
}
layouts := []string{time.RFC3339, "2006-01-02 15:04:05", "2006-01-02"}
for _, layout := range layouts {
t, err := time.ParseInLocation(layout, value, loc)
if err != nil {
continue
}
if layout == "2006-01-02" {
if start {
return dayStart(t, loc), nil
}
return dayEnd(t), nil
}
return t.In(loc), nil
}
return time.Time{}, errors.New("自定义统计周期格式错误")
}
func dayStart(t time.Time, loc *time.Location) time.Time {
local := t.In(loc)
return time.Date(local.Year(), local.Month(), local.Day(), 0, 0, 0, 0, loc)
}
func dayEnd(t time.Time) time.Time {
start := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
return start.Add(24*time.Hour - time.Nanosecond)
} }
+6 -1
View File
@@ -201,10 +201,11 @@ func (Order) Paid(ctx *gin.Context) {
return return
} }
confirmedAt := time.Now()
var update = map[string]interface{}{ var update = map[string]interface{}{
"ref_hash": req.RefHash, "ref_hash": req.RefHash,
"status": model.OrderStatusSuccess, "status": model.OrderStatusSuccess,
"confirmed_at": model.Datetime(time.Now()), "confirmed_at": model.Datetime(confirmedAt),
} }
err := model.Db.Model(&order).Updates(update).Error err := model.Db.Model(&order).Updates(update).Error
@@ -214,6 +215,10 @@ func (Order) Paid(ctx *gin.Context) {
return return
} }
order.RefHash = req.RefHash
order.Status = model.OrderStatusSuccess
order.ConfirmedAt = &confirmedAt
go notify.Handle(order) go notify.Handle(order)
base.Ok(ctx, "操作成功") base.Ok(ctx, "操作成功")
+12 -1
View File
@@ -69,6 +69,17 @@ func (e Epay) Submit(ctx *gin.Context) {
return return
} }
if !utils.IsAllowedCallbackURL(data.NotifyURL) {
ctx.String(200, "notify_url 地址不合法")
return
}
if !utils.IsAllowedCallbackURL(data.ReturnURL) {
ctx.String(200, "return_url 地址不合法")
return
}
money, err := decimal.NewFromString(data.Money) money, err := decimal.NewFromString(data.Money)
if err != nil { if err != nil {
ctx.String(200, "参数 money 解析错误,"+err.Error()) ctx.String(200, "参数 money 解析错误,"+err.Error())
@@ -76,7 +87,7 @@ func (e Epay) Submit(ctx *gin.Context) {
return return
} }
var order, err2 = model.BuildOrder(model.OrderParams{ var order, err2 = model.StartBuildOrder(model.OrderParams{
Money: money, Money: money,
ApiType: model.OrderApiTypeEpay, ApiType: model.OrderApiTypeEpay,
Address: data.Address, Address: data.Address,
+37 -15
View File
@@ -21,11 +21,11 @@ import (
type Epusdt struct{} type Epusdt struct{}
type createReq struct { type createReq struct {
Amount float64 `json:"amount" binding:"required"`
OrderID string `json:"order_id" binding:"required"` OrderID string `json:"order_id" binding:"required"`
NotifyURL string `json:"notify_url" binding:"required"` NotifyURL string `json:"notify_url" binding:"required"`
RedirectURL string `json:"redirect_url" binding:"required"` RedirectURL string `json:"redirect_url" binding:"required"`
Signature string `json:"signature" binding:"required"` Signature string `json:"signature" binding:"required"`
Amount float64 `json:"amount"`
Name string `json:"name"` Name string `json:"name"`
Fiat model.Fiat `json:"fiat"` Fiat model.Fiat `json:"fiat"`
TradeType string `json:"trade_type"` TradeType string `json:"trade_type"`
@@ -35,11 +35,11 @@ type createReq struct {
} }
type createOrderReq struct { type createOrderReq struct {
Amount float64 `json:"amount" binding:"required"`
OrderID string `json:"order_id" binding:"required"` OrderID string `json:"order_id" binding:"required"`
NotifyURL string `json:"notify_url" binding:"required"` NotifyURL string `json:"notify_url" binding:"required"`
RedirectURL string `json:"redirect_url" binding:"required"` RedirectURL string `json:"redirect_url" binding:"required"`
Signature string `json:"signature" binding:"required"` Signature string `json:"signature" binding:"required"`
Amount float64 `json:"amount"`
Name string `json:"name"` Name string `json:"name"`
Fiat model.Fiat `json:"fiat"` Fiat model.Fiat `json:"fiat"`
Currencies string `json:"currencies"` Currencies string `json:"currencies"`
@@ -146,6 +146,17 @@ func (Epusdt) CreateOrder(ctx *gin.Context) {
return return
} }
if !utils.IsAllowedCallbackURL(req.NotifyURL) {
ctx.JSON(200, respFailJson("notify_url 地址不合法"))
return
}
if !utils.IsAllowedCallbackURL(req.RedirectURL) {
ctx.JSON(200, respFailJson("redirect_url 地址不合法"))
return
}
// 解析请求地址 // 解析请求地址
host := "http://" + ctx.Request.Host host := "http://" + ctx.Request.Host
if ctx.Request.TLS != nil { if ctx.Request.TLS != nil {
@@ -170,7 +181,6 @@ func (Epusdt) CreateOrder(ctx *gin.Context) {
}) })
if err != nil { if err != nil {
ctx.JSON(200, respFailJson(fmt.Sprintf("CreateOrder: order create failed: %s", err.Error()))) ctx.JSON(200, respFailJson(fmt.Sprintf("CreateOrder: order create failed: %s", err.Error())))
return return
} }
@@ -262,6 +272,17 @@ func (Epusdt) CreateTransaction(ctx *gin.Context) {
return return
} }
if !utils.IsAllowedCallbackURL(req.NotifyURL) {
ctx.JSON(200, respFailJson("notify_url 地址不合法"))
return
}
if !utils.IsAllowedCallbackURL(req.RedirectURL) {
ctx.JSON(200, respFailJson("redirect_url 地址不合法"))
return
}
if req.Fiat == "" { if req.Fiat == "" {
req.Fiat = model.CNY req.Fiat = model.CNY
} }
@@ -269,18 +290,19 @@ func (Epusdt) CreateTransaction(ctx *gin.Context) {
req.TradeType = string(model.UsdtTrc20) req.TradeType = string(model.UsdtTrc20)
} }
order, err := model.BuildOrder(model.OrderParams{ order, err := model.StartBuildOrder(model.OrderParams{
Money: decimal.NewFromFloat(req.Amount), Money: decimal.NewFromFloat(req.Amount),
ApiType: model.OrderApiTypeEpusdt, ApiType: model.OrderApiTypeEpusdt,
Address: req.Address, Address: req.Address,
OrderId: req.OrderID, AddressLocked: req.Amount == 0,
TradeType: model.TradeType(req.TradeType), OrderId: req.OrderID,
RedirectUrl: req.RedirectURL, TradeType: model.TradeType(req.TradeType),
NotifyUrl: req.NotifyURL, RedirectUrl: req.RedirectURL,
Name: req.Name, NotifyUrl: req.NotifyURL,
Timeout: req.Timeout, Name: req.Name,
Rate: req.Rate, Timeout: req.Timeout,
Fiat: req.Fiat, Rate: req.Rate,
Fiat: req.Fiat,
}) })
if err != nil { if err != nil {
ctx.JSON(200, respFailJson(fmt.Sprintf("订单创建失败:%s", err.Error()))) ctx.JSON(200, respFailJson(fmt.Sprintf("订单创建失败:%s", err.Error())))
+64 -35
View File
@@ -15,10 +15,41 @@ import (
) )
var confCache sync.Map var confCache sync.Map
var defaultConf = map[ConfKey]string{
ApiAppUri: "",
RateSyncInterval: "3600",
AtomUSDT: "0.01",
AtomUSDC: "0.01",
AtomTRX: "0.01",
AtomBNB: "0.00001",
AtomETH: "0.000001",
MonitorMinAmount: "0.01",
PaymentMinAmount: "0.01",
PaymentMaxAmount: "99999",
RpcEndpointTron: "grpc.trongrid.io:50051",
RpcEndpointBsc: "https://binance-smart-chain-public.nodies.app/",
RpcEndpointSolana: "https://solana-rpc.publicnode.com/",
RpcEndpointXlayer: "https://xlayerrpc.okx.com/",
RpcEndpointPolygon: "https://polygon-public.nodies.app/",
RpcEndpointArbitrum: "https://arb1.arbitrum.io/rpc",
RpcEndpointEthereum: "https://ethereum-public.nodies.app/",
RpcEndpointBase: "https://base-public.nodies.app/",
RpcEndpointAptos: "https://aptos-rest.publicnode.com/",
RpcEndpointPlasma: "https://rpc.plasma.to/",
NotifyMaxRetry: "10",
BlockHeightMaxDiff: "1000",
BlockOffsetConfirm: "0",
PaymentTimeout: "1200", // 20分钟
PaymentMatchMode: string(Classic),
SystemInstallLock: "0",
RateSyncCoingeckoApiUrl: "https://api.coingecko.com",
RateSyncHistoryDays: "30",
MqttTopicPrefix: "bepusdt",
}
type Conf struct { type Conf struct {
K ConfKey `gorm:"column:k;type:varchar(32);not null;primaryKey" json:"key"` K ConfKey `gorm:"column:k;type:varchar(32);not null;primaryKey" json:"key"`
V string `gorm:"column:v;type:varchar(255);not null" json:"val"` V string `gorm:"column:v;type:varchar(512);not null" json:"val"`
} }
func (c Conf) TableName() string { func (c Conf) TableName() string {
@@ -122,45 +153,19 @@ func ConfInit() {
var password = hash[20:30] var password = hash[20:30]
var encrypt, _ = bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) var encrypt, _ = bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
var data = map[ConfKey]string{ var data = map[ConfKey]string{
ApiAppUri: "", ApiAuthToken: token,
ApiAuthToken: token, AdminSecret: utils.StrSha256(hash),
AdminSecure: secure, AdminSecure: secure,
AdminUsername: username, AdminUsername: username,
AdminPassword: string(encrypt), AdminPassword: string(encrypt),
RateSyncInterval: "3600",
AtomUSDT: "0.01",
AtomUSDC: "0.01",
AtomTRX: "0.01",
AtomBNB: "0.00001",
AtomETH: "0.000001",
MonitorMinAmount: "0.01",
PaymentMinAmount: "0.01",
PaymentMaxAmount: "99999",
RpcEndpointTron: "grpc.trongrid.io:50051",
RpcEndpointBsc: "https://binance-smart-chain-public.nodies.app/",
RpcEndpointSolana: "https://solana-rpc.publicnode.com/",
RpcEndpointXlayer: "https://xlayerrpc.okx.com/",
RpcEndpointPolygon: "https://polygon-public.nodies.app/",
RpcEndpointArbitrum: "https://arb1.arbitrum.io/rpc",
RpcEndpointEthereum: "https://ethereum-public.nodies.app/",
RpcEndpointBase: "https://base-public.nodies.app/",
RpcEndpointAptos: "https://aptos-rest.publicnode.com/",
RpcEndpointPlasma: "https://rpc.plasma.to/",
NotifyMaxRetry: "10",
BlockHeightMaxDiff: "1000",
BlockOffsetConfirm: "0",
PaymentTimeout: "1200", // 20分钟
PaymentStaticPath: "",
PaymentMatchMode: string(Classic),
SystemInstallLock: "0",
RateSyncCoingeckoApiUrl: "https://api.coingecko.com",
RateSyncCoingeckoApiKey: "",
} }
var rows = make([]Conf, 0) var rows = make([]Conf, 0)
for k, v := range data { for k, v := range data {
rows = append(rows, Conf{K: k, V: v}) rows = append(rows, Conf{K: k, V: v})
} }
for k, v := range defaultConf {
rows = append(rows, Conf{K: k, V: v})
}
fmt.Println() fmt.Println()
fmt.Println("╔═══════════════════════════════════════════════════════════════════════") fmt.Println("╔═══════════════════════════════════════════════════════════════════════")
@@ -220,3 +225,27 @@ func GetInstallInfo() gin.H {
return gin.H{} return gin.H{}
} }
func GetTronGridApiKeys() []string {
return strings.Split(GetK(RpcEndpointTronGridApiKey), ",")
}
func FillDefaultConf() {
var existKeys []string
Db.Model(&Conf{}).Pluck("k", &existKeys)
existSet := make(map[ConfKey]struct{}, len(existKeys))
for _, k := range existKeys {
existSet[ConfKey(k)] = struct{}{}
}
var rows []Conf
for k, v := range defaultConf {
if _, ok := existSet[k]; !ok {
rows = append(rows, Conf{K: k, V: v})
}
}
if len(rows) > 0 {
Db.Create(&rows)
}
}
+14 -3
View File
@@ -31,6 +31,7 @@ const (
AdminUsername ConfKey = "admin_username" AdminUsername ConfKey = "admin_username"
AdminPassword ConfKey = "admin_password" AdminPassword ConfKey = "admin_password"
AdminSecure ConfKey = "admin_secure" AdminSecure ConfKey = "admin_secure"
AdminSecret ConfKey = "admin_secret"
AdminLoginIP ConfKey = "admin_login_ip" AdminLoginIP ConfKey = "admin_login_ip"
AdminLoginAt ConfKey = "admin_login_at" AdminLoginAt ConfKey = "admin_login_at"
@@ -65,9 +66,19 @@ const (
RateSyncCoingeckoApiUrl ConfKey = "rate_sync_coingecko_api_url" // 汇率同步 Coingecko Api URL RateSyncCoingeckoApiUrl ConfKey = "rate_sync_coingecko_api_url" // 汇率同步 Coingecko Api URL
RateSyncCoingeckoApiKey ConfKey = "rate_sync_coingecko_api_key" // 汇率同步 Coingecko Api Key RateSyncCoingeckoApiKey ConfKey = "rate_sync_coingecko_api_key" // 汇率同步 Coingecko Api Key
RateSyncInterval ConfKey = "rate_sync_interval" // 汇率同步间隔,单位秒 RateSyncInterval ConfKey = "rate_sync_interval" // 汇率同步间隔,单位秒
NotifyMaxRetry ConfKey = "notify_max_retry" // 最大重试次数,订单回调失败 RateSyncHistoryDays ConfKey = "rate_sync_history_days" // 历史汇率保存天数
BlockHeightMaxDiff ConfKey = "block_height_max_diff" // 区块高度最大差值,超过此值则以当前区块高度为准,重新开始扫描
BlockOffsetConfirm ConfKey = "block_offset_confirm" // 区块偏移确认数,扫描时以当前区块高度减去此偏移量为准,避免重链导致的订单回调失败 NotifyMaxRetry ConfKey = "notify_max_retry" // 最大重试次数,订单回调失败
BlockHeightMaxDiff ConfKey = "block_height_max_diff" // 区块高度最大差值,超过此值则以当前区块高度为准,重新开始扫描
BlockOffsetConfirm ConfKey = "block_offset_confirm" // 区块偏移确认数,扫描时以当前区块高度减去此偏移量为准,避免重链导致的订单回调失败
MqttHost ConfKey = "mqtt_host"
MqttPort ConfKey = "mqtt_port"
MqttUser ConfKey = "mqtt_user"
MqttPass ConfKey = "mqtt_pass"
MqttPublishQos ConfKey = "mqtt_publish_qos"
MqttTopicPrefix ConfKey = "mqtt_topic_prefix" // 消息发布 Topic 路径前缀
MqttNetworks ConfKey = "mqtt_networks" // 需要持续监控的区块网络
NotifierParams ConfKey = "notifier_params" // 通知参数 (token, chat_id, email NotifierParams ConfKey = "notifier_params" // 通知参数 (token, chat_id, email
NotifierChannel ConfKey = "notifier_channel" // 通知渠道 (telegram, wechat, email NotifierChannel ConfKey = "notifier_channel" // 通知渠道 (telegram, wechat, email
+7 -13
View File
@@ -6,17 +6,18 @@ import (
"time" "time"
) )
var localLocation = time.Local
type Datetime time.Time type Datetime time.Time
func (d *Datetime) MarshalJSON() ([]byte, error) { func (d *Datetime) MarshalJSON() ([]byte, error) {
tTime := time.Time(*d) tTime := time.Time(*d).In(localLocation)
return []byte(fmt.Sprintf("\"%v\"", tTime.Format("2006-01-02 15:04:05"))), nil return []byte(fmt.Sprintf("\"%v\"", tTime.Format("2006-01-02 15:04:05"))), nil
} }
func (d Datetime) Value() (driver.Value, error) { func (d Datetime) Value() (driver.Value, error) {
var zeroTime time.Time var zeroTime time.Time
tlt := time.Time(d) tlt := time.Time(d)
// 判断给定时间是否和默认零时间的时间戳相同
if tlt.UnixNano() == zeroTime.UnixNano() { if tlt.UnixNano() == zeroTime.UnixNano() {
return nil, nil return nil, nil
} }
@@ -26,34 +27,27 @@ func (d Datetime) Value() (driver.Value, error) {
func (d *Datetime) Scan(v interface{}) error { func (d *Datetime) Scan(v interface{}) error {
if value, ok := v.(time.Time); ok { if value, ok := v.(time.Time); ok {
*d = Datetime(value) *d = Datetime(value)
return nil return nil
} }
return fmt.Errorf("can not convert %v to timestamp", v) return fmt.Errorf("can not convert %v to timestamp", v)
} }
func (d *Datetime) String() string { func (d *Datetime) String() string {
return time.Time(*d).In(localLocation).Format(time.DateTime)
return time.Time(*d).Format(time.DateTime)
} }
func (d *Datetime) Year() string { func (d *Datetime) Year() string {
return time.Time(*d).In(localLocation).Format("2006")
return time.Time(*d).Format("2006")
} }
func (d *Datetime) Before(u time.Time) bool { func (d *Datetime) Before(u time.Time) bool {
return time.Time(*d).Before(u) return time.Time(*d).Before(u)
} }
func (d *Datetime) Time() time.Time { func (d *Datetime) Time() time.Time {
return time.Time(*d).In(localLocation)
return time.Time(*d)
} }
func (d *Datetime) Format(layout string) string { func (d *Datetime) Format(layout string) string {
return time.Time(*d).In(localLocation).Format(layout)
return time.Time(*d).Format(layout)
} }
+3
View File
@@ -76,6 +76,7 @@ func initSqlite(path string) error {
ConfInit() ConfInit()
} }
FillDefaultConf()
RefreshC() RefreshC()
return nil return nil
@@ -118,6 +119,7 @@ func initMySQL(dsn string) error {
ConfInit() ConfInit()
} }
FillDefaultConf()
RefreshC() RefreshC()
return nil return nil
@@ -157,6 +159,7 @@ func initPostgres(dsn string) error {
ConfInit() ConfInit()
} }
FillDefaultConf()
RefreshC() RefreshC()
return nil return nil
+45 -16
View File
@@ -4,7 +4,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"math" "math"
"sync"
"time" "time"
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
@@ -52,8 +51,6 @@ const (
OrderApiTypeAdmin = "admin" // 管理后台 OrderApiTypeAdmin = "admin" // 管理后台
) )
var calcMutex sync.Mutex
type Order struct { type Order struct {
Id Id
OrderId string `gorm:"column:order_id;type:varchar(128);not null;index;comment:商户ID" json:"order_id"` OrderId string `gorm:"column:order_id;type:varchar(128);not null;index;comment:商户ID" json:"order_id"`
@@ -67,13 +64,14 @@ type Order struct {
Money string `gorm:"column:money;type:varchar(32);not null;default:0.00;comment:交易金额" json:"money"` Money string `gorm:"column:money;type:varchar(32);not null;default:0.00;comment:交易金额" json:"money"`
Address string `gorm:"column:address;type:varchar(128);index;not null;comment:收款地址" json:"address"` Address string `gorm:"column:address;type:varchar(128);index;not null;comment:收款地址" json:"address"`
FromAddress string `gorm:"column:from_address;type:varchar(128);not null;default:'';comment:支付地址" json:"from_address"` FromAddress string `gorm:"column:from_address;type:varchar(128);not null;default:'';comment:支付地址" json:"from_address"`
Status int `gorm:"column:status;not null;default:1;index;comment:交易状态" json:"status"` AddressLocked bool `gorm:"column:address_locked;not null;default:false;comment:地址锁定 1:独占 0:共享" json:"address_locked"`
Status int `gorm:"column:status;not null;default:1;index;index:idx_order_notify_retry,priority:1;comment:交易状态" json:"status"`
Name string `gorm:"column:name;type:varchar(64);not null;default:'';comment:商品名称" json:"name"` Name string `gorm:"column:name;type:varchar(64);not null;default:'';comment:商品名称" json:"name"`
ApiType string `gorm:"column:api_type;type:varchar(20);not null;default:'epusdt';comment:API类型" json:"api_type"` ApiType string `gorm:"column:api_type;type:varchar(20);not null;default:'epusdt';comment:API类型" json:"api_type"`
ReturnUrl string `gorm:"column:return_url;type:varchar(255);not null;default:'';comment:同步地址" json:"return_url"` ReturnUrl string `gorm:"column:return_url;type:varchar(255);not null;default:'';comment:同步地址" json:"return_url"`
NotifyUrl string `gorm:"column:notify_url;type:varchar(255);not null;default:'';comment:异步地址" json:"notify_url"` NotifyUrl string `gorm:"column:notify_url;type:varchar(255);not null;default:'';comment:异步地址" json:"notify_url"`
NotifyNum int `gorm:"column:notify_num;not null;default:0;comment:回调次数" json:"notify_num"` NotifyNum int `gorm:"column:notify_num;not null;default:0;index:idx_order_notify_retry,priority:3;comment:回调次数" json:"notify_num"`
NotifyState int `gorm:"column:notify_state;not null;default:0;comment:回调状态 1:成功 0:失败" json:"notify_state"` NotifyState int `gorm:"column:notify_state;not null;default:0;index:idx_order_notify_retry,priority:2;comment:回调状态 1:成功 0:失败" json:"notify_state"`
RefHash string `gorm:"column:ref_hash;type:varchar(128);not null;default:'';index;comment:交易哈希" json:"ref_hash"` RefHash string `gorm:"column:ref_hash;type:varchar(128);not null;default:'';index;comment:交易哈希" json:"ref_hash"`
RefBlockNum int `gorm:"column:ref_block_num;not null;default:0;comment:区块索引" json:"ref_block_num"` RefBlockNum int `gorm:"column:ref_block_num;not null;default:0;comment:区块索引" json:"ref_block_num"`
ExpiredAt time.Time `gorm:"column:expired_at;not null;comment:失效时间" json:"expired_at"` ExpiredAt time.Time `gorm:"column:expired_at;not null;comment:失效时间" json:"expired_at"`
@@ -105,12 +103,17 @@ func (o *Order) SetFailed() {
Db.Save(o) Db.Save(o)
} }
func (o *Order) MarkConfirming(blockNum int, from, hash string, at time.Time) { func (o *Order) MarkConfirming(blockNum int, from, hash string, at time.Time, amount decimal.Decimal) {
o.FromAddress = from o.FromAddress = from
o.ConfirmedAt = &at o.ConfirmedAt = &at
o.RefHash = hash o.RefHash = hash
o.RefBlockNum = int(blockNum) o.RefBlockNum = blockNum
o.Status = OrderStatusConfirming o.Status = OrderStatusConfirming
if o.AddressLocked {
rate, _ := decimal.NewFromString(o.Rate)
o.Amount = amount.String()
o.Money = rate.Mul(amount).String()
}
Db.Save(o) Db.Save(o)
} }
@@ -177,36 +180,44 @@ func GetOrderByStatus(Status int) []Order {
func GetNotifyFailedTradeOrders() ([]Order, error) { func GetNotifyFailedTradeOrders() ([]Order, error) {
var orders []Order var orders []Order
maxRetry := cast.ToInt(GetC(NotifyMaxRetry))
if maxRetry <= 0 {
maxRetry = cast.ToInt(defaultConf[NotifyMaxRetry])
}
res := Db.Where("status = ?", OrderStatusSuccess). res := Db.Where("status = ?", OrderStatusSuccess).
Where("notify_num <= ?", GetC(NotifyMaxRetry)). Where("notify_state = ?", OrderNotifyStateFail).
Where("notify_state = ?", OrderNotifyStateFail).Find(&orders) Where("notify_num <= ?", maxRetry).Find(&orders)
return orders, res.Error return orders, res.Error
} }
// CalcTradeAmount 计算当前实际可用的交易金额 // CalcTradeAmount 计算当前实际可用的交易金额
func CalcTradeAmount(address []string, rate, money decimal.Decimal, t TradeType) (string, string, error) { func CalcTradeAmount(address []string, rate decimal.Decimal, p OrderParams) (string, string, error) {
calcMutex.Lock() if p.AddressLocked {
defer calcMutex.Unlock() return LockTradeAddress(address, p.TradeType)
}
var orders []Order var orders []Order
lock := make(map[string]bool) lock := make(map[string]bool)
status := []int{OrderStatusConfirming, OrderStatusWaiting} status := []int{OrderStatusConfirming, OrderStatusWaiting}
Db.Where("status in (?) and trade_type = ?", status, t).Find(&orders) Db.Where("status in (?) and trade_type = ?", status, p.TradeType).Find(&orders)
for _, order := range orders { for _, order := range orders {
lock[order.Address+order.Amount] = true lock[order.Address+order.Amount] = true
} }
atom, precision := GetAtomicity(t) atom, precision := GetAtomicity(p.TradeType)
if rate.LessThanOrEqual(decimal.Zero) || precision <= 0 { if rate.LessThanOrEqual(decimal.Zero) || precision <= 0 {
return "", "", errors.New(fmt.Sprintf("[%v - %v]原子颗粒度计算异常,联系管理员处理!", atom, precision)) return "", "", errors.New(fmt.Sprintf("[%v - %v]原子颗粒度计算异常,联系管理员处理!", atom, precision))
} }
amount := money.DivRound(rate, precision) amount := p.Money.DivRound(rate, precision)
if amount.LessThan(atom) { // 低于最小原子精度,从最小原子精度开始计算 if amount.LessThan(atom) { // 低于最小原子精度,从最小原子精度开始计算
amount = atom amount = atom
} }
var i = 0
var m = 100
for { for {
for _, addr := range address { for _, addr := range address {
k := addr + amount.String() k := addr + amount.String()
@@ -219,9 +230,27 @@ func CalcTradeAmount(address []string, rate, money decimal.Decimal, t TradeType)
// 已经被占用,每次递增一个原子精度 // 已经被占用,每次递增一个原子精度
amount = amount.Add(atom) amount = amount.Add(atom)
if i++; i > m {
return "", "", errors.New("计算交易金额异常,联系管理员处理!")
}
} }
} }
// LockTradeAddress 检测交易地址,独占使用
func LockTradeAddress(address []string, t TradeType) (string, string, error) {
zero := decimal.Zero.String()
status := []int{OrderStatusConfirming, OrderStatusWaiting}
for _, addr := range address {
var o Order
Db.Where("address = ? and status in (?) and trade_type = ? and address_locked = ?", addr, status, t, true).Order("id desc").Limit(1).Find(&o)
if o.ID == 0 {
return addr, zero, nil
}
}
return "", zero, errors.New("暂无可用钱包地址")
}
// CalcTradeExpiredAt 计算订单过期时间 最小180,最大3600,默认1200 // CalcTradeExpiredAt 计算订单过期时间 最小180,最大3600,默认1200
func CalcTradeExpiredAt(sec int64) time.Time { func CalcTradeExpiredAt(sec int64) time.Time {
if sec >= 180 && sec <= 3600 { if sec >= 180 && sec <= 3600 {
+41 -45
View File
@@ -25,6 +25,7 @@ type OrderParams struct {
Rate string `json:"rate"` // 强制指定汇率 Rate string `json:"rate"` // 强制指定汇率
Fiat Fiat `json:"fiat"` // 法币类型 Fiat Fiat `json:"fiat"` // 法币类型
CurrencyLimit string `json:"currency_limit"` // 限定币种 CurrencyLimit string `json:"currency_limit"` // 限定币种
AddressLocked bool `json:"address_locked"` // 地址独占锁定
} }
type Trade struct { type Trade struct {
@@ -34,7 +35,9 @@ type Trade struct {
Amount string Amount string
} }
func BuildOrder(p OrderParams) (Order, error) { var buildMutex sync.Mutex
func StartBuildOrder(p OrderParams) (Order, error) {
var order Order var order Order
if p.Address != "" { if p.Address != "" {
@@ -47,18 +50,14 @@ func BuildOrder(p OrderParams) (Order, error) {
} }
} }
if _, ok := registry[p.TradeType]; !ok { if _, ok := registry[p.TradeType]; !ok {
return order, fmt.Errorf("不支持的交易类型:%s", p.TradeType) return order, fmt.Errorf("不支持的交易类型:%s", p.TradeType)
} }
if _, ok := supportFiat[p.Fiat]; !ok { if _, ok := supportFiat[p.Fiat]; !ok {
return order, fmt.Errorf("不支持的法币类型:%s", p.Fiat) return order, fmt.Errorf("不支持的法币类型:%s", p.Fiat)
} }
maxAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMaxAmount))) maxAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMaxAmount)))
minAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMinAmount))) minAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMinAmount)))
if p.Money.GreaterThan(maxAmount) || p.Money.LessThan(minAmount) { if !p.AddressLocked && (p.Money.GreaterThan(maxAmount) || p.Money.LessThan(minAmount)) {
return order, fmt.Errorf("交易金额必须在 %s - %s 之间", minAmount.String(), maxAmount.String()) return order, fmt.Errorf("交易金额必须在 %s - %s 之间", minAmount.String(), maxAmount.String())
} }
@@ -67,50 +66,26 @@ func BuildOrder(p OrderParams) (Order, error) {
return order, nil return order, nil
} }
buildMutex.Lock()
defer buildMutex.Unlock()
Db.Where("order_id = ?", p.OrderId).Order("id desc").Limit(1).Find(&order)
if order.Status == OrderStatusSuccess || order.Status == OrderStatusConfirming {
return order, nil
}
if order.Status == OrderStatusWaiting { if order.Status == OrderStatusWaiting {
return RebuildOrder(order, p) return RebuildOrder(order, p)
} }
var lock sync.Mutex
lock.Lock()
defer lock.Unlock()
data, err := BuildTrade(p) data, err := BuildTrade(p)
if err != nil { if err != nil {
return order, err return order, err
} }
return NewOrder(p, data) return BuildOrder(p, data)
} }
func RebuildOrder(t Order, p OrderParams) (Order, error) { func BuildOrder(p OrderParams, data Trade) (Order, error) {
if p.OrderId == t.OrderId &&
p.TradeType == t.TradeType &&
p.Money.String() == t.Money &&
p.Fiat == t.Fiat {
return t, nil
}
var lock sync.Mutex
lock.Lock()
defer lock.Unlock()
data, err := BuildTrade(p)
if err != nil {
return t, err
}
t.Amount = data.Amount
t.TradeType = p.TradeType
t.Address = data.Address
t.Crypto = data.Crypto
t.Rate = fmt.Sprintf("%v", data.Rate)
t.ExpiredAt = CalcTradeExpiredAt(p.Timeout)
return t, Db.Save(&t).Error
}
func NewOrder(p OrderParams, data Trade) (Order, error) {
tradeId, err := utils.GenerateTradeId() tradeId, err := utils.GenerateTradeId()
if err != nil { if err != nil {
return Order{}, err return Order{}, err
@@ -126,6 +101,7 @@ func NewOrder(p OrderParams, data Trade) (Order, error) {
Amount: data.Amount, Amount: data.Amount,
Money: p.Money.String(), Money: p.Money.String(),
Address: data.Address, Address: data.Address,
AddressLocked: p.Money.IsZero(), // 零值订单,地址锁定 独占
Status: OrderStatusWaiting, Status: OrderStatusWaiting,
Name: p.Name, Name: p.Name,
ApiType: p.ApiType, ApiType: p.ApiType,
@@ -143,7 +119,6 @@ func NewOrder(p OrderParams, data Trade) (Order, error) {
if tradeOrder.Name == "" { if tradeOrder.Name == "" {
tradeOrder.Name = tradeOrder.OrderId tradeOrder.Name = tradeOrder.OrderId
} }
if err = Db.Create(&tradeOrder).Error; err != nil { if err = Db.Create(&tradeOrder).Error; err != nil {
log.Error("订单创建失败:", err.Error()) log.Error("订单创建失败:", err.Error())
return Order{}, err return Order{}, err
@@ -181,7 +156,7 @@ func BuildTrade(p OrderParams) (Trade, error) {
} }
// 计算交易金额 // 计算交易金额
address, amount, err := CalcTradeAmount(wallet, rate, p.Money, p.TradeType) address, amount, err := CalcTradeAmount(wallet, rate, p)
if err != nil { if err != nil {
return Trade{}, err return Trade{}, err
@@ -195,13 +170,35 @@ func BuildTrade(p OrderParams) (Trade, error) {
}, nil }, nil
} }
func RebuildOrder(t Order, p OrderParams) (Order, error) {
if p.OrderId == t.OrderId && p.TradeType == t.TradeType && p.Money.String() == t.Money && p.Fiat == t.Fiat {
return t, nil
}
data, err := BuildTrade(p)
if err != nil {
return t, err
}
t.Fiat = p.Fiat
t.Address = data.Address
t.Crypto = data.Crypto
t.Amount = data.Amount
t.Money = p.Money.String()
t.TradeType = p.TradeType
t.Rate = fmt.Sprintf("%v", data.Rate)
t.ExpiredAt = CalcTradeExpiredAt(p.Timeout)
return t, Db.Save(&t).Error
}
// BuildPendingOrder 创建待支付订单(不锁定地址和汇率) // BuildPendingOrder 创建待支付订单(不锁定地址和汇率)
func BuildPendingOrder(p OrderParams) (Order, error) { func BuildPendingOrder(p OrderParams) (Order, error) {
var order Order var order Order
maxAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMaxAmount))) maxAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMaxAmount)))
minAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMinAmount))) minAmount := decimal.NewFromFloat(cast.ToFloat64(GetC(PaymentMinAmount)))
if p.Money.GreaterThan(maxAmount) || p.Money.LessThan(minAmount) { if !p.Money.IsZero() && (p.Money.GreaterThan(maxAmount) || p.Money.LessThan(minAmount)) {
return order, fmt.Errorf("交易金额必须在 %s - %s 之间", minAmount.String(), maxAmount.String()) return order, fmt.Errorf("交易金额必须在 %s - %s 之间", minAmount.String(), maxAmount.String())
} }
@@ -217,15 +214,14 @@ func BuildPendingOrder(p OrderParams) (Order, error) {
if err == nil { if err == nil {
crypto = c crypto = c
} }
} else if p.CurrencyLimit != "" { } else if p.CurrencyLimit != "" { // 如果指定了唯一的币种限制,且不是黑名单模式,则使用该币种
// 如果指定了唯一的币种限制,且不是黑名单模式,则使用该币种
cur := strings.ToUpper(p.CurrencyLimit) cur := strings.ToUpper(p.CurrencyLimit)
if !strings.Contains(cur, ",") && !strings.HasPrefix(cur, "-") { if !strings.Contains(cur, ",") && !strings.HasPrefix(cur, "-") {
crypto = Crypto(cur) crypto = Crypto(cur)
} }
} }
return NewOrder(p, Trade{ return BuildOrder(p, Trade{
Crypto: crypto, Crypto: crypto,
Rate: decimal.Zero, Rate: decimal.Zero,
Amount: "0", Amount: "0",
+85
View File
@@ -0,0 +1,85 @@
package mqtt
import (
"fmt"
"os"
"sync"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/model"
)
type activeConf struct {
host string
port string
user string
pass string
}
var (
client mqtt.Client
mu sync.RWMutex
curConf activeConf
)
// Reload 按最新配置连接MQTT服务器
func Reload() error {
host := model.GetC(model.MqttHost)
port := model.GetC(model.MqttPort)
if host == "" || port == "" {
return nil // 未配置 MQTT,跳过
}
newConf := activeConf{
host: host,
port: port,
user: model.GetC(model.MqttUser),
pass: model.GetC(model.MqttPass),
}
mu.Lock()
defer mu.Unlock()
if newConf == curConf { // 配置未变更,无需重连
return nil
}
// 断开旧连接(给 250ms 优雅退出)
if client != nil {
client.Disconnect(250)
log.Info("🔄 MQTT 配置变动,正在连接...")
}
opts := mqtt.NewClientOptions()
// 暂时只支持 tcp 模式
opts.AddBroker(fmt.Sprintf("tcp://%s:%s", newConf.host, newConf.port))
opts.SetUsername(newConf.user)
opts.SetPassword(newConf.pass)
opts.SetClientID(fmt.Sprintf("BEpusdt %d", os.Getpid()))
opts.SetAutoReconnect(true)
opts.SetOrderMatters(false)
opts.SetOnConnectHandler(onConnectHandler)
opts.SetConnectionLostHandler(onConnectionLost)
newClient := mqtt.NewClient(opts)
if token := newClient.Connect(); token.Wait() && token.Error() != nil {
return fmt.Errorf("MQTT 连接失败: %s", token.Error())
}
client = newClient
curConf = newConf
return nil
}
func onConnectHandler(c mqtt.Client) {
for topic, cb := range subscribeMap {
c.Subscribe(topic, cb.Qos, cb.Handler).Wait()
}
log.Info("✅ MQTT 连接成功")
}
func onConnectionLost(_ mqtt.Client, err error) {
log.Warn(fmt.Sprintf("❌ MQTT 连接断开: %s", err.Error()))
}
+30
View File
@@ -0,0 +1,30 @@
package mqtt
import (
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/v03413/bepusdt/app/log"
)
// Publish 发布消息。若 MQTT 未连接则静默丢弃,返回 nil。
func Publish(topic string, qos byte, retained bool, payload interface{}) mqtt.Token {
mu.RLock()
c := client
mu.RUnlock()
if c == nil {
return nil
}
token := c.Publish(topic, qos, retained, payload)
if qos > 0 {
go func() {
token.Wait()
if err := token.Error(); err != nil {
log.Warn("MQTT publish error: " + err.Error())
return
}
}()
}
return token
}
+33
View File
@@ -0,0 +1,33 @@
package mqtt
import (
"fmt"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/v03413/bepusdt/app/log"
)
type callback struct {
Qos byte
Handler mqtt.MessageHandler
}
var subscribeMap = make(map[string]callback)
// Subscribe 注册订阅。topic 会持久保存在 subscribeMap,
// 重连后由 onConnectHandler 自动恢复所有订阅。
func Subscribe(topic string, qos byte, handler mqtt.MessageHandler) {
subscribeMap[topic] = callback{Qos: qos, Handler: handler}
mu.RLock()
c := client
mu.RUnlock()
if c == nil {
return
}
if token := c.Subscribe(topic, qos, handler); token.Wait() && token.Error() == nil {
log.Info(fmt.Sprintf("✅ 订阅主题: %s", topic))
}
}
+2 -2
View File
@@ -62,7 +62,7 @@ func (t *Telegram) Success(o model.Order) {
\-\-\- \-\-\-
` + "```" + ` ` + "```" + `
🚦商户订单:%v 🚦商户订单:%v
💰请求金额:%v CNY(%v) 💰请求金额:%v ` + string(o.Fiat) + `(%v)
💲支付数额:%v ` + tradeType + ` 💲支付数额:%v ` + tradeType + `
💎交易哈希:%s 💎交易哈希:%s
✅收款地址:%s ✅收款地址:%s
@@ -111,7 +111,7 @@ func (t *Telegram) NotifyFail(o model.Order, reason string) {
`+"```"+` `+"```"+`
🚦商户订单:%v 🚦商户订单:%v
💲支付数额:%v 💲支付数额:%v
💰请求金额:%v CNY(%v) 💰请求金额:%v `+string(o.Fiat)+`(%v)
💍交易类别:%s 💍交易类别:%s
⚖️️确认时间:%s ⚖️️确认时间:%s
⏰下次回调:%s ⏰下次回调:%s
+1 -2
View File
@@ -23,8 +23,7 @@ func Handler() *gin.Engine {
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
engine = gin.New() engine = gin.New()
session := memstore.NewStore([]byte(model.GetK(model.AdminSecret)))
session := memstore.NewStore([]byte(conf.Secret))
session.Options(sessions.Options{ session.Options(sessions.Options{
MaxAge: 86400, MaxAge: 86400,
HttpOnly: true, HttpOnly: true,
+5 -1
View File
@@ -396,7 +396,7 @@ func (e *evm) tradeConfirmHandle(ctx context.Context) {
if !ok { if !ok {
return return
} }
if last.(int)-o.RefBlockNum < e.Block.ConfirmedOffset { if cast.ToInt(last)-o.RefBlockNum < e.Block.ConfirmedOffset {
return return
} }
} }
@@ -461,6 +461,10 @@ func syncBreak(network string, num int) bool {
return true return true
} }
if mqttSubscribed(network) {
return false
}
trades := model.GetNetworkTrades(model.Network(network)) trades := model.GetNetworkTrades(model.Network(network))
if len(trades) == 0 { if len(trades) == 0 {
+70
View File
@@ -0,0 +1,70 @@
package task
import (
"context"
"encoding/json"
"log"
"strings"
"time"
"github.com/shopspring/decimal"
"github.com/spf13/cast"
"github.com/v03413/bepusdt/app/model"
appMqtt "github.com/v03413/bepusdt/app/mqtt"
"github.com/v03413/go-cache"
)
type mqttTransfer struct {
Network string `json:"network"`
TxHash string `json:"tx_hash"`
Amount decimal.Decimal `json:"amount"`
FromAddress string `json:"from_address"`
RecvAddress string `json:"recv_address"`
Timestamp int64 `json:"timestamp"`
TradeType model.TradeType `json:"trade_type"`
BlockNum int `json:"block_num"`
}
func init() {
Register(Task{Duration: time.Second * 5, Callback: mqttWatcher})
}
func mqttWatcher(_ context.Context) {
if err := appMqtt.Reload(); err != nil {
log.Printf("❌ MQTT 连接失败: %s\n", err.Error())
}
networks := strings.Split(model.GetC(model.MqttNetworks), ",")
for _, n := range networks {
cache.Set("mqtt_subscribed_"+n, true, time.Second*8)
}
}
func mqttPublish(t transfer) {
if !mqttSubscribed(t.Network) {
return
}
var qos = cast.ToUint8(model.GetC(model.MqttPublishQos))
var topic = model.GetC(model.MqttTopicPrefix) + "/transfer/" + t.Network
var data = mqttTransfer{
Network: t.Network,
TxHash: t.TxHash,
Amount: t.Amount,
FromAddress: t.FromAddress,
RecvAddress: t.RecvAddress,
Timestamp: t.Timestamp.Unix(),
TradeType: t.TradeType,
BlockNum: t.BlockNum,
}
go func() {
payload, _ := json.Marshal(data)
appMqtt.Publish(topic, qos, false, payload)
}()
}
func mqttSubscribed(n string) bool {
_, found := cache.Get("mqtt_subscribed_" + n)
return found
}
+7
View File
@@ -6,6 +6,7 @@ import (
"github.com/v03413/bepusdt/app/log" "github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/model" "github.com/v03413/bepusdt/app/model"
"github.com/v03413/bepusdt/app/notifier"
"github.com/v03413/bepusdt/app/task/notify" "github.com/v03413/bepusdt/app/task/notify"
"github.com/v03413/bepusdt/app/utils" "github.com/v03413/bepusdt/app/utils"
) )
@@ -37,3 +38,9 @@ func notifyRoll(context.Context) {
notify.Bepusdt(o) notify.Bepusdt(o)
} }
} }
// notifyOrderSuccess 统一触发订单成功后的回调与订单通知。
func notifyOrderSuccess(order model.Order) {
go notify.Handle(order)
go notifier.Success(order)
}
+70 -78
View File
@@ -19,6 +19,7 @@ import (
"github.com/v03413/bepusdt/app/utils" "github.com/v03413/bepusdt/app/utils"
"github.com/v03413/go-cache" "github.com/v03413/go-cache"
"gorm.io/gorm"
) )
type EpNotify struct { type EpNotify struct {
@@ -166,90 +167,81 @@ func Bepusdt(o model.Order) {
return return
} }
var todo = func() error { var authToken = model.AuthToken()
var db = model.Db.Begin() var client = &http.Client{Timeout: time.Second * 5}
if err := db.Where("trade_id = ? and status = ?", o.TradeId, o.Status).Limit(1).Find(&o).Error; err != nil {
db.Rollback()
return err
}
var key = fmt.Sprintf("bepusdt_notify_%d_%s", o.Status, o.TradeId)
if _, ok := cache.Get(key); ok {
db.Rollback()
return nil
}
cache.Set(key, true, time.Minute)
var data = make(map[string]interface{})
var body = EpNotify{
TradeId: o.TradeId,
OrderId: o.OrderId,
Amount: cast.ToFloat64(o.Money),
ActualAmount: o.Amount,
Token: o.Address,
BlockTransactionId: o.RefHash,
Status: o.Status,
}
var jsonBody, err = json.Marshal(body)
if err != nil {
db.Rollback()
return err
}
if err = json.Unmarshal(jsonBody, &data); err != nil {
db.Rollback()
return err
}
// 签名
body.Signature = utils.EpusdtSign(data, model.AuthToken())
// 再次序列化
jsonBody, _ = json.Marshal(body)
var client = http.Client{Timeout: time.Second * 5}
var req, err2 = http.NewRequest("POST", o.NotifyUrl, strings.NewReader(string(jsonBody)))
if err2 != nil {
db.Rollback()
return err2
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Powered-By", "https://github.com/v03413/BEpusdt")
resp, err := client.Do(req)
if err != nil {
db.Rollback()
return err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
db.Rollback()
return fmt.Errorf("resp.StatusCode != 200")
}
all, _ := io.ReadAll(resp.Body)
log.Info(fmt.Sprintf("订单回调成功[%d]:%s %s", o.Status, o.TradeId, string(all)))
db.Commit()
return nil
}
go func() { go func() {
if err := todo(); err != nil { if err := deliverBepusdtStatusUpdate(model.Db, client, authToken, o); err != nil {
log.Warn("notify BEpusdt Error:", err.Error()) log.Warn("notify BEpusdt Error:", err.Error())
} }
}() }()
} }
func deliverBepusdtStatusUpdate(db *gorm.DB, client *http.Client, authToken string, o model.Order) error {
if client == nil {
client = &http.Client{Timeout: time.Second * 5}
}
var current model.Order
tx := db.Where("trade_id = ? and status = ?", o.TradeId, o.Status).Limit(1).Find(&current)
if tx.Error != nil {
return tx.Error
}
if tx.RowsAffected == 0 {
return nil
}
var key = fmt.Sprintf("bepusdt_notify_%d_%s", current.Status, current.TradeId)
if _, ok := cache.Get(key); ok {
return nil
}
cache.Set(key, true, time.Minute)
var data = make(map[string]interface{})
var body = EpNotify{
TradeId: current.TradeId,
OrderId: current.OrderId,
Amount: cast.ToFloat64(current.Money),
ActualAmount: current.Amount,
Token: current.Address,
BlockTransactionId: current.RefHash,
Status: current.Status,
}
jsonBody, err := json.Marshal(body)
if err != nil {
return err
}
if err = json.Unmarshal(jsonBody, &data); err != nil {
return err
}
body.Signature = utils.EpusdtSign(data, authToken)
jsonBody, _ = json.Marshal(body)
req, err := http.NewRequest("POST", current.NotifyUrl, strings.NewReader(string(jsonBody)))
if err != nil {
return err
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Powered-By", "https://github.com/v03413/BEpusdt")
resp, err := client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return fmt.Errorf("resp.StatusCode != 200")
}
all, _ := io.ReadAll(resp.Body)
log.Info(fmt.Sprintf("订单回调成功[%d]:%s %s", current.Status, current.TradeId, string(all)))
return nil
}
func markNotifyFail(o model.Order, reason string) { func markNotifyFail(o model.Order, reason string) {
log.Warn(fmt.Sprintf("订单回调失败(%v):%s %v", o.TradeId, reason, o.SetNotifyState(model.OrderNotifyStateFail))) log.Warn(fmt.Sprintf("订单回调失败(%v):%s %v", o.TradeId, reason, o.SetNotifyState(model.OrderNotifyStateFail)))
+123
View File
@@ -0,0 +1,123 @@
package notify
import (
"net/http"
"net/http/httptest"
"path/filepath"
"testing"
"time"
applog "github.com/v03413/bepusdt/app/log"
"github.com/glebarez/sqlite"
"github.com/v03413/bepusdt/app/model"
"gorm.io/gorm"
)
func newNotifyTestDB(t *testing.T) *gorm.DB {
t.Helper()
dbPath := filepath.Join(t.TempDir(), "notify-test.db")
db, err := gorm.Open(sqlite.Open(dbPath+"?cache=shared&mode=rwc&_pragma=journal_mode(WAL)&_pragma=busy_timeout(1000)"), &gorm.Config{})
if err != nil {
t.Fatalf("open test db: %v", err)
}
sqlDB, err := db.DB()
if err != nil {
t.Fatalf("get sql db: %v", err)
}
sqlDB.SetMaxOpenConns(1)
sqlDB.SetMaxIdleConns(1)
if err := db.AutoMigrate(&model.Order{}); err != nil {
t.Fatalf("auto migrate order: %v", err)
}
return db
}
func initNotifyTestLog(t *testing.T) {
t.Helper()
if err := applog.Init(filepath.Join(t.TempDir(), "logs")); err != nil {
t.Fatalf("init log: %v", err)
}
t.Cleanup(func() {
applog.Close()
})
}
func newWaitingOrder(notifyURL string) model.Order {
now := time.Now()
confirmedAt := now
return model.Order{
OrderId: "merchant-order-1",
TradeId: "trade-order-1",
TradeType: model.UsdtTrc20,
Fiat: "CNY",
Crypto: "USDT",
Rate: "7.00",
Amount: "1.00",
Money: "7.00",
Address: "TTestAddress1234567890",
Status: model.OrderStatusWaiting,
ApiType: model.OrderApiTypeEpusdt,
NotifyUrl: notifyURL,
ExpiredAt: now.Add(10 * time.Minute),
ConfirmedAt: &confirmedAt,
AutoTimeAt: model.AutoTimeAt{CreatedAt: (*model.Datetime)(&now), UpdatedAt: (*model.Datetime)(&now)},
}
}
func TestDeliverBepusdtStatusUpdateDoesNotHoldDBWhileHTTPIsPending(t *testing.T) {
db := newNotifyTestDB(t)
initNotifyTestLog(t)
requestStarted := make(chan struct{}, 1)
releaseResponse := make(chan struct{})
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
requestStarted <- struct{}{}
<-releaseResponse
w.WriteHeader(http.StatusOK)
}))
defer server.Close()
order := newWaitingOrder(server.URL)
if err := db.Create(&order).Error; err != nil {
t.Fatalf("seed order: %v", err)
}
errCh := make(chan error, 1)
go func() {
errCh <- deliverBepusdtStatusUpdate(db, &http.Client{Timeout: 2 * time.Second}, "test-auth-token", order)
}()
select {
case <-requestStarted:
case <-time.After(2 * time.Second):
t.Fatal("notification request never reached test server")
}
queryDone := make(chan error, 1)
go func() {
var count int64
queryDone <- db.Model(&model.Order{}).Where("status = ?", model.OrderStatusWaiting).Count(&count).Error
}()
select {
case err := <-queryDone:
if err != nil {
t.Fatalf("concurrent query failed: %v", err)
}
case <-time.After(300 * time.Millisecond):
close(releaseResponse)
<-errCh
t.Fatal("database query was blocked while notification HTTP request was in flight")
}
close(releaseResponse)
if err := <-errCh; err != nil {
t.Fatalf("deliver notification: %v", err)
}
}
+11
View File
@@ -13,6 +13,7 @@ import (
func init() { func init() {
var rate = Rate{} var rate = Rate{}
Register(Task{Duration: time.Hour, Callback: rate.Clear})
Register(Task{Duration: time.Second * 5, Callback: rate.Sync}) Register(Task{Duration: time.Second * 5, Callback: rate.Sync})
} }
@@ -34,3 +35,13 @@ func (Rate) Sync(ctx context.Context) {
log.Warn(fmt.Sprintf("同步汇率失败: %s", err.Error())) log.Warn(fmt.Sprintf("同步汇率失败: %s", err.Error()))
} }
} }
func (Rate) Clear(ctx context.Context) {
days := cast.ToInt(model.GetC(model.RateSyncHistoryDays))
if days <= 0 {
days = 1
}
createdAt := time.Now().AddDate(0, 0, -days)
model.Db.Where("created_at < ?", createdAt).Delete(&model.Rate{})
}
+32 -22
View File
@@ -9,6 +9,7 @@ import (
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
"github.com/smallnest/chanx" "github.com/smallnest/chanx"
"github.com/v03413/bepusdt/app/conf" "github.com/v03413/bepusdt/app/conf"
"github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/model" "github.com/v03413/bepusdt/app/model"
"github.com/v03413/bepusdt/app/notifier" "github.com/v03413/bepusdt/app/notifier"
"github.com/v03413/bepusdt/app/task/notify" "github.com/v03413/bepusdt/app/task/notify"
@@ -16,14 +17,14 @@ import (
) )
type transfer struct { type transfer struct {
Network string Network string `json:"network"`
TxHash string TxHash string `json:"tx_hash"`
Amount decimal.Decimal Amount decimal.Decimal `json:"amount"`
FromAddress string FromAddress string `json:"from_address"`
RecvAddress string RecvAddress string `json:"recv_address"`
Timestamp time.Time Timestamp time.Time `json:"timestamp"`
TradeType model.TradeType TradeType model.TradeType `json:"trade_type"`
BlockNum int BlockNum int `json:"block_num"`
} }
type resource struct { type resource struct {
@@ -76,8 +77,7 @@ func orderTransferHandle(ctx context.Context) {
} }
var other = make([]transfer, 0) var other = make([]transfer, 0)
// getAllWaitingOrders 内部包含过期检查逻辑 var orders = getAllWaitingOrders() // 内部包含过期检查逻辑
var orders = getAllWaitingOrders()
if len(batch) == 0 { if len(batch) == 0 {
continue continue
} }
@@ -87,6 +87,8 @@ func orderTransferHandle(ctx context.Context) {
continue continue
} }
mqttPublish(t)
key := fmt.Sprintf("%s%s", t.RecvAddress, t.TradeType) key := fmt.Sprintf("%s%s", t.RecvAddress, t.TradeType)
orderList, ok := orders[key] orderList, ok := orders[key]
if !ok { if !ok {
@@ -95,21 +97,22 @@ func orderTransferHandle(ctx context.Context) {
} }
var matched bool var matched bool
for _, o := range orderList { for i, o := range orderList {
// 金额前缀匹配 // 金额匹配
if !amountMatch(t.Amount, o.Amount, string(o.TradeType)) { if !o.AddressLocked && !amountMatch(t.Amount, o.Amount, string(o.TradeType)) {
continue continue
} }
// 有效期检测 // 有效期检测
if !o.CreatedAt.Before(t.Timestamp) || !o.ExpiredAt.After(t.Timestamp) { if !o.CreatedAt.Before(t.Timestamp) || !o.ExpiredAt.After(t.Timestamp) {
continue continue
} }
// 找到匹配的订单 // 从内存 map 中移除已匹配订单,防止同批次其他 transfer 重复匹配
o.MarkConfirming(t.BlockNum, t.FromAddress, t.TxHash, t.Timestamp) orders[key] = append(orderList[:i], orderList[i+1:]...)
// 订单匹配 进入确认流程
o.MarkConfirming(t.BlockNum, t.FromAddress, t.TxHash, t.Timestamp, t.Amount)
matched = true matched = true
break break
} }
@@ -224,9 +227,7 @@ func tronResourceHandle(ctx context.Context) {
func markFinalConfirmed(o model.Order) { func markFinalConfirmed(o model.Order) {
o.SetSuccess() o.SetSuccess()
notifyOrderSuccess(o)
go notify.Handle(o) // 订单回调
go notifier.Success(o) // 消息通知
} }
func getAllWaitingOrders() map[string][]model.Order { func getAllWaitingOrders() map[string][]model.Order {
@@ -277,10 +278,20 @@ func amountMatch(amount decimal.Decimal, target, tradeType string) bool {
case model.Classic: case model.Classic:
return amount.String() == target return amount.String() == target
case model.HasPrefix: case model.HasPrefix:
return strings.HasPrefix(amount.String(), target) s := amount.String()
if !strings.HasPrefix(s, target) {
return false
}
rest := s[len(target):]
if rest == "" {
return true
}
return strings.Contains(target, ".") || strings.HasPrefix(rest, ".")
case model.RoundOff: case model.RoundOff:
t, err := decimal.NewFromString(target) t, err := decimal.NewFromString(target)
if err != nil { if err != nil {
log.Warn(err.Error())
return false return false
} }
@@ -288,7 +299,6 @@ func amountMatch(amount decimal.Decimal, target, tradeType string) bool {
_, precision := model.GetAtomicity(model.TradeType(tradeType)) // 标准精度 _, precision := model.GetAtomicity(model.TradeType(tradeType)) // 标准精度
precision2 := abs(t.Exponent()) // 实际精度 precision2 := abs(t.Exponent()) // 实际精度
if precision2 != precision { if precision2 != precision {
precision = precision2 precision = precision2
} }
+88 -9
View File
@@ -37,6 +37,9 @@ type tron struct {
blockScanQueue *chanx.UnboundedChan[int] blockScanQueue *chanx.UnboundedChan[int]
conn map[string]*grpc.ClientConn conn map[string]*grpc.ClientConn
connMu sync.RWMutex connMu sync.RWMutex
retryMu sync.Mutex
retryAttempts map[int]int
retryScheduled map[int]*time.Timer
} }
var tr tron var tr tron
@@ -54,6 +57,8 @@ func newTron() tron {
blockConfirmedOffset: 30, blockConfirmedOffset: 30,
blockScanQueue: chanx.NewUnboundedChan[int](context.Background(), 30), blockScanQueue: chanx.NewUnboundedChan[int](context.Background(), 30),
conn: make(map[string]*grpc.ClientConn), conn: make(map[string]*grpc.ClientConn),
retryAttempts: make(map[int]int),
retryScheduled: make(map[int]*time.Timer),
} }
} }
@@ -138,7 +143,7 @@ func (t *tron) syncBlocksBackward(now int) {
}() }()
} }
func (t *tron) blockDispatch(context.Context) { func (t *tron) blockDispatch(ctx context.Context) {
p, err := ants.NewPoolWithFunc(2, t.blockParse) p, err := ants.NewPoolWithFunc(2, t.blockParse)
if err != nil { if err != nil {
log.Task.Warn("Error creating pool:", err) log.Task.Warn("Error creating pool:", err)
@@ -148,11 +153,19 @@ func (t *tron) blockDispatch(context.Context) {
defer p.Release() defer p.Release()
for n := range t.blockScanQueue.Out { for {
if err := p.Invoke(n); err != nil { select {
t.blockScanQueue.In <- n case <-ctx.Done():
return
case n, ok := <-t.blockScanQueue.Out:
if !ok {
return
}
if err := p.Invoke(n); err != nil {
t.scheduleBlockRetry(n, 0)
log.Task.Warn("Tron Error invoking process block:", err) log.Task.Warn("Tron Error invoking process block:", err)
}
} }
} }
} }
@@ -168,19 +181,20 @@ func (t *tron) blockParse(n any) {
return return
} }
conf.RecordSuccess(conf.Tron)
var ctx, cancel = context.WithTimeout(context.Background(), time.Second*5) var ctx, cancel = context.WithTimeout(context.Background(), time.Second*5)
bok, err2 := api.NewWalletClient(conn).GetBlockByNum2(ctx, &api.NumberMessage{Num: int64(num)}) bok, err2 := api.NewWalletClient(conn).GetBlockByNum2(ctx, &api.NumberMessage{Num: int64(num)})
cancel() cancel()
if err2 != nil { if err2 != nil {
conf.RecordFailure(conf.Tron) conf.RecordFailure(conf.Tron)
t.blockScanQueue.In <- int(num) t.scheduleBlockRetry(num, 0)
log.Task.Warn("GetBlockByNum2 ", err2) log.Task.Warn("GetBlockByNum2 ", err2)
return return
} }
conf.RecordSuccess(conf.Tron)
t.resetBlockRetry(num)
var resources = make([]resource, 0) var resources = make([]resource, 0)
var transfers = make([]transfer, 0) var transfers = make([]transfer, 0)
var timestamp = time.UnixMilli(bok.GetBlockHeader().GetRawData().GetTimestamp()) var timestamp = time.UnixMilli(bok.GetBlockHeader().GetRawData().GetTimestamp())
@@ -474,6 +488,10 @@ func (t *tron) syncBreak() bool {
return true return true
} }
if mqttSubscribed(conf.Tron) {
return false
}
var count int64 = 0 var count int64 = 0
trade := []model.TradeType{model.TronTrx, model.UsdtTrc20, model.UsdcTrc20} trade := []model.TradeType{model.TronTrx, model.UsdtTrc20, model.UsdcTrc20}
model.Db.Model(&model.Order{}).Where("status = ? and trade_type in (?)", model.OrderStatusWaiting, trade).Count(&count) model.Db.Model(&model.Order{}).Where("status = ? and trade_type in (?)", model.OrderStatusWaiting, trade).Count(&count)
@@ -491,6 +509,67 @@ func (t *tron) syncBreak() bool {
return true return true
} }
func (t *tron) scheduleBlockRetry(num int, delay time.Duration) {
t.retryMu.Lock()
if _, ok := t.retryScheduled[num]; ok {
t.retryMu.Unlock()
return
}
attempt := t.retryAttempts[num] + 1
t.retryAttempts[num] = attempt
if delay <= 0 {
delay = tronRetryDelay(attempt)
}
var timer *time.Timer
timer = time.AfterFunc(delay, func() {
t.retryMu.Lock()
if t.retryScheduled[num] != timer {
t.retryMu.Unlock()
return
}
delete(t.retryScheduled, num)
t.retryMu.Unlock()
if t.blockScanQueue.Len() >= blockQueueLimit {
log.Task.Warn("Tron 重试延后,当前区块消费堆积数量:", t.blockScanQueue.Len())
t.scheduleBlockRetry(num, delay)
return
}
t.blockScanQueue.In <- num
})
t.retryScheduled[num] = timer
t.retryMu.Unlock()
}
func (t *tron) resetBlockRetry(num int) {
t.retryMu.Lock()
defer t.retryMu.Unlock()
delete(t.retryAttempts, num)
if timer, ok := t.retryScheduled[num]; ok {
timer.Stop()
delete(t.retryScheduled, num)
}
}
func tronRetryDelay(attempt int) time.Duration {
if attempt < 1 {
attempt = 1
}
if attempt > 5 {
attempt = 5
}
return time.Duration(1<<uint(attempt-1)) * 5 * time.Second
}
func (t *tron) client() (*grpc.ClientConn, error) { func (t *tron) client() (*grpc.ClientConn, error) {
var endpoint = model.Endpoint(conf.Tron) var endpoint = model.Endpoint(conf.Tron)
@@ -521,7 +600,7 @@ func (t *tron) client() (*grpc.ClientConn, error) {
c.Close() c.Close()
} }
conn, err := utils.NewTronGrpcClient(endpoint, model.GetK(model.RpcEndpointTronGridApiKey)) conn, err := utils.NewTronGrpcClient(endpoint, model.GetTronGridApiKeys())
if err != nil { if err != nil {
return nil, fmt.Errorf("连接失败: %w", err) return nil, fmt.Errorf("连接失败: %w", err)
+8 -6
View File
@@ -14,7 +14,7 @@ import (
) )
// NewTronGrpcClient 目前很多 TRON API 基本都有QPS限制,过于激进或者过于保守的重试策略都不合适 // NewTronGrpcClient 目前很多 TRON API 基本都有QPS限制,过于激进或者过于保守的重试策略都不合适
func NewTronGrpcClient(apiNode, apiKey string) (*grpc.ClientConn, error) { func NewTronGrpcClient(apiNode string, apiKey []string) (*grpc.ClientConn, error) {
apiNode = strings.TrimSpace(apiNode) apiNode = strings.TrimSpace(apiNode)
if apiNode == "" { if apiNode == "" {
return nil, errors.New("tron api node address is empty") return nil, errors.New("tron api node address is empty")
@@ -41,7 +41,7 @@ func NewTronGrpcClient(apiNode, apiKey string) (*grpc.ClientConn, error) {
}), }),
} }
if apiKey != "" { if len(apiKey) > 0 {
opts = append(opts, opts = append(opts,
grpc.WithUnaryInterceptor(tronGridApiKeyUnaryInterceptor(apiKey)), grpc.WithUnaryInterceptor(tronGridApiKeyUnaryInterceptor(apiKey)),
grpc.WithStreamInterceptor(tronGridApiKeyStreamInterceptor(apiKey)), grpc.WithStreamInterceptor(tronGridApiKeyStreamInterceptor(apiKey)),
@@ -51,18 +51,20 @@ func NewTronGrpcClient(apiNode, apiKey string) (*grpc.ClientConn, error) {
return grpc.NewClient(apiNode, opts...) return grpc.NewClient(apiNode, opts...)
} }
func tronGridApiKeyUnaryInterceptor(apiKey string) grpc.UnaryClientInterceptor { func tronGridApiKeyUnaryInterceptor(apiKeys []string) grpc.UnaryClientInterceptor {
return func(ctx context.Context, method string, req, reply interface{}, return func(ctx context.Context, method string, req, reply interface{},
cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
ctx = addTronGridApiKeyToContext(ctx, apiKey) i := time.Now().UnixMicro() % int64(len(apiKeys))
ctx = addTronGridApiKeyToContext(ctx, apiKeys[i])
return invoker(ctx, method, req, reply, cc, opts...) return invoker(ctx, method, req, reply, cc, opts...)
} }
} }
func tronGridApiKeyStreamInterceptor(apiKey string) grpc.StreamClientInterceptor { func tronGridApiKeyStreamInterceptor(apiKeys []string) grpc.StreamClientInterceptor {
return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn,
method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
ctx = addTronGridApiKeyToContext(ctx, apiKey) i := time.Now().UnixMicro() % int64(len(apiKeys))
ctx = addTronGridApiKeyToContext(ctx, apiKeys[i])
return streamer(ctx, desc, cc, method, opts...) return streamer(ctx, desc, cc, method, opts...)
} }
} }
+17
View File
@@ -8,6 +8,7 @@ import (
"math" "math"
"math/big" "math/big"
"net/http" "net/http"
"net/url"
"os" "os"
"regexp" "regexp"
"sort" "sort"
@@ -206,6 +207,22 @@ func StrSha256(str string) string {
return fmt.Sprintf("%x", hash.Sum(nil)) return fmt.Sprintf("%x", hash.Sum(nil))
} }
func IsAllowedCallbackURL(raw string) bool {
// IsAllowedCallbackURL 校验回调/跳转地址格式是否合法
// 规则:必须是合法 URL,且 scheme 只允许 http 或 https
if raw == "" {
return false
}
u, err := url.ParseRequestURI(raw)
if err != nil {
return false
}
if u.Scheme != "http" && u.Scheme != "https" {
return false
}
return u.Host != ""
}
// GetRequestHost 识别完整的请求主机地址 // GetRequestHost 识别完整的请求主机地址
func GetRequestHost(r *http.Request) string { func GetRequestHost(r *http.Request) string {
scheme := "http" scheme := "http"
+2 -2
View File
@@ -1,7 +1,7 @@
FROM node:25.2.1 AS web_builder FROM node:25.2.1 AS web_builder
# 安装 pnpm # 安装 pnpm
RUN npm install -g pnpm RUN npm install -g pnpm@10
WORKDIR /web WORKDIR /web
COPY web/package.json web/pnpm-lock.yaml ./ COPY web/package.json web/pnpm-lock.yaml ./
@@ -11,7 +11,7 @@ RUN pnpm install --frozen-lockfile --shamefully-hoist
COPY web/ ./ COPY web/ ./
RUN pnpm run build:prod RUN pnpm run build:prod
FROM golang:1.24.3-alpine3.20 AS builder FROM golang:1.26.2-alpine3.23 AS builder
ENV GO111MODULE=on ENV GO111MODULE=on
WORKDIR /go/release WORKDIR /go/release
+100 -125
View File
@@ -1,5 +1,11 @@
## 📚 API 对接文档 ## 📚 API 对接文档
> 📡 **MQTT 实时推送**:系统支持将扫描到的链上交易广播到 MQTT 服务器,其它系统通过订阅即可实时获取数据,无需轮询
> API。详见 [《MQTT 对接开发文档》](./mqtt.md)。
> 💡 **推荐阅读**:在开始对接前,建议先阅读 [《BEpusdt 执行原理说明》](./how-it-works.md)
> ,了解订单匹配机制、金额匹配模式与汇率浮动等核心原理,有助于更准确地理解本文档中的参数设计。
### 基础信息 ### 基础信息
**认证方式**:签名认证(详见[签名算法](#签名算法)) **认证方式**:签名认证(详见[签名算法](#签名算法))
@@ -12,6 +18,17 @@
## 接口列表 ## 接口列表
> **两种订单模式说明**
>
> BEpusdt 的订单创建接口支持两种工作模式,通过 `amount` 参数决定:
>
> | 模式 | 触发条件 | 地址分配 | 匹配规则 | 典型场景 |
> |------|---------|---------|---------|---------|
> | **普通模式** | `amount > 0` | 地址 + 金额同时锁定 | 到账金额须匹配订单金额(±匹配容差) | 商城购物、固定金额收款 |
> | **独占模式** | `amount = 0` 或不传 | 仅锁定地址,金额不限 | 任意金额到账均触发回调 | 充值场景、钱包监控、不定额收款 |
>
> 独占模式下,回调中的 `amount`(法币)和 `actual_amount`(加密货币)均以**实际到账金额**为准,创建订单时无需预设金额。
### 1. 创建交易 ### 1. 创建交易
创建支付订单并获取收银台付款地址。 创建支付订单并获取收银台付款地址。
@@ -29,15 +46,15 @@ POST /api/v1/order/create-transaction
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
|--------------|--------|----|-------------------------------------------------------------------------------------------------------------------------------------------------------------| |--------------|--------|----|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| order_id | string | ✅ | 商户订单编号(唯一标识) | | order_id | string | ✅ | 商户订单编号(唯一标识) |
| amount | number | ✅ | 支付金额(法币金额) |
| notify_url | string | ✅ | 支付结果异步回调地址 | | notify_url | string | ✅ | 支付结果异步回调地址 |
| redirect_url | string | ✅ | 支付成功后商户跳转地址 | | redirect_url | string | ✅ | 支付成功后商户跳转地址 |
| signature | string | ✅ | 签名字符串(详见[签名算法](#签名算法)) | | signature | string | ✅ | 签名字符串(详见[签名算法](#签名算法)) |
| amount | number | ❌ | 支付金额(法币金额);留空或传 `0` 则进入**地址独占模式**,收到任意金额均触发回调(详见[执行原理](./how-it-works.md)) |
| trade_type | string | ❌ | 交易类型,默认 `usdt.trc20`<br/>完整列表:[trade-type.md](../trade-type.md) | | trade_type | string | ❌ | 交易类型,默认 `usdt.trc20`<br/>完整列表:[trade-type.md](../trade-type.md) |
| fiat | string | ❌ | 法币类型,默认 `CNY`<br/>可选:`CNY`、`USD`、`EUR`、`GBP`、`JPY` | | fiat | string | ❌ | 法币类型,默认 `CNY`<br/>可选:`CNY`、`USD`、`EUR`、`GBP`、`JPY` |
| address | string | ❌ | 指定收款地址(留空则自动分配) | | address | string | ❌ | 指定收款地址(留空则自动分配) |
| name | string | ❌ | 商品名称 | | name | string | ❌ | 商品名称 |
| timeout | number | ❌ | 订单超时时间(秒),最低 120 秒<br/>留空则使用配置 `payment_timeout`,默认 600 秒 | | timeout | number | ❌ | 订单超时时间(秒),最低 120 秒<br/>留空则使用配置 `payment_timeout`,默认 600 秒 |
| rate | string | ❌ | 强制指定汇率,支持多种写法:<br/>• `7.4` - 固定汇率 7.4<br/>• `~1.02` - 最新汇率上浮 2%<br/>• `~0.97` - 最新汇率下浮 3%<br/>• `+0.3` - 最新汇率加 0.3<br/>• `-0.2` - 最新汇率减 0.2<br/>留空则使用系统配置汇率 | | rate | string | ❌ | 强制指定汇率,支持多种写法:<br/>• `7.4` - 固定汇率 7.4<br/>• `~1.02` - 最新汇率上浮 2%<br/>• `~0.97` - 最新汇率下浮 3%<br/>• `+0.3` - 最新汇率加 0.3<br/>• `-0.2` - 最新汇率减 0.2<br/>留空则使用系统配置汇率 |
#### 请求示例 #### 请求示例
@@ -72,7 +89,7 @@ POST /api/v1/order/create-transaction
| data.status | string | 订单状态,1 表示待付款 | | data.status | string | 订单状态,1 表示待付款 |
| data.token | string | 收款地址 | | data.token | string | 收款地址 |
| data.expiration_time | number | 订单有效期(秒) | | data.expiration_time | number | 订单有效期(秒) |
| data.payment_url | string | 收银台付款链接地址 | | data.payment_url | string | 收银台付款链接地址 |
> **计算公式**:`actual_amount` = `amount` ÷ 汇率 > **计算公式**:`actual_amount` = `amount` ÷ 汇率
@@ -99,9 +116,8 @@ POST /api/v1/order/create-transaction
--- ---
### 2. 取消交易订单 <details>
<summary><strong>2. 取消交易</strong> 取消指定订单,系统将停止监控该订单并释放金额占用。</summary>
取消指定订单,系统将停止监控该订单并释放金额占用。
#### 请求地址 #### 请求地址
@@ -138,13 +154,14 @@ POST /api/v1/order/cancel-transaction
} }
``` ```
</details>
--- ---
### 3. 创建订单 <details>
<summary><strong>3. 创建订单</strong> 创建收银台订单,让用户在付款页自由选择支付方式。</summary>
创建支付订单并获取收银台付款链接,让用户自由选择已添加的付款方式。 > **注意**:使用相同 `order_id` 创建订单时,系统会根据最新参数重建订单(订单金额、交易类型、收款地址、法币类型),同时超时时间重置。
> **注意**:使用相同 `order_id` 创建订单时,系统会根据最新参数重建订单(订单金额、交易类型、收款地址、法币类型),同时超时时间重置。这意味着商户可以基于同一订单号实现独立收银台,灵活变更支付参数。
#### 请求地址 #### 请求地址
@@ -154,17 +171,17 @@ POST /api/v1/order/create-order
#### 请求参数 #### 请求参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
|--------------|--------|----|-------------------------------------------------------------------------------------------------------------------------------------------------------------| |--------------|--------|----|------------------------------------------------------------------------------------------------------------------------------------------|
| order_id | string | ✅ | 商户订单编号(唯一标识) | | order_id | string | ✅ | 商户订单编号(唯一标识) |
| amount | number | ✅ | 支付金额(法币金额) | | notify_url | string | ✅ | 支付结果异步回调地址 |
| notify_url | string | ✅ | 支付结果异步回调地址 | | redirect_url | string | ✅ | 支付成功后商户跳转地址 |
| redirect_url | string | ✅ | 支付成功后商户跳转地址 | | signature | string | ✅ | 签名字符串(详见[签名算法](#签名算法)) |
| signature | string | ✅ | 签名字符串(详见[签名算法](#签名算法)) | | amount | number | ❌ | 支付金额(法币金额);留空或传 `0` 则进入**地址独占模式**,收到任意金额均触发回调(详见[执行原理](./how-it-works.md)) |
| currencies | string | ❌ | 限定交易币种,留空则提不限制付款币种。<br/>多个币种请使用半角逗号分隔,黑名单模式以短横线开头。<br/>例如可配置为:<br/>`USDT`(仅限 USDT)<br/>`USDT,USDC` (限 USDT/USDC)<br/>`-ETH,-BNB` (表示排除 ETH/BNB 两个币种) | | currencies | string | ❌ | 限定交易币种,留空则不限制付款币种。<br/>多个币种请使用半角逗号分隔,黑名单模式以短横线开头。<br/>例如:<br/>`USDT`(仅限 USDT)<br/>`USDT,USDC` (限 USDT/USDC)<br/>`-ETH,-BNB` (排除 ETH/BNB) |
| fiat | string | ❌ | 法币类型,默认 `CNY`<br/>可选:`CNY`、`USD`、`EUR`、`GBP`、`JPY` | | fiat | string | ❌ | 法币类型,默认 `CNY`<br/>可选:`CNY`、`USD`、`EUR`、`GBP`、`JPY` |
| name | string | ❌ | 商品名称 | | name | string | ❌ | 商品名称 |
| timeout | number | ❌ | 订单超时时间(秒),最低 180 秒<br/>留空则使用配置 `payment_timeout`,默认 600 秒 | | timeout | number | ❌ | 订单超时时间(秒),最低 180 秒<br/>留空则使用配置 `payment_timeout`,默认 600 秒 |
#### 请求示例 #### 请求示例
@@ -188,7 +205,6 @@ POST /api/v1/order/create-order
|----------------------|--------|--------------| |----------------------|--------|--------------|
| status_code | number | 状态码,200 表示成功 | | status_code | number | 状态码,200 表示成功 |
| message | string | 响应消息 | | message | string | 响应消息 |
| data | object | 订单数据 |
| data.fiat | string | 交易法币类型 | | data.fiat | string | 交易法币类型 |
| data.trade_id | string | 系统交易 ID | | data.trade_id | string | 系统交易 ID |
| data.order_id | string | 商户订单编号 | | data.order_id | string | 商户订单编号 |
@@ -197,8 +213,6 @@ POST /api/v1/order/create-order
| data.expiration_time | number | 订单有效期(秒) | | data.expiration_time | number | 订单有效期(秒) |
| data.payment_url | string | 收银台订单链接 | | data.payment_url | string | 收银台订单链接 |
> **计算公式**:`actual_amount` = `amount` ÷ 汇率
#### 响应示例 #### 响应示例
```json ```json
@@ -211,17 +225,18 @@ POST /api/v1/order/create-order
"order_id": "20250120001", "order_id": "20250120001",
"amount": "28.88", "amount": "28.88",
"expiration_time": 1200, "expiration_time": 1200,
"payment_url": "https://example.com/pay/order/b3d2477c-d945-41da-96b7-f925bbd1b415" "payment_url": "https://example.com/pay/cashier/b3d2477c-d945-41da-96b7-f925bbd1b415"
}, },
"request_id": "" "request_id": ""
} }
``` ```
</details>
--- ---
### 4. 更新订单付款方式 <details>
<summary><strong>4. 更新订单付款方式</strong> 为收银台订单选定支付链,获取具体收款地址与金额。</summary>
用于向订单付款链接传递付款方式,得到收银台付款地址。
> **注意**:使用相同 `trade_id` 更新订单时,系统会根据最新交易类型更新订单付款方式。 > **注意**:使用相同 `trade_id` 更新订单时,系统会根据最新交易类型更新订单付款方式。
@@ -233,11 +248,11 @@ POST /api/v1/pay/update-order
#### 请求参数 #### 请求参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
|--------------|--------|----|-------------------------------------------------------------------------------------------------------------------------------------------------------------| |----------|--------|----|-------------------------------------|
| trade_id | string | ✅ | 系统交易 ID | | trade_id | string | ✅ | 系统交易 ID |
| currency | string | ✅ | 加密货币币种<br/>您已添加的加密货币币种,可选:`USDT`、`USDC`、`TRX` 等。 | | currency | string | ✅ | 加密货币币种,可选:`USDT`、`USDC`、`TRX` 等 |
| network | string | ✅ | 加密货币所属的网络名<br/>例如:`tron`、`polygon`、`bsc` 等。 | | network | string | ✅ | 加密货币所属网络,如:`tron`、`polygon`、`bsc` 等 |
#### 请求示例 #### 请求示例
@@ -254,8 +269,6 @@ POST /api/v1/pay/update-order
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
|----------------------|--------|--------------| |----------------------|--------|--------------|
| status_code | number | 状态码,200 表示成功 | | status_code | number | 状态码,200 表示成功 |
| message | string | 响应消息 |
| data | object | 订单数据 |
| data.fiat | string | 交易法币类型 | | data.fiat | string | 交易法币类型 |
| data.trade_id | string | 系统交易 ID | | data.trade_id | string | 系统交易 ID |
| data.order_id | string | 商户订单编号 | | data.order_id | string | 商户订单编号 |
@@ -263,9 +276,7 @@ POST /api/v1/pay/update-order
| data.actual_amount | string | 实际支付金额(加密货币) | | data.actual_amount | string | 实际支付金额(加密货币) |
| data.status | string | 订单状态,1 表示待付款 | | data.status | string | 订单状态,1 表示待付款 |
| data.expiration_time | number | 订单有效期(秒) | | data.expiration_time | number | 订单有效期(秒) |
| data.payment_url | string | 收银台订单链接 | | data.payment_url | string | 收银台付款链接 |
> **计算公式**:`actual_amount` = `amount` ÷ 汇率
#### 响应示例 #### 响应示例
@@ -281,65 +292,56 @@ POST /api/v1/pay/update-order
"actual_amount": "4.25", "actual_amount": "4.25",
"expiration_time": 1200, "expiration_time": 1200,
"status": 1, "status": 1,
"payment_url": "https://example.com/pay/order/b3d2477c-d945-41da-96b7-f925bbd1b415" "payment_url": "https://example.com/pay/checkout-counter/b3d2477c-d945-41da-96b7-f925bbd1b415"
}, },
"request_id": "" "request_id": ""
} }
``` ```
--- </details>
### 5. 订单可用付款方式列表:
## 接口说明
- **URL**:`POST /api/v1/pay/methods`
--- ---
## 请求参数 <details>
<summary><strong>5. 订单可用付款方式列表</strong> 返回指定订单当前所有可用的支付方式及实时报价。</summary>
### 请求体(JSON) #### 请求地址
| 参数名 | 类型 | 必填 | 说明 | ```http
|------|------|------|------| POST /api/v1/pay/methods
| trade_id | string | 是 | 系统交易 ID | ```
| currency | string | 否 | 货币名称(如 USDT / USDC / TRX),不传则返回全部可用方式 |
#### 请求参数
| 参数名 | 类型 | 必填 | 说明 |
|----------|--------|----|---------------------------------------|
| trade_id | string | ✅ | 系统交易 ID |
| currency | string | ❌ | 货币名称(如 USDT / USDC / TRX),不传则返回全部可用方式 |
#### 请求示例
### 请求示例
```json ```json
{ {
"trade_id": "b3d2477c-d945-41da-96b7-f925bbd1b415" "trade_id": "b3d2477c-d945-41da-96b7-f925bbd1b415"
} }
``` ```
--- #### methods 字段说明
## 响应参数 | 字段 | 类型 | 说明 |
|-------------------|---------|--------------|
| amount | string | 应付金额(法币) |
| actual_amount | string | 实际支付金额(加密货币) |
| fiat | string | 法币单位 |
| exchange_rate | string | 汇率 |
| currency | string | 货币名称 |
| network | string | 网络名称 |
| token_net_name | string | 代币协议标准名 |
| token_custom_name | string | 用户自定义显示名称 |
| is_popular | boolean | 是否为流行网络 |
| 字段 | 类型 | 说明 | #### 响应示例
|------|------|------|
| status_code | number | 状态码,200 表示成功 |
| message | string | 响应消息 |
| data | object | 数据对象 |
| data.methods | array | 可用付款方式列表 |
### methods 字段说明
| 字段 | 类型 | 说明 |
|------|------|------|
| amount | number | 应付金额(法币) |
| actual_amount | number | 实际支付金额(加密货币) |
| fiat | string | 应付金额法币单位 |
| exchange_rate | number | 汇率 |
| currency | string | 货币名称 |
| network | string | 网络名称 |
| token_net_name | string | 代币协议标准名 |
| token_custom_name | string | 用户自定义显示名称 |
| is_popular | boolean | 是否为流行网络 |
---
## 响应示例
```json ```json
{ {
"status_code": 200, "status_code": 200,
@@ -350,63 +352,27 @@ POST /api/v1/pay/update-order
"amount": "28.88", "amount": "28.88",
"actual_amount": "4.25", "actual_amount": "4.25",
"fiat": "CNY", "fiat": "CNY",
"exchange_rate": "", "exchange_rate": "6.79",
"currency": "USDT", "currency": "USDT",
"network": "bsc", "network": "bsc",
"token_net_name": "BEP20", "token_net_name": "BEP20",
"token_custom_name": "", "token_custom_name": "",
"is_popular": true "is_popular": false
}, }
{
"amount": "28.88",
"actual_amount": "4.25",
"fiat": "CNY",
"exchange_rate": "",
"currency": "USDC",
"network": "arbitrum",
"token_net_name": "Arbitrum",
"token_custom_name": "ARBITRUM-ONE",
"is_popular": true
},
{
"amount": "34.28",
"actual_amount": "10",
"fiat": "CNY",
"exchange_rate": "",
"currency": "TRX",
"network": "tron",
"token_net_name": "TRC20",
"token_custom_name": "",
"is_popular": true
},
] ]
}, },
"request_id": "" "request_id": ""
} }
``` ```
TODO: `is_popular` 当前临时返回为 `false` 待后期完善该功能。 > TODO: `is_popular` 与 `token_custom_name` 当前为占位值,待后期完善。
TODO: `token_custom_name` 当前临时返回为空字符串,待后期完善该功能。 </details>
## 如果货币不存在则不响应内容
```json
{
"status_code": 200,
"message": "success",
"data": {
"methods": [
]
},
"request_id": ""
}
```
--- ---
### 6. 支付回调通知 <details>
<summary><strong>6. 支付回调通知</strong> 订单状态变更时系统主动推送至 <code>notify_url</code>。</summary>
订单状态变更时,系统会向 `notify_url` 发送 POST 请求。
#### 通知参数 #### 通知参数
@@ -438,12 +404,15 @@ TODO: `token_custom_name` 当前临时返回为空字符串,待后期完善该
#### 响应要求 #### 响应要求
- **成功响应**:返回字符串 `success`(不区分大小写) - **成功**:返回字符串 `success`(不区分大小写)
- **失败响应**:返回其他内容,系统将重试通知 - **失败**:返回其他内容,系统将按退避策略重试通知
</details>
--- ---
## 签名算法 <details>
<summary><strong>签名算法</strong></summary>
### 签名流程 ### 签名流程
@@ -490,7 +459,8 @@ MD5(amount=42&notify_url=http://example.com/notify&order_id=20220201030210321&re
### 代码参考 ### 代码参考
- **PHP 实现**:[点击查看](https://github.com/v03413/Epay-BEpusdt/blob/b7fa8fd608d71ce50e0f8eabb1717783c96761ac/bepusdt_plugin.php#L108:L127) - **PHP 实现
**:[点击查看](https://github.com/v03413/Epay-BEpusdt/blob/b7fa8fd608d71ce50e0f8eabb1717783c96761ac/bepusdt_plugin.php#L108:L127)
- **Python 实现**:[BEpusdt Python SDK](https://github.com/luoyanglang/bepusdt-python-sdk) - **Python 实现**:[BEpusdt Python SDK](https://github.com/luoyanglang/bepusdt-python-sdk)
### 签名规则总结 ### 签名规则总结
@@ -503,9 +473,12 @@ MD5(amount=42&notify_url=http://example.com/notify&order_id=20220201030210321&re
| 必须按字典序排序 | 确保双方计算结果一致 | | 必须按字典序排序 | 确保双方计算结果一致 |
| MD5 结果必须小写 | 统一使用小写字母 | | MD5 结果必须小写 | 统一使用小写字母 |
</details>
--- ---
## 常见问题 <details>
<summary><strong>常见问题</strong></summary>
### 1. 如何获取 API Token? ### 1. 如何获取 API Token?
@@ -543,6 +516,8 @@ MD5(amount=42&notify_url=http://example.com/notify&order_id=20220201030210321&re
4. 测试回调通知处理逻辑 4. 测试回调通知处理逻辑
5. 确认超时和取消场景 5. 确认超时和取消场景
</details>
--- ---
## 参考资料 ## 参考资料
Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

+46 -181
View File
@@ -1,202 +1,67 @@
# Dujiao-Next 对接教程 # DuJiao Next 对接 BEpusdt 集成指南
本文档介绍如何在 [Dujiao-Next](https://github.com/dujiao-next/dujiao-next)(独角next)中对接 BEpusdt。 **当前教程针对的是新版独角 [Dujiao Next](https://dujiao-next.com/),旧版独角数卡对接[请看这个](../dujiaoka/dujiaoka.md)**
## 前置条件 ## 前提条件
- BEpusdt 已成功安装并运行 在开始配置前,请确保已满足以下条件:
- Dujiao-Next 已部署
**BEpusdt 部署信息**
- API 服务地址:`https://your-bepusdt.com`
- API 密钥:`your_api_token`
**DuJiao Next 部署信息**
- 部署地址:`https://your-dujiao.com`
- 已进入后台管理界面
- 已找到支付渠道管理 > 新增渠道功能
## 配置步骤 ## 配置步骤
### 1. 进入支付渠道配置 在 DuJiao Next 后台中选择渠道类型为 BEpusdt,按照以下格式进行配置。
Dujiao-Next 后台 → 支付渠道 → 新增渠道 ![BEpusdt 配置界面](./bepusdt.png)
### 2. 基本参数填写 **必填配置项**
| 参数名称 | 填写内容 | 说明 | | 配置项 | 说明 | 示例 |
|---------|---------|------| |-----------|--------------------|----------------------------------------------------|
| 渠道名称 | USDT-TRC20 支付 | 自定义名称,建议包含币种 | | 网关地址 | BEpusdt 的 API 服务地址 | `https://your-bepusdt.com` |
| 渠道类型 | `epusdt` | 固定值,选择 BEpusdt | | API Token | BEpusdt 的 API 密钥 | `your_api_token` |
| 支付方式 | `usdt-trc20` / `usdc-trc20` / `trx` | 选择支持的币种 | | 支付币种 | 支持的加密资产类型,严格区分大小写 | `usdt.trc20` |
| 交互方式 | `qr` 或 `redirect` | 二维码或跳转收银台 | | 法币类型 | 支持的法定货币类型 | `CNY`、`USD`、`EUR`、`JPY`、`GBP` |
| 异步通知地址 | 交易完成时的服务器异步回调地址 | `https://your-dujiao.com/api/v1/payments/callback` |
| 同步回跳地址 | 用户支付完成后的页面跳转地址 | `https://your-dujiao.com/pay` |
### 3. 支持的渠道类型 **配置说明**
Dujiao-Next 支持以下 BEpusdt 币种: - **支付币种**:详见 [支持的币种列表](https://github.com/v03413/BEpusdt/blob/main/docs/trade-type.md),必须严格区分大小写。
- **法币类型**:仅支持 `CNY`、`USD`、`EUR`、`JPY`、`GBP` 五种,必须严格区分大小写。
| 渠道类型 | 说明 | 对应 trade_type | **⚠️ 重要说明:异步通知地址和同步回跳地址**
|---------|------|----------------|
| `usdt-trc20` | USDT (TRC20) | `usdt.trc20` |
| `usdc-trc20` | USDC (TRC20) | `usdc.trc20` |
| `trx` | TRX | `tron.trx` |
> **注意**:选择渠道类型后,系统会自动设置对应的 `trade_type`,无需手动填写。 这两个地址的路由部分 **严格按要求修改**,只需将域名部分替换为您实际部署的 DuJiao Next 服务器地址:
### 4. 渠道配置参数 - **异步通知地址**:`https://your-dujiao.com/api/v1/payments/callback`
- 路由固定为 `/api/v1/payments/callback`
- 示例:若部署地址为 `https://example.com`,则填写 `https://example.com/api/v1/payments/callback`
在「渠道配置」中填写以下 JSON: - **同步回跳地址**:`https://your-dujiao.com/pay`
- 路由固定为 `/pay`
- 示例:若部署地址为 `https://example.com`,则填写 `https://example.com/pay`
```json ## 配置验证
{
"gateway_url": "https://your-bepusdt-domain.com",
"auth_token": "your-api-token",
"fiat": "CNY",
"notify_url": "https://your-api-domain.com/api/v1/payments/callback",
"return_url": "https://your-user-domain.com/pay"
}
```
### 5. 配置参数说明 配置完成后,请按照以下步骤进行测试:
| 参数 | 必填 | 说明 | 示例 | 1. 进入 DuJiao Next 前台,进行支付测试。
|------|------|------|------| 2. 观察是否正常跳转到支付页面。
| `gateway_url` | ✅ | BEpusdt 网关地址 | `https://pay.example.com` |
| `auth_token` | ✅ | BEpusdt API Token | 从 BEpusdt 后台获取 |
| `trade_type` | ❌ | 交易类型(自动设置) | `usdt.trc20` / `usdc.trc20` / `tron.trx` |
| `fiat` | ❌ | 法币类型,默认 `CNY` | `CNY` / `USD` |
| `notify_url` | ✅ | 异步回调地址 | `https://api.example.com/api/v1/payments/callback` |
| `return_url` | ✅ | 支付成功跳转地址 | `https://shop.example.com/pay` |
> **重要提示**: ## 故障排查
> - `trade_type` 会根据「支付方式」自动设置,无需在配置中填写
> - `notify_url` 路径必须是 `/api/v1/payments/callback`(不是 `/api/public/payment/callback`)
> - `return_url` 路径必须是 `/pay`(不是 `/order` 或 `/payment`)
## 获取 API Token 若出现网关错误提示,请按照以下步骤排查:
1. 登录 BEpusdt 后台 - **检查网络连通性**:确认 DuJiao Next API 所在服务器能够正常访问 BEpusdt API 地址。
2. 系统管理 → 基本设置 → API 设置 - **检查 API Token**:确认所配置的 API Token 与 BEpusdt 中的密钥一致。
3. 复制「对接令牌」 - **查看日志**:检查 DuJiao Next 和 BEpusdt 的应用日志,获取更详细的错误信息。
## 配置示例
### 示例 1:USDT-TRC20 支付
```
渠道名称: USDT-TRC20 支付
渠道类型: epusdt
支付方式: usdt-trc20
交互方式: qr
渠道配置:
{
"gateway_url": "http://127.0.0.1:8088",
"auth_token": "your-token-here",
"fiat": "CNY",
"notify_url": "https://api.example.com/api/v1/payments/callback",
"return_url": "https://shop.example.com/pay"
}
```
### 示例 2:TRX 支付
```
渠道名称: TRX 支付
渠道类型: epusdt
支付方式: trx
交互方式: redirect
渠道配置:
{
"gateway_url": "http://127.0.0.1:8088",
"auth_token": "your-token-here",
"fiat": "CNY",
"notify_url": "https://api.example.com/api/v1/payments/callback",
"return_url": "https://shop.example.com/pay"
}
```
## 回调机制说明
### 异步通知(notify_url)
BEpusdt 会在支付状态变化时,向 `notify_url` 发送 POST 请求:
```
POST /api/v1/payments/callback
Content-Type: application/x-www-form-urlencoded
order_id=xxx&trade_id=xxx&amount=xxx&actual_amount=xxx&token=xxx&...&signature=xxx
```
Dujiao-Next 会验证签名并更新订单状态。
### 同步跳转(return_url)
用户支付完成后,BEpusdt 会跳转到 `return_url`,并附带参数:
```
https://shop.example.com/pay?order_id=xxx&epusdt_return=1
```
Dujiao-Next 前端会检测 `epusdt_return=1` 参数,自动查询订单状态并显示支付结果。
## 常见问题
### 1. 支付创建失败
**可能原因**:
- `gateway_url` 配置错误或 BEpusdt 服务未运行
- `auth_token` 与 BEpusdt 配置不一致
- 网络连接问题(检查防火墙)
**解决方法**:
- 检查 BEpusdt 服务状态:`curl http://your-bepusdt/health`
- 验证 API Token 是否正确
- 查看 Dujiao-Next 后端日志
### 2. 回调未收到或订单状态未更新
**可能原因**:
- `notify_url` 配置错误(路径必须是 `/api/v1/payments/callback`)
- BEpusdt 无法访问回调地址(网络/防火墙问题)
- 签名验证失败
**解决方法**:
- 确认回调地址可被外网访问:`curl https://your-api/api/v1/payments/callback`
- 检查 BEpusdt 日志中的回调错误
- 检查 Dujiao-Next 后端日志中的签名验证信息
### 3. 支付完成后跳转错误
**可能原因**:
- `return_url` 路径配置错误(必须是 `/pay` 不是 `/payment` 或 `/order`)
- 前端路由配置问题
**解决方法**:
- 确认 `return_url` 配置为:`https://your-user-domain.com/pay`
- 清除浏览器缓存后重试
### 4. 签名验证失败
**可能原因**:
- `auth_token` 不一致(注意前后空格)
- 回调参数被中间件修改
**解决方法**:
- 确保 `auth_token` 完全一致
- 检查是否有反向代理修改了请求参数
### 5. 金额不匹配
**可能原因**:
- 汇率波动导致实际支付金额与订单金额不同
- BEpusdt 配置的汇率源问题
**解决方法**:
- BEpusdt 会返回 `actual_amount`(实际支付金额),Dujiao-Next 会记录此金额
- 可在订单详情中查看实际支付金额
## 技术支持
- Dujiao-Next: [GitHub Issues](https://github.com/dujiao-next/dujiao-next/issues)
- BEpusdt: [Telegram 群组](https://t.me/BEpusdtChat)
---
**贡献者**: 狼哥 ([@luoyanglang](https://github.com/luoyanglang) | Telegram: [@luoyanglang](https://t.me/luoyanglang))
> 本文档适用于 Dujiao-Next 最新版本和 BEpusdt 最新版本
> 最后更新:2026-02-13
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+79
View File
@@ -0,0 +1,79 @@
# EdgeKey 对接 BEpusdt 教程
**当前教程对接BEpusdt(v1.23.5)通过测试验收**
## 配置步骤
**配置说明**
- **网关地址**:只需填写域名,如 `https://test.shop.com`,系统会自动拼接 API 路径(`/api/v1/order/create-order`)。
- **App ID 和 App Secret**:在 BEpusdt 后台「系统管理 → 基本设置 → API 设置」中获取。
- **支付币种**:用户在 BEpusdt 收银台页面自由选择支付币种,具体在 BEpusdt 后台配置。
**配置步骤示例**:
1. 登录 EdgeKey 管理后台
2. 进入「支付配置」页面
3. 选择 BEpusdt 标签页
4. 填写具体配置
5. 启用支付方式:点击右上角的启用开关
6. 保存配置:点击「保存配置」按钮
![支付配置](./1.jpg)
### 重要提示
填写完配置信息后,点击右上角的 **启用** 开关,然后点击 **保存配置** 按钮。
⚠️ **重要提示**:启用支付前,请先前往「站点设置」配置网站地址,否则无法获取支付结果。
![网站地址配置](./2.jpg)
## 配置字段说明
**通用字段说明**:
- **显示名称**:支付方式在前台显示的名称,用户可自定义
- **网关地址**:支付网关服务域名,系统会自动处理接口路径
- **Notify URL**:异步通知地址,支付完成后系统会回调此地址
- **Return URL**:同步回跳地址,用户支付完成后跳转的页面
**BEpusdt专用字段**:
- **App ID**:BEpusdt后台获取的应用ID
- **App Secret**:BEpusdt后台获取的应用密钥(API密钥)
## 异步通知地址和同步回跳地址
这两个地址的路由部分 **严格按要求填写**,只需将域名部分替换为您实际部署的 EdgeKey 服务器地址:
- **异步通知地址**:`/api/payments/bepusdt/notify`
- 路由固定为 `/api/payments/bepusdt/notify`
- 示例:若部署地址为 `https://example.com`,则填写 `/api/payments/bepusdt/notify`
- **同步回跳地址**:`/order/{orderNo}?token={token}`
- 路由固定为 `/order/{orderNo}?token={token}`(`:orderNo` 和 `{token}` 为动态参数)
- 示例:若部署地址为 `https://example.com`,则填写 `/order/{orderNo}?token={token}`
## 配置验证
配置完成后,请按照以下步骤进行测试:
1. 进入 EdgeKey 前台,选择一个商品进行购买。
2. 在结算页面选择 BEpusdt 支付方式。
3. 观察是否正常跳转到收银台页面。
## 故障排查
若出现网关错误提示,请按照以下步骤排查:
- **检查网络连通性**:确认 EdgeKey 服务器能够正常访问 BEpusdt API 地址。
- **检查 App ID 和 App Secret**:确认所配置的 App ID 和 App Secret 与 BEpusdt 中的一致。
- **检查回调地址**:确保异步通知地址可以从外部访问,且格式正确。
- **检查站点设置**:确保在「站点设置」中配置了正确的网站地址。
- **查看日志**:检查 EdgeKey 和 BEpusdt 的应用日志,获取更详细的错误信息。
## BEpusdt 工作模式
本项目使用 **收银台模式**(`/api/v1/order/create-order`),用户在 BEpusdt 收银台页面自由选择支付链,无需在代码中指定 `trade_type`。
## 相关链接
- [BEpusdt 项目主页](https://github.com/v03413/bepusdt)
- [EdgeKey 项目主页](https://github.com/34892002/edgeKey)
+508
View File
@@ -0,0 +1,508 @@
# BEpusdt 执行原理说明
> 本文档基于源代码逐层拆解 BEpusdt 的核心运行机制,适合开发者对接或二次开发时参考。
---
## 目录
1. [底层区块扫描](#1-底层区块链持续扫描)
2. [订单匹配原理](#2-订单匹配原理)
3. [地址独占模式](#3-地址独占模式)
4. [汇率浮动说明](#4-汇率浮动说明)
---
## 1. 底层区块链持续扫描
### 1.1 整体扫描架构
BEpusdt 的区块扫描采用 **全链路扫块 + 本地匹配** 的方式,而非对每个地址发起单独的查询请求。
```
┌─────────────────────────────────────────────────────────────────┐
│ 区块链网络节点 (RPC) │
│ Tron gRPC EVM JSON-RPC (BSC / ETH / Polygon…) │
└──────────┬──────────────────────────┬───────────────────────────┘
│ 每 ~3s 拉取最新区块高度 │ 每 ~5s 拉取最新区块高度
▼ ▼
┌──────────────────┐ ┌──────────────────────┐
│ syncBlocksForward│ │ syncBlocksForward │
│ (Tron 正向同步) │ │ (EVM 正向同步) │
└────────┬─────────┘ └──────────┬───────────┘
│ 待扫区块编号入队 │ 待扫区块范围入队 (批量最多10个)
▼ ▼
┌────────────────────────────────────────────────────────┐
│ blockScanQueue (无界异步队列) │
│ chanx.UnboundedChan · 最大堆积 100 个 │
└──────────────────────┬─────────────────────────────────┘
│ 消费
▼
┌────────────────────────────────────────────────────────┐
│ blockDispatch (goroutine worker pool) │
│ Tron: 2 个并发 Worker EVM: 3 个并发 Worker │
└──────────────────────┬─────────────────────────────────┘
│ 解析完成
▼
┌────────────────────────────────────────────────────────┐
│ transferQueue │
│ 提取出的 transfer 记录入队 │
└──────────────────────┬─────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ orderTransferHandle (订单匹配) │
└────────────────────────────────────────────────────────┘
```
> 源码位置:`app/task/tron.go` · `app/task/evm.go` · `app/task/transfer.go`
---
### 1.2 扫块两种方向
| 方向 | 触发条件 | 目的 |
|---------------------------------|--------------------|-----------------------------|
| **正向扫描** (`syncBlocksForward`) | 定时循环 | 实时跟随链上最新区块,保证新交易不漏掉 |
| **反向扫描** (`syncBlocksBackward`) | 程序首次启动,或检测到已有待支付订单 | 补扫程序 **未运行期间** 产生的历史区块,防止漏单 |
反向扫描回溯量的计算逻辑(以 Tron 为例):
```
回溯区块数 = (当前时间 - 最早待支付订单创建时间) / 3秒(波场出块速度) + 冗余5个区块
```
---
### 1.3 对比「单地址轮询」的优势
市面上许多同类项目的做法是:对每个收款地址,定时调用 `getTransactionsByAddress` 之类的 API 来查询该地址的交易记录。
BEpusdt 采用 **全量扫块** 的策略,具体区别如下:
```
┌─────────────────────────────────────────────────────────────────┐
│ 传统「单地址轮询」模式 │
│ │
│ 地址A ──→ getTransactions(A) ──→ API 调用 ×1 │
│ 地址B ──→ getTransactions(B) ──→ API 调用 ×1 │
│ 地址C ──→ getTransactions(C) ──→ API 调用 ×1 │
│ ⋮ ⋮ │
│ 地址N ──→ getTransactions(N) ──→ API 调用 ×N │
│ │
│ 总 API 调用次数 = 地址数量 × 轮询频率 │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ BEpusdt「全量扫块」模式 │
│ │
│ 区块 #N ──→ getBlock(N) ──→ API 调用 ×1 │
│ │ │
│ ├─ 解析出所有 transfer │
│ └─ 本地内存匹配:地址A / 地址B / 地址C / … 地址N │
│ │
│ 总 API 调用次数 = 区块数 (与地址数量无关) │
└─────────────────────────────────────────────────────────────────┘
```
**核心优势:**
| 维度 | 单地址轮询 | 全量扫块 (BEpusdt) |
|----------|------------------|-------------------|
| API 调用量 | 与地址数线性增长 | **固定**,与地址数无关 |
| RPC 节点压力 | 高(易触发限流) | **低**,易满足免费节点限额 |
| 地址扩展性 | 增加地址 = 增加 API 压力 | **随意添加**地址,无额外成本 |
| 实时性 | 受限于轮询间隔 | 与出块速度对齐(秒级) |
| 漏单风险 | 较高(轮询窗口期) | **低**,区块连续无跳跃 |
| 历史回溯 | 依赖节点接口能力 | **内建支持**,自动补扫历史区块 |
---
### 1.4 Tron 与 EVM 扫块的技术差异
| 项目 | Tron | EVM 系列 |
|-------------|-------------------|--------------------------------------|
| 通信协议 | gRPC(长连接复用) | HTTP JSON-RPC |
| 出块时间 | ~3 秒 | 1~12 秒不等 |
| 扫块触发频率 | 每 3 秒 | 每 5 秒 |
| 每次批量区块数 | 1 个 | 最多 10 个 |
| Token 事件解析 | 手动解析合约 ABI 数据 | `eth_getLogs` + ERC-20 Transfer 事件签名 |
| Gas Free 支持 | ✅ 特殊解析 GasFree 合约 | — |
---
## 2. 订单匹配原理
### 2.1 匹配键:地址 + 交易类型
系统在内存中维护一张等待匹配的订单索引表,Key 由 **收款地址 + 交易类型** 组成:
```go
// app/task/transfer.go · getAllWaitingOrders()
key := t.Address + string(t.TradeType)
// 例:
// "TRX123...abcusdt.trc20"
// "0xABC...defusdt.bep20"
```
每当从区块中解析出一笔 `transfer`,就以 `RecvAddress + TradeType` 为 Key 在索引表中查找候选订单,再进一步做金额比对。
---
### 2.2 同地址同金额冲突的处理
**创建订单时**的冲突检测与自动规避(`app/model/order.go · CalcTradeAmount`):
```
创建订单
│
▼
查询当前所有「等待中」和「确认中」的订单
│
▼
构建冲突锁表:lock["地址+金额"] = true
│
▼
计算本次订单金额(法币 ÷ 汇率,保留精度)
│
▼
检查 lock["地址A + 金额X"] 是否存在?
│
├─ 不存在 ──→ 直接分配,订单创建成功
│
└─ 已存在 ──→ 金额 += 1个原子精度单位,重新检查
最多尝试 100 次,超出则报错
```
**示例:**
```
已有订单:地址A / 10.01 USDT
新订单金额计算结果也是:10.01 USDT
→ 冲突!自动调整为 10.02 USDT
再有同地址订单:
→ 调整为 10.03 USDT
```
**扫块匹配时**的防重(`app/task/transfer.go · orderTransferHandle`):
同一批次 `transfer` 中,一旦某笔交易匹配了订单,该订单会被**立即从内存 Map 中移除**,确保批次内其他 transfer 不会重复命中同一订单。
---
### 2.3 金额匹配三种模式
系统提供三种金额匹配策略,可在后台「支付设置」中配置(`payment_match_mode`):
```
┌──────────────────────────────────────────────────────────────────┐
│ 模式一:Classic(经典精确匹配) │
│ │
│ 规则:实际到账金额字符串 == 订单金额字符串(完全相等) │
│ │
│ 订单金额:10.01 │
│ 到账金额:10.01 ✅ 匹配 │
│ 到账金额:10.011 ❌ 不匹配 │
│ 到账金额:10.02 ❌ 不匹配 │
│ │
│ 适用场景:对收款金额精确控制,防止多付混淆 │
└──────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────┐
│ 模式二:HasPrefix(前缀匹配 / 允许多付) │
│ │
│ 规则:实际到账金额以订单金额为前缀,允许多付小数 │
│ │
│ 订单金额:10.01 │
│ 到账金额:10.01 ✅ 匹配(完全等于) │
│ 到账金额:10.011 ✅ 匹配(以 10.01 为前缀) │
│ 到账金额:10.019 ✅ 匹配(以 10.01 为前缀) │
│ 到账金额:10.02 ❌ 不匹配 │
│ │
│ 适用场景:用户手动转账时可能多付小数,允许容错 │
└──────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────┐
│ 模式三:RoundOff(数值修约 / 四舍五入) │
│ │
│ 规则:将两边金额按精度四舍五入后比较 │
│ 精度取:订单金额的实际小数位 与 币种标准精度 中较大值 │
│ │
│ 订单金额:10.01 (精度2位) │
│ 到账金额:10.014 → 四舍五入 → 10.01 ✅ 匹配 │
│ 到账金额:10.015 → 四舍五入 → 10.02 ❌ 不匹配 │
│ 到账金额:10.009 → 四舍五入 → 10.01 ✅ 匹配 │
│ │
│ 适用场景:链上转账因精度截断导致微小误差,允许容错 │
└──────────────────────────────────────────────────────────────────┘
```
> 源码位置:`app/task/transfer.go · amountMatch()`
---
### 2.4 完整匹配流程图
```
区块扫描 ──→ 解析出 transfer 列表 ──→ transferQueue
│
▼
每 1 秒批量处理(batchInterval)
│
▼
┌─────────────────────┐
│ 获取所有等待中订单 │
│ 构建内存索引 Map │
│ Key = 地址 + 交易类型 │
└──────────┬──────────┘
│
遍历 transfer 列表
│
┌──────────▼──────────┐
│ 按 Key 查找候选订单 │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ 金额范围是否合法? │
└──────────┬──────────┘
否 ↙ ↘ 是
进入非订单流 检查独占 or amountMatch
(notOrderQueue) │
┌──────▼──────┐
│ 有效期验证 │
│ 创建时间 < │
│ 交易时间 < │
│ 过期时间 │
└──────┬──────┘
│ 通过
┌──────▼──────┐
│ 内存移除订单 │
│ 标记确认中 │
│ 写入区块/Hash │
└──────┬──────┘
│
等待区块确认偏移
│
┌──────▼──────┐
│ 标记成功 │
│ 触发回调 │
└─────────────┘
```
---
## 3. 地址独占模式
### 3.1 什么是地址独占
普通订单:分配 **地址 + 金额**,系统根据「地址+金额」双重维度匹配交易。
地址独占模式:**只分配地址,不指定金额**。该地址在订单存续期间被独占,任何金额的收款都会触发回调。
**触发条件:** 创建订单时不传 `amount` 字段(或传 `0`)。
```go
// app/handler/epusdt/epusdt.go · CreateTransaction()
AddressLocked: req.Amount == 0, // 金额为0 → 独占模式
// app/model/trade.go · BuildOrder()
AddressLocked: p.Money.IsZero(), // 零值订单 → 地址锁定
```
---
### 3.2 地址独占分配逻辑
```
创建独占订单
│
▼
LockTradeAddress(addressPool, tradeType)
│
遍历所有可用地址
│
├─ 地址A:查询是否有「等待中」或「确认中」的独占订单?
│ → 有 → 跳过(该地址已被占用)
│ → 无 → ✅ 分配此地址,Amount = "0"
│
├─ 地址B:同上检测 …
│
└─ 全部地址已被占用 → 返回错误「暂无可用钱包地址」
```
> 独占模式下,同一地址不会同时存在两个有效的独占订单。
---
### 3.3 独占订单的匹配行为
```go
// app/task/transfer.go · orderTransferHandle()
// 独占订单跳过金额匹配,任何入账均可命中
if !o.AddressLocked && !amountMatch(t.Amount, o.Amount, string(o.TradeType)) {
continue // 普通订单:金额不符则跳过
}
// 独占订单:o.AddressLocked = true,直接跳过此 if,进入有效期检查
```
收款后,系统用实际到账金额和订单创建时锁定的汇率,**动态计算法币金额**并写入订单:
```go
// app/model/order.go · MarkConfirming()
if o.AddressLocked {
rate, _ := decimal.NewFromString(o.Rate)
o.Amount = amount.String() // 实际到账加密货币数量
o.Money = rate.Mul(amount).String() // 折算法币金额
}
```
---
### 3.4 独占模式 vs 普通模式对比
```
┌──────────────────────────────────────────────────────────────────┐
│ 普通订单(带金额) │
│ │
│ 创建 → 分配:地址A + 金额 10.01 USDT │
│ 收款条件:必须向地址A 转入 10.01 USDT(±匹配模式容差) │
│ 回调内容:包含约定金额 │
└──────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────┐
│ 独占订单(不带金额) │
│ │
│ 创建 → 分配:地址A(独占,金额=0) │
│ 收款条件:向地址A 转入 任意金额(大于监控最小金额即可) │
│ 回调内容:包含实际到账金额 + 汇率折算法币金额 │
│ 典型用途:充值场景、不定额收款、钱包监控 │
└──────────────────────────────────────────────────────────────────┘
```
---
## 4. 汇率浮动说明
### 4.1 汇率来源
BEpusdt 通过 **CoinGecko API** 定期同步加密货币对多种法币(CNY / USD / JPY / EUR / GBP)的实时汇率。
```
定时任务(默认间隔 3600 秒)
│
▼
GET https://api.coingecko.com/api/v3/simple/price
?ids=tether,usd-coin,tron,binancecoin,ethereum
&vs_currencies=cny,usd,jpy,eur,gbp
│
▼
写入数据库 bep_rate 表
(含 raw_rate 原始汇率 + syntax 浮动语法 + 最终 rate)
```
> 同步间隔可在后台「系统设置」中调整,最短可设置为数秒级。
---
### 4.2 汇率浮动语法
除直接使用 CoinGecko 的原始汇率外,系统支持为每种 **加密货币 × 法币** 对单独设置浮动语法,实现灵活调价。
浮动语法规则(配置键:`rate_float_<CRYPTO>_<FIAT>`,如 `rate_float_USDT_CNY`):
```
┌────────────┬───────────────────────────────────────────────────────┐
│ 语法格式 │ 说明 │
├────────────┼───────────────────────────────────────────────────────┤
│ 7.25 │ 固定汇率,直接使用该数值,忽略 CoinGecko 原始价格 │
├────────────┼───────────────────────────────────────────────────────┤
│ ~1.05 │ 乘以系数:最终汇率 = 原始汇率 × 1.05(上浮 5%) │
├────────────┼───────────────────────────────────────────────────────┤
│ +0.1 │ 加固定值:最终汇率 = 原始汇率 + 0.1 │
├────────────┼───────────────────────────────────────────────────────┤
│ -0.05 │ 减固定值:最终汇率 = 原始汇率 - 0.05 │
├────────────┼───────────────────────────────────────────────────────┤
│ (空) │ 不浮动,直接使用 CoinGecko 原始汇率 │
└────────────┴───────────────────────────────────────────────────────┘
```
**示例计算:**
```
CoinGecko 当前 USDT/CNY = 7.2456
语法 ~1.03 → 最终汇率 = 7.2456 × 1.03 = 7.4630
语法 +0.20 → 最终汇率 = 7.2456 + 0.20 = 7.4456
语法 7.30 → 最终汇率 = 7.30(固定,不参考市价)
语法 (空) → 最终汇率 = 7.2456(原始市价)
```
> 最终汇率保留 4 位小数。源码:`app/model/rate.go · ParseFloatRate()`
---
### 4.3 汇率在订单生命周期中的作用
```
创建订单
│
├─ 从 bep_rate 获取最新汇率(含浮动计算)
│
├─ 法币金额 ÷ 汇率 = 加密货币金额(按精度取整)
│
└─ 汇率快照写入订单 rate 字段(后续不再变更)
│
▼
订单支付期间
│
汇率波动不影响本次订单
│
▼
收款成功
│
├─ 普通订单:以创建时约定金额为准,回调包含法币金额
│
└─ 独占订单:以实际到账金额 × 快照汇率计算法币金额
```
> 汇率快照机制保证了**下单瞬间确定交易金额**,不因支付期间行情波动而产生金额争议。
---
### 4.4 创建订单时指定汇率(高级用法)
API 支持通过 `rate` 参数**强制指定本次订单汇率**,此时将忽略数据库中的汇率记录:
```json
POST /api/v1/epusdt/create
{
"order_id": "xxx",
"amount": 100.0,
"fiat": "CNY",
"rate": "7.30",
...
}
```
若传入 `rate` 参数,则浮动语法也不再生效,直接以传入值为准。
---
## 附录:关键配置项速查
| 配置键 | 默认值 | 说明 |
|-------------------------|-----------|-----------------------------------------------|
| `payment_match_mode` | `classic` | 金额匹配模式:`classic` / `has_prefix` / `round_off` |
| `payment_timeout` | `1200` | 订单默认超时时间(秒),范围 180~3600 |
| `rate_sync_interval` | `3600` | 汇率同步间隔(秒) |
| `atom_usdt` | `0.01` | USDT 最小原子精度(影响同地址冲突递增步长) |
| `block_height_max_diff` | `1000` | 区块高度跳跃容忍值,超过则强制重新对齐 |
| `block_offset_confirm` | `0` | 开启后需等待 N 个区块确认才回调(防回滚) |
| `monitor_min_amount` | `0.01` | 非订单监控最小入账金额 |
| `rate_float_USDT_CNY` | (空) | USDT/CNY 汇率浮动语法 |
---
*文档生成时间:2026-04-14 · 基于 BEpusdt 源码分析*
+182
View File
@@ -0,0 +1,182 @@
# 📡 MQTT 对接开发文档
> 系统可将扫描到的交易信息广播到 MQTT 服务器,其它系统通过订阅 MQTT 即可实时获取数据。
---
## 概述
BEpusdt 内置了 MQTT 发布能力,每当区块扫描器捕获到一笔**金额合法**的链上转账时,系统会立即将该交易信息以 JSON 格式发布到对应的
MQTT Topic。
外部系统(如监控大屏、自动充值系统、风控系统等)只需连接同一 MQTT Broker 并订阅对应 Topic,即可**实时、被动地**获取链上交易数据,无需轮询
API。
```
区块链网络
│
▼
BEpusdt(扫块)
│ 检测到合法转账
▼
MQTT Broker(广播)
│
├──► 订阅方 A(充值系统)
├──► 订阅方 B(数据分析)
└──► 订阅方 C(监控告警)
```
---
## 一、后台配置
在 BEpusdt 后台 → **系统管理 → 基本设置 → MQTT 设置** 中填写以下参数:
| 配置项 | 说明 | 示例 |
|-----------|--------------------------------------------|---------------------|
| MQTT Host | Broker 服务器地址(仅支持 TCP 模式) | `mqtt.example.com` |
| MQTT Port | Broker 端口 | `1883` |
| MQTT 用户名 | Broker 认证用户名,无认证可留空 | `admin` |
| MQTT 密码 | Broker 认证密码,无认证可留空 | `password` |
| 发布 QoS | 消息服务质量:`0` 最多一次 / `1` 至少一次 / `2` 恰好一次 | `1` |
| 持续监控网络 | 需要**持续扫块**的网络列表,多个用英文逗号分隔;配置后即使无待支付订单也持续推送 | `tron,bsc,ethereum` |
> ⚠️ **注意**:系统当前仅支持 `tcp://` 连接协议,不支持 WebSocket(`ws://`)或 TLS(`ssl://`)。
>
> 客户端 ID 由系统自动生成,格式为 `BEpusdt {进程PID}`,每次启动可能不同,请勿依赖客户端 ID 做业务判断。
---
## 二、Topic 规则
系统按**区块链网络**维度发布消息,Topic 格式如下:
```
bepusdt/transfer/{network}
```
### 网络标识对照表
| 网络 | Topic | 支持币种 |
|----------|-----------------------------|-------------------------------|
| Tron | `bepusdt/transfer/tron` | USDT (TRC20)、USDC (TRC20)、TRX |
| Ethereum | `bepusdt/transfer/ethereum` | USDT (ERC20)、USDC (ERC20)、ETH |
| BSC | `bepusdt/transfer/bsc` | USDT (BEP20)、USDC (BEP20)、BNB |
| Polygon | `bepusdt/transfer/polygon` | USDT、USDC |
| Arbitrum | `bepusdt/transfer/arbitrum` | USDT、USDC |
| Base | `bepusdt/transfer/base` | USDC |
| Solana | `bepusdt/transfer/solana` | USDT、USDC |
| Aptos | `bepusdt/transfer/aptos` | USDT、USDC |
| X Layer | `bepusdt/transfer/xlayer` | USDT、USDC |
| Plasma | `bepusdt/transfer/plasma` | USDT |
### 订阅示例
```
# 仅订阅 Tron 网络
bepusdt/transfer/tron
# 同时订阅 BSC 和 Polygon(分两次 Subscribe)
bepusdt/transfer/bsc
bepusdt/transfer/polygon
# 使用通配符订阅所有网络(MQTT v3.1.1)
bepusdt/transfer/#
```
---
## 三、消息格式
消息体为 **UTF-8 编码的 JSON 字符串**,结构如下:
### 字段说明
| 字段名 | 类型 | 说明 |
|----------------|--------|----------------------------------------------|
| `network` | string | 区块链网络标识,如 `tron`、`bsc`、`ethereum` |
| `tx_hash` | string | 链上交易哈希(全局唯一,可作为幂等键) |
| `amount` | string | 实际到账的**加密货币数量**(非法币金额) |
| `from_address` | string | 发款方钱包地址 |
| `recv_address` | string | 收款方钱包地址 |
| `timestamp` | number | 交易发生时间,Unix 时间戳(秒) |
| `trade_type` | string | 交易类型,完整列表见 [trade-type.md](../trade-type.md) |
| `block_num` | number | 交易所在区块高度 |
### 消息示例
```json
{
"network": "tron",
"tx_hash": "12ef6267b42e43959795cf31808d0cc72b3d0a48953ed19c61d4b6665a341d10",
"amount": "4.25",
"from_address": "TJRabPrwbZy45sbavfcjinPJC18iYKbPa5",
"recv_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"timestamp": 1744732800,
"trade_type": "usdt.trc20",
"block_num": 68123456
}
```
---
## 四、注意事项
### 消息去重
同一笔交易**可能被发布多次**(例如系统重启、扫块重叠时),建议以 `tx_hash` 作为幂等键,在业务层去重处理。
### 消息触发时机
MQTT 消息在**扫块阶段**触发,此时交易已出现在区块链上,但系统层面尚未完成订单匹配或回调流程。如果需要确认订单是否支付成功,应以
**订单回调通知**(`notify_url`)为准;MQTT 消息可作为辅助的实时感知手段。
### 金额过滤
系统仅广播金额在合法范围内的交易(由后台「监控最小金额」配置决定)。超出范围的链上转账不会触发 MQTT 推送。
### 网络断线重连
BEpusdt 的 MQTT 客户端已启用自动重连,断线后会自动恢复并重新订阅所有 Topic。订阅方同样建议使用支持自动重连的 MQTT 客户端库。
### QoS 建议
| 场景 | 推荐 QoS |
|-------------------|--------|
| 数据监控、日志记录(允许少量丢失) | `0` |
| 充值到账、财务类业务(不能漏消息) | `1` |
| 对消息重复极度敏感的场景 | `2` |
---
## 五、常见问题
**Q:MQTT 消息和订单回调(notify_url)有什么区别?**
> MQTT 是对**所有捕获到的合法链上转账**广播,不区分是否匹配到订单,实时性更高;订单回调仅针对成功匹配的支付订单,包含完整订单信息。两者可结合使用。
**Q:如何只监听特定收款地址的转账?**
> MQTT 消息包含 `recv_address` 字段,订阅方自行在消费逻辑中按地址过滤即可,Topic 层面暂不支持按地址过滤。
**Q:没有活跃订单时为什么收不到消息?**
> 默认情况下,BEpusdt 仅在有待支付订单时才对对应网络扫块。需在后台**「持续监控网络」**中填入目标网络标识(如 `tron,bsc`
> ),才能保证无订单时也持续推送。
**Q:支持 WebSocket 或 TLS 连接吗?**
> 当前版本仅支持 TCP 模式(`tcp://`),暂不支持 `ws://` / `wss://` / `ssl://`。
**Q:`amount` 字段的单位是什么?**
> `amount` 为**加密货币数量**(如 USDT 数量),并非法币金额。例如 `"amount": "4.25"` 表示实际到账 4.25 USDT。
---
## 参考资料
- [交易类型完整列表](../trade-type.md)
- [API 对接文档](./api.md)
- [订单回调通知](../notify/readme.md)
- [BEpusdt GitHub](https://github.com/v03413/BEpusdt)
+3 -1
View File
@@ -15,9 +15,11 @@
以下是常见程序的对接文档,请根据您的实际需求选择相应教程进行配置。如遇问题,请仔细核对操作步骤,或在相关技术社区寻求协助。 以下是常见程序的对接文档,请根据您的实际需求选择相应教程进行配置。如遇问题,请仔细核对操作步骤,或在相关技术社区寻求协助。
- [独角数卡](./dujiaoka/dujiaoka.md) - [独角Dujiao-Next](./dujiao-next/dujiao-next.md)
- [独角数卡(旧版)](./dujiaoka/dujiaoka.md)
- [彩虹易支付](https://github.com/v03413/Epay-BEpusdt) - [彩虹易支付](https://github.com/v03413/Epay-BEpusdt)
- [WHMCS](https://github.com/v03413/whmcs-gateway-epusdt) - [WHMCS](https://github.com/v03413/whmcs-gateway-epusdt)
- [异次元发卡](acg-faka/README.md) - [异次元发卡](acg-faka/README.md)
- [萌次元商城](./mcy-faka/mcy-shop.md) - [萌次元商城](./mcy-faka/mcy-shop.md)
- [EdgeKey](./edge-key/edge-key.md)
+34 -5
View File
@@ -27,7 +27,7 @@ docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
- `v03413/bepusdt:latest` - 稳定发行版(推荐生产环境使用) - `v03413/bepusdt:latest` - 稳定发行版(推荐生产环境使用)
- `v03413/bepusdt:nightly` - 每日构建开发版(包含最新特性,适合测试环境) - `v03413/bepusdt:nightly` - 每日构建开发版(包含最新特性,适合测试环境)
## 数据持久化配置 ## 数据持久化
### SQLite 数据库(默认) ### SQLite 数据库(默认)
@@ -47,18 +47,45 @@ docker run -d --restart=unless-stopped -p 8080:8080 -v [挂载路径]:/var/lib/b
docker run -d --restart=unless-stopped -p 8080:8080 -v /opt/bepusdt:/var/lib/bepusdt v03413/bepusdt:latest docker run -d --restart=unless-stopped -p 8080:8080 -v /opt/bepusdt:/var/lib/bepusdt v03413/bepusdt:latest
``` ```
### MySQL 数据库(可选) <details>
<summary><strong>PostgreSQL 数据库(推荐)</strong></summary>
系统支持使用 MySQL 作为数据存储方案,适用于需要更强大数据库功能的场景。 系统支持使用 PostgreSQL 作为数据存储方案,适用于生产环境。这是目前推荐的数据库方案。
**前置准备:** **前置准备:**
- MySQL 版本:5.7 或更高版本 - PostgreSQL 版本:18 或更高版本
- 需提前完成 MySQL 安装及安全配置 - 需提前完成 PostgreSQL 安装及安全配置
- 已创建专用数据库(如 `bepusdt`) - 已创建专用数据库(如 `bepusdt`)
**部署命令:** **部署命令:**
```bash
docker run -d \
--restart unless-stopped \
-p 8080:8080 \
-e POSTGRESQL_DSN=postgres://user:password@localhost:5432/bepusdt?sslmode=disable&connect_timeout=3 \
v03413/bepusdt:latest
```
**配置说明:**
- 将 `user` 替换为 PostgreSQL 用户名
- 将 `password` 替换为 PostgreSQL 密码
- 将 `localhost:5432` 替换为 PostgreSQL 服务器地址和端口
- 将 `bepusdt` 替换为实际数据库名称
</details>
<details>
<summary><strong>MySQL 数据库(已弃用)</strong></summary>
> **注意:** MySQL 支持将逐步弃用,建议使用 PostgreSQL 替代。
系统仍支持使用 MySQL 作为数据存储方案,但不再推荐用于新部署。
**部署命令:**
```bash ```bash
docker run -d \ docker run -d \
--restart unless-stopped \ --restart unless-stopped \
@@ -74,6 +101,8 @@ docker run -d \
- 将 `127.0.0.1:3306` 替换为 MySQL 服务器地址和端口 - 将 `127.0.0.1:3306` 替换为 MySQL 服务器地址和端口
- 将 `bepusdt` 替换为实际数据库名称(如需要) - 将 `bepusdt` 替换为实际数据库名称(如需要)
</details>
## 部署验证 ## 部署验证
### 查看容器日志 ### 查看容器日志
+29
View File
@@ -0,0 +1,29 @@
# BEpusdt 与 EPusdt 项目说明
## 项目背景
### EPusdt
EPusdt 是与独角数卡(开源数字商品销售系统)配套的个人 USDT 收款网关,两个项目由同一作者
@assimon 开发。
### BEpusdt
BEpusdt 由独立作者开发;由于 EPusdt 在一段时间内缺乏积极维护,结合个人需求和对区块链技术的兴趣,才开发了 BEpusdt 项目。
BEpusdt 项目名称含义:在 EPusdt 前添加字母 `B`(代表 `Better`),寓意更简单、更好用的 USDT 收款网关。
## 项目演进
| 时间 | 事件 |
|-------------|-----------------------------|
| 2022 年 3 月 | EPusdt 项目发布,4 月基本完善,后续基本无更新 |
| 2023 年 10 月 | BEpusdt 项目建立,持续迭代更新至今 |
| 2026 年 3 月 | EPusdt 项目转让给其他开发者接手维护 |
## ⚠️ 重要声明
**BEpusdt 与转让后的 EPusdt 项目没有任何联系、无共同维护者。两个项目完全独立运营。**
## 致谢
感谢原作者 [@assimon](https://github.com/assimon) 开源的 EPusdt 项目,为本项目的诞生提供了灵感和参考。
+48
View File
@@ -0,0 +1,48 @@
# EVM RPC 节点配置指南
### RPC 节点在 BEpusdt 中的作用
BEpusdt 在区块扫描过程中,所有区块数据均通过 RPC 节点获取。因此,**RPC 节点的性能和稳定性直接影响系统的收款体验**。
## 内置公益节点
BEpusdt 默认内置了一批公益 RPC
节点,详见[源代码配置](https://github.com/v03413/BEpusdt/blob/0e1e22cebbf4a2127786e62b2b8b4d2175054c0b/app/model/conf.go#L140)。
### 公益节点的局限性
- **稳定性难以保证**:公益节点由第三方维护,服务质量无法长期保障
- **网络质量差异大**:部分 VPS 的网络状况本身较差,容易导致请求失败
- **覆盖面不完整**:虽然这些节点已在开发中测试,但无法覆盖所有场景
这也是常见问题"为什么无法收款"或"为什么换台服务器就好了"的主要原因。
### 建议
- 优先选择大型云服务提供商的服务器部署 BEpusdt,确保国际网络连接质量
- 在非必要情况下,考虑禁用钱包交易监控功能,以降低 RPC 节点的请求压力
## 第三方 RPC 服务
### Chainlist
**官网**:https://chainlist.org/
Chainlist 是一个聚合各类区块链网络 RPC 节点信息的平台,用户可以:
- 查找适合自己需求的 RPC 节点
- 一键复制配置信息
- 直接集成到应用中
> **注意**:第三方提供的节点质量需自行测试和评估。
### Nodies
**官网**:https://www.nodies.app/
Nodies 是一个商业 RPC 服务提供商,具有以下特点:
- 提供企业级的高质量 RPC 节点服务
- 性能和稳定性有保障,适合生产环境使用
- 提供免费配额,可满足个人单节点的使用需求
- 需付费才能获得更高的配额和优先级支持
+48 -41
View File
@@ -1,85 +1,92 @@
module github.com/v03413/bepusdt module github.com/v03413/bepusdt
go 1.24.3 go 1.26.2
require ( require (
github.com/btcsuite/btcd/btcutil v1.1.6 github.com/btcsuite/btcd/btcutil v1.1.6
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/gin-contrib/sessions v1.0.4 github.com/eclipse/paho.mqtt.golang v1.5.1
github.com/gin-gonic/gin v1.10.1 github.com/gin-contrib/sessions v1.1.0
github.com/gin-gonic/gin v1.12.0
github.com/glebarez/sqlite v1.11.0 github.com/glebarez/sqlite v1.11.0
github.com/go-telegram/bot v1.17.0 github.com/go-telegram/bot v1.20.0
github.com/joho/godotenv v1.5.1 github.com/joho/godotenv v1.5.1
github.com/matoous/go-nanoid/v2 v2.1.0 github.com/matoous/go-nanoid/v2 v2.1.0
github.com/panjf2000/ants/v2 v2.11.3 github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/panjf2000/ants/v2 v2.12.0
github.com/shopspring/decimal v1.4.0 github.com/shopspring/decimal v1.4.0
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.4
github.com/smallnest/chanx v1.2.0 github.com/smallnest/chanx v1.2.0
github.com/spf13/cast v1.9.2 github.com/spf13/cast v1.10.0
github.com/tidwall/gjson v1.18.0 github.com/tidwall/gjson v1.18.0
github.com/urfave/cli/v3 v3.5.0 github.com/urfave/cli/v3 v3.8.0
github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932 github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158 github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158
golang.org/x/crypto v0.39.0 golang.org/x/crypto v0.50.0
google.golang.org/grpc v1.73.0 google.golang.org/grpc v1.81.0
gorm.io/driver/mysql v1.6.0 gorm.io/driver/mysql v1.6.0
gorm.io/driver/postgres v1.6.0
gorm.io/gorm v1.31.1 gorm.io/gorm v1.31.1
) )
require ( require (
filippo.io/edwards25519 v1.1.0 // indirect filippo.io/edwards25519 v1.2.0 // indirect
github.com/bytedance/sonic v1.13.3 // indirect github.com/BurntSushi/toml v1.6.0 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect github.com/bytedance/gopkg v0.1.4 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect github.com/bytedance/sonic v1.15.1 // indirect
github.com/bytedance/sonic/loader v0.5.1 // indirect
github.com/cloudwego/base64x v0.1.7 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect github.com/gabriel-vasile/mimetype v1.4.13 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect github.com/gin-contrib/sse v1.1.1 // indirect
github.com/glebarez/go-sqlite v1.22.0 // indirect github.com/glebarez/go-sqlite v1.22.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.26.0 // indirect github.com/go-playground/validator/v10 v10.30.2 // indirect
github.com/go-sql-driver/mysql v1.9.3 // indirect github.com/go-sql-driver/mysql v1.10.0 // indirect
github.com/goccy/go-json v0.10.5 // indirect github.com/goccy/go-json v0.10.6 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/context v1.1.2 // indirect github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/sessions v1.4.0 // indirect github.com/gorilla/sessions v1.4.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.6.0 // indirect github.com/jackc/pgx/v5 v5.9.2 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.22 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.3.1 // indirect
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect
github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.59.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.14 // indirect github.com/ugorji/go/codec v1.3.1 // indirect
golang.org/x/arch v0.18.0 // indirect go.mongodb.org/mongo-driver/v2 v2.6.0 // indirect
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect golang.org/x/arch v0.26.0 // indirect
golang.org/x/net v0.41.0 // indirect golang.org/x/net v0.53.0 // indirect
golang.org/x/sync v0.19.0 // indirect golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.33.0 // indirect golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.33.0 // indirect golang.org/x/text v0.36.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect golang.org/x/tools v0.44.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260504160031-60b97b32f348 // indirect
google.golang.org/protobuf v1.36.6 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gorm.io/driver/postgres v1.6.0 // indirect modernc.org/libc v1.72.2 // indirect
modernc.org/libc v1.65.10 // indirect
modernc.org/mathutil v1.7.1 // indirect modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect modernc.org/memory v1.11.0 // indirect
modernc.org/sqlite v1.38.0 // indirect modernc.org/sqlite v1.50.0 // indirect
) )
+131 -113
View File
@@ -1,5 +1,7 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
@@ -25,14 +27,16 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0= github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM=
github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= github.com/bytedance/gopkg v0.1.4/go.mod h1:v1zWfPm21Fb+OsyXN2VAHdL6TBb2L88anLQgdyje6R4=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic v1.15.1 h1:nJD5PmM0vY7J8CT6MxoqbVAAMhkSmV2HgRAUrrpLoOw=
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= github.com/bytedance/sonic v1.15.1/go.mod h1:mT2NbXunuaEbnZ+mRIX/vYqKISmgEuHFDI4UzmKx2SA=
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= github.com/bytedance/sonic/loader v0.5.1 h1:Ygpfa9zwRCCKSlrp5bBP/b/Xzc3VxsAW+5NIYXrOOpI=
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= github.com/bytedance/sonic/loader v0.5.1/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudwego/base64x v0.1.7 h1:NppS+Fgzg5ovhn4NkUXaDT3x9jldgH5ToMCqzBSi2zI=
github.com/cloudwego/base64x v0.1.7/go.mod h1:Cu1PV9zfrSf7ET2tIbWbbEy7jO7HHJ13q4X2SQ8aWYg=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -42,24 +46,26 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/eclipse/paho.mqtt.golang v1.5.1 h1:/VSOv3oDLlpqR2Epjn1Q7b2bSTplJIeV2ISgCl2W7nE=
github.com/eclipse/paho.mqtt.golang v1.5.1/go.mod h1:1/yJCneuyOoCOzKSsOTUc0AJfpsItBGWvYpBLimhArU=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gin-contrib/sessions v1.0.4 h1:ha6CNdpYiTOK/hTp05miJLbpTSNfOnFg5Jm2kbcqy8U= github.com/gin-contrib/sessions v1.1.0 h1:00mhHfNEGF5sP2fwxa98aRqj1FOJdL6IkR86n2hOiBo=
github.com/gin-contrib/sessions v1.0.4/go.mod h1:ccmkrb2z6iU2osiAHZG3x3J4suJK+OU27oqzlWOqQgs= github.com/gin-contrib/sessions v1.1.0/go.mod h1:TyYZDIs6qCQg2SOoYPgMT9pAkmZceVNEJMcv5qbIy60=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.1 h1:uGYpNwTacv5R68bSGMapo62iLTRa9l5zxGCps4hK6ko=
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= github.com/gin-contrib/sse v1.1.1/go.mod h1:QXzuVkA0YO7o/gun03UI1Q+FTI8ZV/n5t03kIQAI89s=
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= github.com/gin-gonic/gin v1.12.0 h1:b3YAbrZtnf8N//yjKeU2+MQsh2mY5htkZidOM7O0wG8=
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/gin-gonic/gin v1.12.0/go.mod h1:VxccKfsSllpKshkBWgVgRniFFAzFb9csfngsqANjnLc=
github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ= github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ=
github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc=
github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=
github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
@@ -68,14 +74,16 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.30.2 h1:JiFIMtSSHb2/XBUbWM4i/MpeQm9ZK2xqPNk8vgvu5JQ=
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= github.com/go-playground/validator/v10 v10.30.2/go.mod h1:mAf2pIOVXjTEBrwUMGKkCWKKPs9NheYGabeB04txQSc=
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw=
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
github.com/go-telegram/bot v1.17.0 h1:Hs0kGxSj97QFqOQP0zxduY/4tSx8QDzvNI9uVRS+zmY= github.com/go-telegram/bot v1.20.0 h1:4Pea/qTidSspr4WBJw9FbHUMNhYeqszBqQUfsQEyFbc=
github.com/go-telegram/bot v1.17.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM= github.com/go-telegram/bot v1.20.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
@@ -105,13 +113,17 @@ github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pw
github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ= github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ=
github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik= github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY= github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw=
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw= github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -126,23 +138,18 @@ github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlT
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE= github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE=
github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM= github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -150,8 +157,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -161,92 +168,100 @@ github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg= github.com/panjf2000/ants/v2 v2.12.0 h1:u9JhESo83i/GkZnhfTNuFMMWcNt7mnV1bGJ6FT4wXH8=
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek= github.com/panjf2000/ants/v2 v2.12.0/go.mod h1:tSQuaNQ6r6NRhPt+IZVUevvDyFMTs+eS4ztZc52uJTY=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b h1:aUNXCGgukb4gtY99imuIeoh8Vr0GSwAlYxPAhqZrpFc= github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b h1:aUNXCGgukb4gtY99imuIeoh8Vr0GSwAlYxPAhqZrpFc=
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg=
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
github.com/smallnest/chanx v1.2.0 h1:RLyldZBbQZ4O0dSvdkTMHo4+mDw20Bc1jXXTHf+ymZo= github.com/smallnest/chanx v1.2.0 h1:RLyldZBbQZ4O0dSvdkTMHo4+mDw20Bc1jXXTHf+ymZo=
github.com/smallnest/chanx v1.2.0/go.mod h1:+4nWMF0+CqEcU74SnX2NxaGqZ8zX4pcQ8Jcs77DbX5A= github.com/smallnest/chanx v1.2.0/go.mod h1:+4nWMF0+CqEcU74SnX2NxaGqZ8zX4pcQ8Jcs77DbX5A=
github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.14 h1:yOQvXCBc3Ij46LRkRoh4Yd5qK6LVOgi0bYOXfb7ifjw= github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
github.com/ugorji/go/codec v1.2.14/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/urfave/cli/v3 v3.5.0 h1:qCuFMmdayTF3zmjG8TSsoBzrDqszNrklYg2x3g4MSgw= github.com/urfave/cli/v3 v3.8.0 h1:XqKPrm0q4P0q5JpoclYoCAv0/MIvH/jZ2umzuf8pNTI=
github.com/urfave/cli/v3 v3.5.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/urfave/cli/v3 v3.8.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso=
github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932 h1:Z2aWpconrfks7x1QZgmxHyS5i2rXOYIvQZrzhaCOFrI= github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932 h1:Z2aWpconrfks7x1QZgmxHyS5i2rXOYIvQZrzhaCOFrI=
github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932/go.mod h1:QKQ2xRbIt1CAA6767Z00YzFWXQ9ihmoIJi7A14klR2g= github.com/v03413/go-cache v0.0.0-20250922030915-0ab5b738a932/go.mod h1:QKQ2xRbIt1CAA6767Z00YzFWXQ9ihmoIJi7A14klR2g=
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158 h1:zAlBqlv+ljSO0AOvHQo2ur/MiCZFdwMYPVf7Hu0vezE= github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158 h1:zAlBqlv+ljSO0AOvHQo2ur/MiCZFdwMYPVf7Hu0vezE=
github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158/go.mod h1:ToWfuVvvk9OTE5i0nisoXPWxVdeBdEduj7ddlwf/s9M= github.com/v03413/tronprotocol v0.0.0-20240824084238-bbd62f5e0158/go.mod h1:ToWfuVvvk9OTE5i0nisoXPWxVdeBdEduj7ddlwf/s9M=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.mongodb.org/mongo-driver/v2 v2.6.0 h1:b9sJOYrkmt4l8bY43ZenFBcPlhYIjaOfYHLtbB/5qi8=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.mongodb.org/mongo-driver/v2 v2.6.0/go.mod h1:yOI9kBsufol30iFsl1slpdq1I0eHPzybRWdyYUs8K/0=
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
golang.org/x/arch v0.26.0 h1:jZ6dpec5haP/fUv1kLCbuJy6dnRrfX6iVK08lZBFpk4=
golang.org/x/arch v0.26.0/go.mod h1:0X+GdSIP+kL5wPmpK7sdkEVTt2XoYP0cSjQSbZBwOi8=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4= golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -256,42 +271,42 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA= golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc= golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 h1:hE3bRWtU6uceqlh4fhrSnUyjKHMKB9KrTLLG+bc0ddM= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463/go.mod h1:U90ffi8eUL9MwPcrJylN5+Mk2v3vuPDptd5yyNUiRR8= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE= google.golang.org/genproto/googleapis/api v0.0.0-20260504160031-60b97b32f348 h1:U8orV30l6KpDsi9dxU0CoJZGbjS8EEpw+6ba+XwGPQA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= google.golang.org/genproto/googleapis/api v0.0.0-20260504160031-60b97b32f348/go.mod h1:Yzdzr5OOZFgSsEV2D/Xi9NL3bszpXFAg0hFJiRohcD8=
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348 h1:pfIbyB44sWzHiCpRqIen67ZQnVXSfIxWrqUMk1qwODE=
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= google.golang.org/genproto/googleapis/rpc v0.0.0-20260504160031-60b97b32f348/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.81.0 h1:W3G9N3KQf3BU+YuCtGKJk0CmxQNbAISICD/9AORxLIw=
google.golang.org/grpc v1.81.0/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
@@ -302,28 +317,31 @@ gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4=
gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo= gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo=
gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg= gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg=
gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs= gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
modernc.org/cc/v4 v4.26.1 h1:+X5NtzVBn0KgsBCBe+xkDC7twLb/jNVj9FPgiwSQO3s= modernc.org/cc/v4 v4.28.1 h1:XpLbkYVQ24E8tX5u8+yWGvaxerxkR/S4zqxI8ZoSBuc=
modernc.org/cc/v4 v4.26.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= modernc.org/cc/v4 v4.28.1/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
modernc.org/ccgo/v4 v4.28.0 h1:rjznn6WWehKq7dG4JtLRKxb52Ecv8OUGah8+Z/SfpNU= modernc.org/ccgo/v4 v4.34.0 h1:yRLPFZieg532OT4rp4JFNIVcquwalMX26G95WQDqwCQ=
modernc.org/ccgo/v4 v4.28.0/go.mod h1:JygV3+9AV6SmPhDasu4JgquwU81XAKLd3OKTUDNOiKE= modernc.org/ccgo/v4 v4.34.0/go.mod h1:AS5WYMyBakQ+fhsHhtP8mWB82KTGPkNNJDGfGQCe0/A=
modernc.org/fileutil v1.3.3 h1:3qaU+7f7xxTUmvU1pJTZiDLAIoJVdUSSauJNHg9yXoA= modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
modernc.org/fileutil v1.3.3/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc= modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
modernc.org/libc v1.65.10 h1:ZwEk8+jhW7qBjHIT+wd0d9VjitRyQef9BnzlzGwMODc= modernc.org/gc/v3 v3.1.2 h1:ZtDCnhonXSZexk/AYsegNRV1lJGgaNZJuKjJSWKyEqo=
modernc.org/libc v1.65.10/go.mod h1:StFvYpx7i/mXtBAfVOjaU0PWZOvIRoZSgXhrwXzr8Po= modernc.org/gc/v3 v3.1.2/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
modernc.org/libc v1.72.2 h1:HwRjrHwX7hZIFCfRyw6otVlY+BoZEHFQmHQa5B0BzDE=
modernc.org/libc v1.72.2/go.mod h1:43RZAMuEX483KwP1bW+3lTFm3dzwFpl6R8HMEutqy/w=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI= modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
modernc.org/sqlite v1.38.0 h1:+4OrfPQ8pxHKuWG4md1JpR/EYAh3Md7TdejuuzE7EUI= modernc.org/sqlite v1.50.0 h1:eMowQSWLK0MeiQTdmz3lqoF5dqclujdlIKeJA11+7oM=
modernc.org/sqlite v1.38.0/go.mod h1:1Bj+yES4SVvBZ4cBOpVZ6QgesMCKpJZDq0nxYzOpmNE= modernc.org/sqlite v1.50.0/go.mod h1:m0w8xhwYUVY3H6pSDwc3gkJ/irZT/0YEXwBlhaxQEew=
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
File diff suppressed because one or more lines are too long
+36 -36
View File
@@ -1,37 +1,37 @@
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg width="44" height="44" viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" stroke="#fff"> <svg width="44" height="44" viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
<g fill="none" fill-rule="evenodd" stroke-width="2"> <g fill="none" fill-rule="evenodd" stroke-width="2">
<circle cx="22" cy="22" r="1"> <circle cx="22" cy="22" r="1">
<animate attributeName="r" <animate attributeName="r"
begin="0s" dur="1.8s" begin="0s" dur="1.8s"
values="1; 20" values="1; 20"
calcMode="spline" calcMode="spline"
keyTimes="0; 1" keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1" keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" /> repeatCount="indefinite" />
<animate attributeName="stroke-opacity" <animate attributeName="stroke-opacity"
begin="0s" dur="1.8s" begin="0s" dur="1.8s"
values="1; 0" values="1; 0"
calcMode="spline" calcMode="spline"
keyTimes="0; 1" keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1" keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" /> repeatCount="indefinite" />
</circle> </circle>
<circle cx="22" cy="22" r="1"> <circle cx="22" cy="22" r="1">
<animate attributeName="r" <animate attributeName="r"
begin="-0.9s" dur="1.8s" begin="-0.9s" dur="1.8s"
values="1; 20" values="1; 20"
calcMode="spline" calcMode="spline"
keyTimes="0; 1" keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1" keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" /> repeatCount="indefinite" />
<animate attributeName="stroke-opacity" <animate attributeName="stroke-opacity"
begin="-0.9s" dur="1.8s" begin="-0.9s" dur="1.8s"
values="1; 0" values="1; 0"
calcMode="spline" calcMode="spline"
keyTimes="0; 1" keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1" keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" /> repeatCount="indefinite" />
</circle> </circle>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+17 -17
View File
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="katman_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" <svg version="1.0" id="katman_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 800 600" style="enable-background:new 0 0 800 600;" xml:space="preserve"> viewBox="0 0 800 600" style="enable-background:new 0 0 800 600;" xml:space="preserve">
<style type="text/css"> <style type="text/css">
.st0{fill:#FF060A;} .st0{fill:#FF060A;}
.st1{fill:#FFFFFF;} .st1{fill:#FFFFFF;}
</style> </style>
<path class="st0" d="M399.8,549.7c144.2,0,261-112,261-250.1S544,49.5,399.8,49.5c-144.2,0-261,112-261,250.1 <path class="st0" d="M399.8,549.7c144.2,0,261-112,261-250.1S544,49.5,399.8,49.5c-144.2,0-261,112-261,250.1
S255.7,549.7,399.8,549.7z"/> S255.7,549.7,399.8,549.7z"/>
<path class="st1" d="M546.6,254.7c-14.4-12.8-34.4-32.3-50.6-46.1l-1-0.6c-1.6-1.2-3.4-2.2-5.3-2.9l0,0 <path class="st1" d="M546.6,254.7c-14.4-12.8-34.4-32.3-50.6-46.1l-1-0.6c-1.6-1.2-3.4-2.2-5.3-2.9l0,0
c-39.2-7-221.6-39.7-225.1-39.3c-1,0.1-2,0.5-2.8,1l-0.9,0.7c-1.1,1.1-2,2.4-2.5,3.9l-0.2,0.6v3.3v0.5 c-39.2-7-221.6-39.7-225.1-39.3c-1,0.1-2,0.5-2.8,1l-0.9,0.7c-1.1,1.1-2,2.4-2.5,3.9l-0.2,0.6v3.3v0.5
c20.5,54.8,101.6,234.2,117.6,276.4c1,2.9,2.8,8.3,6.2,8.6h0.8c1.8,0,9.6-9.9,9.6-9.9s139.3-161.8,153.4-179 c20.5,54.8,101.6,234.2,117.6,276.4c1,2.9,2.8,8.3,6.2,8.6h0.8c1.8,0,9.6-9.9,9.6-9.9s139.3-161.8,153.4-179
c1.8-2.1,3.4-4.4,4.8-6.8c0.4-1.9,0.2-3.8-0.5-5.6S548.1,256,546.6,254.7L546.6,254.7z M428,273.6l59.4-47.2l34.9,30.8L428,273.6z c1.8-2.1,3.4-4.4,4.8-6.8c0.4-1.9,0.2-3.8-0.5-5.6S548.1,256,546.6,254.7L546.6,254.7z M428,273.6l59.4-47.2l34.9,30.8L428,273.6z
M404.9,270.5l-102.3-80.4l165.6,29.3L404.9,270.5z M414.1,291.5l104.7-16.2L399.1,413.6L414.1,291.5z M288.7,198.2l107.7,87.5 M404.9,270.5l-102.3-80.4l165.6,29.3L404.9,270.5z M414.1,291.5l104.7-16.2L399.1,413.6L414.1,291.5z M288.7,198.2l107.7,87.5
l-15.6,128L288.7,198.2z"/> l-15.6,128L288.7,198.2z"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+29 -6
View File
@@ -142,8 +142,12 @@
function generateQRCode() { function generateQRCode() {
const qrContainer = document.getElementById('qrcode'); const qrContainer = document.getElementById('qrcode');
const containerWidth = qrContainer.offsetWidth; const containerWidth = qrContainer.clientWidth;
const qrSize = Math.min(containerWidth - 10, 150); const containerHeight = qrContainer.clientHeight || containerWidth;
const measuredSize = Math.floor(Math.min(containerWidth, containerHeight) - 10);
const qrSize = measuredSize > 0 ? measuredSize : 150;
qrContainer.innerHTML = '';
$('#qrcode').qrcode({ $('#qrcode').qrcode({
text: paymentConfig.address, text: paymentConfig.address,
@@ -300,7 +304,11 @@
`; `;
modal.innerHTML = ` modal.innerHTML = `
<div style="font-size: 48px; margin-bottom: 20px;">⏰</div> <div style="margin-bottom: 20px;">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#e53e3e" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="13" r="8"/><path d="M12 9v4l2 2"/><path d="M5 3 2 6"/><path d="m22 6-3-3"/>
</svg>
</div>
<h3 style="color: #e53e3e; margin-bottom: 15px;">${t('payment.paymentTimeout')}</h3> <h3 style="color: #e53e3e; margin-bottom: 15px;">${t('payment.paymentTimeout')}</h3>
<p style="color: #666; margin-bottom: 25px; line-height: 1.5;"> <p style="color: #666; margin-bottom: 25px; line-height: 1.5;">
${t('payment.timeoutMessage')} ${t('payment.timeoutMessage')}
@@ -363,7 +371,13 @@
`; `;
modal.innerHTML = ` modal.innerHTML = `
<div style="font-size: 48px; margin-bottom: 20px; animation: spin 2s linear infinite;">⏳</div> <div style="margin-bottom: 20px;">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#667eea" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="animation: spin 2s linear infinite;">
<path d="M5 22h14"/><path d="M5 2h14"/>
<path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/>
<path d="M7 2v4.172a2 2 0 0 1 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/>
</svg>
</div>
<h3 style="color: #667eea; margin-bottom: 15px;">${t('payment.waitingConfirmation')}</h3> <h3 style="color: #667eea; margin-bottom: 15px;">${t('payment.waitingConfirmation')}</h3>
<p style="color: #666; margin-bottom: 20px; line-height: 1.5;"> <p style="color: #666; margin-bottom: 20px; line-height: 1.5;">
<span style="color: #059669; font-weight: 600; background: linear-gradient(135deg, #ecfdf5, #f0fdf4); padding: 8px 12px; border-radius: 6px; border-left: 3px solid #10b981;">${t('payment.confirmationMessage')}</span><br> <span style="color: #059669; font-weight: 600; background: linear-gradient(135deg, #ecfdf5, #f0fdf4); padding: 8px 12px; border-radius: 6px; border-left: 3px solid #10b981;">${t('payment.confirmationMessage')}</span><br>
@@ -375,6 +389,9 @@
<p style="color: #999; font-size: 12px;"> <p style="color: #999; font-size: 12px;">
${t('payment.estimatedTime')} ${t('payment.estimatedTime')}
</p> </p>
<div style="margin-top: 15px; padding-top: 12px; border-top: 1px solid #f0f0f0; font-size: 12px; color: #aaa;">
Powered by <a href="https://github.com/v03413/BEpusdt" target="_blank" style="color: #667eea; text-decoration: none; font-weight: 600;">BEpusdt</a> · Github
</div>
`; `;
const style = document.createElement('style'); const style = document.createElement('style');
@@ -434,7 +451,11 @@
`; `;
modal.innerHTML = ` modal.innerHTML = `
<div style="font-size: 48px; margin-bottom: 20px;">✅</div> <div style="margin-bottom: 20px;">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#48bb78" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>
</svg>
</div>
<h3 style="color: #48bb78; margin-bottom: 15px;">${t('payment.paymentSuccess')}</h3> <h3 style="color: #48bb78; margin-bottom: 15px;">${t('payment.paymentSuccess')}</h3>
<p style="color: #666; margin-bottom: 20px; line-height: 1.5;"> <p style="color: #666; margin-bottom: 20px; line-height: 1.5;">
${t('payment.transactionHash')}<br> ${t('payment.transactionHash')}<br>
@@ -451,6 +472,9 @@
cursor: pointer; cursor: pointer;
font-size: 14px; font-size: 14px;
">${t('payment.returnToMerchant')}</button> ">${t('payment.returnToMerchant')}</button>
<div style="margin-top: 15px; padding-top: 12px; border-top: 1px solid #f0f0f0; font-size: 12px; color: #aaa;">
Powered by <a href="https://github.com/v03413/BEpusdt" target="_blank" style="color: #667eea; text-decoration: none; font-weight: 600;">BEpusdt</a> · Github
</div>
`; `;
overlay.appendChild(modal); overlay.appendChild(modal);
@@ -503,4 +527,3 @@
init: init init: init
}; };
})(); })();
+15 -15
View File
@@ -1,15 +1,15 @@
# @see: http://editorconfig.org # @see: http://editorconfig.org
root = true root = true
[*] # 表示所有文件适用 [*] # 表示所有文件适用
charset = utf-8 # 设置文件字符集为 utf-8 charset = utf-8 # 设置文件字符集为 utf-8
indent_style = space # 缩进风格(tab | space) indent_style = space # 缩进风格(tab | space)
indent_size = 2 # 缩进大小 indent_size = 2 # 缩进大小
max_line_length = 130 # 最大行长度 max_line_length = 130 # 最大行长度
end_of_line = crlf # 控制换行类型(lf | cr | crlf) end_of_line = crlf # 控制换行类型(lf | cr | crlf)
insert_final_newline = true # 始终在文件末尾插入一个新行 insert_final_newline = true # 始终在文件末尾插入一个新行
[*.md] # 表示仅对 md 文件适用以下规则 [*.md] # 表示仅对 md 文件适用以下规则
max_line_length = off # 关闭最大行长度限制 max_line_length = off # 关闭最大行长度限制
trim_trailing_whitespace = false # 关闭末尾空格修剪 trim_trailing_whitespace = false # 关闭末尾空格修剪
+11 -14
View File
@@ -1,14 +1,11 @@
# 生产环境优先级 # 生产环境优先级
# development & production & test > .env # development & production & test > .env
# title # title
VITE_GLOB_APP_TITLE = 'BEpusdt' VITE_GLOB_APP_TITLE = 'BEpusdt'
# 静态资源url # 静态资源url
VITE_IMG_BASE_URL = 'https://my-image-cdn.com' VITE_IMG_BASE_URL = 'https://my-image-cdn.com'
# 本地mock数据 true开启 false关闭 # 资源公共路径
VITE_APP_OPEN_MOCK = false VITE_PUBLIC_PATH = '/secure/'
# 资源公共路径
VITE_PUBLIC_PATH = '/secure/'
+12 -12
View File
@@ -1,12 +1,12 @@
# 开发环境 # 开发环境
VITE_USER_NODE_ENV = development VITE_USER_NODE_ENV = development
# 路由模式 hash | history # 路由模式 hash | history
VITE_ROUTER_MODE = hash VITE_ROUTER_MODE = hash
# 打包路径 开发环境地址前缀 (一般 '/' 或 './' 都可以,如果开发环境 '/' 打包预览白屏,请使用 './') # 打包路径 开发环境地址前缀 (一般 '/' 或 './' 都可以,如果开发环境 '/' 打包预览白屏,请使用 './')
# 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上,所以这里 VITE_PUBLIC_PATH 为 '/' # 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上,所以这里 VITE_PUBLIC_PATH 为 '/'
VITE_PUBLIC_PATH = './' VITE_PUBLIC_PATH = './'
# 请求路径 管理系统/开发环境 # 请求路径 管理系统/开发环境
VITE_APP_BASE_URL = 'http://127.0.0.1:8080' VITE_APP_BASE_URL = 'http://127.0.0.1:8080'
+10 -10
View File
@@ -1,11 +1,11 @@
# 开发环境 # 开发环境
VITE_USER_NODE_ENV = test VITE_USER_NODE_ENV = test
# 路由模式 hash | history # 路由模式 hash | history
VITE_ROUTER_MODE = hash VITE_ROUTER_MODE = hash
# 开发环境地址前缀 (一般 '/' 或 './' 都可以) # 开发环境地址前缀 (一般 '/' 或 './' 都可以)
VITE_PUBLIC_PATH = '/test' VITE_PUBLIC_PATH = '/test'
# 请求路径 管理系统/开发环境 # 请求路径 管理系统/开发环境
VITE_APP_BASE_URL = '/' VITE_APP_BASE_URL = '/'
+28 -27
View File
@@ -1,27 +1,28 @@
# Logs # Logs
logs logs
*.log *.log
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
pnpm-debug.log* pnpm-debug.log*
lerna-debug.log* lerna-debug.log*
node_modules node_modules
dist dist
dist.zip dist.zip
dist.7z dist.7z
dist-ssr dist-ssr
*.local *.local
.eslintcache
# Editor directories and files
.vscode/* # Editor directories and files
!.vscode/extensions.json .vscode/*
!.vscode/settings.json !.vscode/extensions.json
.idea !.vscode/settings.json
.DS_Store .idea
*.suo .DS_Store
*.ntvs* *.suo
*.njsproj *.ntvs*
*.sln *.njsproj
*.sw? *.sln
*.sw?
+1 -1
View File
@@ -1 +1 @@
npx --no-install commitlint --edit "$1" npx --no-install commitlint --edit "$1"
+1 -1
View File
@@ -1 +1 @@
npm run lint:lint-staged npm run lint:lint-staged
+2 -2
View File
@@ -1,8 +1,8 @@
/dist/* /dist/*
.local .local
/node_modules/** /node_modules/**
**/*.svg **/*.svg
**/*.sh **/*.sh
/public/* /public/*
/src/components.d.ts
/src/auto-import.d.ts
-4
View File
@@ -1,4 +0,0 @@
/dist/*
/public/*
public/*
stats.html
+44 -44
View File
@@ -1,44 +1,44 @@
{ {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.stylelint": "explicit" "source.fixAll.stylelint": "explicit"
}, },
"stylelint.enable": true, "stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass", "html"], "stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass", "html"],
"files.eol": "\n", "files.eol": "\n",
"marscode.chatLanguage": "cn", "marscode.chatLanguage": "cn",
"[vue]": { "[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[typescript]": { "[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[json]": { "[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[jsonc]": { "[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[javascript]": { "[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[typescriptreact]": { "[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[scss]": { "[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[html]": { "[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[markdown]": { "[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[less]": { "[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"i18n-ally.localesPaths": [ "i18n-ally.localesPaths": [
"src/lang", "src/lang",
"src/views/i18n" "src/views/i18n"
] ]
} }
+21 -21
View File
@@ -1,21 +1,21 @@
MIT License MIT License
Copyright (c) 2024 兔子先森Ace Copyright (c) 2024 兔子先森Ace
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
+287 -256
View File
@@ -1,256 +1,287 @@
# SnowAdmin # SnowAdmin
<div> <div>
<p> <p>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank"> <a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/License-MIT-%2343aefc" alt="License"> <img src="https://img.shields.io/badge/License-MIT-%2343aefc" alt="License">
</a> </a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank"> <a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/vue_.js-vue3_.x-%2300b42a" alt="Vue"> <img src="https://img.shields.io/badge/vue_.js-vue3_.x-%2300b42a" alt="Vue">
</a> </a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank"> <a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img src="https://img.shields.io/badge/Vite-6x-%2311B337" alt="Vite"> <img src="https://img.shields.io/badge/Vite-6x-%2311B337" alt="Vite">
</a> </a>
<a href="https://github.com/WangFan-io/SnowAdmin" target="_blank"> <a href="https://github.com/WangFan-io/SnowAdmin" target="_blank">
<img alt="arco.design" src="https://img.shields.io/badge/arco.design-2.57.0-%23%2028%2C175%2C%2063"> <img alt="arco.design" src="https://img.shields.io/badge/arco.design-2.57.0-%23%2028%2C175%2C%2063">
</a> </a>
</p> </p>
</div> </div>
### 介绍 📖 ### 介绍 📖
SnowAdmin 是一个清新优雅、高颜值且功能强大的后台管理模板,基于最新的前端技术栈,包括 Vue3, Vite6, TypeScript, Pinia。它内置了丰富的主题配置和组件,代码规范严谨,实现了自动化的文件路由系统。SnowAdmin 为您提供了一站式的后台管理解决方案,无需额外配置,开箱即用。同样是一个快速学习前沿技术的最佳实践。 SnowAdmin 是一个清新优雅、高颜值且功能强大的后台管理模板,基于最新的前端技术栈,包括 Vue3, Vite7, TypeScript, Pinia。它内置了丰富的主题配置和组件,代码规范严谨,实现了自动化的文件路由系统。SnowAdmin 为您提供了一站式的后台管理解决方案,无需额外配置,开箱即用。同样是一个快速学习前沿技术的最佳实践。
### 版本 📦 ### 版本 📦
**预览及文档** **预览及文档**
项目预览地址:[SnowAdmin](http://115.190.79.132/#/login) 项目预览地址:[SnowAdmin](http://115.190.79.132/#/login)
项目文档地址:[SnowAdmin-开发指南](http://115.190.79.132:81/) 项目文档地址:[SnowAdmin-开发指南](http://115.190.79.132:81/)
**代码仓库** **代码仓库**
| 平台 | 仓库地址 | | 平台 | 仓库地址 |
| ------ | ------------------------------------------------------ | | ------ | ------------------------------------------------------ |
| GitHub | [Github 仓库](https://github.com/WangFan-io/SnowAdmin) | | GitHub | [Github 仓库](https://github.com/WangFan-io/SnowAdmin) |
| Gitee | [Gitee 仓库](https://gitee.com/wang_fan_w/SnowAdmin) | | Gitee | [Gitee 仓库](https://gitee.com/wang_fan_w/SnowAdmin) |
> 完整版分支:main > 完整版分支:main
> >
> 极简版分支:main-thin > 极简版分支:main-thin
> >
> ⚠️主要的维护在github上,提issue/pr请认准github主战场 > ⚠️主要的维护在github上,提issue/pr请认准github主战场
> >
> 大家也可以进wx群交流,二维码在介绍末尾 > 大家也可以进wx群交流,二维码在介绍末尾
### 先行预览 🖼️ ### 先行预览 🖼️
![登录页](https://ooo.0x0.ooo/2025/04/11/O0lhbG.png) ![登录页](https://ooo.0x0.ooo/2025/04/11/O0lhbG.png)
![首页](https://ooo.0x0.ooo/2025/04/11/O0lnVI.png) ![首页](https://ooo.0x0.ooo/2025/04/11/O0lnVI.png)
![文件库](https://ooo.0x0.ooo/2025/04/11/O0l7qD.png) ![文件库](https://ooo.0x0.ooo/2025/04/11/O0l7qD.png)
![国际化](https://ooo.0x0.ooo/2025/04/11/O0lNAF.png) ![国际化](https://ooo.0x0.ooo/2025/04/11/O0lNAF.png)
![横向布局](https://ooo.0x0.ooo/2025/04/11/O0leQ6.png) ![横向布局](https://ooo.0x0.ooo/2025/04/11/O0leQ6.png)
![混合布局](https://ooo.0x0.ooo/2025/04/11/O0lrCP.png) ![混合布局](https://ooo.0x0.ooo/2025/04/11/O0lrCP.png)
![主题配置](https://ooo.0x0.ooo/2025/04/11/O0lKnb.png) ![主题配置](https://ooo.0x0.ooo/2025/04/11/O0lKnb.png)
![黑暗模式-1](https://ooo.0x0.ooo/2025/04/11/O0lZ4l.png) ![黑暗模式-1](https://ooo.0x0.ooo/2025/04/11/O0lZ4l.png)
![黑暗模式-2](https://ooo.0x0.ooo/2025/04/11/O0lv6g.png) ![黑暗模式-2](https://ooo.0x0.ooo/2025/04/11/O0lv6g.png)
![黑暗模式-3](https://ooo.0x0.ooo/2025/04/11/O0lgkB.png) ![黑暗模式-3](https://ooo.0x0.ooo/2025/04/11/O0lgkB.png)
### 项目功能 🔨 ### 项目功能 🔨
- 清晰的项目架构:结构清晰,优雅易懂,代码全注释 - 清晰的项目架构:结构清晰,优雅易懂,代码全注释
- 前沿技术应用:采用 Vue3, Vite6, TypeScript等最新流行的技术栈 - 前沿技术应用:采用 Vue3, Vite7, TypeScript等最新流行的技术栈
- 内置RBAC角色权限模型,实现路由、角色、按钮权限访问控制 - 内置RBAC角色权限模型,实现路由、角色、按钮权限访问控制
- 使用 Pinia 替代 Vuex,轻量、简单、易用,集成 Pinia 持久化插件 - 使用 Pinia 替代 Vuex,轻量、简单、易用,集成 Pinia 持久化插件
- 支持 Arco-Design 组件大小切换、多主题布局、暗黑模式、i18n 国际化 - 支持 Arco-Design 组件大小切换、多主题布局、暗黑模式、i18n 国际化
- 使用 VueRouter 配置动态路由权限拦截、路由懒加载,支持页面按钮权限控制 - 使用 VueRouter 配置动态路由权限拦截、路由懒加载,支持页面按钮权限控制
- 使用 KeepAlive 对页面进行缓存,支持多级嵌套路由缓存 - 使用 KeepAlive 对页面进行缓存,支持多级嵌套路由缓存
- 使用 Prettier 统一格式化代码,集成 ESLint、Stylelint 代码校验规范 - 使用 Prettier 统一格式化代码,集成 ESLint、Stylelint 代码校验规范
- 使用 husky、lint-staged、commitlint等插件,规范提交信息 - 使用 husky、lint-staged、commitlint等插件,规范提交信息
- 丰富的页面组件:内置多样页面和组件,包括 401、404、500 页面,以及布局组件、标签组件、主题配置组件等 - 丰富的页面组件:内置多样页面和组件,包括 401、404、500 页面,以及布局组件、标签组件、主题配置组件等
### 环境准备 🏝️ ### 环境准备 🏝️
确保你的环境满足以下要求(重要): 确保你的环境满足以下要求(重要):
- **git**: 你需要 git 来克隆和管理项目版本。 - **git**: 你需要 git 来克隆和管理项目版本。
- **NodeJS**: >=18.12.0,推荐 20.12.0 或更高。 - **NodeJS**: >=18.12.0,推荐 20.12.0 或更高。
- **pnpm**: >= 8.7.0,推荐最新版本。 - **pnpm**: >= 8.7.0,推荐最新版本。
### 安装使用步骤 📔 ### 安装使用步骤 📔
### 从 GitHub 获取代码 🔗 ### 从 GitHub 获取代码 🔗
```bash ```bash
# 克隆代码 # 克隆代码
git clone https://github.com/WangFan-io/SnowAdmin.git git clone https://github.com/WangFan-io/SnowAdmin.git
``` ```
### 从 Gitee 获取代码 🔗 ### 从 Gitee 获取代码 🔗
```bash ```bash
# 克隆代码 # 克隆代码
git clone https://gitee.com/wang_fan_w/SnowAdmin.git git clone https://gitee.com/wang_fan_w/SnowAdmin.git
``` ```
### 安装依赖 📌 ### 安装依赖 📌
安装项目依赖 安装项目依赖
```bash ```bash
pnpm install pnpm install
``` ```
### 插件配置 🛠️ ### 插件配置 🛠️
安装 Vue - Official,禁用 Vetur 安装 Vue - Official,禁用 Vetur
- [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) - Vue 服务插件 - [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) - Vue 服务插件
### 项目启动 🚀 ### 项目启动 🚀
```json ```json
{ {
// 开发环境启动 // 开发环境启动
"dev": "vite", "dev": "vite",
// 开发环境构建 // 开发环境构建
"build:dev": "vue-tsc && vite build --mode development", "build:dev": "vue-tsc && vite build --mode development",
// 生产环境构建 // 生产环境构建
"build:prod": "vue-tsc && vite build --mode production", "build:prod": "vue-tsc && vite build --mode production",
// 测试环境构建 // 测试环境构建
"build:test": "vue-tsc && vite build --mode test", "build:test": "vue-tsc && vite build --mode test",
// 预览环境启动 // 预览环境启动
"preview": "vite preview" "preview": "vite preview"
} }
``` ```
### 文件资源目录 📚 ### 文件资源目录 📚
```text ```text
SnowAdmin SnowAdmin
├─ .husky # husky 配置文件 ├─ .github # GitHub 配置目录
├─ .vscode # VSCode 推荐配置 │ └─ ISSUE_TEMPLATE # Issue 模板
├─ build # vite项目配置目录 ├─ .husky # husky 配置文件
├─ public # 静态资源文件(该文件夹不会被打包) ├─ build # vite 项目配置目录
├─ src ├─ node_modules # 依赖包(自动生成)
│ ├─ api # API 接口管理 ├─ public # 静态资源文件(不会被打包)
│ ├─ assets # 静态资源文件 ├─ src
│ ├─ components # 全局组件 │ ├─ api # API 接口管理
│ ├─ config # 全局配置项 │ │ └─ modules # 接口模块
│ ├─ directives # 全局自定义指令文件 │ ├─ assets # 静态资源文件
│ ├─ globals # 全局函数 │ │ ├─ fonts # 字体文件
│ ├─ hooks # 常用 Hooks 封装 │ │ ├─ img # 图片资源
│ ├─ lang # 语言国际化 i18n │ │ ├─ logo # Logo 图标
│ ├─ layout # 框架布局模块 │ │ └─ svgs # SVG 图标
│ ├─ mock # 本地数据mock │ ├─ components # 全局组件(code-view/qrcode/svg-icon等)
│ ├─ router # 路由管理 │ ├─ config # 全局配置项
│ ├─ store # pinia store │ ├─ directives # 全局自定义指令(防抖/节流/权限指令)
│ ├─ style # 全局样式文件 │ ├─ globals # 全局函数
│ ├─ typings # 全局 ts 声明 │ ├─ hooks # 常用 Hooks 封装
│ ├─ utils # 常用工具库 │ ├─ lang # 语言国际化 i18n
│ ├─ views # 项目所有页面 │ ├─ layout # 框架布局模块
│ ├─ App.vue # 项目主组件 │ │ ├─ components # 布局组件(Aside/Header/Footer/Menu/Tabs等)
│ ├─ main.ts # 项目入口文件 │ │ └─ layout-* # 布局类型(defaults/head/mixing)
│ └─ vite-env.d.ts # 指定 ts 识别 vue │ ├─ mock # 本地数据 mock
├─ .editorconfig # 代码编辑器配置文件 │ ├─ router # 路由管理
├─ .env # 通用环境配置 │ ├─ store # pinia store
├─ .env.development # 开发环境配置 │ ├─ style # 全局样式文件
├─ .env.production # 生产环境配置 │ │ ├─ media # 响应式样式
├─ .env.test # 测试环境配置 │ │ ├─ model # 动画/滚动条/全局样式
├─ .eslintignore # 忽略 Eslint 校验 │ │ └─ var # 主题变量
├─ .eslintrc.cjs # Eslint 校验配置文件 │ ├─ typings # 全局 ts 声明
├─ .gitignore # 忽略 git 提交 │ ├─ utils # 常用工具库
├─ .prettierignore # 忽略 Prettier 格式化 │ ├─ views # 项目所有页面
├─ .prettierrc.cjs # Prettier 格式化配置 │ │ ├─ about # 关于页面
├─ .stylelintignore # 忽略 Stylelint 校验 │ │ ├─ component # 组件展示页
├─ .stylelintrc.cjs # Stylelint 格式化配置 │ │ ├─ directive # 指令展示页
├─ commitlint.config.cjs # git 提交规范配置 │ │ ├─ error # 错误页面(401/404/500)
├─ index.html # 入口 html │ │ ├─ file # 文件管理
├─ LICENSE # 开源协议 │ │ ├─ form # 表单页
├─ lint-staged.config.cjs # lint-staged 配置文件 │ │ ├─ functions # 工具函数演示
├─ package-lock.json # 依赖包包版本锁 │ │ ├─ home # 首页
├─ package.json # 依赖包管理 │ │ ├─ i18n # 国际化演示
├─ pnpm-lock.yaml # 依赖包包版本锁 │ │ ├─ link # 链接演示
├─ README.md # README 介绍 │ │ ├─ login # 登录页
├─ tsconfig.json # typescript 全局配置 │ │ ├─ monitor # 系统监控
└─ vite.config.ts # vite 全局配置文件 │ │ ├─ multilevel # 多级菜单演示
``` │ │ ├─ permission # 权限演示
│ │ ├─ personal # 个人中心
### 浏览器支持 🌎 │ │ ├─ system # 系统管理
│ │ ├─ table # 表格页
- 本地开发推荐使用 Chrome 最新版浏览器 [Download](https://www.google.com/intl/zh-CN/chrome/)。 │ │ └─ thin-preview # 简洁预览页
- 生产环境支持现代浏览器,不再支持 IE 浏览器,更多浏览器可以查看 [Can I Use Es Module](https://caniuse.com/?search=ESModule)。 │ ├─ App.vue # 项目主组件
│ ├─ auto-import.d.ts # 自动导入声明
| ![IE](https://i.imgtg.com/2023/04/11/8z7ot.png) | ![Edge](https://i.imgtg.com/2023/04/11/8zr3p.png) | ![Firefox](https://i.imgtg.com/2023/04/11/8zKiU.png) | ![Chrome](https://i.imgtg.com/2023/04/11/8zNrx.png) | ![Safari](https://i.imgtg.com/2023/04/11/8zeGj.png) | │ ├─ components.d.ts # 组件声明
| :---------------------------------------------: | :-----------------------------------------------: | :--------------------------------------------------: | :-------------------------------------------------: | :-------------------------------------------------: | │ ├─ main.ts # 项目入口文件
| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | │ ├─ style.css # 全局样式入口
│ └─ vite-env.d.ts # 指定 ts 识别 vue
### 鸣谢列表 🧩 ├─ .editorconfig # 代码编辑器配置文件
├─ .env # 通用环境配置
- [vue:https://v3.cn.vuejs.org/](https://v3.cn.vuejs.org/) ├─ .env.development # 开发环境配置
- [axios:https://github.com/axios/axios](https://github.com/axios/axios) ├─ .env.production # 生产环境配置
- [nprogress:https://github.com/rstacruz/nprogress](https://github.com/rstacruz/nprogress) ├─ .env.test # 测试环境配置
- [sortablejs:https://github.com/SortableJS/Sortabl](https://github.com/SortableJS/Sortable) ├─ .eslintrc-auto-import.json # ESLint 自动导入配置
- [sass:https://github.com/sass/sass](https://github.com/sass/sass) ├─ .gitignore # 忽略 git 提交
- [typescript:https://github.com/microsoft/TypeScript](https://github.com/microsoft/TypeScript) ├─ .prettierignore # 忽略 Prettier 格式化
- [vite:https://github.com/vitejs/vite](https://github.com/vitejs/vite) ├─ .prettierrc.cjs # Prettier 格式化配置
- [wangeditor:https://github.com/wangeditor-team/wangEditor](https://github.com/wangeditor-team/wangEditor) ├─ .stylelintignore # 忽略 Stylelint 校验
- [qrcodejs:https://github.com/davidshimjs/qrcodejs](https://github.com/davidshimjs/qrcodejs) ├─ .stylelintrc.cjs # Stylelint 格式化配置
- [print-js:https://github.com/crabbly/Print.js](https://github.com/crabbly/Print.js) ├─ commitlint.config.cjs # git 提交规范配置
- [eslint:https://github.com/eslint/eslint](https://github.com/eslint/eslint) ├─ eslint.config.js # Eslint 校验配置文件
- [prettier:https://github.com/prettier/prettier](https://github.com/prettier/prettier) ├─ index.html # 入口 html
- [arco.design:https://arco.design/](https://arco.design/) ├─ LICENSE # 开源协议
- [pinyin-pro:https://github.com/zh-lx/pinyin-pro](https://github.com/zh-lx/pinyin-pro) ├─ lint-staged.config.cjs # lint-staged 配置文件
- [qrcode:https://www.npmjs.com/package/qrcode](https://www.npmjs.com/package/qrcode) ├─ package.json # 依赖包管理
- [jsbarcode:https://github.com/lindell/JsBarcode/wiki/Options](https://github.com/lindell/JsBarcode/wiki/Options) ├─ pnpm-lock.yaml # 依赖包版本锁
- [fingerprintjs2:https://www.npmjs.com/package/fingerprintjs2](https://www.npmjs.com/package/fingerprintjs2) ├─ README.md # README 介绍
└─ vite.config.ts # vite 全局配置文件
### 特别鸣谢 🎉 ```
- [vue-next-admin:http://vuenextadmin.ccfast.cc/](http://vuenextadmin.ccfast.cc/) ### 浏览器支持 🌎
- [Gi-admin:https://lin-97.github.io/gi-demo/](https://lin-97.github.io/gi-demo/#/home)
- [Geeker-Admin:https://admin.spicyboy.cn/](https://admin.spicyboy.cn/#/home/index) - 本地开发推荐使用 Chrome 最新版浏览器 [Download](https://www.google.com/intl/zh-CN/chrome/)。
- 生产环境支持现代浏览器,不再支持 IE 浏览器,更多浏览器可以查看 [Can I Use Es Module](https://caniuse.com/?search=ESModule)。
感谢以上框架为本项目提供了帮助,项目中的很多设计思想值得参考和学习,再次感谢。
| ![IE](https://i.imgtg.com/2023/04/11/8z7ot.png) | ![Edge](https://i.imgtg.com/2023/04/11/8zr3p.png) | ![Firefox](https://i.imgtg.com/2023/04/11/8zKiU.png) | ![Chrome](https://i.imgtg.com/2023/04/11/8zNrx.png) | ![Safari](https://i.imgtg.com/2023/04/11/8zeGj.png) |
### 学习 & 交流 🏫 | :---------------------------------------------: | :-----------------------------------------------: | :--------------------------------------------------: | :-------------------------------------------------: | :-------------------------------------------------: |
| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
| SnowAdmin 交流群 |
| :---------------------------------------------------------------------------------------------------------: | ### 鸣谢列表 🧩
| ![微信图片_20250726141221](https://github.com/user-attachments/assets/8c1ebf3c-4630-487e-9a54-810fd4d6972c) |
- [vue:https://v3.cn.vuejs.org/](https://v3.cn.vuejs.org/)
使用过程中有各种问题也可以进群交流,欢迎大家积极参与 - [axios:https://github.com/axios/axios](https://github.com/axios/axios)
- [nprogress:https://github.com/rstacruz/nprogress](https://github.com/rstacruz/nprogress)
### 支持作者 🌟 - [sortablejs:https://github.com/SortableJS/Sortabl](https://github.com/SortableJS/Sortable)
- [sass:https://github.com/sass/sass](https://github.com/sass/sass)
如果觉得框架不错,或者已经在使用了,希望你可以去 [GitHub](https://github.com/WangFan-io/SnowAdmin) ⭐ Star,这将是对我极大的鼓励与支持。 - [typescript:https://github.com/microsoft/TypeScript](https://github.com/microsoft/TypeScript)
- [vite:https://github.com/vitejs/vite](https://github.com/vitejs/vite)
### 免责条款 📫 - [wangeditor:https://github.com/wangeditor-team/wangEditor](https://github.com/wangeditor-team/wangEditor)
- [qrcodejs:https://github.com/davidshimjs/qrcodejs](https://github.com/davidshimjs/qrcodejs)
您充分了解并同意,您必须为自己使用本服务及注册帐号下的一切行为负责,包括您所发表的任何内容以及由此产生的任何后果。您应对本服务中的内容自行加以判断,并自行承担因使用内容而引起的所有风险。 - [print-js:https://github.com/crabbly/Print.js](https://github.com/crabbly/Print.js)
- [eslint:https://github.com/eslint/eslint](https://github.com/eslint/eslint)
`SnowAdmin` 对网站上所显示的信息或资料的准确性、内容、完整性、合法性、可靠性、可操作性或可用性不承担任何责任。 - [prettier:https://github.com/prettier/prettier](https://github.com/prettier/prettier)
- [arco.design:https://arco.design/](https://arco.design/)
`SnowAdmin` 二次开发使用者因为违法而触犯中华人民共和国法律的,一切后果自己负责,`SnowAdmin` 作者不承担任何责任。 - [pinyin-pro:https://github.com/zh-lx/pinyin-pro](https://github.com/zh-lx/pinyin-pro)
- [qrcode:https://www.npmjs.com/package/qrcode](https://www.npmjs.com/package/qrcode)
本声明未涉及的问题参见国家有关法律法规,当本声明与国家法律法规冲突时,以国家法律法规为准。 - [jsbarcode:https://github.com/lindell/JsBarcode/wiki/Options](https://github.com/lindell/JsBarcode/wiki/Options)
- [fingerprintjs2:https://www.npmjs.com/package/fingerprintjs2](https://www.npmjs.com/package/fingerprintjs2)
### 学习 & 商用 🌈
### 特别鸣谢 🎉
`SnowAdmin` 是免费和开源的,可免费用于学习、商业使用 。
- [vue-next-admin:http://vuenextadmin.ccfast.cc/](http://vuenextadmin.ccfast.cc/)
### 捐赠 💖 - [Gi-admin:https://lin-97.github.io/gi-demo/](https://lin-97.github.io/gi-demo/#/home)
- [Geeker-Admin:https://admin.spicyboy.cn/](https://admin.spicyboy.cn/#/home/index)
| 微信 | 支付宝 |
| :------------------------------------------------: | :--------------------------------------------------: | 感谢以上框架为本项目提供了帮助,项目中的很多设计思想值得参考和学习,再次感谢。
| ![微信](https://ooo.0x0.ooo/2025/07/20/OYtFn1.jpg) | ![支付宝](https://ooo.0x0.ooo/2025/07/20/OYth4I.jpg) |
### 学习 & 交流 🏫
| SnowAdmin 交流群 |
| :---------------------------------------------------------------------------------------------------------: |
| ![微信图片_20250726141221](https://github.com/user-attachments/assets/8c1ebf3c-4630-487e-9a54-810fd4d6972c) |
使用过程中有各种问题也可以进群交流,欢迎大家积极参与
### 支持作者 🌟
如果觉得框架不错,或者已经在使用了,希望你可以去 [GitHub](https://github.com/WangFan-io/SnowAdmin) ⭐ Star,这将是对我极大的鼓励与支持。
### 免责条款 📫
您充分了解并同意,您必须为自己使用本服务及注册帐号下的一切行为负责,包括您所发表的任何内容以及由此产生的任何后果。您应对本服务中的内容自行加以判断,并自行承担因使用内容而引起的所有风险。
`SnowAdmin` 对网站上所显示的信息或资料的准确性、内容、完整性、合法性、可靠性、可操作性或可用性不承担任何责任。
`SnowAdmin` 二次开发使用者因为违法而触犯中华人民共和国法律的,一切后果自己负责,`SnowAdmin` 作者不承担任何责任。
本声明未涉及的问题参见国家有关法律法规,当本声明与国家法律法规冲突时,以国家法律法规为准。
### 学习 & 商用 🌈
`SnowAdmin` 是免费和开源的,可免费用于学习、商业使用 。
### 捐赠 💖
| 微信 | 支付宝 |
| :------------------------------------------------: | :--------------------------------------------------: |
| ![微信](https://ooo.0x0.ooo/2025/07/20/OYtFn1.jpg) | ![支付宝](https://ooo.0x0.ooo/2025/07/20/OYth4I.jpg) |
+56 -73
View File
@@ -1,73 +1,56 @@
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import { resolve } from "path"; import { resolve } from "path";
import { PluginOption } from "vite"; import { PluginOption } from "vite";
import { vitePluginForArco } from "@arco-plugins/vite-vue"; import { vitePluginForArco } from "@arco-plugins/vite-vue";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons"; import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import AutoImport from "unplugin-auto-import/vite"; import AutoImport from "unplugin-auto-import/vite";
import { ArcoResolver } from "unplugin-vue-components/resolvers"; import { ArcoResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite"; import Components from "unplugin-vue-components/vite";
import { viteMockServe } from "vite-plugin-mock"; /**
import eslintPlugin from "vite-plugin-eslint"; * 创建 vite 插件
/** * @param viteEnv
* 创建 vite 插件 */
* @param viteEnv export const createVitePlugins = (_viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => {
*/ return [
export const createVitePlugins = (viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => { vue(),
const env = viteEnv; vitePluginForArco({
return [ style: "css"
vue(), }),
// esLint 报错信息显示在浏览器界面上 createSvgIconsPlugin({
eslintPlugin(), // 配置src下存放svg的路径,这里表示在src/assets/svgs文件夹下
vitePluginForArco({ iconDirs: [resolve(process.cwd(), "src/assets/svgs")],
style: "css" symbolId: "icon-[dir]-[name]"
}), }),
createSvgIconsPlugin({ AutoImport({
// 配置src下存放svg的路径,这里表示在src/assets/svgs文件夹下 // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
iconDirs: [resolve(process.cwd(), "src/assets/svgs")], imports: ["vue", "vue-router"],
symbolId: "icon-[dir]-[name]" // 自动导入的目录-自定义全局函数
}), dirs: ["src/globals"],
AutoImport({ // arco组件的按需加载
// 自动导入 Vue 相关函数,如:ref, reactive, toRef 等 resolvers: [ArcoResolver()],
imports: ["vue", "vue-router"], // 解决eslint报错问题
// 自动导入的目录-自定义全局函数 eslintrc: {
dirs: ["src/globals"], // 这里先设置成true然后npm run dev 运行之后会生成 .eslintrc-auto-import.json 文件之后,在改为false
// arco组件的按需加载 enabled: false,
resolvers: [ArcoResolver()], filepath: "./.eslintrc-auto-import.json", // 生成的文件路径
// 解决eslint报错问题 globalsPropValue: true
eslintrc: { },
// 这里先设置成true然后npm run dev 运行之后会生成 .eslintrc-auto-import.json 文件之后,在改为false // 配置文件生成位置
enabled: false, dts: "src/auto-import.d.ts"
filepath: "./.eslintrc-auto-import.json", // 生成的文件路径 }),
globalsPropValue: true Components({
}, resolvers: [
// 配置文件生成位置 // arco组件的按需加载
dts: "src/auto-import.d.ts" ArcoResolver({
}), sideEffect: true
Components({ })
resolvers: [ ],
// arco组件的按需加载 // 自动加载组件的目录配置,默认的为 'src/components'
ArcoResolver({ dirs: ["src/components"],
sideEffect: true // 组件的有效文件扩展名
}) extensions: ["vue"],
], // 配置文件生成位置
// 自动加载组件的目录配置,默认的为 'src/components' dts: "src/components.d.ts"
dirs: ["src/components"], })
// 组件的有效文件扩展名 ];
extensions: ["vue"], };
// 配置文件生成位置
dts: "src/components.d.ts"
}),
viteMockServe({
mockPath: "./src/mock/", // 目录位置
logger: true, // 是否在控制台显示请求日志
supportTs: true, // 是否读取ts文件模块
localEnabled: env.VITE_APP_OPEN_MOCK === "true", // 设置是否启用本地mock文件
prodEnabled: env.VITE_APP_OPEN_MOCK === "true", // 设置打包是否启用mock功能
// 这样可以控制关闭mock的时候不让mock打包到最终代码内
injectCode: `
import { setupProdMockServer } from '../src/mock/index';
setupProdMockServer();
`
})
];
};
+52 -52
View File
@@ -1,52 +1,52 @@
module.exports = { module.exports = {
ignores: [commit => commit.includes("init")], ignores: [commit => commit.includes("init")],
extends: ["@commitlint/config-conventional"], extends: ["@commitlint/config-conventional"],
rules: { rules: {
"body-leading-blank": [2, "always"], "body-leading-blank": [2, "always"],
"footer-leading-blank": [1, "always"], "footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 108], "header-max-length": [2, "always", 108],
"subject-empty": [2, "never"], "subject-empty": [2, "never"],
"type-empty": [2, "never"], "type-empty": [2, "never"],
"type-enum": [ "type-enum": [
2, 2,
"always", "always",
[ [
"feat", "feat",
"fix", "fix",
"style", "style",
"perf", "perf",
"refactor", "refactor",
"test", "test",
"chore", "chore",
"docs", "docs",
"workflow", "workflow",
"build", "build",
"ci", "ci",
"revert", "revert",
"wip", "wip",
"release", "release",
"deps", "deps",
"merge", "merge",
"sync" "sync"
// feat:交新功能 // feat:交新功能
// fix:bug修复 // fix:bug修复
// style: 调整代码格式,未修改代码逻辑 // style: 调整代码格式,未修改代码逻辑
// perf: 性能优化 // perf: 性能优化
// refactor:代码重构,既没修复bug也没有添加新功能 // refactor:代码重构,既没修复bug也没有添加新功能
// test:增加测试 // test:增加测试
// chore: 其他修改(不在上述类型中的修改) // chore: 其他修改(不在上述类型中的修改)
// docs:修改文档或注释 // docs:修改文档或注释
// workflow: 工作流 // workflow: 工作流
// build: 项目打包构建相关的配置修改 // build: 项目打包构建相关的配置修改
// ci: 持续集成相关 // ci: 持续集成相关
// revert: 恢复上一次提交(回滚) // revert: 恢复上一次提交(回滚)
// wip: work in progress 工作中 还没完成 // wip: work in progress 工作中 还没完成
// release: 发版 // release: 发版
// deps: 依赖相关的修改 // deps: 依赖相关的修改
// merge 代码合并 // merge 代码合并
// sync 同步主线或分支的Bug // sync 同步主线或分支的Bug
// scope 说明 commit 影响的范围,比如数据层、控制层、视图层等等 // scope 说明 commit 影响的范围,比如数据层、控制层、视图层等等
] ]
] ]
} }
}; };
+1 -2
View File
@@ -67,8 +67,7 @@ export default defineConfig([
"/docs", "/docs",
".husky", ".husky",
".local", ".local",
"/bin", "/bin"
"/src/mock/*"
] ]
}, },
eslintConfigPrettier eslintConfigPrettier
+15 -18
View File
@@ -1,21 +1,18 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head>
<head> <meta charset="UTF-8" />
<meta charset="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/src/assets/logo/snow.svg" />
<link rel="icon" type="image/svg+xml" href="/src/assets/logo/snow.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="/assets/css/loading.css" type="text/css" />
<link rel="stylesheet" href="/assets/css/loading.css" type="text/css" /> <title>BEpusdt 一款更好用的个人加密货币收款网关!</title>
<title>BEpusdt 一款更好用的个人加密货币收款网关!</title> </head>
</head> <body>
<div id="app">
<body> <div class="init-page">
<div id="app"> <div class="snow-loader"></div>
<div class="init-page"> </div>
<div class="snow-loader"></div>
</div> </div>
</div> <script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main.ts"></script> </body>
</body> </html>
</html>
+8 -8
View File
@@ -1,8 +1,8 @@
module.exports = { module.exports = {
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"], "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": ["prettier --write--parser json"], "{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": ["prettier --write--parser json"],
"package.json": ["prettier --write"], "package.json": ["prettier --write"],
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"], "*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
"*.{scss,less,styl,html}": ["stylelint --fix", "prettier --write"], "*.{scss,less,styl,html}": ["stylelint --fix", "prettier --write"],
"*.md": ["prettier --write"] "*.md": ["prettier --write"]
}; };
+36 -41
View File
@@ -33,66 +33,61 @@
}, },
"dependencies": { "dependencies": {
"@arco-design/color": "^0.4.0", "@arco-design/color": "^0.4.0",
"@visactor/vchart": "^1.11.0",
"@visactor/vchart-arco-theme": "^1.11.0",
"@vueuse/core": "^12.4.0", "@vueuse/core": "^12.4.0",
"axios": "^1.6.8", "axios": "^1.16.0",
"dayjs": "^1.11.20",
"echarts": "^6.0.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^2.3.0", "pinia": "^2.3.1",
"pinia-plugin-persistedstate": "^3.2.1", "pinia-plugin-persistedstate": "^3.2.3",
"vue": "^3.5.15", "vue": "^3.5.34",
"vue-color-kit": "^1.0.6", "vue-color-kit": "^1.0.6",
"vue-echarts": "^8.0.1",
"vue-i18n": "10.0.0-alpha.3", "vue-i18n": "10.0.0-alpha.3",
"vue-pick-colors": "^1.7.6", "vue-pick-colors": "^1.8.0",
"vue-router": "^4.3.0" "vue-router": "^4.6.4"
}, },
"devDependencies": { "devDependencies": {
"@arco-design/web-vue": "^2.57.0", "@arco-design/web-vue": "^2.58.0",
"@arco-plugins/vite-vue": "^1.4.5", "@arco-plugins/vite-vue": "^1.4.6",
"@commitlint/cli": "^19.8.0", "@commitlint/cli": "^19.8.0",
"@commitlint/config-conventional": "^19.8.0", "@commitlint/config-conventional": "^19.8.0",
"@types/node": "^22.13.11", "@types/node": "^22.19.18",
"@typescript-eslint/eslint-plugin": "^8.32.1", "@typescript-eslint/eslint-plugin": "^8.59.2",
"@typescript-eslint/parser": "^8.32.1", "@typescript-eslint/parser": "^8.59.2",
"@vitejs/plugin-vue": "^5.2.1", "@vitejs/plugin-vue": "^6.0.6",
"commitlint": "^19.2.1", "commitlint": "^19.2.1",
"depcheck": "^1.4.7", "eslint": "^9.39.4",
"eslint": "^9.27.0", "eslint-config-prettier": "^10.1.8",
"eslint-config-prettier": "^10.1.1", "eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-prettier": "^5.2.3", "eslint-plugin-vue": "^10.9.1",
"eslint-plugin-vue": "^10.0.0",
"globals": "^16.1.0", "globals": "^16.1.0",
"husky": "^9.0.11", "husky": "^9.1.7",
"lint-staged": "^15.2.2", "lint-staged": "^15.2.2",
"mockjs": "^1.1.0", "postcss": "^8.5.14",
"postcss": "^8.4.38", "postcss-html": "^1.8.1",
"postcss-html": "^1.6.0",
"postcss-preset-env": "^9.5.2", "postcss-preset-env": "^9.5.2",
"postcss-scss": "^4.0.9", "postcss-scss": "^4.0.9",
"prettier": "^3.2.5", "prettier": "^3.8.3",
"rollup-plugin-visualizer": "^6.0.5", "sass-embedded": "^1.99.0",
"sass-embedded": "^1.86.0", "stylelint": "^16.26.1",
"stylelint": "^16.16.0",
"stylelint-config-html": "^1.1.0", "stylelint-config-html": "^1.1.0",
"stylelint-config-recess-order": "^6.0.0", "stylelint-config-recess-order": "^7.7.0",
"stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-scss": "^16.0.2",
"stylelint-config-recommended-vue": "^1.6.0", "stylelint-config-recommended-vue": "^1.6.1",
"stylelint-config-standard": "^37.0.0", "stylelint-config-standard": "^39.0.1",
"stylelint-config-standard-scss": "^14.0.0", "stylelint-config-standard-scss": "^16.0.0",
"terser": "^5.29.2", "terser": "^5.47.1",
"typescript": "^5.2.2", "typescript": "^5.9.3",
"typescript-eslint": "^8.32.1", "typescript-eslint": "^8.59.2",
"unplugin-auto-import": "^0.17.5", "unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0", "unplugin-vue-components": "^0.26.0",
"vite": "^6.3.5", "vite": "^7.3.3",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-inspect": "^11.3.3",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vue-tsc": "^2.2.4" "vue-tsc": "^2.2.4"
}, },
"engines": { "engines": {
"node": ">= 18.12.0", "node": ">=20.19.0",
"pnpm": ">= 8.7.0" "pnpm": ">=10.0.0 <11"
} }
} }
+3033 -3873
View File
File diff suppressed because it is too large Load Diff
+42 -41
View File
@@ -1,41 +1,42 @@
// @see: https://www.prettier.cn // prettier.config.ts
module.exports = { // @see: https://www.prettier.cn
// 指定最大换行长度 export default {
printWidth: 130, // 指定最大换行长度
// 缩进制表符宽度 | 空格数 printWidth: 130,
tabWidth: 2, // 缩进制表符宽度 | 空格数
// 使用制表符而不是空格缩进行 (true:制表符,false:空格) tabWidth: 2,
useTabs: false, // 使用制表符而不是空格缩进行 (true:制表符,false:空格)
// 结尾不用分号 (true:有,false:没有) useTabs: false,
semi: true, // 结尾不用分号 (true:有,false:没有)
// 使用单引号 (true:单引号,false:双引号) semi: true,
singleQuote: false, // 使用单引号 (true:单引号,false:双引号)
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>" singleQuote: false,
quoteProps: 'as-needed', // 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号) quoteProps: "as-needed",
jsxSingleQuote: false, // 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>" jsxSingleQuote: false,
trailingComma: 'none', // 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有) trailingComma: "none",
bracketSpacing: true, // 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行) bracketSpacing: true,
bracketSameLine: false, // 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号) bracketSameLine: false,
arrowParens: 'avoid', // (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
// 指定要使用的解析器,不需要写文件开头的 @prettier arrowParens: "avoid",
requirePragma: false, // 指定要使用的解析器,不需要写文件开头的 @prettier
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化 requirePragma: false,
insertPragma: false, // 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
// 用于控制文本是否应该被换行以及如何进行换行 insertPragma: false,
proseWrap: 'preserve', // 用于控制文本是否应该被换行以及如何进行换行
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的 proseWrap: "preserve",
htmlWhitespaceSensitivity: 'css', // 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式 htmlWhitespaceSensitivity: "css",
vueIndentScriptAndStyle: false, // 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>" vueIndentScriptAndStyle: false,
endOfLine: 'auto', // 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束) endOfLine: "auto",
rangeStart: 0, // 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
rangeEnd: Infinity rangeStart: 0,
}; rangeEnd: Infinity
};
+61 -61
View File
@@ -1,61 +1,61 @@
body { body {
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
} }
.init-page { .init-page {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
left: 0; left: 0;
top: 0; top: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: #fff; background: #fff;
} }
/* HTML: <div class="snow-loader"></div> */ /* HTML: <div class="snow-loader"></div> */
.snow-loader { .snow-loader {
width: 45px; width: 45px;
aspect-ratio: 1; aspect-ratio: 1;
--c: no-repeat linear-gradient(rgb(22, 93, 255) 0 0); --c: no-repeat linear-gradient(rgb(22, 93, 255) 0 0);
background: background:
var(--c) 0% 50%, var(--c) 0% 50%,
var(--c) 50% 50%, var(--c) 50% 50%,
var(--c) 100% 50%; var(--c) 100% 50%;
background-size: 20% 100%; background-size: 20% 100%;
animation: l1 1s infinite linear; animation: l1 1s infinite linear;
} }
@keyframes l1 { @keyframes l1 {
0% { 0% {
background-size: background-size:
20% 100%, 20% 100%,
20% 100%, 20% 100%,
20% 100%; 20% 100%;
} }
33% { 33% {
background-size: background-size:
20% 10%, 20% 10%,
20% 100%, 20% 100%,
20% 100%; 20% 100%;
} }
50% { 50% {
background-size: background-size:
20% 100%, 20% 100%,
20% 10%, 20% 10%,
20% 100%; 20% 100%;
} }
66% { 66% {
background-size: background-size:
20% 100%, 20% 100%,
20% 100%, 20% 100%,
20% 10%; 20% 10%;
} }
100% { 100% {
background-size: background-size:
20% 100%, 20% 100%,
20% 100%, 20% 100%,
20% 100%; 20% 100%;
} }
} }
+18 -18
View File
@@ -1,18 +1,18 @@
<template> <template>
<div> <div>
<router-view /> <router-view />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useThemeMethods } from "@/hooks/useThemeMethods"; import { useThemeMethods } from "@/hooks/useThemeMethods";
// 初始化主题 // 初始化主题
const onTheme = () => { const onTheme = () => {
let { initTheme } = useThemeMethods(); let { initTheme } = useThemeMethods();
initTheme(); initTheme();
}; };
onTheme(); onTheme();
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
+101 -101
View File
@@ -1,101 +1,101 @@
import axios from "axios"; import axios from "axios";
import { Message } from "@arco-design/web-vue"; import { Message } from "@arco-design/web-vue";
import { useUserInfoStore } from "@/store/modules/user-info"; import { useUserInfoStore } from "@/store/modules/user-info";
import pinia from "@/store/index"; import pinia from "@/store/index";
declare module "axios" { declare module "axios" {
interface AxiosInstance { interface AxiosInstance {
(config: AxiosRequestConfig): Promise<any>; (config: AxiosRequestConfig): Promise<any>;
} }
} }
// 创建axios实例 // 创建axios实例
const service = axios.create(); const service = axios.create();
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
function (config: any) { function (config: any) {
// 发送请求之前做什么 // 发送请求之前做什么
// 获取token鉴权 // 获取token鉴权
let userInfo: any = {}; let userInfo: any = {};
if (localStorage.getItem("user-info")) { if (localStorage.getItem("user-info")) {
userInfo = JSON.parse(localStorage.getItem("user-info") as string); userInfo = JSON.parse(localStorage.getItem("user-info") as string);
} }
if (userInfo?.token) { if (userInfo?.token) {
// 有token,在请求头中携带token // 有token,在请求头中携带token
config.headers.Authorization = userInfo.token; config.headers.Authorization = userInfo.token;
} }
return config; return config;
}, },
function (error: any) { function (error: any) {
// 请求错误 // 请求错误
return Promise.reject(error); return Promise.reject(error);
} }
); );
// 响应拦截器 // 响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
function (response: any) { function (response: any) {
if (response.status != 200) { if (response.status != 200) {
Message.error("服务器异常,请联系管理员"); Message.error("服务器异常,请联系管理员");
return Promise.reject(response.data); return Promise.reject(response.data);
} }
let res = response.data; let res = response.data;
if (res.code == 400) { if (res.code == 400) {
Message.error(res.msg); Message.error(res.msg);
return Promise.reject(res); return Promise.reject(res);
} }
if (res.code == 403) { if (res.code == 403) {
// 清除 localStorage // 清除 localStorage
localStorage.removeItem("user-info"); localStorage.removeItem("user-info");
// 清除 Pinia store 中的 token 和用户信息 // 清除 Pinia store 中的 token 和用户信息
const userStore = useUserInfoStore(pinia); const userStore = useUserInfoStore(pinia);
userStore.logOut(); userStore.logOut();
// 跳转到登录页(保留当前路径前缀,如 /admin) // 跳转到登录页(保留当前路径前缀,如 /admin)
const basePath = window.location.pathname.split("#")[0]; const basePath = window.location.pathname.split("#")[0];
window.location.href = `${basePath}#/login`; window.location.href = `${basePath}#/login`;
return Promise.reject(res); return Promise.reject(res);
} }
if (res.code == 404) { if (res.code == 404) {
Message.error("请求连接超时"); Message.error("请求连接超时");
return Promise.reject(res); return Promise.reject(res);
} }
if (res.code != 200) { if (res.code != 200) {
Message.error(res.message); Message.error(res.message);
return Promise.reject(res); return Promise.reject(res);
} }
// 返回数据 // 返回数据
return Promise.resolve(res); return Promise.resolve(res);
}, },
function (error: any) { function (error: any) {
// 处理 HTTP 错误状态码 // 处理 HTTP 错误状态码
if (error.response) { if (error.response) {
if (error.response.status === 403) { if (error.response.status === 403) {
localStorage.removeItem("user-info"); localStorage.removeItem("user-info");
const userStore = useUserInfoStore(pinia); const userStore = useUserInfoStore(pinia);
userStore.logOut(); userStore.logOut();
Message.error("登录已过期,请重新登录"); Message.error("登录已过期,请重新登录");
const basePath = window.location.pathname.split("#")[0]; const basePath = window.location.pathname.split("#")[0];
return (window.location.href = `${basePath}#/login`); return (window.location.href = `${basePath}#/login`);
} }
return Message.error(error.message || "请求失败"); return Message.error(error.message || "请求失败");
} }
} }
); );
export default service; export default service;
+9 -9
View File
@@ -1,9 +1,9 @@
import axios from "@/api"; import axios from "@/api";
export const getDashboardHomeAPI = (data: any) => { export const getDashboardHomeAPI = (data: any) => {
return axios({ return axios({
url: "/api/dashboard/home", url: "/api/dashboard/home",
method: "post", method: "post",
data data
}); });
}; };
+32 -32
View File
@@ -1,32 +1,32 @@
import axios from "@/api"; import axios from "@/api";
export const getRateListAPI = (data: any) => { export const getRateListAPI = (data: any) => {
return axios({ return axios({
url: "/api/rate/list", url: "/api/rate/list",
method: "post", method: "post",
data data
}); });
}; };
export const getSyntaxListAPI = () => { export const getSyntaxListAPI = () => {
return axios({ return axios({
url: "/api/rate/syntax", url: "/api/rate/syntax",
method: "post" method: "post"
}); });
}; };
export const setSyntaxAPI = (data: any) => { export const setSyntaxAPI = (data: any) => {
return axios({ return axios({
url: "/api/rate/set_syntax", url: "/api/rate/set_syntax",
method: "post", method: "post",
data data
}); });
}; };
export const onSyncAPI = (data: any) => { export const onSyncAPI = (data: any) => {
return axios({ return axios({
url: "/api/rate/sync", url: "/api/rate/sync",
method: "post", method: "post",
data data
}); });
}; };
+58 -58
View File
@@ -1,58 +1,58 @@
import axios from "@/api"; import axios from "@/api";
// 获取菜单数据 // 获取菜单数据
export const getRoutersAPI = () => { export const getRoutersAPI = () => {
return axios({ return axios({
url: "/api/auth/menu", url: "/api/auth/menu",
method: "get" method: "get"
}); });
}; };
// 获取字典数据 // 获取字典数据
export const getDictAPI = () => { export const getDictAPI = () => {
return axios({ return axios({
url: "/mock/system/getDict", url: "/mock/system/getDict",
method: "get" method: "get"
}); });
}; };
// 获取部门数据 // 获取部门数据
export const getDivisionAPI = () => { export const getDivisionAPI = () => {
return axios({ return axios({
url: "/mock/system/getDivision", url: "/mock/system/getDivision",
method: "get" method: "get"
}); });
}; };
// 获取角色数据 // 获取角色数据
export const getRoleAPI = () => { export const getRoleAPI = () => {
return axios({ return axios({
url: "/mock/system/getRole", url: "/mock/system/getRole",
method: "get" method: "get"
}); });
}; };
// 获取账户数据 // 获取账户数据
export const getAccountAPI = () => { export const getAccountAPI = () => {
return axios({ return axios({
url: "/mock/system/getAccount", url: "/mock/system/getAccount",
method: "get" method: "get"
}); });
}; };
// 获取菜单管理列表 // 获取菜单管理列表
export const getMenuListAPI = () => { export const getMenuListAPI = () => {
return axios({ return axios({
url: "/mock/menu/getMenuList", url: "/mock/menu/getMenuList",
method: "get" method: "get"
}); });
}; };
// 根据角色获取权限数据 // 根据角色获取权限数据
export const getUserPermissionAPI = (params: { role: string }) => { export const getUserPermissionAPI = (params: { role: string }) => {
return axios({ return axios({
url: "/mock/menu/getUserPermission", url: "/mock/menu/getUserPermission",
method: "get", method: "get",
params params
}); });
}; };
+37 -37
View File
@@ -1,37 +1,37 @@
import axios from "@/api"; import axios from "@/api";
// 登录 // 登录
export const loginAPI = (data: any) => { export const loginAPI = (data: any) => {
return axios({ return axios({
url: "/api/auth/login", url: "/api/auth/login",
method: "post", method: "post",
data data
}); });
}; };
// 获取用户信息 // 获取用户信息
export const getUserInfoAPI = (params?: any) => { export const getUserInfoAPI = (params?: any) => {
return axios({ return axios({
url: "/api/auth/info", url: "/api/auth/info",
method: "get", method: "get",
params params
}); });
}; };
// 安全设置 // 安全设置
export const securityAPI = (data: any) => { export const securityAPI = (data: any) => {
return axios({ return axios({
url: "/api/auth/security", url: "/api/auth/security",
method: "post", method: "post",
data data
}); });
}; };
// 设置密码 // 设置密码
export const setPasswordAPI = (data: any) => { export const setPasswordAPI = (data: any) => {
return axios({ return axios({
url: "/api/auth/set_password", url: "/api/auth/set_password",
method: "post", method: "post",
data data
}); });
}; };
+33 -33
View File
@@ -1,33 +1,33 @@
import axios from "@/api"; import axios from "@/api";
export const getWalletListAPI = (data: any) => { export const getWalletListAPI = (data: any) => {
return axios({ return axios({
url: "/api/wallet/list", url: "/api/wallet/list",
method: "post", method: "post",
data data
}); });
}; };
export const delWalletAPI = (data: any) => { export const delWalletAPI = (data: any) => {
return axios({ return axios({
url: "/api/wallet/del", url: "/api/wallet/del",
method: "post", method: "post",
data data
}); });
}; };
export const addWalletAPI = (data: any) => { export const addWalletAPI = (data: any) => {
return axios({ return axios({
url: "/api/wallet/add", url: "/api/wallet/add",
method: "post", method: "post",
data data
}); });
}; };
export const modWalletAPI = (data: any) => { export const modWalletAPI = (data: any) => {
return axios({ return axios({
url: "/api/wallet/mod", url: "/api/wallet/mod",
method: "post", method: "post",
data data
}); });
}; };
+6 -6
View File
@@ -1,6 +1,6 @@
@font-face { @font-face {
font-family: "AliFangYuanTi"; /*字体名-自定义*/ font-family: "AliFangYuanTi"; /*字体名-自定义*/
src: url("./AlimamaFangYuanTiVF-Thin.ttf"); /* 字体路径 */ src: url("./AlimamaFangYuanTiVF-Thin.ttf"); /* 字体路径 */
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
+1 -1
View File
@@ -74,6 +74,6 @@ declare global {
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue') import('vue')
} }
+1
View File
@@ -9,6 +9,7 @@ declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
SEcharts: typeof import('./components/s-echarts/index.vue')['default']
SLangProvider: typeof import('./components/s-lang-provider/index.vue')['default'] SLangProvider: typeof import('./components/s-lang-provider/index.vue')['default']
SMainTransition: typeof import('./components/s-main-transition/index.vue')['default'] SMainTransition: typeof import('./components/s-main-transition/index.vue')['default']
SSvgIcon: typeof import('./components/s-svg-icon/index.vue')['default'] SSvgIcon: typeof import('./components/s-svg-icon/index.vue')['default']
+32
View File
@@ -0,0 +1,32 @@
<template>
<VCharts v-if="renderChart" :option="options" :autoresize="autoResize" :style="{ width, height }" />
</template>
<script lang="ts" setup>
import VCharts from "vue-echarts";
defineProps({
options: {
type: Object,
default() {
return {};
}
},
autoResize: {
type: Boolean,
default: true
},
width: {
type: String,
default: "100%"
},
height: {
type: String,
default: "100%"
}
});
const renderChart = ref(false);
// wait container expand
nextTick(() => {
renderChart.value = true;
});
</script>
+31 -31
View File
@@ -1,31 +1,31 @@
import { App, Directive } from "vue"; import { App, Directive } from "vue";
import antiShake from "@/directives/modules/global/anti-shake"; import antiShake from "@/directives/modules/global/anti-shake";
import throttle from "@/directives/modules/global/throttle"; import throttle from "@/directives/modules/global/throttle";
import custom from "@/directives/modules/global/custom"; import custom from "@/directives/modules/global/custom";
import hasPerm from "@/directives/modules/permission/has-perm"; import hasPerm from "@/directives/modules/permission/has-perm";
import hasRole from "@/directives/modules/permission/has-role"; import hasRole from "@/directives/modules/permission/has-role";
// 定义安装函数 // 定义安装函数
// install 函数是一个对象中的方法,其作用是将一系列指令对象安装到 Vue 应用实例中,它自带两个参数:app 和 options // install 函数是一个对象中的方法,其作用是将一系列指令对象安装到 Vue 应用实例中,它自带两个参数:app 和 options
// app就是vue实例,options则是安装函数的参数(可选) // app就是vue实例,options则是安装函数的参数(可选)
// install 方法的定义就插件对象,install 方法会在引入插件时自动被 vue 调用,并传参 vue 实例和 options // install 方法的定义就插件对象,install 方法会在引入插件时自动被 vue 调用,并传参 vue 实例和 options
const group: { [key: string]: Directive } = { const group: { [key: string]: Directive } = {
antiShake, antiShake,
throttle, throttle,
custom, custom,
hasPerm, hasPerm,
hasRole hasRole
}; };
const directives = { const directives = {
install(app: App<Element>) { install(app: App<Element>) {
// 将一系列自定义指令对象安装到 Vue 应用实例中 // 将一系列自定义指令对象安装到 Vue 应用实例中
for (const key in group) { for (const key in group) {
app.directive(key, group[key]); app.directive(key, group[key]);
} }
} }
}; };
// 导出安装函数 // 导出安装函数
export default directives; export default directives;
+50 -50
View File
@@ -1,50 +1,50 @@
import { Directive } from "vue"; import { Directive } from "vue";
const antiShake: Directive = { const antiShake: Directive = {
mounted(el, binding) { mounted(el, binding) {
// 判断是否是函数,防抖指令必须绑定函数 // 判断是否是函数,防抖指令必须绑定函数
if (typeof binding.value != "function") { if (typeof binding.value != "function") {
return console.warn("Anti-shake instructions must be bound to a function"); return console.warn("Anti-shake instructions must be bound to a function");
} }
let timeout: any = null; let timeout: any = null;
// 给el添加自定义事件-防抖函数 // 给el添加自定义事件-防抖函数
el.__onClick__ = () => { el.__onClick__ = () => {
if (timeout) clearTimeout(timeout); if (timeout) clearTimeout(timeout);
timeout = setTimeout(() => { timeout = setTimeout(() => {
// 由于绑定的是函数,这里直接调用绑定之即可(也就是调用绑定的函数) // 由于绑定的是函数,这里直接调用绑定之即可(也就是调用绑定的函数)
binding.value(); binding.value();
}, 500); }, 500);
}; };
// 监听点击事件,点击后调用绑定的自定义事件 // 监听点击事件,点击后调用绑定的自定义事件
el.addEventListener("click", el.__onClick__); el.addEventListener("click", el.__onClick__);
}, },
beforeUnmount(el) { beforeUnmount(el) {
el.removeEventListener("click", el.__onClick__); el.removeEventListener("click", el.__onClick__);
} }
}; };
export default antiShake; export default antiShake;
// 每个生命周期都有两个参数,el、binding // 每个生命周期都有两个参数,el、binding
// 其中el为绑定的dom元素,binding为指令的传入值 // 其中el为绑定的dom元素,binding为指令的传入值
// app.directive("focus", { // app.directive("focus", {
// 在绑定元素的 attribute 前 // 在绑定元素的 attribute 前
// 或事件监听器应用前调用 // 或事件监听器应用前调用
// created(el, binding, vnode) { // created(el, binding, vnode) {
// // 下面会介绍各个参数的细节 // // 下面会介绍各个参数的细节
// }, // },
// // 在元素被插入到 DOM 前调用 // // 在元素被插入到 DOM 前调用
// beforeMount(el, binding, vnode) {}, // beforeMount(el, binding, vnode) {},
// // 在绑定元素的父组件 // // 在绑定元素的父组件
// // 及他自己的所有子节点都挂载完成后调用 // // 及他自己的所有子节点都挂载完成后调用
// mounted(el, binding, vnode) {}, // mounted(el, binding, vnode) {},
// // 绑定元素的父组件更新前调用 // // 绑定元素的父组件更新前调用
// beforeUpdate(el, binding, vnode, prevVnode) {}, // beforeUpdate(el, binding, vnode, prevVnode) {},
// // 在绑定元素的父组件 // // 在绑定元素的父组件
// // 及他自己的所有子节点都更新后调用 // // 及他自己的所有子节点都更新后调用
// updated(el, binding, vnode, prevVnode) {}, // updated(el, binding, vnode, prevVnode) {},
// // 绑定元素的父组件卸载前调用 // // 绑定元素的父组件卸载前调用
// beforeUnmount(el, binding, vnode) {}, // beforeUnmount(el, binding, vnode) {},
// // 绑定元素的父组件卸载后调用 // // 绑定元素的父组件卸载后调用
// unmounted(el, binding, vnode) {} // unmounted(el, binding, vnode) {}
// }); // });
+13 -13
View File
@@ -1,13 +1,13 @@
import { Directive } from "vue"; import { Directive } from "vue";
const custom: Directive = { const custom: Directive = {
mounted(el, binding) { mounted(el, binding) {
el.__onClick__ = () => { el.__onClick__ = () => {
let { goodsId, event } = binding.value; let { goodsId, event } = binding.value;
event(goodsId); event(goodsId);
}; };
el.addEventListener("click", el.__onClick__); el.addEventListener("click", el.__onClick__);
} }
}; };
export default custom; export default custom;
+31 -31
View File
@@ -1,31 +1,31 @@
import { Directive } from "vue"; import { Directive } from "vue";
const throttle: Directive = { const throttle: Directive = {
mounted(el, binding) { mounted(el, binding) {
if (typeof binding.value != "function") { if (typeof binding.value != "function") {
return console.warn("The throttling instruction must be bound to a function"); return console.warn("The throttling instruction must be bound to a function");
} }
let countDown = 0; let countDown = 0;
let timer: any = null; let timer: any = null;
el.__onClick__ = () => { el.__onClick__ = () => {
if (timer) return; if (timer) return;
if (countDown == 0) { if (countDown == 0) {
binding.value(); binding.value();
countDown = 1; countDown = 1;
} }
timer = setInterval(() => { timer = setInterval(() => {
countDown--; countDown--;
if (countDown <= 0) { if (countDown <= 0) {
clearInterval(timer); clearInterval(timer);
timer = null; timer = null;
} }
}, 1000); }, 1000);
}; };
el.addEventListener("click", el.__onClick__); el.addEventListener("click", el.__onClick__);
}, },
beforeUnmount(el) { beforeUnmount(el) {
el.removeEventListener("click", el.__onClick__); el.removeEventListener("click", el.__onClick__);
} }
}; };
export default throttle; export default throttle;
+39
View File
@@ -0,0 +1,39 @@
import { computed } from "vue";
import { storeToRefs } from "pinia";
import { EChartsOption } from "echarts";
import { useThemeConfig } from "@/store/modules/theme-config";
interface optionsFn {
(isDark?: boolean, palette?: string[]): EChartsOption;
}
/**
* ECharts图表hooks
* @param sourceOption ECharts配置项函数
* @returns { option: ComputedRef<EChartsOption>, theme: ComputedRef<string | undefined> } ECharts配置项和主题
*/
export function useChart(sourceOption: optionsFn): {
option: ComputedRef<EChartsOption>;
theme: ComputedRef<string | undefined>;
} {
const themeStore = useThemeConfig();
const { darkMode } = storeToRefs(themeStore);
// 预设调色盘,适配arco.design主题:https://visactor.io/vchart/guide/tutorial_docs/Theme/Arco_Design
const palette = ["#4080FF", "#55C5FD", "#FF7D00", "#4CD263", "#A871E3", "#F7BA1E", "#9FDB1D", "#F979B7", "#0FC6C2", "#E865DF"];
// echarts support https://echarts.apache.org/zh/theme-builder.html
const option = computed<EChartsOption>(() => {
return sourceOption(darkMode.value, palette);
});
// 主题
const theme = computed(() => (darkMode.value ? "dark" : undefined));
return {
// ECharts配置项
option,
// 黑暗模式
theme
};
}
+21 -21
View File
@@ -1,21 +1,21 @@
import { computed } from "vue"; import { computed } from "vue";
import { useWindowSize } from "@vueuse/core"; import { useWindowSize } from "@vueuse/core";
interface DeviceSize { interface DeviceSize {
isPc: ComputedRef<boolean>; isPc: ComputedRef<boolean>;
isPad: ComputedRef<boolean>; isPad: ComputedRef<boolean>;
isMobile: ComputedRef<boolean>; isMobile: ComputedRef<boolean>;
} }
/** /**
* 小于 768px:适配移动设备(如手机)。 * 小于 768px:适配移动设备(如手机)。
* 768px - 1024px:适配平板设备。 * 768px - 1024px:适配平板设备。
* 大于 1024px:适配桌面设备。 * 大于 1024px:适配桌面设备。
* @returns PC窗口isPc, 平板窗口isPad, 移动端窗口isMobile * @returns PC窗口isPc, 平板窗口isPad, 移动端窗口isMobile
*/ */
export const useDevicesSize = (): DeviceSize => { export const useDevicesSize = (): DeviceSize => {
const { width } = useWindowSize(); const { width } = useWindowSize();
const isPc = computed(() => width.value > 1024); const isPc = computed(() => width.value > 1024);
const isPad = computed(() => width.value > 768 && width.value <= 1024); const isPad = computed(() => width.value > 768 && width.value <= 1024);
const isMobile = computed(() => width.value <= 768); const isMobile = computed(() => width.value <= 768);
return { isPc, isPad, isMobile }; return { isPc, isPad, isMobile };
}; };
+3 -3
View File
@@ -1,3 +1,3 @@
// 用于全局使用globalProperties // 用于全局使用globalProperties
import { getCurrentInstance, ComponentInternalInstance } from "vue"; import { getCurrentInstance, ComponentInternalInstance } from "vue";
export default () => (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties; export default () => (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties;
+23
View File
@@ -0,0 +1,23 @@
import { computed } from "vue";
import type { ComputedRef } from "vue";
import { useDevicesSize } from "@/hooks/useDevicesSize";
interface LayoutModel {
formLayout: ComputedRef<"vertical" | "horizontal">;
tableFixed: ComputedRef<"" | "right">;
descriptionsLayout: ComputedRef<"inline-vertical" | "right">;
descriptionsColumn: (min?: number, max?: number) => number;
dialogWidth: (min?: string, max?: string) => string;
}
export const useLayoutModel = (): LayoutModel => {
const { isMobile } = useDevicesSize();
const formLayout = computed(() => (isMobile.value ? "vertical" : "horizontal"));
const tableFixed = computed(() => (isMobile.value ? "" : "right"));
const descriptionsLayout = computed(() => (isMobile.value ? "inline-vertical" : "right"));
const descriptionsColumn = (min: number = 1, max: number = 2) => (isMobile.value ? min : max);
const dialogWidth = (min: string = "40%", max: string = "95%") => (isMobile.value ? max : min);
return { formLayout, tableFixed, descriptionsLayout, descriptionsColumn, dialogWidth };
};
+29 -29
View File
@@ -1,29 +1,29 @@
/** /**
* 菜单处理hooks,内置多种菜单处理场景 * 菜单处理hooks,内置多种菜单处理场景
* @returns 菜单处理方法 * @returns 菜单处理方法
*/ */
export const useMenuMethod = () => { export const useMenuMethod = () => {
/** /**
* 多级菜单的显示隐藏 * 多级菜单的显示隐藏
* @param {Menu.MenuOptions} item 菜单的item * @param {Menu.MenuOptions} item 菜单的item
* @returns type:1为目录,并且不隐藏,返回true,否则返回false * @returns type:1为目录,并且不隐藏,返回true,否则返回false
*/ */
const menuShow = (item: Menu.MenuOptions) => { const menuShow = (item: Menu.MenuOptions) => {
if (item.meta.type == 1 && !item.meta.hide) return true; if (item.meta.type == 1 && !item.meta.hide) return true;
return false; return false;
}; };
/** /**
* 单级菜单的显示隐藏 * 单级菜单的显示隐藏
* @param {Menu.MenuOptions} item 菜单的item * @param {Menu.MenuOptions} item 菜单的item
* @returns type:2为菜单,并且单级菜单不隐藏,返回true,否则返回false * @returns type:2为菜单,并且单级菜单不隐藏,返回true,否则返回false
*/ */
const aMenuShow = (item: Menu.MenuOptions) => { const aMenuShow = (item: Menu.MenuOptions) => {
if (item.meta.type == 2 && !item.meta.hide) return true; if (item.meta.type == 2 && !item.meta.hide) return true;
return false; return false;
}; };
return { return {
menuShow, menuShow,
aMenuShow aMenuShow
}; };
}; };
+88 -83
View File
@@ -1,83 +1,88 @@
import pinia from "@/store/index"; import pinia from "@/store/index";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useRouteConfigStore } from "@/store/modules/route-config"; import { useRouteConfigStore } from "@/store/modules/route-config";
import { findCategoryById, findPathOfParentNode } from "@/utils/tree-tools"; import { findCategoryById, findPathOfParentNode } from "@/utils/tree-tools";
/** /**
* 路由处理hooks,内置多种路由处理场景 * 路由处理hooks,内置多种路由处理场景
* @returns 路由方法 * @returns 路由方法
*/ */
export const useRoutingMethod = () => { export const useRoutingMethod = () => {
/** /**
* 从一维路由中查找路由 * 从一维路由中查找路由
* @param {string} path 路由的path * @param {string} path 路由的path
* @returns 查找到的路由,undefined则表示未找到 * @returns 查找到的路由,undefined则表示未找到
*/ */
const findLinearArray = (path: string) => { const findLinearArray = (path: string) => {
const routerStore = useRouteConfigStore(pinia); const routerStore = useRouteConfigStore(pinia);
const { routeTree } = storeToRefs(routerStore); const { routeTree } = storeToRefs(routerStore);
return findCategoryById(routeTree.value, "path", path); return findCategoryById(routeTree.value, "path", path);
}; };
/** /**
* 根据当前路由找到所有直属父级路由 * 根据当前路由找到所有直属父级路由
* @param {string} path 路由的path * @param {string} path 路由的path
* @returns 查找到的所有父级路由,未找到则null * @returns 查找到的所有父级路由,未找到则null
*/ */
const getAllParentRoute = (path: string) => { const getAllParentRoute = (path: string) => {
const routerStore = useRouteConfigStore(pinia); const routerStore = useRouteConfigStore(pinia);
const { routeTree } = storeToRefs(routerStore); const { routeTree } = storeToRefs(routerStore);
return findPathOfParentNode(routeTree.value, "path", path); return findPathOfParentNode(routeTree.value, "path", path);
}; };
/** /**
* 从一维路由中判断路由是否存在 * 从一维路由中判断路由是否存在
* @param {string} key 路由的name * @param {string} key 路由的name
* @returns 路由是否存在,true存在 false不存在 * @returns 路由是否存在,true存在 false不存在
*/ */
const hasRoute = (key: string) => { const hasRoute = (key: string) => {
const routerStore = useRouteConfigStore(pinia); const routerStore = useRouteConfigStore(pinia);
const { routeList } = storeToRefs(routerStore); const { routeList } = storeToRefs(routerStore);
return routeList.value.some((item: Menu.MenuOptions) => item.name == key); return routeList.value.some((item: Menu.MenuOptions) => item.name == key);
}; };
/** /**
* 从tabs路由中查找路由 * 从tabs路由中查找路由
* @param {string} key 路由的name * @param {string} key 路由的name
* @returns 查找到的路由,undefined则表示未找到 * @returns 查找到的路由,undefined则表示未找到
*/ */
const findTagsList = (key: string) => { const findTagsList = (key: string) => {
const routerStore = useRouteConfigStore(pinia); const routerStore = useRouteConfigStore(pinia);
const { tabsList } = storeToRefs(routerStore); const { tabsList } = storeToRefs(routerStore);
return tabsList.value.find((item: Menu.MenuOptions) => item.name == key); return tabsList.value.find((item: Menu.MenuOptions) => item.name == key);
}; };
/** /**
* 处理外链跳转,打开一个新窗口并根据url跳转 * 处理外链跳转,打开一个新窗口并根据url跳转
* @param {any} route 路由 * @param {any} route 路由
*/ */
const openExternalLinks = (route: any) => { const openExternalLinks = (route: any) => {
// 处理外链跳转 // 处理外链跳转
if (route.meta.link && !route.meta.iframe) { if (route.meta.link && !route.meta.iframe) {
window.open(route.meta.link as string, "_blank"); window.open(route.meta.link as string, "_blank");
} }
}; };
/** /**
* 检测是否是动态匹配路由,如果是动态匹配路由,则path必然带有"/:"字样,例如:/user/:id * 检测是否是动态匹配路由,如果是动态匹配路由,则path必然带有"/:"字样,例如:/user/:id
* @param {string} path 路由path * @param {string} path 路由path
* @returns 是否是动态匹配路由 * @returns 是否是动态匹配路由
*/ */
const isDynamicRoute = (path: string) => { const isDynamicRoute = (route: any) => {
return path.includes("/:"); // to.matched 包含了当前路由匹配到的所有层级(包括父级 layout 等)
}; // 我们主要关心叶子节点或包含参数的节点
return route.matched.some((record: any) => {
return { // record.path 是定义时的路径,如 "/user/:id"
findLinearArray, return record.path.includes("/:");
getAllParentRoute, });
findTagsList, };
openExternalLinks,
isDynamicRoute, return {
hasRoute findLinearArray,
}; getAllParentRoute,
}; findTagsList,
openExternalLinks,
isDynamicRoute,
hasRoute
};
};
+99 -99
View File
@@ -1,99 +1,99 @@
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config"; import { useThemeConfig } from "@/store/modules/theme-config";
import { generate, getRgbStr } from "@arco-design/color"; import { generate, getRgbStr } from "@arco-design/color";
/** /**
* 主题处理hooks,内置多种主题处理场景 * 主题处理hooks,内置多种主题处理场景
* @returns 主题方法 * @returns 主题方法
*/ */
export const useThemeMethods = () => { export const useThemeMethods = () => {
/** /**
* @description: 初始化主题 * @description: 初始化主题
*/ */
const initTheme = () => { const initTheme = () => {
// 黑暗模式和主题色 // 黑暗模式和主题色
setDarkMode(); setDarkMode();
// 色弱模式和灰色模式 // 色弱模式和灰色模式
const themeStore = useThemeConfig(); const themeStore = useThemeConfig();
const { grayMode } = storeToRefs(themeStore); const { grayMode } = storeToRefs(themeStore);
if (grayMode.value) { if (grayMode.value) {
setGray(); setGray();
} else { } else {
setColorWeak(); setColorWeak();
} }
}; };
/** /**
* @description: 暗黑模式 * @description: 暗黑模式
*/ */
const setDarkMode = () => { const setDarkMode = () => {
const themeStore = useThemeConfig(); const themeStore = useThemeConfig();
const { darkMode, asideDark } = storeToRefs(themeStore); const { darkMode, asideDark } = storeToRefs(themeStore);
if (darkMode.value) { if (darkMode.value) {
// 设置为暗黑主题 // 设置为暗黑主题
document.body.setAttribute("arco-theme", "dark"); document.body.setAttribute("arco-theme", "dark");
asideDark.value = false; // 黑暗模式与侧边栏深色互斥 asideDark.value = false; // 黑暗模式与侧边栏深色互斥
} else { } else {
// 恢复亮色主题 // 恢复亮色主题
document.body.removeAttribute("arco-theme"); document.body.removeAttribute("arco-theme");
} }
// 黑暗模式切换后需要更新主题色 // 黑暗模式切换后需要更新主题色
setThemeColor(); setThemeColor();
}; };
/** /**
* @description: 主题色设置 * @description: 主题色设置
*/ */
const setThemeColor = () => { const setThemeColor = () => {
const themeStore = useThemeConfig(); const themeStore = useThemeConfig();
const { themeColor, darkMode } = storeToRefs(themeStore); const { themeColor, darkMode } = storeToRefs(themeStore);
// 对于给定的颜色,使用算法生成包含10种颜色的渐变样本。这适用于光模式和暗模式。 // 对于给定的颜色,使用算法生成包含10种颜色的渐变样本。这适用于光模式和暗模式。
let list = generate(themeColor.value, { list: true, dark: darkMode.value }); let list = generate(themeColor.value, { list: true, dark: darkMode.value });
list.forEach((color: string, index: number) => { list.forEach((color: string, index: number) => {
// https://arco.design/palette/list // https://arco.design/palette/list
// arco的颜色等级为1-10,这里需要index+1 // arco的颜色等级为1-10,这里需要index+1
document.body.style.setProperty(`--primary-${index + 1}`, getRgbStr(color)); document.body.style.setProperty(`--primary-${index + 1}`, getRgbStr(color));
}); });
}; };
/** /**
* @description: 色弱模式 * @description: 色弱模式
*/ */
const setColorWeak = () => { const setColorWeak = () => {
// 获取html // 获取html
const htmlCase = document.querySelector("html") as HTMLHtmlElement | null; const htmlCase = document.querySelector("html") as HTMLHtmlElement | null;
if (!htmlCase) return; if (!htmlCase) return;
const themeStore = useThemeConfig(); const themeStore = useThemeConfig();
const { colorWeakMode, grayMode } = storeToRefs(themeStore); const { colorWeakMode, grayMode } = storeToRefs(themeStore);
if (colorWeakMode.value) { if (colorWeakMode.value) {
grayMode.value = false; // 色弱模式和灰色模式互斥 grayMode.value = false; // 色弱模式和灰色模式互斥
htmlCase.style.filter = "invert(80%)"; // 反转色80% htmlCase.style.filter = "invert(80%)"; // 反转色80%
} else { } else {
htmlCase.style.filter = ""; htmlCase.style.filter = "";
} }
}; };
/** /**
* @description: 灰色模式 * @description: 灰色模式
*/ */
const setGray = () => { const setGray = () => {
// 获取html // 获取html
const htmlCase = document.querySelector("html") as HTMLHtmlElement | null; const htmlCase = document.querySelector("html") as HTMLHtmlElement | null;
if (!htmlCase) return; if (!htmlCase) return;
const themeStore = useThemeConfig(); const themeStore = useThemeConfig();
const { colorWeakMode, grayMode } = storeToRefs(themeStore); const { colorWeakMode, grayMode } = storeToRefs(themeStore);
if (grayMode.value) { if (grayMode.value) {
colorWeakMode.value = false; // 色弱模式和灰色模式互斥 colorWeakMode.value = false; // 色弱模式和灰色模式互斥
htmlCase.style.filter = "grayscale(100%)"; // 灰度100% htmlCase.style.filter = "grayscale(100%)"; // 灰度100%
} else { } else {
htmlCase.style.filter = ""; htmlCase.style.filter = "";
} }
}; };
return { return {
initTheme, initTheme,
setDarkMode, setDarkMode,
setThemeColor, setThemeColor,
setColorWeak, setColorWeak,
setGray setGray
}; };
}; };
+39 -39
View File
@@ -1,39 +1,39 @@
import { createI18n } from "vue-i18n"; import { createI18n } from "vue-i18n";
import zhCN from "@/lang/modules/zhCN"; import zhCN from "@/lang/modules/zhCN";
import enUS from "@/lang/modules/enUS"; import enUS from "@/lang/modules/enUS";
/* 获取语言 */ /* 获取语言 */
const getLang = () => { const getLang = () => {
let store = localStorage.getItem("theme-config"); let store = localStorage.getItem("theme-config");
if (store) { if (store) {
return JSON.parse(store)?.language || "zh-CN"; return JSON.parse(store)?.language || "zh-CN";
} else { } else {
return "zh-CN"; return "zh-CN";
} }
}; };
/* 这里必须是messages名称 */ /* 这里必须是messages名称 */
const messages = { const messages = {
"zh-CN": zhCN, "zh-CN": zhCN,
"en-US": enUS "en-US": enUS
}; };
const i18n = createI18n({ const i18n = createI18n({
legacy: false, // Composition API模式需要设为false legacy: false, // Composition API模式需要设为false
globalInjection: true, // 全局生效: $ globalInjection: true, // 全局生效: $
locale: getLang(), // 默认语言 locale: getLang(), // 默认语言
messages, // 数据源 messages, // 数据源
missing: (_: string, key: string) => { missing: (_: string, key: string) => {
return removeBeforeFirstDot(key); return removeBeforeFirstDot(key);
} }
}); });
/** /**
* @param { string } str 国际化key * @param { string } str 国际化key
* @returns 去掉第一个点之前的字符串,例如:"menu.home" => "home",否则返回原字符串 * @returns 去掉第一个点之前的字符串,例如:"menu.home" => "home",否则返回原字符串
*/ */
function removeBeforeFirstDot(str: string) { function removeBeforeFirstDot(str: string) {
const dotIndex = str.indexOf("."); const dotIndex = str.indexOf(".");
return dotIndex >= 0 ? str.slice(dotIndex + 1) : str; return dotIndex >= 0 ? str.slice(dotIndex + 1) : str;
} }
export default i18n; export default i18n;
+139 -119
View File
@@ -1,119 +1,139 @@
export default { export default {
system: { system: {
["login"]: "login", ["login"]: "login",
["not-power"]: "No permission", ["not-power"]: "No permission",
["not-found"]: "Page not found", ["not-found"]: "Page not found",
["zh-CN"]: "中文", ["zh-CN"]: "中文",
["en-US"]: "English", ["en-US"]: "English",
["refresh"]: "refresh", ["refresh"]: "refresh",
["close-current"]: "close current", ["close-current"]: "close current",
["close-left-side"]: "close left side", ["close-left-side"]: "close left side",
["close-right-side"]: "close right side", ["close-right-side"]: "close right side",
["close-other"]: "close other", ["close-other"]: "close other",
["close-all"]: "close all", ["close-all"]: "close all",
["switch-to-night-mode"]: "switch to night mode", ["switch-to-night-mode"]: "switch to night mode",
["switch-to-daytime-mode"]: "switch to daytime mode", ["switch-to-daytime-mode"]: "switch to daytime mode",
["full-screen"]: "full screen", ["full-screen"]: "full screen",
["exit-full-screen"]: "exit full screen", ["exit-full-screen"]: "exit full screen",
["system-settings"]: "system settings", ["system-settings"]: "system settings",
["theme-settings"]: "theme settings", ["theme-settings"]: "theme settings",
["personal-information"]: "personal information", ["navigate mode"]: "navigate mode",
["change-password"]: "change password", ["personal-information"]: "personal information",
["project-address"]: "project address", ["change-password"]: "change password",
["logout"]: "logout", ["project-address"]: "project address",
["notice"]: "Notice", ["logout"]: "logout",
["message"]: "Message", ["notice"]: "Notice",
["backlog"]: "Backlog", ["message"]: "Message",
["switch-language-to-preview"]: "Please switch the language to preview the internationalization effect", ["backlog"]: "Backlog",
["please-enter-something"]: "Please enter something" ["switch-language-to-preview"]: "Please switch the language to preview the internationalization effect",
}, ["please-enter-something"]: "please enter something",
menu: { ["color weakness mode"]: "color weakness mode",
["home"]: "home", ["grey mode"]: "grey mode",
["file"]: "file", ["sidebar is dark"]: "sidebar is dark",
["document-library"]: "document-library", ["page transition"]: "page transition",
["table"]: "table", ["interface settings"]: "interface settings",
["common-table"]: "common-table", ["menu folding"]: "menu folding",
["custom-table"]: "custom-table", ["menu accordion"]: "menu accordion",
["form"]: "form", ["breadcrumb"]: "breadcrumb",
["common-form"]: "common-form", ["tab bar"]: "tab bar",
["step-form"]: "step-form", ["page footer"]: "page footer",
["multilevel"]: "multilevel", ["watermark settings"]: "watermark settings",
["second-1"]: "second-1", ["watermark color"]: "watermark color",
["second-2"]: "second-2", ["watermark text"]: "watermark text",
["third-1"]: "third-1", ["watermark size"]: "watermark size",
["third-2"]: "third-2", ["watermark angle"]: "watermark angle",
["third-3"]: "third-3", ["watermark gap"]: "watermark gap",
["third-4"]: "third-4", ["system settings"]: "system settings",
["third-5"]: "third-5", ["anti-debugging"]: "anti-debugging",
["third-6"]: "third-6", ["please select"]: "please select"
["third-7"]: "third-7", },
["third-8"]: "third-8", menu: {
["third-9"]: "third-9", ["home"]: "home",
["component"]: "component", ["file"]: "file",
["player"]: "player", ["document-library"]: "document-library",
["print"]: "print", ["table"]: "table",
["draggable"]: "draggable", ["common-table"]: "common-table",
["editor"]: "editor", ["custom-table"]: "custom-table",
["newbie"]: "newbie", ["form"]: "form",
["icon-selector"]: "icon-selector", ["common-form"]: "common-form",
["user-center"]: "user-center", ["step-form"]: "step-form",
["fingerprintjs2"]: "fingerprintjs2", ["multilevel"]: "multilevel",
["barcode"]: "barcode", ["second-1"]: "second-1",
["qrcode"]: "qrcode", ["second-2"]: "second-2",
["pinyin"]: "pinyin", ["third-1"]: "third-1",
["markdown"]: "Markdown", ["third-2"]: "third-2",
["directive"]: "directive", ["third-3"]: "third-3",
["anti-shake"]: "anti-shake", ["third-4"]: "third-4",
["throttle"]: "throttle", ["third-5"]: "third-5",
["test-directive"]: "test-directive", ["third-6"]: "third-6",
["personal"]: "personal", ["third-7"]: "third-7",
["userinfo"]: "userinfo", ["third-8"]: "third-8",
["user-settings"]: "user-settings", ["third-9"]: "third-9",
["system"]: "system", ["component"]: "component",
["account"]: "account", ["player"]: "player",
["role"]: "role", ["print"]: "print",
["menu"]: "menu", ["draggable"]: "draggable",
["division"]: "division", ["editor"]: "editor",
["dictionary"]: "dictionary", ["newbie"]: "newbie",
["log"]: "log", ["icon-selector"]: "icon-selector",
["about"]: "about", ["user-center"]: "user-center",
["link"]: "link", ["fingerprintjs2"]: "fingerprintjs2",
["internal"]: "internal", ["barcode"]: "barcode",
["uigradients"]: "uigradients", ["qrcode"]: "qrcode",
["color-taking-tool"]: "color-taking-tool", ["pinyin"]: "pinyin",
["grid-generator"]: "grid-generator", ["markdown"]: "Markdown",
["external"]: "external", ["directive"]: "directive",
["vue"]: "vue", ["anti-shake"]: "anti-shake",
["vite"]: "vite", ["throttle"]: "throttle",
["github"]: "github", ["test-directive"]: "test-directive",
["SnowAdmin-Docs"]: "SnowAdmin-Docs", ["personal"]: "personal",
["juejin"]: "juejin", ["userinfo"]: "userinfo",
["disable-menu"]: "disable-menu", ["user-settings"]: "user-settings",
["hide-menu"]: "hide-menu", ["system"]: "system",
["system-monitor"]: "system monitor", ["account"]: "account",
["onlineuser"]: "online user", ["role"]: "role",
["crontab"]: "crontab", ["menu"]: "menu",
["crontab-logs"]: "crontab logs", ["division"]: "division",
["i18n"]: "i18n", ["dictionary"]: "dictionary",
["amap"]: "amap", ["log"]: "log",
["permission"]: "permission", ["about"]: "about",
["btn-perm"]: "btn perm", ["link"]: "link",
["admin-page"]: "admin page", ["internal"]: "internal",
["common-page"]: "common page", ["uigradients"]: "uigradients",
["functions"]: "functions", ["color-taking-tool"]: "color-taking-tool",
["routing-operation"]: "routing operation", ["grid-generator"]: "grid-generator",
["common-route"]: "common route", ["external"]: "external",
["dynamic-route"]: "dynamic route", ["vue"]: "vue",
["audio"]: "audio", ["vite"]: "vite",
["recorder"]: "recorder", ["github"]: "github",
["virtual-list"]: "virtual-list", ["SnowAdmin-Docs"]: "SnowAdmin-Docs",
["common-tools"]: "common tools", ["juejin"]: "juejin",
["tree-tools"]: "tree-tools", ["disable-menu"]: "disable-menu",
["file-tools"]: "file-tools", ["hide-menu"]: "hide-menu",
["verify-tools"]: "verify tools", ["system-monitor"]: "system monitor",
["common-layouts"]: "common layouts", ["onlineuser"]: "online user",
["data-screen"]: "data screen", ["crontab"]: "crontab",
["thin-preview"]: "thin preview", ["crontab-logs"]: "crontab logs",
["test"]: "test" ["i18n"]: "i18n",
} ["amap"]: "amap",
}; ["permission"]: "permission",
["btn-perm"]: "btn perm",
["admin-page"]: "admin page",
["common-page"]: "common page",
["functions"]: "functions",
["routing-operation"]: "routing operation",
["common-route"]: "common route",
["dynamic-route"]: "dynamic route",
["audio"]: "audio",
["recorder"]: "recorder",
["virtual-list"]: "virtual-list",
["common-tools"]: "common tools",
["tree-tools"]: "tree-tools",
["file-tools"]: "file-tools",
["verify-tools"]: "verify tools",
["common-layouts"]: "common layouts",
["data-screen"]: "data screen",
["thin-preview"]: "thin preview",
["test"]: "test"
}
};
+148 -128
View File
@@ -1,128 +1,148 @@
export default { export default {
system: { system: {
["login"]: "登录", ["login"]: "登录",
["not-power"]: "没有权限", ["not-power"]: "没有权限",
["not-found"]: "未找到页面", ["not-found"]: "未找到页面",
["zh-CN"]: "中文", ["zh-CN"]: "中文",
["en-US"]: "English", ["en-US"]: "English",
["refresh"]: "刷新", ["refresh"]: "刷新",
["close-current"]: "关闭当前", ["close-current"]: "关闭当前",
["close-left-side"]: "关闭左侧", ["close-left-side"]: "关闭左侧",
["close-right-side"]: "关闭右侧", ["close-right-side"]: "关闭右侧",
["close-other"]: "关闭其它", ["close-other"]: "关闭其它",
["close-all"]: "关闭全部", ["close-all"]: "关闭全部",
["switch-to-night-mode"]: "切换黑夜模式", ["switch-to-night-mode"]: "切换黑夜模式",
["switch-to-daytime-mode"]: "切换白天模式", ["switch-to-daytime-mode"]: "切换白天模式",
["full-screen"]: "全屏", ["full-screen"]: "全屏",
["exit-full-screen"]: "退出全屏", ["exit-full-screen"]: "退出全屏",
["system-settings"]: "系统设置", ["system-settings"]: "系统设置",
["theme-settings"]: "主题设置", ["theme-settings"]: "主题设置",
["personal-information"]: "个人信息", ["navigate mode"]: "导航模式",
["change-password"]: "修改密码", ["personal-information"]: "个人信息",
["project-address"]: "项目地址", ["change-password"]: "修改密码",
["logout"]: "退出登录", ["project-address"]: "项目地址",
["notice"]: "通知", ["logout"]: "退出登录",
["message"]: "消息", ["notice"]: "通知",
["backlog"]: "待办", ["message"]: "消息",
["switch-language-to-preview"]: "请切换语言来预览国际化效果", ["backlog"]: "待办",
["please-enter-something"]: "请输入" ["switch-language-to-preview"]: "请切换语言来预览国际化效果",
}, ["please-enter-something"]: "请输入",
menu: { ["color weakness mode"]: "色弱模式",
["home"]: "首页", ["grey mode"]: "灰色模式",
["wallet"]: "钱包管理", ["sidebar is dark"]: "侧边栏深色",
["order"]: "交易订单", ["page transition"]: "页面过渡",
["rate"]: "汇率监控", ["interface settings"]: "界面设置",
["rate-list"]: "同步记录", ["menu folding"]: "菜单折叠",
["rate-syntax"]: "汇率配置", ["menu accordion"]: "菜单手风琴",
["system-base"]: "基本设置", ["breadcrumb"]: "面包屑",
["system-rpc"]: "区块节点", ["tab bar"]: "标签栏",
["create-order"]: "创建订单", ["page footer"]: "页脚",
["github-api-doc"]: "对接文档", ["watermark settings"]: "水印设置",
["file"]: "文件管理", ["watermark color"]: "水印颜色",
["document-library"]: "文件库", ["watermark text"]: "水印文案",
["table"]: "列表管理", ["watermark size"]: "水印大小",
["common-table"]: "普通列表", ["watermark angle"]: "水印角度",
["custom-table"]: "自定义列表", ["watermark gap"]: "水印间隙",
["form"]: "表单管理", ["system settings"]: "系统设置",
["common-form"]: "普通表单", ["anti-debugging"]: "防调试",
["step-form"]: "分步表单", ["please select"]: "请选择"
["multilevel"]: "多级菜单", },
["second-1"]: "二级菜单-1", menu: {
["second-2"]: "二级菜单-2", ["home"]: "首页",
["third-1"]: "三级菜单-1", ["wallet"]: "钱包管理",
["third-2"]: "三级菜单-2", ["order"]: "交易订单",
["third-3"]: "三级菜单-3", ["rate"]: "汇率监控",
["third-4"]: "三级菜单-4", ["rate-list"]: "同步记录",
["third-5"]: "三级菜单-5", ["rate-syntax"]: "汇率配置",
["third-6"]: "三级菜单-6", ["system-base"]: "基本设置",
["third-7"]: "三级菜单-7", ["system-rpc"]: "区块节点",
["third-8"]: "三级菜单-8", ["create-order"]: "创建订单",
["third-9"]: "三级菜单-9", ["github-api-doc"]: "对接文档",
["component"]: "组件管理", ["file"]: "文件管理",
["player"]: "播放器", ["document-library"]: "文件库",
["print"]: "打印", ["table"]: "列表管理",
["draggable"]: "拖拽", ["common-table"]: "普通列表",
["editor"]: "富文本", ["custom-table"]: "自定义列表",
["newbie"]: "新手指引", ["form"]: "表单管理",
["icon-selector"]: "图标选择器", ["common-form"]: "普通表单",
["user-center"]: "用户中心", ["step-form"]: "分步表单",
["fingerprintjs2"]: "浏览器指纹", ["multilevel"]: "多级菜单",
["barcode"]: "条形码", ["second-1"]: "二级菜单-1",
["qrcode"]: "二维码", ["second-2"]: "二级菜单-2",
["pinyin"]: "拼音转换", ["third-1"]: "三级菜单-1",
["markdown"]: "Markdown", ["third-2"]: "三级菜单-2",
["directive"]: "自定义指令", ["third-3"]: "三级菜单-3",
["anti-shake"]: "防抖", ["third-4"]: "三级菜单-4",
["throttle"]: "节流", ["third-5"]: "三级菜单-5",
["test-directive"]: "测试指令", ["third-6"]: "三级菜单-6",
["personal"]: "个人中心", ["third-7"]: "三级菜单-7",
["userinfo"]: "用户信息", ["third-8"]: "三级菜单-8",
["user-settings"]: "用户设置", ["third-9"]: "三级菜单-9",
["system"]: "系统管理", ["component"]: "组件管理",
["account"]: "账号管理", ["player"]: "播放器",
["role"]: "角色管理", ["print"]: "打印",
["menu"]: "菜单管理", ["draggable"]: "拖拽",
["division"]: "部门管理", ["editor"]: "富文本",
["dictionary"]: "字典管理", ["newbie"]: "新手指引",
["log"]: "系统日志", ["icon-selector"]: "图标选择器",
["about"]: "关于项目", ["user-center"]: "用户中心",
["link"]: "外部链接", ["fingerprintjs2"]: "浏览器指纹",
["internal"]: "内部", ["barcode"]: "条形码",
["uigradients"]: "渐变配色", ["qrcode"]: "二维码",
["color-taking-tool"]: "取色工具", ["pinyin"]: "拼音转换",
["grid-generator"]: "网格生成器", ["markdown"]: "Markdown",
["external"]: "外部", ["directive"]: "自定义指令",
["vue"]: "vue官网", ["anti-shake"]: "防抖",
["vite"]: "vite官网", ["throttle"]: "节流",
["github"]: "github", ["test-directive"]: "测试指令",
["SnowAdmin-Docs"]: "SnowAdmin文档", ["personal"]: "个人中心",
["juejin"]: "掘金", ["userinfo"]: "用户信息",
["disable-menu"]: "停用菜单", ["user-settings"]: "用户设置",
["hide-menu"]: "隐藏菜单", ["system"]: "系统管理",
["system-monitor"]: "系统监控", ["account"]: "账号管理",
["onlineuser"]: "在线用户", ["role"]: "角色管理",
["crontab"]: "定时任务", ["menu"]: "菜单管理",
["crontab-logs"]: "任务日志", ["division"]: "部门管理",
["i18n"]: "国际化", ["dictionary"]: "字典管理",
["amap"]: "高德地图", ["log"]: "系统日志",
["permission"]: "权限测试", ["about"]: "关于项目",
["btn-perm"]: "按钮权限", ["link"]: "外部链接",
["admin-page"]: "管理员页面", ["internal"]: "内部",
["common-page"]: "普通角色页面", ["uigradients"]: "渐变配色",
["functions"]: "常用功能", ["color-taking-tool"]: "取色工具",
["routing-operation"]: "路由操作", ["grid-generator"]: "网格生成器",
["common-route"]: "普通路由", ["external"]: "外部",
["dynamic-route"]: "动态路由", ["vue"]: "vue官网",
["audio"]: "音频", ["vite"]: "vite官网",
["recorder"]: "录音", ["github"]: "github",
["virtual-list"]: "虚拟列表", ["SnowAdmin-Docs"]: "SnowAdmin文档",
["common-tools"]: "常用工具类", ["juejin"]: "掘金",
["tree-tools"]: "树处理工具类", ["disable-menu"]: "停用菜单",
["file-tools"]: "文件工具类", ["hide-menu"]: "隐藏菜单",
["verify-tools"]: "校验工具类", ["system-monitor"]: "系统监控",
["common-layouts"]: "常用布局", ["onlineuser"]: "在线用户",
["data-screen"]: "数据大屏", ["crontab"]: "定时任务",
["thin-preview"]: "极简版预览", ["crontab-logs"]: "任务日志",
["test"]: "测试" ["i18n"]: "国际化",
} ["amap"]: "高德地图",
}; ["permission"]: "权限测试",
["btn-perm"]: "按钮权限",
["admin-page"]: "管理员页面",
["common-page"]: "普通角色页面",
["functions"]: "常用功能",
["routing-operation"]: "路由操作",
["common-route"]: "普通路由",
["dynamic-route"]: "动态路由",
["audio"]: "音频",
["recorder"]: "录音",
["virtual-list"]: "虚拟列表",
["common-tools"]: "常用工具类",
["tree-tools"]: "树处理工具类",
["file-tools"]: "文件工具类",
["verify-tools"]: "校验工具类",
["common-layouts"]: "常用布局",
["data-screen"]: "数据大屏",
["thin-preview"]: "极简版预览",
["test"]: "测试"
}
};
+75 -75
View File
@@ -1,75 +1,75 @@
<template> <template>
<div :class="asideDark ? 'aside dark' : 'aside'"> <div :class="asideDark ? 'aside dark' : 'aside'">
<Logo /> <Logo />
<a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220"> <a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeTree" /></a-scrollbar> <a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeTree" /></a-scrollbar>
</a-layout-sider> </a-layout-sider>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue"; import Logo from "@/layout/components/Logo/index.vue";
import Menu from "@/layout/components/Menu/index.vue"; import Menu from "@/layout/components/Menu/index.vue";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config"; import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config"; import { useRouteConfigStore } from "@/store/modules/route-config";
const themeStore = useThemeConfig(); const themeStore = useThemeConfig();
const { collapsed, asideDark } = storeToRefs(themeStore); const { collapsed, asideDark } = storeToRefs(themeStore);
const routerStore = useRouteConfigStore(); const routerStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routerStore); const { routeTree } = storeToRefs(routerStore);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.aside { .aside {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh; height: 100vh;
} }
.dark { .dark {
background: #232324; background: #232324;
} }
.layout_side { .layout_side {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
.scrollbar { .scrollbar {
height: 100%; height: 100%;
} }
} }
// 修改左侧滚动条宽度 // 修改左侧滚动条宽度
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) { :deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px; width: 4px;
margin-left: 8px; margin-left: 8px;
} }
// 去掉右侧阴影并替换为边线 // 去掉右侧阴影并替换为边线
:deep(.arco-layout-sider-light) { :deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2; border-right: $border-1 solid $color-border-2;
box-shadow: unset; box-shadow: unset;
} }
// 解决折叠菜单的icon不居中问题 // 解决折叠菜单的icon不居中问题
:deep(.arco-menu-vertical.arco-menu-collapsed) { :deep(.arco-menu-vertical.arco-menu-collapsed) {
// 消除icon的自带padding值,并且让元素居中 // 消除icon的自带padding值,并且让元素居中
.arco-menu-has-icon { .arco-menu-has-icon {
justify-content: center; justify-content: center;
padding: 0; padding: 0;
} }
// 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙 // 消除icon的自带margin-right值,并且设置icon的padding值以保留icon空隙
.arco-menu-icon { .arco-menu-icon {
padding: 10px 0; padding: 10px 0;
margin-right: 0; margin-right: 0;
} }
// 消除title占位 // 消除title占位
.arco-menu-title { .arco-menu-title {
display: none; display: none;
} }
} }
// 去掉sider背景 // 去掉sider背景
.arco-layout-sider { .arco-layout-sider {
background: unset; background: unset;
} }
</style> </style>
+2 -1
View File
@@ -2,13 +2,14 @@
<a-layout-footer class="footer"> <a-layout-footer class="footer">
<div class="footer_title"> <div class="footer_title">
<div class="left-placeholder"></div> <div class="left-placeholder"></div>
<span @click="onBEpusdt" class="primary-copyright">© 2026 BEpusdt. All rights reserved.</span> <span @click="onBEpusdt" class="primary-copyright">{{ currentYear }} © BEpusdt. All rights reserved.</span>
<span class="secondary-info">Powered by SnowAdmin</span> <span class="secondary-info">Powered by SnowAdmin</span>
</div> </div>
</a-layout-footer> </a-layout-footer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const currentYear = ref(new Date().getFullYear());
const onBEpusdt = () => { const onBEpusdt = () => {
window.open("https://github.com/v03413/BEpusdt", "_blank"); window.open("https://github.com/v03413/BEpusdt", "_blank");
}; };
@@ -1,81 +1,81 @@
<template> <template>
<div id="system-breadcrumb" class="breadcrumb" v-if="!isMobile && isBreadcrumb"> <div id="system-breadcrumb" class="breadcrumb" v-if="!isMobile && isBreadcrumb">
<a-space direction="vertical"> <a-space direction="vertical">
<a-breadcrumb> <a-breadcrumb>
<a-breadcrumb-item v-for="(item, index) in breadcrumb" :key="item.path" :class="transition"> <a-breadcrumb-item v-for="(item, index) in breadcrumb" :key="item.path" :class="transition">
<span v-if="index === breadcrumb.length - 1" class="main_button">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span> <span v-if="index === breadcrumb.length - 1" class="main_button">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span>
<span v-else class="route_button" @click="onBreadcrumb(item)">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span> <span v-else class="route_button" @click="onBreadcrumb(item)">{{ $t(`menu.${item?.meta?.title || ""}`) }}</span>
</a-breadcrumb-item> </a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
</a-space> </a-space>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config"; import { useThemeConfig } from "@/store/modules/theme-config";
import { useRouteConfigStore } from "@/store/modules/route-config"; import { useRouteConfigStore } from "@/store/modules/route-config";
import { useDevicesSize } from "@/hooks/useDevicesSize"; import { useDevicesSize } from "@/hooks/useDevicesSize";
import { findPathOfParentNode } from "@/utils/tree-tools"; import { findPathOfParentNode } from "@/utils/tree-tools";
import { HOME_PATH } from "@/config/index"; import { HOME_PATH } from "@/config/index";
const themeStore = useThemeConfig(); const themeStore = useThemeConfig();
const { isBreadcrumb, transitionPage } = storeToRefs(themeStore); const { isBreadcrumb, transitionPage } = storeToRefs(themeStore);
const routeConfigStore = useRouteConfigStore(); const routeConfigStore = useRouteConfigStore();
const { routeTree } = storeToRefs(routeConfigStore); const { routeTree } = storeToRefs(routeConfigStore);
const { isMobile } = useDevicesSize(); const { isMobile } = useDevicesSize();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
/** /**
* 获取面包屑 * 获取面包屑
* 根据当前路由信息获取,route.matched可以获取当前路由的所有父级路由信息 * 根据当前路由信息获取,route.matched可以获取当前路由的所有父级路由信息
* 如果当前路由是home路由,则只返回当前路由信息(说明当前就是顶层) * 如果当前路由是home路由,则只返回当前路由信息(说明当前就是顶层)
* 否则返回所有父级路由信息,顶层路由重写为首页 * 否则返回所有父级路由信息,顶层路由重写为首页
*/ */
const breadcrumb = computed(() => { const breadcrumb = computed(() => {
// 如果是首页则直接返回当前路由信息 // 如果是首页则直接返回当前路由信息
if (route.path === HOME_PATH) return [route]; if (route.path === HOME_PATH) return [route];
// 返回路径信息 // 返回路径信息
let list = findPathOfParentNode(routeTree.value, "name", route.name); let list = findPathOfParentNode(routeTree.value, "name", route.name);
if (!list) return []; if (!list) return [];
if (!routeTree.value[0].children) list.unshift(routeTree.value[0]); if (!routeTree.value[0].children) list.unshift(routeTree.value[0]);
return list; return list;
}); });
// 页面过渡 // 页面过渡
const transition = computed(() => { const transition = computed(() => {
if (transitionPage.value === "fadeInOut") { if (transitionPage.value === "fadeInOut") {
return "fadeInOut-enter-active"; return "fadeInOut-enter-active";
} else if (transitionPage.value === "cardInOut") { } else if (transitionPage.value === "cardInOut") {
return "cardInOut-enter-active"; return "cardInOut-enter-active";
} else { } else {
return "fadeOut-enter-active"; return "fadeOut-enter-active";
} }
}); });
// 面包屑跳转 // 面包屑跳转
const onBreadcrumb = (route: any) => { const onBreadcrumb = (route: any) => {
let path = route.redirect || route.path; let path = route.redirect || route.path;
router.replace((path as string) || HOME_PATH); router.replace((path as string) || HOME_PATH);
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.breadcrumb { .breadcrumb {
margin-left: $margin; margin-left: $margin;
overflow: auto; overflow: auto;
.main_button { .main_button {
color: $color-text-1; color: $color-text-1;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
} }
.route_button { .route_button {
color: $color-text-2; color: $color-text-2;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: $color-primary; color: $color-primary;
} }
} }
} }
</style> </style>

Some files were not shown because too many files have changed in this diff Show More