Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeb7ac1f79 | ||
|
|
468fe8b0c2 | ||
|
|
48b7c0b414 | ||
|
|
c8304a05cd | ||
|
|
34127df014 | ||
|
|
f4a225baea | ||
|
|
126905400d | ||
|
|
89bd4caba4 | ||
|
|
c84ca4ab30 | ||
|
|
3be13ebb6f | ||
|
|
584998bf02 | ||
|
|
f14a7680af | ||
|
|
cd6994d611 | ||
|
|
64ab143e0e | ||
|
|
8525dd4722 | ||
|
|
90e672f7f8 | ||
|
|
cb5aed93c6 | ||
|
|
e46706370c | ||
|
|
34e7dc6b81 | ||
|
|
5a0d333f71 | ||
|
|
9f89015722 | ||
|
|
609a850e61 | ||
|
|
43614ee3c5 | ||
|
|
a603e201c1 | ||
|
|
4081e7e5ab | ||
|
|
17b0d1cad1 | ||
|
|
742d05d253 | ||
|
|
1b0df627a5 | ||
|
|
94ba4b7c5b | ||
|
|
14644e00a5 | ||
|
|
be2ef02923 | ||
|
|
6ccd93a161 | ||
|
|
2edf71dee1 | ||
|
|
86251ac054 | ||
|
|
2f4915a808 | ||
|
|
a596ebc875 | ||
|
|
5e7f9ca701 | ||
|
|
0f4346cd5f | ||
|
|
c4d5e20c7a | ||
|
|
56bf320588 | ||
|
|
e6f8112df2 | ||
|
|
30eb6659d8 | ||
|
|
240da52d11 | ||
|
|
a45003ce3d | ||
|
|
f9bdf1f18a | ||
|
|
a5467d3fbb | ||
|
|
f866db9f1b | ||
|
|
b8df9d1d72 | ||
|
|
0e1e22cebb | ||
|
|
9cfd4b6e1c | ||
|
|
8c4ead0169 | ||
|
|
2992a1f032 | ||
|
|
9e7707588f | ||
|
|
0db728dc52 |
@@ -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: 问题类型
|
||||||
|
|||||||
@@ -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天内没有任何活动,现在标记为过时。"
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ conf.toml
|
|||||||
# Added by goreleaser init:
|
# Added by goreleaser init:
|
||||||
dist/
|
dist/
|
||||||
static/web
|
static/web
|
||||||
|
static/secure
|
||||||
*.log
|
*.log
|
||||||
@@ -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,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"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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, "操作成功")
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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
@@ -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
@@ -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
@@ -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)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
@@ -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
@@ -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",
|
||||||
|
|||||||
@@ -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()))
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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
@@ -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(¤t)
|
||||||
|
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)))
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
@@ -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
@@ -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
@@ -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...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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
@@ -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¬ify_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¬ify_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¬ify_url=http://example.com/notify&order_id=20220201030210321&re
|
|||||||
4. 测试回调通知处理逻辑
|
4. 测试回调通知处理逻辑
|
||||||
5. 确认超时和取消场景
|
5. 确认超时和取消场景
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 参考资料
|
## 参考资料
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 104 KiB |
@@ -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 后台 → 支付渠道 → 新增渠道
|

|
||||||
|
|
||||||
### 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 |
@@ -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. 保存配置:点击「保存配置」按钮
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 重要提示
|
||||||
|
填写完配置信息后,点击右上角的 **启用** 开关,然后点击 **保存配置** 按钮。
|
||||||
|
⚠️ **重要提示**:启用支付前,请先前往「站点设置」配置网站地址,否则无法获取支付结果。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 配置字段说明
|
||||||
|
|
||||||
|
**通用字段说明**:
|
||||||
|
- **显示名称**:支付方式在前台显示的名称,用户可自定义
|
||||||
|
- **网关地址**:支付网关服务域名,系统会自动处理接口路径
|
||||||
|
- **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)
|
||||||
@@ -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 源码分析*
|
||||||
|
|
||||||
@@ -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
@@ -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
@@ -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>
|
||||||
|
|
||||||
## 部署验证
|
## 部署验证
|
||||||
|
|
||||||
### 查看容器日志
|
### 查看容器日志
|
||||||
|
|||||||
@@ -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 项目,为本项目的诞生提供了灵感和参考。
|
||||||
@@ -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 节点服务
|
||||||
|
- 性能和稳定性有保障,适合生产环境使用
|
||||||
|
- 提供免费配额,可满足个人单节点的使用需求
|
||||||
|
- 需付费才能获得更高的配额和优先级支持
|
||||||
@@ -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
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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=
|
|
||||||
|
|||||||
+1
-2
File diff suppressed because one or more lines are too long
Vendored
+29
-6
@@ -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
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,5 @@ 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/'
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ dist.zip
|
|||||||
dist.7z
|
dist.7z
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
|||||||
+2
-2
@@ -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
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
/dist/*
|
|
||||||
/public/*
|
|
||||||
public/*
|
|
||||||
stats.html
|
|
||||||
+78
-47
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
### 介绍 📖
|
### 介绍 📖
|
||||||
|
|
||||||
SnowAdmin 是一个清新优雅、高颜值且功能强大的后台管理模板,基于最新的前端技术栈,包括 Vue3, Vite6, TypeScript, Pinia。它内置了丰富的主题配置和组件,代码规范严谨,实现了自动化的文件路由系统。SnowAdmin 为您提供了一站式的后台管理解决方案,无需额外配置,开箱即用。同样是一个快速学习前沿技术的最佳实践。
|
SnowAdmin 是一个清新优雅、高颜值且功能强大的后台管理模板,基于最新的前端技术栈,包括 Vue3, Vite7, TypeScript, Pinia。它内置了丰富的主题配置和组件,代码规范严谨,实现了自动化的文件路由系统。SnowAdmin 为您提供了一站式的后台管理解决方案,无需额外配置,开箱即用。同样是一个快速学习前沿技术的最佳实践。
|
||||||
|
|
||||||
### 版本 📦
|
### 版本 📦
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ SnowAdmin 是一个清新优雅、高颜值且功能强大的后台管理模板
|
|||||||
### 项目功能 🔨
|
### 项目功能 🔨
|
||||||
|
|
||||||
- 清晰的项目架构:结构清晰,优雅易懂,代码全注释
|
- 清晰的项目架构:结构清晰,优雅易懂,代码全注释
|
||||||
- 前沿技术应用:采用 Vue3, Vite6, TypeScript等最新流行的技术栈
|
- 前沿技术应用:采用 Vue3, Vite7, TypeScript等最新流行的技术栈
|
||||||
- 内置RBAC角色权限模型,实现路由、角色、按钮权限访问控制
|
- 内置RBAC角色权限模型,实现路由、角色、按钮权限访问控制
|
||||||
- 使用 Pinia 替代 Vuex,轻量、简单、易用,集成 Pinia 持久化插件
|
- 使用 Pinia 替代 Vuex,轻量、简单、易用,集成 Pinia 持久化插件
|
||||||
- 支持 Arco-Design 组件大小切换、多主题布局、暗黑模式、i18n 国际化
|
- 支持 Arco-Design 组件大小切换、多主题布局、暗黑模式、i18n 国际化
|
||||||
@@ -138,52 +138,83 @@ pnpm install
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
SnowAdmin
|
SnowAdmin
|
||||||
├─ .husky # husky 配置文件
|
├─ .github # GitHub 配置目录
|
||||||
├─ .vscode # VSCode 推荐配置
|
│ └─ ISSUE_TEMPLATE # Issue 模板
|
||||||
├─ build # vite项目配置目录
|
├─ .husky # husky 配置文件
|
||||||
├─ public # 静态资源文件(该文件夹不会被打包)
|
├─ build # vite 项目配置目录
|
||||||
|
├─ node_modules # 依赖包(自动生成)
|
||||||
|
├─ public # 静态资源文件(不会被打包)
|
||||||
├─ src
|
├─ src
|
||||||
│ ├─ api # API 接口管理
|
│ ├─ api # API 接口管理
|
||||||
│ ├─ assets # 静态资源文件
|
│ │ └─ modules # 接口模块
|
||||||
│ ├─ components # 全局组件
|
│ ├─ assets # 静态资源文件
|
||||||
│ ├─ config # 全局配置项
|
│ │ ├─ fonts # 字体文件
|
||||||
│ ├─ directives # 全局自定义指令文件
|
│ │ ├─ img # 图片资源
|
||||||
│ ├─ globals # 全局函数
|
│ │ ├─ logo # Logo 图标
|
||||||
│ ├─ hooks # 常用 Hooks 封装
|
│ │ └─ svgs # SVG 图标
|
||||||
│ ├─ lang # 语言国际化 i18n
|
│ ├─ components # 全局组件(code-view/qrcode/svg-icon等)
|
||||||
│ ├─ layout # 框架布局模块
|
│ ├─ config # 全局配置项
|
||||||
│ ├─ mock # 本地数据mock
|
│ ├─ directives # 全局自定义指令(防抖/节流/权限指令)
|
||||||
│ ├─ router # 路由管理
|
│ ├─ globals # 全局函数
|
||||||
│ ├─ store # pinia store
|
│ ├─ hooks # 常用 Hooks 封装
|
||||||
│ ├─ style # 全局样式文件
|
│ ├─ lang # 语言国际化 i18n
|
||||||
│ ├─ typings # 全局 ts 声明
|
│ ├─ layout # 框架布局模块
|
||||||
│ ├─ utils # 常用工具库
|
│ │ ├─ components # 布局组件(Aside/Header/Footer/Menu/Tabs等)
|
||||||
│ ├─ views # 项目所有页面
|
│ │ └─ layout-* # 布局类型(defaults/head/mixing)
|
||||||
│ ├─ App.vue # 项目主组件
|
│ ├─ mock # 本地数据 mock
|
||||||
│ ├─ main.ts # 项目入口文件
|
│ ├─ router # 路由管理
|
||||||
│ └─ vite-env.d.ts # 指定 ts 识别 vue
|
│ ├─ store # pinia store
|
||||||
├─ .editorconfig # 代码编辑器配置文件
|
│ ├─ style # 全局样式文件
|
||||||
├─ .env # 通用环境配置
|
│ │ ├─ media # 响应式样式
|
||||||
├─ .env.development # 开发环境配置
|
│ │ ├─ model # 动画/滚动条/全局样式
|
||||||
├─ .env.production # 生产环境配置
|
│ │ └─ var # 主题变量
|
||||||
├─ .env.test # 测试环境配置
|
│ ├─ typings # 全局 ts 声明
|
||||||
├─ .eslintignore # 忽略 Eslint 校验
|
│ ├─ utils # 常用工具库
|
||||||
├─ .eslintrc.cjs # Eslint 校验配置文件
|
│ ├─ views # 项目所有页面
|
||||||
├─ .gitignore # 忽略 git 提交
|
│ │ ├─ about # 关于页面
|
||||||
├─ .prettierignore # 忽略 Prettier 格式化
|
│ │ ├─ component # 组件展示页
|
||||||
├─ .prettierrc.cjs # Prettier 格式化配置
|
│ │ ├─ directive # 指令展示页
|
||||||
├─ .stylelintignore # 忽略 Stylelint 校验
|
│ │ ├─ error # 错误页面(401/404/500)
|
||||||
├─ .stylelintrc.cjs # Stylelint 格式化配置
|
│ │ ├─ file # 文件管理
|
||||||
├─ commitlint.config.cjs # git 提交规范配置
|
│ │ ├─ form # 表单页
|
||||||
├─ index.html # 入口 html
|
│ │ ├─ functions # 工具函数演示
|
||||||
├─ LICENSE # 开源协议
|
│ │ ├─ home # 首页
|
||||||
├─ lint-staged.config.cjs # lint-staged 配置文件
|
│ │ ├─ i18n # 国际化演示
|
||||||
├─ package-lock.json # 依赖包包版本锁
|
│ │ ├─ link # 链接演示
|
||||||
├─ package.json # 依赖包管理
|
│ │ ├─ login # 登录页
|
||||||
├─ pnpm-lock.yaml # 依赖包包版本锁
|
│ │ ├─ monitor # 系统监控
|
||||||
├─ README.md # README 介绍
|
│ │ ├─ multilevel # 多级菜单演示
|
||||||
├─ tsconfig.json # typescript 全局配置
|
│ │ ├─ permission # 权限演示
|
||||||
└─ vite.config.ts # vite 全局配置文件
|
│ │ ├─ personal # 个人中心
|
||||||
|
│ │ ├─ system # 系统管理
|
||||||
|
│ │ ├─ table # 表格页
|
||||||
|
│ │ └─ thin-preview # 简洁预览页
|
||||||
|
│ ├─ App.vue # 项目主组件
|
||||||
|
│ ├─ auto-import.d.ts # 自动导入声明
|
||||||
|
│ ├─ components.d.ts # 组件声明
|
||||||
|
│ ├─ main.ts # 项目入口文件
|
||||||
|
│ ├─ style.css # 全局样式入口
|
||||||
|
│ └─ vite-env.d.ts # 指定 ts 识别 vue
|
||||||
|
├─ .editorconfig # 代码编辑器配置文件
|
||||||
|
├─ .env # 通用环境配置
|
||||||
|
├─ .env.development # 开发环境配置
|
||||||
|
├─ .env.production # 生产环境配置
|
||||||
|
├─ .env.test # 测试环境配置
|
||||||
|
├─ .eslintrc-auto-import.json # ESLint 自动导入配置
|
||||||
|
├─ .gitignore # 忽略 git 提交
|
||||||
|
├─ .prettierignore # 忽略 Prettier 格式化
|
||||||
|
├─ .prettierrc.cjs # Prettier 格式化配置
|
||||||
|
├─ .stylelintignore # 忽略 Stylelint 校验
|
||||||
|
├─ .stylelintrc.cjs # Stylelint 格式化配置
|
||||||
|
├─ commitlint.config.cjs # git 提交规范配置
|
||||||
|
├─ eslint.config.js # Eslint 校验配置文件
|
||||||
|
├─ index.html # 入口 html
|
||||||
|
├─ LICENSE # 开源协议
|
||||||
|
├─ lint-staged.config.cjs # lint-staged 配置文件
|
||||||
|
├─ package.json # 依赖包管理
|
||||||
|
├─ pnpm-lock.yaml # 依赖包版本锁
|
||||||
|
├─ README.md # README 介绍
|
||||||
|
└─ vite.config.ts # vite 全局配置文件
|
||||||
```
|
```
|
||||||
|
|
||||||
### 浏览器支持 🌎
|
### 浏览器支持 🌎
|
||||||
|
|||||||
@@ -6,18 +6,13 @@ 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 插件
|
* 创建 vite 插件
|
||||||
* @param viteEnv
|
* @param viteEnv
|
||||||
*/
|
*/
|
||||||
export const createVitePlugins = (viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => {
|
export const createVitePlugins = (_viteEnv: ViteEnv): (PluginOption | PluginOption[])[] => {
|
||||||
const env = viteEnv;
|
|
||||||
return [
|
return [
|
||||||
vue(),
|
vue(),
|
||||||
// esLint 报错信息显示在浏览器界面上
|
|
||||||
eslintPlugin(),
|
|
||||||
vitePluginForArco({
|
vitePluginForArco({
|
||||||
style: "css"
|
style: "css"
|
||||||
}),
|
}),
|
||||||
@@ -56,18 +51,6 @@ export const createVitePlugins = (viteEnv: ViteEnv): (PluginOption | PluginOptio
|
|||||||
extensions: ["vue"],
|
extensions: ["vue"],
|
||||||
// 配置文件生成位置
|
// 配置文件生成位置
|
||||||
dts: "src/components.d.ts"
|
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();
|
|
||||||
`
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,8 +67,7 @@ export default defineConfig([
|
|||||||
"/docs",
|
"/docs",
|
||||||
".husky",
|
".husky",
|
||||||
".local",
|
".local",
|
||||||
"/bin",
|
"/bin"
|
||||||
"/src/mock/*"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
eslintConfigPrettier
|
eslintConfigPrettier
|
||||||
|
|||||||
+14
-17
@@ -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>
|
||||||
+36
-41
@@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+3033
-3873
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
// @see: https://www.prettier.cn
|
// prettier.config.ts
|
||||||
|
|
||||||
module.exports = {
|
// @see: https://www.prettier.cn
|
||||||
|
export default {
|
||||||
// 指定最大换行长度
|
// 指定最大换行长度
|
||||||
printWidth: 130,
|
printWidth: 130,
|
||||||
// 缩进制表符宽度 | 空格数
|
// 缩进制表符宽度 | 空格数
|
||||||
@@ -12,29 +13,29 @@ module.exports = {
|
|||||||
// 使用单引号 (true:单引号,false:双引号)
|
// 使用单引号 (true:单引号,false:双引号)
|
||||||
singleQuote: false,
|
singleQuote: false,
|
||||||
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
|
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
|
||||||
quoteProps: 'as-needed',
|
quoteProps: "as-needed",
|
||||||
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
|
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
|
||||||
jsxSingleQuote: false,
|
jsxSingleQuote: false,
|
||||||
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
|
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
|
||||||
trailingComma: 'none',
|
trailingComma: "none",
|
||||||
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
|
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
|
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
|
||||||
bracketSameLine: false,
|
bracketSameLine: false,
|
||||||
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
|
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
|
||||||
arrowParens: 'avoid',
|
arrowParens: "avoid",
|
||||||
// 指定要使用的解析器,不需要写文件开头的 @prettier
|
// 指定要使用的解析器,不需要写文件开头的 @prettier
|
||||||
requirePragma: false,
|
requirePragma: false,
|
||||||
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
|
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
|
||||||
insertPragma: false,
|
insertPragma: false,
|
||||||
// 用于控制文本是否应该被换行以及如何进行换行
|
// 用于控制文本是否应该被换行以及如何进行换行
|
||||||
proseWrap: 'preserve',
|
proseWrap: "preserve",
|
||||||
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
|
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
|
||||||
htmlWhitespaceSensitivity: 'css',
|
htmlWhitespaceSensitivity: "css",
|
||||||
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
|
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
|
||||||
vueIndentScriptAndStyle: false,
|
vueIndentScriptAndStyle: false,
|
||||||
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
|
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
|
||||||
endOfLine: 'auto',
|
endOfLine: "auto",
|
||||||
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
|
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
|
||||||
rangeStart: 0,
|
rangeStart: 0,
|
||||||
rangeEnd: Infinity
|
rangeEnd: Infinity
|
||||||
Vendored
+1
-1
@@ -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')
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
@@ -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']
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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 };
|
||||||
|
};
|
||||||
@@ -68,8 +68,13 @@ export const useRoutingMethod = () => {
|
|||||||
* @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) => {
|
||||||
|
// record.path 是定义时的路径,如 "/user/:id"
|
||||||
|
return record.path.includes("/:");
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default {
|
|||||||
["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",
|
||||||
|
["navigate mode"]: "navigate mode",
|
||||||
["personal-information"]: "personal information",
|
["personal-information"]: "personal information",
|
||||||
["change-password"]: "change password",
|
["change-password"]: "change password",
|
||||||
["project-address"]: "project address",
|
["project-address"]: "project address",
|
||||||
@@ -25,7 +26,26 @@ export default {
|
|||||||
["message"]: "Message",
|
["message"]: "Message",
|
||||||
["backlog"]: "Backlog",
|
["backlog"]: "Backlog",
|
||||||
["switch-language-to-preview"]: "Please switch the language to preview the internationalization effect",
|
["switch-language-to-preview"]: "Please switch the language to preview the internationalization effect",
|
||||||
["please-enter-something"]: "Please enter something"
|
["please-enter-something"]: "please enter something",
|
||||||
|
["color weakness mode"]: "color weakness mode",
|
||||||
|
["grey mode"]: "grey mode",
|
||||||
|
["sidebar is dark"]: "sidebar is dark",
|
||||||
|
["page transition"]: "page transition",
|
||||||
|
["interface settings"]: "interface settings",
|
||||||
|
["menu folding"]: "menu folding",
|
||||||
|
["menu accordion"]: "menu accordion",
|
||||||
|
["breadcrumb"]: "breadcrumb",
|
||||||
|
["tab bar"]: "tab bar",
|
||||||
|
["page footer"]: "page footer",
|
||||||
|
["watermark settings"]: "watermark settings",
|
||||||
|
["watermark color"]: "watermark color",
|
||||||
|
["watermark text"]: "watermark text",
|
||||||
|
["watermark size"]: "watermark size",
|
||||||
|
["watermark angle"]: "watermark angle",
|
||||||
|
["watermark gap"]: "watermark gap",
|
||||||
|
["system settings"]: "system settings",
|
||||||
|
["anti-debugging"]: "anti-debugging",
|
||||||
|
["please select"]: "please select"
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
["home"]: "home",
|
["home"]: "home",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default {
|
|||||||
["exit-full-screen"]: "退出全屏",
|
["exit-full-screen"]: "退出全屏",
|
||||||
["system-settings"]: "系统设置",
|
["system-settings"]: "系统设置",
|
||||||
["theme-settings"]: "主题设置",
|
["theme-settings"]: "主题设置",
|
||||||
|
["navigate mode"]: "导航模式",
|
||||||
["personal-information"]: "个人信息",
|
["personal-information"]: "个人信息",
|
||||||
["change-password"]: "修改密码",
|
["change-password"]: "修改密码",
|
||||||
["project-address"]: "项目地址",
|
["project-address"]: "项目地址",
|
||||||
@@ -25,7 +26,26 @@ export default {
|
|||||||
["message"]: "消息",
|
["message"]: "消息",
|
||||||
["backlog"]: "待办",
|
["backlog"]: "待办",
|
||||||
["switch-language-to-preview"]: "请切换语言来预览国际化效果",
|
["switch-language-to-preview"]: "请切换语言来预览国际化效果",
|
||||||
["please-enter-something"]: "请输入"
|
["please-enter-something"]: "请输入",
|
||||||
|
["color weakness mode"]: "色弱模式",
|
||||||
|
["grey mode"]: "灰色模式",
|
||||||
|
["sidebar is dark"]: "侧边栏深色",
|
||||||
|
["page transition"]: "页面过渡",
|
||||||
|
["interface settings"]: "界面设置",
|
||||||
|
["menu folding"]: "菜单折叠",
|
||||||
|
["menu accordion"]: "菜单手风琴",
|
||||||
|
["breadcrumb"]: "面包屑",
|
||||||
|
["tab bar"]: "标签栏",
|
||||||
|
["page footer"]: "页脚",
|
||||||
|
["watermark settings"]: "水印设置",
|
||||||
|
["watermark color"]: "水印颜色",
|
||||||
|
["watermark text"]: "水印文案",
|
||||||
|
["watermark size"]: "水印大小",
|
||||||
|
["watermark angle"]: "水印角度",
|
||||||
|
["watermark gap"]: "水印间隙",
|
||||||
|
["system settings"]: "系统设置",
|
||||||
|
["anti-debugging"]: "防调试",
|
||||||
|
["please select"]: "请选择"
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
["home"]: "首页",
|
["home"]: "首页",
|
||||||
|
|||||||
@@ -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,34 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-drawer :width="340" :visible="props.systemOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
|
<a-drawer :width="340" :visible="props.systemOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
|
||||||
<template #title> 系统设置 </template>
|
<template #title>{{ $t(`system.system settings`) }}</template>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<div class="title">界面设置</div>
|
<div class="title">{{ $t(`system.interface settings`) }}</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>菜单折叠</div>
|
<div>{{ $t(`system.menu folding`) }}</div>
|
||||||
<a-switch v-model="collapsed" />
|
<a-switch v-model="collapsed" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>菜单手风琴</div>
|
<div>{{ $t(`system.menu accordion`) }}</div>
|
||||||
<a-switch v-model="isAccordion" />
|
<a-switch v-model="isAccordion" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>面包屑</div>
|
<div>{{ $t(`system.breadcrumb`) }}</div>
|
||||||
<a-switch v-model="isBreadcrumb" />
|
<a-switch v-model="isBreadcrumb" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>标签栏</div>
|
<div>{{ $t(`system.tab bar`) }}</div>
|
||||||
<a-switch v-model="isTabs" @change="tabsChange" />
|
<a-switch v-model="isTabs" @change="tabsChange" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>页脚</div>
|
<div>{{ $t(`system.page footer`) }}</div>
|
||||||
<a-switch v-model="isFooter" />
|
<a-switch v-model="isFooter" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="title">水印设置</div>
|
<div class="title">{{ $t(`system.watermark settings`) }}</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>水印颜色</div>
|
<div>{{ $t(`system.watermark color`) }}</div>
|
||||||
<pick-colors
|
<pick-colors
|
||||||
:theme="darkMode ? 'dark' : 'light'"
|
:theme="darkMode ? 'dark' : 'light'"
|
||||||
show-alpha
|
show-alpha
|
||||||
@@ -39,26 +39,31 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>水印文案</div>
|
<div>{{ $t(`system.watermark text`) }}</div>
|
||||||
<a-input :style="{ width: '100px' }" v-model="watermark" placeholder="请输入" allow-clear />
|
<a-input
|
||||||
|
:style="{ width: '100px' }"
|
||||||
|
v-model="watermark"
|
||||||
|
:placeholder="$t(`system.please-enter-something`)"
|
||||||
|
allow-clear
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>水印大小</div>
|
<div>{{ $t(`system.watermark size`) }}</div>
|
||||||
<a-slider v-model="watermarkStyle.fontSize" :min="10" :max="50" :style="{ width: '100px' }" />
|
<a-slider v-model="watermarkStyle.fontSize" :min="10" :max="50" :style="{ width: '100px' }" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>水印角度</div>
|
<div>{{ $t(`system.watermark angle`) }}</div>
|
||||||
<a-slider v-model="watermarkRotate" :min="0" :max="360" :style="{ width: '100px' }" />
|
<a-slider v-model="watermarkRotate" :min="0" :max="360" :style="{ width: '100px' }" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>水印间隙</div>
|
<div>{{ $t(`system.watermark gap`) }}</div>
|
||||||
<a-slider :default-value="gapInfo[0]" :min="0" :max="300" :style="{ width: '100px' }" @change="onWatermarkGap" />
|
<a-slider :default-value="gapInfo[0]" :min="0" :max="300" :style="{ width: '100px' }" @change="onWatermarkGap" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="title">系统设置</div>
|
<div class="title">{{ $t(`system.system settings`) }}</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>防调试</div>
|
<div>{{ $t(`system.anti-debugging`) }}</div>
|
||||||
<a-switch v-model="debugPrevention" />
|
<a-switch v-model="debugPrevention" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-drawer :width="340" :visible="props.themeOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
|
<a-drawer :width="340" :visible="props.themeOpen" @ok="handleCancel" @cancel="handleCancel" unmount-on-close>
|
||||||
<template #title> 主题设置 </template>
|
<template #title>{{ $t(`system.theme-settings`) }}</template>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<a-divider orientation="center">导航模式</a-divider>
|
<a-divider orientation="center">{{ $t(`system.navigate mode`) }}</a-divider>
|
||||||
<div class="flex-center">
|
<div class="flex-center">
|
||||||
<a-tooltip v-for="item in layoutList" :key="item.value" :content="item.label" position="top" mini>
|
<a-tooltip v-for="item in layoutList" :key="item.value" :content="item.label" position="top" mini>
|
||||||
<div
|
<div
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-gap">
|
<div class="box-gap">
|
||||||
<a-divider orientation="center">主题设置</a-divider>
|
<a-divider orientation="center">{{ $t(`system.theme-settings`) }}</a-divider>
|
||||||
<div class="flex-center">
|
<div class="flex-center">
|
||||||
<ColorPicker
|
<ColorPicker
|
||||||
:theme="darkMode ? 'dark' : 'light'"
|
:theme="darkMode ? 'dark' : 'light'"
|
||||||
@@ -29,20 +29,20 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box-gap">
|
<div class="box-gap">
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>色弱模式</div>
|
<div>{{ $t(`system.color weakness mode`) }}</div>
|
||||||
<a-switch v-model="colorWeakMode" @change="onColorWeak" />
|
<a-switch v-model="colorWeakMode" @change="onColorWeak" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>灰色模式</div>
|
<div>{{ $t(`system.grey mode`) }}</div>
|
||||||
<a-switch v-model="grayMode" @change="onGray" />
|
<a-switch v-model="grayMode" @change="onGray" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>侧边栏深色</div>
|
<div>{{ $t(`system.sidebar is dark`) }}</div>
|
||||||
<a-switch :disabled="darkMode" v-model="asideDark" />
|
<a-switch :disabled="darkMode" v-model="asideDark" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<div>页面过渡</div>
|
<div>{{ $t(`system.page transition`) }}</div>
|
||||||
<a-select v-model="transitionPage" :style="{ width: '120px' }" placeholder="请选择">
|
<a-select v-model="transitionPage" :style="{ width: '120px' }" :placeholder="$t(`system.please select`)">
|
||||||
<a-option v-for="item in transitions" :key="item.value" :value="item.value" :label="item.label" />
|
<a-option v-for="item in transitions" :key="item.value" :value="item.value" :label="item.label" />
|
||||||
</a-select>
|
</a-select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import router from "@/router/index";
|
|||||||
import pinia from "@/store/index";
|
import pinia from "@/store/index";
|
||||||
// arco-css
|
// arco-css
|
||||||
import "@arco-design/web-vue/dist/arco.css";
|
import "@arco-design/web-vue/dist/arco.css";
|
||||||
// vchart-arco-theme 主题关联-黑暗模式
|
|
||||||
import { initVChartArcoTheme } from "@visactor/vchart-arco-theme";
|
|
||||||
// 额外引入图标库
|
// 额外引入图标库
|
||||||
import ArcoVueIcon from "@arco-design/web-vue/es/icon";
|
import ArcoVueIcon from "@arco-design/web-vue/es/icon";
|
||||||
// 注册全局svg
|
// 注册全局svg
|
||||||
@@ -22,10 +20,6 @@ import "@/assets/fonts/fonts.scss";
|
|||||||
// 引入自定义指令
|
// 引入自定义指令
|
||||||
import directives from "@/directives/index";
|
import directives from "@/directives/index";
|
||||||
|
|
||||||
// vchart黑暗模式
|
|
||||||
// https://arco.design/react/docs/vchart
|
|
||||||
initVChartArcoTheme();
|
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
// app.use(plugin, options)
|
// app.use(plugin, options)
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
// 在线用户
|
|
||||||
export const onlineuser = [
|
|
||||||
{
|
|
||||||
tokenId: "2t6c278e-495h-821t-as26-31c98f8d2379",
|
|
||||||
userName: "admin",
|
|
||||||
deptName: "研发部门",
|
|
||||||
ipaddr: "115.23.16.25",
|
|
||||||
loginLocation: "上海市 上海市",
|
|
||||||
browser: "Quark 7.9.2.771",
|
|
||||||
os: "HarmonyOS NEXT 5.0.0.102",
|
|
||||||
loginTime: "2025-04-12 10:30:59",
|
|
||||||
status: 1 // 0离线 1在线
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tokenId: "37adftaf-172c-1527-dcf6-efa3f92adc5c",
|
|
||||||
userName: "admin",
|
|
||||||
deptName: "研发部门",
|
|
||||||
ipaddr: "112.21.152.215",
|
|
||||||
loginLocation: "浙江省 杭州市",
|
|
||||||
browser: "Chrome 135.0.0.0",
|
|
||||||
os: "Windows 11",
|
|
||||||
loginTime: "2025-04-12 10:30:59",
|
|
||||||
status: 1 // 0离线 1在线
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 定时任务
|
|
||||||
export const crontab = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "cron任务,5秒执行一次", // 任务名称
|
|
||||||
cron: "0/5 * * * * * ", // cron-执行规则
|
|
||||||
every: null, // 间隔时间秒-执行规则
|
|
||||||
service: "taskDemoService.test()", // 执行服务
|
|
||||||
startDate: "2025-03-30 11:28:35", // 开始时间
|
|
||||||
nextRunTime: "2025-03-13 11:20:50", // 下次执行时间
|
|
||||||
taskType: 0, // 任务类型 0 cron 1 指定时间(秒)
|
|
||||||
misfirePolicy: 1, // 执行策略 1 循环 2 执行一次
|
|
||||||
remark: "这是定时任务", // 备注
|
|
||||||
status: 1, // 0离线 1在线
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-06-30 11:28:35",
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "每秒执行一次",
|
|
||||||
cron: null,
|
|
||||||
every: 1,
|
|
||||||
service: "taskDemoService.test(1,2)",
|
|
||||||
startDate: "2025-03-30 11:28:35",
|
|
||||||
nextRunTime: "2025-03-13 11:20:50",
|
|
||||||
taskType: 1,
|
|
||||||
misfirePolicy: 1,
|
|
||||||
remark: "这是定时任务",
|
|
||||||
status: 1,
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-06-30 11:28:35",
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 任务日志
|
|
||||||
export const crontabLogs = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
taskId: 1,
|
|
||||||
taskName: "cron任务,5秒执行一次",
|
|
||||||
status: 1,
|
|
||||||
remark: "",
|
|
||||||
createTime: "2025-03-30 11:28:35",
|
|
||||||
executionTime: "2025-03-30 11:28:35"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
taskId: 2,
|
|
||||||
taskName: "每秒执行一次",
|
|
||||||
status: 0,
|
|
||||||
remark:
|
|
||||||
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', `_isUTC` = false, `_pf` = '[object Object]', `_locale` = '[object Object]', `_' at line 1",
|
|
||||||
createTime: "2025-03-30 11:28:35",
|
|
||||||
executionTime: "2025-03-30 11:28:35"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
// 部门数据
|
|
||||||
export const divisionData = [
|
|
||||||
{
|
|
||||||
id: "100",
|
|
||||||
parentId: "0",
|
|
||||||
name: "xxx机构有限公司",
|
|
||||||
leader: "兔子先森",
|
|
||||||
phone: "15888888888",
|
|
||||||
email: "2547096351@qq.com",
|
|
||||||
sort: 1,
|
|
||||||
status: 1,
|
|
||||||
description: "这是总部门",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: "admin",
|
|
||||||
updateTime: "2024-09-09 10:08:25",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: "10001",
|
|
||||||
parentId: "100",
|
|
||||||
name: "华中总部",
|
|
||||||
leader: "小唐",
|
|
||||||
phone: "",
|
|
||||||
email: "",
|
|
||||||
sort: 1,
|
|
||||||
status: 1,
|
|
||||||
description: "这里是华中总部",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: "admin",
|
|
||||||
updateTime: "2024-09-09 17:30:40",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: "1000101",
|
|
||||||
parentId: "10001",
|
|
||||||
name: "SnowAdmin开发组",
|
|
||||||
leader: "小汤",
|
|
||||||
phone: "",
|
|
||||||
email: "",
|
|
||||||
sort: 1,
|
|
||||||
status: 1,
|
|
||||||
description: "这是项目研发部",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: "admin",
|
|
||||||
updateTime: "2024-09-09 17:30:40",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: "100010101",
|
|
||||||
parentId: "1000101",
|
|
||||||
name: "UI组",
|
|
||||||
leader: "晓棠",
|
|
||||||
phone: "",
|
|
||||||
email: "",
|
|
||||||
sort: 1,
|
|
||||||
status: 1,
|
|
||||||
description: "这里负责UI设计",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: "admin",
|
|
||||||
updateTime: "2024-09-09 17:30:40",
|
|
||||||
children: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "100010102",
|
|
||||||
parentId: "1000101",
|
|
||||||
name: "研发组",
|
|
||||||
leader: "小塘",
|
|
||||||
phone: "",
|
|
||||||
email: "",
|
|
||||||
sort: 2,
|
|
||||||
status: 1,
|
|
||||||
description: "这里负责开发",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: "admin",
|
|
||||||
updateTime: "2024-09-09 17:30:40",
|
|
||||||
children: null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "1000102",
|
|
||||||
parentId: "10001",
|
|
||||||
name: "人事部门",
|
|
||||||
leader: "兔子",
|
|
||||||
phone: "",
|
|
||||||
email: "",
|
|
||||||
sort: 2,
|
|
||||||
status: 1,
|
|
||||||
description: "这里是人事部门",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: "admin",
|
|
||||||
updateTime: "2024-09-09 17:30:40",
|
|
||||||
children: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "1000103",
|
|
||||||
parentId: "10001",
|
|
||||||
name: "财务部门",
|
|
||||||
leader: "小鹿",
|
|
||||||
phone: "",
|
|
||||||
email: "",
|
|
||||||
sort: 3,
|
|
||||||
status: 1,
|
|
||||||
description: "负责收账的",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: "admin",
|
|
||||||
updateTime: "2024-09-09 17:30:40",
|
|
||||||
children: null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 角色数据
|
|
||||||
export const roleData = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "超级管理员",
|
|
||||||
code: "admin",
|
|
||||||
sort: 1,
|
|
||||||
status: 1,
|
|
||||||
admin: true,
|
|
||||||
description: "默认角色,超级管理员,上帝角色",
|
|
||||||
createBy: null,
|
|
||||||
createTime: "2024-03-27 11:21:01",
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "普通员工",
|
|
||||||
code: "common",
|
|
||||||
sort: 2,
|
|
||||||
status: 1,
|
|
||||||
admin: false,
|
|
||||||
description: "负责一些基础功能",
|
|
||||||
createBy: null,
|
|
||||||
createTime: "2024-03-27 11:21:01",
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 字典数据
|
|
||||||
export const dictData = [
|
|
||||||
{
|
|
||||||
id: "01",
|
|
||||||
name: "性别",
|
|
||||||
code: "gender",
|
|
||||||
status: 1,
|
|
||||||
description: "这是一个性别字典",
|
|
||||||
createTime: "2024-07-01 10:00:00",
|
|
||||||
list: [
|
|
||||||
{ id: "012", name: "女", value: 0, status: 1 },
|
|
||||||
{ id: "011", name: "男", value: 1, status: 1 },
|
|
||||||
{ id: "013", name: "其它", value: 2, status: 1 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "02",
|
|
||||||
name: "状态",
|
|
||||||
code: "status",
|
|
||||||
status: 1,
|
|
||||||
description: "状态字段可以用这个",
|
|
||||||
createTime: "2024-07-01 10:00:00",
|
|
||||||
list: [
|
|
||||||
{ id: "021", name: "禁用", value: 0, status: 1 },
|
|
||||||
{ id: "022", name: "启用", value: 1, status: 1 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "03",
|
|
||||||
name: "岗位",
|
|
||||||
code: "post",
|
|
||||||
status: 1,
|
|
||||||
description: "岗位字段",
|
|
||||||
createTime: "2024-07-01 10:00:00",
|
|
||||||
list: [
|
|
||||||
{ id: "031", name: "总经理", value: 1, status: 1 },
|
|
||||||
{ id: "032", name: "总监", value: 2, status: 1 },
|
|
||||||
{ id: "033", name: "人事主管", value: 3, status: 1 },
|
|
||||||
{ id: "034", name: "开发部主管", value: 4, status: 1 },
|
|
||||||
{ id: "035", name: "普通职员", value: 5, status: 1 },
|
|
||||||
{ id: "036", name: "其它", value: 999, status: 1 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "04",
|
|
||||||
name: "任务状态",
|
|
||||||
code: "taskStatus",
|
|
||||||
status: 1,
|
|
||||||
description: "任务状态字段可以用它",
|
|
||||||
createTime: "2024-07-01 10:00:00",
|
|
||||||
list: [
|
|
||||||
{ id: "041", name: "失败", value: 0, status: 1 },
|
|
||||||
{ id: "042", name: "成功", value: 1, status: 1 }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 账户数据
|
|
||||||
export const accountData = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
deptId: "100",
|
|
||||||
deptName: "研发部门",
|
|
||||||
userName: "admin",
|
|
||||||
nickName: "超级管理员",
|
|
||||||
email: "2547096351@qq.com",
|
|
||||||
phone: "15888888888",
|
|
||||||
sex: 1,
|
|
||||||
avatar: "https://ooo.0x0.ooo/2025/04/10/O0dG7r.jpg",
|
|
||||||
status: 1,
|
|
||||||
description: "系统初始用户",
|
|
||||||
roles: ["admin"],
|
|
||||||
loginIp: "0:0:0:0:0:0:0:1",
|
|
||||||
loginDate: "2025-03-31 10:30:59",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null,
|
|
||||||
admin: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
deptId: "100010101",
|
|
||||||
deptName: "研发部门",
|
|
||||||
userName: "common",
|
|
||||||
nickName: "普通用户",
|
|
||||||
email: "2547096351@qq.com",
|
|
||||||
phone: "15222222222",
|
|
||||||
sex: 0,
|
|
||||||
avatar: "https://ooo.0x0.ooo/2025/04/10/O0ddJI.jpg",
|
|
||||||
status: 1,
|
|
||||||
description: "UI组用户",
|
|
||||||
roles: ["common"],
|
|
||||||
loginIp: "0:0:0:0:0:0:0:1",
|
|
||||||
loginDate: "2025-03-31 10:30:59",
|
|
||||||
createBy: "admin",
|
|
||||||
createTime: "2024-03-19 11:21:01",
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null,
|
|
||||||
admin: false
|
|
||||||
}
|
|
||||||
];
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,187 +0,0 @@
|
|||||||
import Mock from "mockjs";
|
|
||||||
|
|
||||||
/** 返回成功数据 */
|
|
||||||
export const resultSuccess = (data: unknown) => {
|
|
||||||
return Mock.mock({
|
|
||||||
code: 200,
|
|
||||||
data,
|
|
||||||
message: "请求成功",
|
|
||||||
success: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 返回失败数据 */
|
|
||||||
export const resultError = (data: unknown, message: string, code = 500) => {
|
|
||||||
return Mock.mock({
|
|
||||||
code,
|
|
||||||
data,
|
|
||||||
message,
|
|
||||||
success: false
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 路由树递归排序
|
|
||||||
* 1、先给当前层排序
|
|
||||||
* 2、若当前层有children则递归排序
|
|
||||||
* @param {array} tree 根据角色权限过滤后的路由树
|
|
||||||
* @returns 返回排序之后的树
|
|
||||||
*/
|
|
||||||
export const treeSort = (tree: Menu.MenuOptions[]) => {
|
|
||||||
if (!tree || tree.length == 0) return [];
|
|
||||||
tree.sort((a: Menu.MenuOptions, b: Menu.MenuOptions) => {
|
|
||||||
// a和b都是undefined则相等
|
|
||||||
if (a.meta.sort != 0 && !a.meta.sort && b.meta.sort != 0 && !b.meta.sort) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// a是undefined则a被排在b之后
|
|
||||||
if (a.meta.sort != 0 && !a.meta.sort) return 1;
|
|
||||||
// b是undefined则b被排在a之后
|
|
||||||
if (b.meta.sort != 0 && !b.meta.sort) return -1;
|
|
||||||
return a.meta.sort - b.meta.sort;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 深层递归
|
|
||||||
return tree.map((item: any) => {
|
|
||||||
if (item?.children?.length > 0) {
|
|
||||||
item.children = treeSort(item.children);
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 过滤路由树,返回有权限的树
|
|
||||||
* 1、根据角色权限过滤原始路由树
|
|
||||||
* 2、过滤禁用的菜单,该菜单是不可访问的,直接去掉
|
|
||||||
* @param {array} tree 根据角色权限过滤原始路由树
|
|
||||||
* @returns 返回有权限的树
|
|
||||||
*/
|
|
||||||
export const filterByDisable = (tree: any, userRoles: Array<string>) => {
|
|
||||||
return tree.filter((item: any) => {
|
|
||||||
// 过滤角色权限
|
|
||||||
if (item?.meta?.roles) {
|
|
||||||
if (!roleBase(item.meta.roles, userRoles)) return false;
|
|
||||||
}
|
|
||||||
// 过滤是否禁用
|
|
||||||
if (item?.meta?.disable) return false;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验该角色是否有路由权限
|
|
||||||
* @param {array} roles 路由的角色权限
|
|
||||||
* @returns 是否有权限 true是 false否
|
|
||||||
*/
|
|
||||||
export const roleBase = (roles: Array<string>, userRoles: Array<string>) => {
|
|
||||||
// 如果是admin则直接放行
|
|
||||||
if (userRoles.includes("admin")) return true;
|
|
||||||
// 否则判断权限
|
|
||||||
return userRoles.some((item: string) => roles.includes(item));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 深拷贝
|
|
||||||
* @param { string } data 需要深拷贝的数据
|
|
||||||
* @returns 深拷贝的数据
|
|
||||||
*/
|
|
||||||
export function deepClone(data: any) {
|
|
||||||
let stack = [];
|
|
||||||
let cloned;
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
cloned = [];
|
|
||||||
} else if (typeof data === "object" && data !== null) {
|
|
||||||
cloned = {};
|
|
||||||
} else {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
stack.push({
|
|
||||||
original: data,
|
|
||||||
copy: cloned
|
|
||||||
});
|
|
||||||
while (stack.length > 0) {
|
|
||||||
let current: any = stack.pop();
|
|
||||||
let original = current.original;
|
|
||||||
let copy = current.copy;
|
|
||||||
|
|
||||||
for (let key in original) {
|
|
||||||
if (original.hasOwnProperty(key)) {
|
|
||||||
let value = original[key];
|
|
||||||
|
|
||||||
if (typeof value === "object" && value !== null) {
|
|
||||||
copy[key] = Array.isArray(value) ? [] : {};
|
|
||||||
|
|
||||||
stack.push({
|
|
||||||
original: value,
|
|
||||||
copy: copy[key]
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
copy[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cloned;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将扁平路由组装成树形结构
|
|
||||||
* @param {array} nodes 扁平数组
|
|
||||||
* @returns 树形结构
|
|
||||||
*/
|
|
||||||
export const buildTreeOptimized = (nodes: Menu.MenuOptions[]) => {
|
|
||||||
const nodeMap = new Map(); // 哈希表存储所有节点
|
|
||||||
const roots = []; // 存储顶层节点
|
|
||||||
const duplicates = new Set(); // 检测重复ID
|
|
||||||
|
|
||||||
// 第一次遍历: 注册所有节点 & 检测重复
|
|
||||||
for (const node of nodes) {
|
|
||||||
const id = node.id;
|
|
||||||
|
|
||||||
// 循环引用检测
|
|
||||||
if (node.id === node.parentId) {
|
|
||||||
throw new Error(`循环引用: ${node.id} -> ${node.parentId}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重复ID检测
|
|
||||||
if (nodeMap.has(id)) {
|
|
||||||
duplicates.add(id);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化子节点为null,这里children必须得是null,因为arco.design的展开列表组件根据数组判断是否显示展开按钮,哪怕是空数组也会显示展开按钮
|
|
||||||
node.children = null;
|
|
||||||
nodeMap.set(id, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 输出重复警告
|
|
||||||
if (duplicates.size > 0) {
|
|
||||||
console.warn(`检测到重复ID: ${Array.from(duplicates).join(", ")}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第二次遍历: 构建树结构
|
|
||||||
for (const node of nodes) {
|
|
||||||
const { parentId } = node;
|
|
||||||
|
|
||||||
// 跳过已处理的重复节点
|
|
||||||
if (duplicates.has(node.id)) continue;
|
|
||||||
|
|
||||||
if (parentId === "0") {
|
|
||||||
roots.push(node); // 顶层节点
|
|
||||||
} else if (parentId) {
|
|
||||||
const parent = nodeMap.get(parentId);
|
|
||||||
if (parent) {
|
|
||||||
// 初始化父节点的children为数组(若为null)
|
|
||||||
if (parent.children === null) {
|
|
||||||
parent.children = [];
|
|
||||||
}
|
|
||||||
parent.children.push(node);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.warn(`独立节点 ${node.id}: parentId为空`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return roots;
|
|
||||||
};
|
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
import type { MockMethod } from "vite-plugin-mock";
|
|
||||||
import { resultSuccess } from "../_utils";
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: "/mock/document-library/tree",
|
|
||||||
method: "get",
|
|
||||||
timeout: 500,
|
|
||||||
response: () => {
|
|
||||||
let list = [
|
|
||||||
{
|
|
||||||
title: "总公司",
|
|
||||||
key: "0-0",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: "行政部门",
|
|
||||||
key: "0-0-0",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: "人力资源部",
|
|
||||||
key: "0-0-0-0",
|
|
||||||
children: [{ title: "员工出差申请表", key: "0-0-0-0-0" }]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "财务部",
|
|
||||||
key: "0-0-0-1",
|
|
||||||
children: [{ title: "行政费用预算分析", key: "0-0-0-0-1" }]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "法务部",
|
|
||||||
key: "0-0-0-2",
|
|
||||||
children: [{ title: "公司章程", key: "0-0-0-0-2" }]
|
|
||||||
},
|
|
||||||
{ title: "行政工作计划", key: "0-0-0-3" },
|
|
||||||
|
|
||||||
{ title: "会议室预订统计", key: "0-0-0-4" },
|
|
||||||
{ title: "月度工作总结", key: "0-0-0-5" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "业务部门",
|
|
||||||
key: "0-0-1",
|
|
||||||
children: [
|
|
||||||
{ title: "客户反馈集锦", key: "0-0-1-0" },
|
|
||||||
{ title: "市场分析报告-季度", key: "0-0-1-1" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "技术部门",
|
|
||||||
key: "0-0-2",
|
|
||||||
children: [
|
|
||||||
{ title: "代码审查记录", key: "0-0-2-0" },
|
|
||||||
{ title: "数据库优化方案", key: "0-0-2-1" },
|
|
||||||
{ title: "技术支持工单", key: "0-0-2-2" },
|
|
||||||
{ title: "安全漏洞扫描报告", key: "0-0-2-3" },
|
|
||||||
{ title: "系统性能调优总结", key: "0-0-2-4" },
|
|
||||||
{ title: "软件版本发布计划", key: "0-0-2-5" },
|
|
||||||
{ title: "技术培训材料", key: "0-0-2-6" },
|
|
||||||
{ title: "技术文档更新计划", key: "0-0-2-7" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "后勤部门",
|
|
||||||
key: "0-0-3",
|
|
||||||
children: [
|
|
||||||
{ title: "设施维护报告", key: "0-0-3-0" },
|
|
||||||
{ title: "物流运输安排", key: "0-0-3-1" },
|
|
||||||
{ title: "仓库库存清单", key: "0-0-3-2" },
|
|
||||||
{ title: "办公室布局设计", key: "0-0-3-3" },
|
|
||||||
{ title: "设备采购申请表", key: "0-0-3-4" },
|
|
||||||
{ title: "食品安全检查记录", key: "0-0-3-5" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
return resultSuccess(list);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/document-library/table",
|
|
||||||
method: "get",
|
|
||||||
timeout: 500,
|
|
||||||
response: () => {
|
|
||||||
let list = [
|
|
||||||
{
|
|
||||||
key: "1",
|
|
||||||
source: "bilibili",
|
|
||||||
sourceSvg: "bilibili",
|
|
||||||
sourceType: "分享",
|
|
||||||
flow: "5015",
|
|
||||||
percent: "75",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-27 09:00:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "2",
|
|
||||||
source: "微信",
|
|
||||||
sourceSvg: "wechat",
|
|
||||||
sourceType: "分享",
|
|
||||||
flow: "3217",
|
|
||||||
percent: "60",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-26 15:30:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "3",
|
|
||||||
source: "QQ音乐",
|
|
||||||
sourceSvg: "QQ音乐",
|
|
||||||
sourceType: "搜索",
|
|
||||||
flow: "1343",
|
|
||||||
percent: "55",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-25 12:45:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "4",
|
|
||||||
source: "百度",
|
|
||||||
sourceSvg: "百度",
|
|
||||||
sourceType: "搜索",
|
|
||||||
flow: "1235",
|
|
||||||
percent: "20",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-24 11:20:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "5",
|
|
||||||
source: "优酷",
|
|
||||||
sourceSvg: "优酷",
|
|
||||||
sourceType: "首页推荐",
|
|
||||||
flow: "3456",
|
|
||||||
percent: "20",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-23 14:10:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "6",
|
|
||||||
source: "网易云音乐",
|
|
||||||
sourceSvg: "网易云音乐",
|
|
||||||
sourceType: "每日一推",
|
|
||||||
flow: "5873",
|
|
||||||
percent: "30",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-22 10:05:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "7",
|
|
||||||
source: "抖音",
|
|
||||||
sourceSvg: "抖音",
|
|
||||||
sourceType: "自然",
|
|
||||||
flow: "5465",
|
|
||||||
percent: "86",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-21 08:45:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "8",
|
|
||||||
source: "西瓜视频",
|
|
||||||
sourceSvg: "西瓜视频",
|
|
||||||
sourceType: "搜索",
|
|
||||||
flow: "4642",
|
|
||||||
percent: "45",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-20 16:30:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "9",
|
|
||||||
source: "微博",
|
|
||||||
sourceSvg: "微博",
|
|
||||||
sourceType: "搜索",
|
|
||||||
flow: "2375",
|
|
||||||
percent: "60",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-19 09:20:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "10",
|
|
||||||
source: "豆瓣",
|
|
||||||
sourceSvg: "豆瓣",
|
|
||||||
sourceType: "搜索",
|
|
||||||
flow: "2465",
|
|
||||||
percent: "40",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-18 13:55:00"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
let data = {
|
|
||||||
list,
|
|
||||||
total: list.length
|
|
||||||
};
|
|
||||||
return resultSuccess(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] as MockMethod[];
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import { createProdMockServer } from "vite-plugin-mock/es/createProdMockServer";
|
|
||||||
|
|
||||||
import testModule from "./test/index";
|
|
||||||
import userModule from "./user/index";
|
|
||||||
import systemModule from "./system/index";
|
|
||||||
import fileModule from "./file/index";
|
|
||||||
import tableModule from "./table/index";
|
|
||||||
import monitorModule from "./monitor/index";
|
|
||||||
|
|
||||||
export function setupProdMockServer() {
|
|
||||||
createProdMockServer([...testModule, ...userModule, ...systemModule, ...fileModule, ...tableModule, ...monitorModule]);
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import type { MockMethod } from "vite-plugin-mock";
|
|
||||||
import { resultSuccess } from "../_utils";
|
|
||||||
import { onlineuser, crontab, crontabLogs } from "../_data/monitor_data";
|
|
||||||
/**
|
|
||||||
* post请求body,get请求query
|
|
||||||
* /mock/monitor/getOnlineuser 获取在线用户
|
|
||||||
* /mock/monitor/getCrontab 定时任务
|
|
||||||
*/
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: "/mock/monitor/getOnlineuser",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(onlineuser);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/monitor/getCrontab",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(crontab);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/monitor/getCrontabLogs",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: ({ query }: any) => {
|
|
||||||
console.log(query);
|
|
||||||
return resultSuccess(crontabLogs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] as MockMethod[];
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
import menu from "./menu";
|
|
||||||
import system from "./system";
|
|
||||||
|
|
||||||
export default [...menu, ...system];
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
import type { MockMethod } from "vite-plugin-mock";
|
|
||||||
import { deepClone, filterByDisable, buildTreeOptimized, treeSort, resultSuccess } from "../_utils";
|
|
||||||
import { systemMenu, permissionData } from "../_data/system_menu";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化
|
|
||||||
* 后端接口需要做的事情:
|
|
||||||
* 1、根据token判断角色
|
|
||||||
* 2、过滤扁平路由,根据角色过滤权限和非禁用的节点
|
|
||||||
* 3、将扁平路由转换为树结构
|
|
||||||
* 4、路由树排序
|
|
||||||
* 5、返回路由树
|
|
||||||
*
|
|
||||||
* 前端调用接口拿到路由数据后:
|
|
||||||
* 1、将模块设置为真实模块
|
|
||||||
* 2、存储路由树,用于生成菜单
|
|
||||||
* 3、根据树生成一维路由数组
|
|
||||||
* 4、动态添加路由
|
|
||||||
* 5、缓存一维路由
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* post请求body,get请求query
|
|
||||||
* /mock/menu/getRouters 获取路由数据
|
|
||||||
* /mock/menu/getMenuList 获取菜单列表数据-菜单管理
|
|
||||||
* /mock/menu/getUserPermission 根据角色获取权限数据
|
|
||||||
* /mock/menu/getPermission 获取权限数据
|
|
||||||
*/
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: "/mock/menu/getRouters",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: ({ headers }: any) => {
|
|
||||||
let token = headers.authorization;
|
|
||||||
// 根据token或登录账号判断是什么角色,这里模拟两个角色,admin、common
|
|
||||||
let userRoles = token === "Admin-Token" ? ["admin"] : ["common"];
|
|
||||||
const originMenu: any = deepClone(systemMenu);
|
|
||||||
// 1. 过滤扁平路由,根据角色返回有权限且非禁用的节点
|
|
||||||
const survivalTree = filterByDisable(originMenu, userRoles);
|
|
||||||
// 2. 将扁平路由转换为树结构
|
|
||||||
// 2. 给路由树排序
|
|
||||||
// 3. 返回路由树
|
|
||||||
return resultSuccess(treeSort(buildTreeOptimized(survivalTree)));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/menu/getMenuList",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
// 菜单管理这里需要查看到所有菜单,无需判断角色权限、禁用菜单
|
|
||||||
// 将扁平路由和权限菜单合并
|
|
||||||
const originMenu: any = [...deepClone(systemMenu), ...deepClone(permissionData)];
|
|
||||||
// 1. 将扁平路由转换为树结构
|
|
||||||
// 2. 给路由树排序
|
|
||||||
// 3. 返回路由树
|
|
||||||
return resultSuccess(treeSort(buildTreeOptimized(originMenu)));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/menu/getUserPermission",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: ({ query }: any) => {
|
|
||||||
let { role } = query;
|
|
||||||
// 将扁平路由和权限菜单合并
|
|
||||||
const originMenu: any = [...deepClone(systemMenu), ...deepClone(permissionData)];
|
|
||||||
// 根据角色过滤id
|
|
||||||
let idList = originMenu.filter((item: any) => item.meta.roles.includes(role)).map((item: any) => item.id);
|
|
||||||
return resultSuccess(idList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] as MockMethod[];
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
import type { MockMethod } from "vite-plugin-mock";
|
|
||||||
import { resultSuccess } from "../_utils";
|
|
||||||
import { dictData, divisionData, roleData, accountData } from "../_data/system_data";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* post请求body,get请求query
|
|
||||||
* /mock/system/getDict 获取字典数据
|
|
||||||
* /mock/system/getDivision 获取部门数据
|
|
||||||
* /mock/system/getRole 获取角色数据
|
|
||||||
* /mock/system/getAccount 获取账号数据
|
|
||||||
*/
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: "/mock/system/getDict",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(dictData);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/system/getDivision",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(divisionData);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/system/getRole",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(roleData);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/system/getAccount",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(accountData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] as MockMethod[];
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
import type { MockMethod } from "vite-plugin-mock";
|
|
||||||
import { resultSuccess } from "../_utils";
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: "/mock/common-table/list",
|
|
||||||
method: "get",
|
|
||||||
timeout: 500,
|
|
||||||
response: () => {
|
|
||||||
let list = [
|
|
||||||
{
|
|
||||||
key: "1",
|
|
||||||
name: "陈思源",
|
|
||||||
avatar: "陈",
|
|
||||||
phone: "13812345678",
|
|
||||||
email: "zhangsan@example.com",
|
|
||||||
address: "北京市朝阳区",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-27 09:00:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "2",
|
|
||||||
name: "李婉娴",
|
|
||||||
avatar: "李",
|
|
||||||
phone: "13987654321",
|
|
||||||
email: "lisi@example.com",
|
|
||||||
address: "上海市浦东新区",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-26 15:30:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "3",
|
|
||||||
name: "王雨菲",
|
|
||||||
avatar: "王",
|
|
||||||
phone: "13666666666",
|
|
||||||
email: "wangwu@example.com",
|
|
||||||
address: "广州市天河区",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-25 12:45:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "4",
|
|
||||||
name: "张晨曦",
|
|
||||||
avatar: "张",
|
|
||||||
phone: "13788888888",
|
|
||||||
email: "zhaoliu@example.com",
|
|
||||||
address: "深圳市福田区",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-24 11:20:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "5",
|
|
||||||
name: "赵梦琪",
|
|
||||||
avatar: "赵",
|
|
||||||
phone: "13599999999",
|
|
||||||
email: "qianqi@example.com",
|
|
||||||
address: "成都市锦江区",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-23 14:10:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "6",
|
|
||||||
name: "刘昊然",
|
|
||||||
avatar: "刘",
|
|
||||||
phone: "13377777777",
|
|
||||||
email: "sunba@example.com",
|
|
||||||
address: "杭州市西湖区",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-22 10:05:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "7",
|
|
||||||
name: "孙梦洁",
|
|
||||||
avatar: "孙",
|
|
||||||
phone: "13266666666",
|
|
||||||
email: "zhoujiu@example.com",
|
|
||||||
address: "南京市鼓楼区",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-21 08:45:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "8",
|
|
||||||
name: "黄俊杰",
|
|
||||||
avatar: "黄",
|
|
||||||
phone: "13155555555",
|
|
||||||
email: "wushi@example.com",
|
|
||||||
address: "重庆市渝中区",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-20 16:30:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "9",
|
|
||||||
name: "周雨萱",
|
|
||||||
avatar: "周",
|
|
||||||
phone: "13044444444",
|
|
||||||
email: "zhengshiyi@example.com",
|
|
||||||
address: "武汉市江汉区",
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-19 09:20:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "10",
|
|
||||||
name: "韩雪儿",
|
|
||||||
avatar: "韩",
|
|
||||||
phone: "13933333333",
|
|
||||||
email: "kongshier@example.com",
|
|
||||||
address: "西安市雁塔区",
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-18 13:55:00"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
let data = {
|
|
||||||
list,
|
|
||||||
total: list.length
|
|
||||||
};
|
|
||||||
return resultSuccess(data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/custom-table/list",
|
|
||||||
method: "get",
|
|
||||||
timeout: 500,
|
|
||||||
response: () => {
|
|
||||||
let list = [
|
|
||||||
{
|
|
||||||
key: "1",
|
|
||||||
serial: "57",
|
|
||||||
name: "WEIJEIWGSDG",
|
|
||||||
content: "图文",
|
|
||||||
searchType: "阅读量",
|
|
||||||
contentSize: 3700,
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-27 09:00:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "2",
|
|
||||||
serial: "58",
|
|
||||||
name: "DHDWEH",
|
|
||||||
content: "图文",
|
|
||||||
searchType: "阅读量",
|
|
||||||
contentSize: 3700,
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-26 15:30:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "3",
|
|
||||||
serial: "59",
|
|
||||||
name: "SHEHWAE",
|
|
||||||
content: "视频",
|
|
||||||
searchType: "播放量",
|
|
||||||
contentSize: 2500,
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-25 12:45:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "4",
|
|
||||||
serial: "60",
|
|
||||||
name: "WEHJUK",
|
|
||||||
content: "视频",
|
|
||||||
searchType: "播放量",
|
|
||||||
contentSize: 2500,
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-24 11:20:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "5",
|
|
||||||
serial: "61",
|
|
||||||
name: "EYTUJDGSD",
|
|
||||||
content: "音频",
|
|
||||||
searchType: "播放量",
|
|
||||||
contentSize: 2500,
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-23 14:10:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "6",
|
|
||||||
serial: "62",
|
|
||||||
name: "RTIFSDF",
|
|
||||||
content: "图文",
|
|
||||||
searchType: "阅读量",
|
|
||||||
contentSize: 3700,
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-22 10:05:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "7",
|
|
||||||
serial: "63",
|
|
||||||
name: "OIKSHHFD",
|
|
||||||
content: "图文",
|
|
||||||
searchType: "阅读量",
|
|
||||||
contentSize: 3700,
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-21 08:45:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "8",
|
|
||||||
serial: "64",
|
|
||||||
name: "QEUHRKO",
|
|
||||||
content: "视频",
|
|
||||||
searchType: "播放量",
|
|
||||||
contentSize: 2500,
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-20 16:30:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "9",
|
|
||||||
serial: "65",
|
|
||||||
name: "JSGSDRI",
|
|
||||||
content: "视频",
|
|
||||||
searchType: "播放量",
|
|
||||||
contentSize: 2300,
|
|
||||||
status: 1,
|
|
||||||
createTime: "2024-05-19 09:20:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "10",
|
|
||||||
serial: "66",
|
|
||||||
name: "AOUSTHREGG",
|
|
||||||
content: "音频",
|
|
||||||
searchType: "播放量",
|
|
||||||
contentSize: 2300,
|
|
||||||
status: 0,
|
|
||||||
createTime: "2024-05-18 13:55:00"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
let data = {
|
|
||||||
list,
|
|
||||||
total: list.length
|
|
||||||
};
|
|
||||||
return resultSuccess(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] as MockMethod[];
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import type { MockMethod } from "vite-plugin-mock";
|
|
||||||
import { resultSuccess, resultError } from "../_utils";
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: "/mock/test/success",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess("SnowAdmin开源免费,Welcome!");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/test/fail",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: () => {
|
|
||||||
return resultError(null, "模拟mock数据出错", 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] as MockMethod[];
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
import type { MockMethod } from "vite-plugin-mock";
|
|
||||||
import { resultSuccess, resultError, deepClone } from "../_utils";
|
|
||||||
import { accountData } from "../_data/system_data";
|
|
||||||
import { permissionData } from "../_data/system_menu";
|
|
||||||
import { roleData } from "../_data/system_data";
|
|
||||||
/**
|
|
||||||
* post请求body,get请求query
|
|
||||||
* /mock/login 用户登录
|
|
||||||
* /mock/user/getUserInfo 获取用户信息
|
|
||||||
*/
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: "/mock/login",
|
|
||||||
method: "post",
|
|
||||||
timeout: 300,
|
|
||||||
response: ({ body }: any) => {
|
|
||||||
let { username, password } = body;
|
|
||||||
// 根据登录账号返回token,这里模拟两个账号
|
|
||||||
// 1、admin账号
|
|
||||||
// 2、common账号
|
|
||||||
if (username === "admin" && password === "123456") {
|
|
||||||
return resultSuccess({ token: "Admin-Token" });
|
|
||||||
}
|
|
||||||
if (username === "common" && password === "123456") {
|
|
||||||
return resultSuccess({ token: "Common-Token" });
|
|
||||||
}
|
|
||||||
return resultError(null, "账号或者密码错误", 500);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "/mock/user/getUserInfo",
|
|
||||||
method: "get",
|
|
||||||
timeout: 300,
|
|
||||||
response: ({ headers, query }: any) => {
|
|
||||||
let data: any = {
|
|
||||||
user: {}, // 账户信息
|
|
||||||
roles: [], // 角色
|
|
||||||
permissions: [] // 权限
|
|
||||||
};
|
|
||||||
let account = deepClone(accountData);
|
|
||||||
|
|
||||||
// 传入id则通过id匹配,否则通过token匹配
|
|
||||||
if (query.id) {
|
|
||||||
data.user = account.find((item: any) => item.id == query.id);
|
|
||||||
} else {
|
|
||||||
// 1、拿账户信息
|
|
||||||
if (headers.authorization == "Admin-Token") {
|
|
||||||
// 管理员账户
|
|
||||||
data.user = account.find((item: any) => item.id == 1);
|
|
||||||
} else {
|
|
||||||
// 普通账户
|
|
||||||
data.user = account.find((item: any) => item.id == 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2、根据账户拿角色信息
|
|
||||||
let roleInfo = roleData.filter((item: any) => data.user.roles.includes(item.code));
|
|
||||||
data.user.roles = roleInfo;
|
|
||||||
data.roles = roleInfo.map((item: any) => item.code);
|
|
||||||
|
|
||||||
// 3、拿权限信息
|
|
||||||
// 超级管理员
|
|
||||||
if (data.roles.includes("admin")) {
|
|
||||||
data.permissions = ["*:*:*"];
|
|
||||||
} else {
|
|
||||||
// 非admin账号则只拿对应角色的权限
|
|
||||||
let list = permissionData.filter((permission: any) => {
|
|
||||||
return data.roles.some((item: string) => permission.meta.roles.includes(item));
|
|
||||||
});
|
|
||||||
data.permissions = list.map(item => item.meta.permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultSuccess(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] as MockMethod[];
|
|
||||||
+21
-30
@@ -1,24 +1,26 @@
|
|||||||
import NProgress from "@/config/nprogress";
|
import NProgress from "@/config/nprogress";
|
||||||
import pinia from "@/store/index";
|
import pinia from "@/store/index";
|
||||||
import { createRouter, createWebHashHistory } from "vue-router";
|
import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";
|
||||||
import { staticRoutes, notFoundAndNoPower } from "@/router/route.ts";
|
import { staticRoutes, notFoundAndNoPower } from "@/router/route.ts";
|
||||||
import { currentlyRoute } from "@/router/route-output";
|
import { currentlyRoute } from "@/router/route-output";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { useUserInfoStore } from "@/store/modules/user-info";
|
import { useUserInfoStore } from "@/store/modules/user-info";
|
||||||
import { useRouteConfigStore } from "@/store/modules/route-config";
|
import { useRouteConfigStore } from "@/store/modules/route-config";
|
||||||
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
|
import { useRoutingMethod } from "@/hooks/useRoutingMethod";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建vue的路由示例
|
* 创建vue的路由示例
|
||||||
* @method createRouter(options: RouterOptions): Router
|
* @method createRouter(options: RouterOptions): Router
|
||||||
* @link 参考:https://next.router.vuejs.org/zh/api/#createrouter
|
* @link 参考:https://next.router.vuejs.org/zh/api/#createrouter
|
||||||
*/
|
*/
|
||||||
|
const routerHistory = import.meta.env.VITE_ROUTER_MODE === "history" ? createWebHistory() : createWebHashHistory();
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
history: routerHistory,
|
||||||
/**
|
/**
|
||||||
* 设置静态路由,其它的路由通过addRoute动态添加
|
* 设置静态路由,其它的路由通过addRoute动态添加
|
||||||
* 1、staticRoutes登录页、layout页、默认页面('/')
|
* 1、staticRoutes登录页、layout页、默认页面('/')
|
||||||
* 2、notFoundAndNoPower 添加默认 401、500界面,防止提示 No match found for location with path 'xxx'
|
* 2、notFoundAndNoPower 添加默认 401、500界面,防止提示 No match found for location with path 'xxx'
|
||||||
* 2、后端控制路由中也需要添加 notFoundAndNoPower 401、500界面
|
* 3、后端控制路由中也需要添加 notFoundAndNoPower 401、500界面
|
||||||
* 静态添加 notFoundAndNoPower 401、500界面将全屏显示
|
* 静态添加 notFoundAndNoPower 401、500界面将全屏显示
|
||||||
* 如果要 notFoundAndNoPower 在layout容器展示,则需要移除静态添加并将其添加到缓存路由树
|
* 如果要 notFoundAndNoPower 在layout容器展示,则需要移除静态添加并将其添加到缓存路由树
|
||||||
*/
|
*/
|
||||||
@@ -41,46 +43,35 @@ router.beforeEach(async (to: any, _: any, next: any) => {
|
|||||||
const routeStore = useRouteConfigStore(pinia);
|
const routeStore = useRouteConfigStore(pinia);
|
||||||
const { token } = storeToRefs(store);
|
const { token } = storeToRefs(store);
|
||||||
const { routeTree } = storeToRefs(routeStore);
|
const { routeTree } = storeToRefs(routeStore);
|
||||||
// console.log("去", to, "来自", from);
|
// console.log("去", to, "来自", _);
|
||||||
// next()内部加了path等于跳转指定路由会再次触发router.beforeEach,内部无参数等于放行,不会触发router.beforeEach
|
// next()内部加了path等于跳转指定路由会再次触发router.beforeEach,内部无参数等于放行,不会触发router.beforeEach
|
||||||
|
|
||||||
// 1、去登录页,无token,放行
|
// 1、无token处理
|
||||||
if (to.path === "/login" && !token.value) return next();
|
if (!token.value) {
|
||||||
|
// 如果是去登录页,直接放行;否则重定向到登录页
|
||||||
|
return to.path === "/login" ? next() : next("/login");
|
||||||
|
}
|
||||||
|
|
||||||
// 2、没有token,直接重定向到登录页
|
// 2、有token但去登录页 -> 重定向到首页
|
||||||
if (!token.value) return next("/login");
|
if (to.path === "/login") {
|
||||||
|
|
||||||
// 3、去登录页,有token,直接重定向到home页
|
|
||||||
if (to.path === "/login" && token.value) {
|
|
||||||
// 项目内的跳转,处理跳转路由高亮
|
// 项目内的跳转,处理跳转路由高亮
|
||||||
currentlyRoute(to);
|
currentlyRoute(to);
|
||||||
return next("/home");
|
return next("/home");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4、去非登录页,有token,用户信息是否存在,有则放行,否则重新获取路由信息、初始化路由
|
// 3、去非登录页,有token,路由树是否存在,有则放行,否则重新获取路由信息、初始化路由
|
||||||
// 判断路由是否获取,先获取账号信息和路由信息,添加路由后再跳转(页面刷新时触发)
|
// 判断路由是否获取,先获取账号信息和路由信息,添加路由后再跳转(页面刷新时触发)
|
||||||
// 解决刷新页面404的问题
|
// 解决刷新页面404的问题
|
||||||
if (!routeTree.value.length) {
|
if (!routeTree.value.length) {
|
||||||
const routeStore = useRouteConfigStore(pinia);
|
const routeStore = useRouteConfigStore(pinia);
|
||||||
|
// 获取账号信息
|
||||||
|
await store.setAccount();
|
||||||
|
// 获取路由信息
|
||||||
|
await routeStore.initSetRouter();
|
||||||
|
|
||||||
try {
|
// 普通路由需要添加query
|
||||||
// 获取账号信息
|
// 动态路由会自动匹配params
|
||||||
await store.setAccount();
|
return next({ path: to.path, query: to.query });
|
||||||
// 获取路由信息
|
|
||||||
await routeStore.initSetRouter();
|
|
||||||
|
|
||||||
// 判断是否是动态路由
|
|
||||||
const { isDynamicRoute } = useRoutingMethod();
|
|
||||||
if (isDynamicRoute(to.path)) {
|
|
||||||
return next({ name: to.name, params: to.params });
|
|
||||||
} else {
|
|
||||||
return next({ path: to.path, query: to.query });
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
return next(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取外链路由的处理函数
|
// 获取外链路由的处理函数
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
height: 400px;
|
height: 400px;
|
||||||
padding-bottom: $padding;
|
padding-bottom: $padding;
|
||||||
}
|
}
|
||||||
.monthly-analysis {
|
.daily-analysis {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
padding-bottom: $padding;
|
padding-bottom: $padding;
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
height: 400px;
|
height: 400px;
|
||||||
padding-bottom: $padding;
|
padding-bottom: $padding;
|
||||||
}
|
}
|
||||||
.monthly-analysis {
|
.daily-analysis {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
padding-bottom: $padding;
|
padding-bottom: $padding;
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
height: 400px;
|
height: 400px;
|
||||||
padding-bottom: $padding;
|
padding-bottom: $padding;
|
||||||
}
|
}
|
||||||
.monthly-analysis {
|
.daily-analysis {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
padding-bottom: $padding;
|
padding-bottom: $padding;
|
||||||
|
|||||||
Vendored
-4
@@ -1,4 +0,0 @@
|
|||||||
declare module "virtual:svg-icons-register" {
|
|
||||||
const content: any;
|
|
||||||
export default content;
|
|
||||||
}
|
|
||||||
Vendored
+1
-1
@@ -43,8 +43,8 @@ declare namespace TabsMenu {
|
|||||||
interface ViteEnv {
|
interface ViteEnv {
|
||||||
VITE_GLOB_APP_TITLE: string;
|
VITE_GLOB_APP_TITLE: string;
|
||||||
VITE_IMG_BASE_URL: string;
|
VITE_IMG_BASE_URL: string;
|
||||||
VITE_APP_OPEN_MOCK: boolean | string;
|
|
||||||
VITE_USER_NODE_ENV: "development" | "production" | "test";
|
VITE_USER_NODE_ENV: "development" | "production" | "test";
|
||||||
|
VITE_ROUTER_MODE: "hash" | "history";
|
||||||
VITE_PUBLIC_PATH: string;
|
VITE_PUBLIC_PATH: string;
|
||||||
VITE_APP_BASE_URL: string;
|
VITE_APP_BASE_URL: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export const isSecureEnvironment = () => {
|
|||||||
* 获取不同路由模式所对应的 url + params
|
* 获取不同路由模式所对应的 url + params
|
||||||
* @returns {String} 返回路径
|
* @returns {String} 返回路径
|
||||||
*/
|
*/
|
||||||
export const getUrlWithParams = () => {
|
export const getUrlWithParams = (): string => {
|
||||||
type UrlParams = {
|
type UrlParams = {
|
||||||
hash: string;
|
hash: string;
|
||||||
history: string;
|
history: string;
|
||||||
|
|||||||
@@ -17,43 +17,50 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.doc-container {
|
.doc-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
background: #fff;
|
min-width: 0;
|
||||||
border: 1px solid #ebeef5;
|
background: $color-bg-2;
|
||||||
|
border: 1px solid $color-border-2;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: $shadow2-center;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0 0 10px 0;
|
margin: 0 0 10px 0;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #303133;
|
color: $color-text-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background-color: #dcdfe6;
|
background-color: $color-border-2;
|
||||||
margin: 16px 0;
|
margin: 16px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #606266;
|
color: $color-text-2;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
line-height: 1.6;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
color: #409eff;
|
display: inline;
|
||||||
|
color: $color-link;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link:hover {
|
.link:hover {
|
||||||
color: #66b1ff;
|
color: rgb(var(--link-5));
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,135 +1,111 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="height: 100%" ref="monthlyAnalysis"></div>
|
<div class="analysis-chart" :class="{ empty: isEmpty }">
|
||||||
|
<a-empty v-if="isEmpty" description="暂无交易数据" />
|
||||||
|
<s-echarts v-else :options="option" :theme="theme" :update-options="{ notMerge: true }" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { default as VChart } from "@visactor/vchart";
|
import { use } from "echarts/core";
|
||||||
|
import { CanvasRenderer } from "echarts/renderers";
|
||||||
|
import { PieChart } from "echarts/charts";
|
||||||
|
import { TooltipComponent, LegendComponent } from "echarts/components";
|
||||||
|
import { useChart } from "@/hooks/useChart";
|
||||||
|
|
||||||
|
use([CanvasRenderer, PieChart, TooltipComponent, LegendComponent]);
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
homeData: any;
|
homeData: any;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const monthlyAnalysis = ref();
|
const colorMap: Record<string, string> = {
|
||||||
let vchart: any = null;
|
USDT: "#1E90FF",
|
||||||
|
USDC: "#32CD32",
|
||||||
const init = () => {
|
TRX: "#FF4500",
|
||||||
try {
|
BNB: "#F5A623",
|
||||||
if (!props.homeData?.token_map || !monthlyAnalysis.value) return;
|
ETH: "#722ED1"
|
||||||
|
|
||||||
const tokenMap = props.homeData.token_map;
|
|
||||||
if (typeof tokenMap !== "object" || tokenMap === null) return;
|
|
||||||
|
|
||||||
const totalAmount = Object.values(tokenMap).reduce((sum: number, value: any) => {
|
|
||||||
const numValue = Number(value);
|
|
||||||
return sum + (isNaN(numValue) ? 0 : numValue);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
if (totalAmount === 0) return;
|
|
||||||
|
|
||||||
const chartData = Object.entries(tokenMap)
|
|
||||||
.map(([token, amount]) => {
|
|
||||||
const numAmount = Number(amount);
|
|
||||||
if (isNaN(numAmount) || numAmount <= 0) return null;
|
|
||||||
const percentage = (numAmount / totalAmount) * 100;
|
|
||||||
return {
|
|
||||||
type: token,
|
|
||||||
value: Number(percentage.toFixed(2)),
|
|
||||||
amount: Number(numAmount.toFixed(2))
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter(item => item !== null);
|
|
||||||
|
|
||||||
if (chartData.length === 0) return;
|
|
||||||
|
|
||||||
if (vchart) {
|
|
||||||
vchart.release();
|
|
||||||
vchart = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const colorMap = {
|
|
||||||
USDT: "#1E90FF",
|
|
||||||
USDC: "#32CD32",
|
|
||||||
TRX: "#FF4500"
|
|
||||||
};
|
|
||||||
|
|
||||||
const spec = {
|
|
||||||
type: "pie",
|
|
||||||
data: [{ id: "monthlyAnalysisData", values: chartData }],
|
|
||||||
outerRadius: 0.8,
|
|
||||||
innerRadius: 0.5,
|
|
||||||
padAngle: 0.6,
|
|
||||||
valueField: "value",
|
|
||||||
categoryField: "type",
|
|
||||||
color: {
|
|
||||||
type: "ordinal",
|
|
||||||
domain: chartData.map(item => item.type),
|
|
||||||
range: chartData.map(item => colorMap[item.type as keyof typeof colorMap] || "#666666")
|
|
||||||
},
|
|
||||||
pie: {
|
|
||||||
style: { cornerRadius: 0 },
|
|
||||||
state: {
|
|
||||||
hover: { outerRadius: 0.85, stroke: "#fff", lineWidth: 1 },
|
|
||||||
selected: { outerRadius: 0.85, stroke: "#fff", lineWidth: 1 }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legends: { visible: true, orient: "left" },
|
|
||||||
label: { visible: true, content: "{type}: {value}%" },
|
|
||||||
tooltip: {
|
|
||||||
mark: {
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
key: (datum: any) => datum["type"],
|
|
||||||
value: (datum: any) => `${datum["value"]}% (${datum["amount"]})`
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
animation: false,
|
|
||||||
width: monthlyAnalysis.value?.clientWidth || 400,
|
|
||||||
height: monthlyAnalysis.value?.clientHeight || 300
|
|
||||||
};
|
|
||||||
|
|
||||||
if (monthlyAnalysis.value?.isConnected) {
|
|
||||||
vchart = new VChart(spec as any, { dom: monthlyAnalysis.value });
|
|
||||||
vchart.renderSync();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("分析图表初始化错误:", error);
|
|
||||||
if (vchart) {
|
|
||||||
vchart.release();
|
|
||||||
vchart = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
const chartData = computed(() => {
|
||||||
() => props.homeData,
|
const tokenMap = props.homeData?.token_map;
|
||||||
newData => {
|
if (!tokenMap || typeof tokenMap !== "object") return [];
|
||||||
try {
|
|
||||||
if (newData?.token_map) init();
|
|
||||||
} catch (error) {
|
|
||||||
console.error("分析图表更新失败:", error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true, deep: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
onMounted(() => {
|
const totalAmount = Object.values(tokenMap).reduce((sum: number, value: any) => {
|
||||||
try {
|
const numValue = Number(value);
|
||||||
if (props.homeData?.token_map) init();
|
return sum + (Number.isNaN(numValue) ? 0 : numValue);
|
||||||
} catch (error) {
|
}, 0);
|
||||||
console.error("分析图表初始化失败:", error);
|
if (totalAmount <= 0) return [];
|
||||||
}
|
|
||||||
|
return Object.entries(tokenMap)
|
||||||
|
.map(([token, amount]) => {
|
||||||
|
const numAmount = Number(amount);
|
||||||
|
if (Number.isNaN(numAmount) || numAmount <= 0) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: token,
|
||||||
|
value: Number(((numAmount / totalAmount) * 100).toFixed(2)),
|
||||||
|
amount: Number(numAmount.toFixed(2))
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter(Boolean) as Array<{ name: string; value: number; amount: number }>;
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
const isEmpty = computed(() => chartData.value.length === 0);
|
||||||
try {
|
|
||||||
vchart?.release();
|
const { option, theme } = useChart((_, palette = []) => {
|
||||||
vchart = null;
|
const colors = chartData.value.map(item => colorMap[item.name] || palette[chartData.value.indexOf(item) % palette.length] || "#666666");
|
||||||
} catch (error) {
|
|
||||||
console.error("清理图表失败:", error);
|
return {
|
||||||
}
|
backgroundColor: "transparent",
|
||||||
|
color: colors,
|
||||||
|
tooltip: {
|
||||||
|
trigger: "item",
|
||||||
|
borderWidth: 0,
|
||||||
|
formatter: (params: any) => {
|
||||||
|
const amount = params.data?.amount ?? 0;
|
||||||
|
return `<b>${params.name}</b><br/>${params.marker} 占比 <b style="margin-left: 16px">${params.value}%</b><br/>金额 <b style="margin-left: 16px">${amount}</b>`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
orient: "vertical",
|
||||||
|
left: "left",
|
||||||
|
top: "middle",
|
||||||
|
icon: "circle",
|
||||||
|
itemHeight: 10,
|
||||||
|
itemGap: 14,
|
||||||
|
data: chartData.value.map(item => item.name)
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
type: "pie",
|
||||||
|
center: ["62%", "50%"],
|
||||||
|
padAngle: 1,
|
||||||
|
radius: ["45%", "70%"],
|
||||||
|
label: {
|
||||||
|
color: "inherit",
|
||||||
|
formatter: "{b}: {c}%"
|
||||||
|
},
|
||||||
|
data: chartData.value,
|
||||||
|
emphasis: {
|
||||||
|
scale: true,
|
||||||
|
scaleSize: 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
.analysis-chart {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 300px;
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -3,17 +3,21 @@
|
|||||||
<div class="sell-histogram">
|
<div class="sell-histogram">
|
||||||
<div>
|
<div>
|
||||||
<span class="data-title">收款趋势</span>
|
<span class="data-title">收款趋势</span>
|
||||||
<span class="data-subtext">单位:元</span>
|
<span class="data-subtext">单位: 天</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<HistogramChart :home-data="props.homeData" :key="chartKey" />
|
<div class="chart-body">
|
||||||
|
<HistogramChart :home-data="props.homeData" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="monthly-analysis">
|
<div class="daily-analysis">
|
||||||
<div>
|
<div>
|
||||||
<span class="data-title">交易占比</span>
|
<span class="data-title">交易占比</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AnalysisChart :home-data="props.homeData" :key="chartKey" />
|
<div class="chart-body">
|
||||||
|
<AnalysisChart :home-data="props.homeData" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -25,18 +29,6 @@ import AnalysisChart from "@/views/home/components/analysis-chart.vue";
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
homeData: any;
|
homeData: any;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const chartKey = ref(0);
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.homeData,
|
|
||||||
newData => {
|
|
||||||
if (newData) {
|
|
||||||
chartKey.value++;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ deep: true }
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -45,6 +37,30 @@ watch(
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-top: calc($padding * 2);
|
margin-top: calc($padding * 2);
|
||||||
|
|
||||||
|
.sell-histogram,
|
||||||
|
.daily-analysis {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 400px;
|
||||||
|
padding-bottom: $padding;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sell-histogram {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.daily-analysis {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-body {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.data-title {
|
.data-title {
|
||||||
font-size: $font-size-body-3;
|
font-size: $font-size-body-3;
|
||||||
color: $color-text-1;
|
color: $color-text-1;
|
||||||
@@ -55,4 +71,17 @@ watch(
|
|||||||
color: $color-text-2;
|
color: $color-text-2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: $xxl) {
|
||||||
|
.data-box {
|
||||||
|
.sell-histogram {
|
||||||
|
width: calc(100% - 600px - $padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
.daily-analysis {
|
||||||
|
width: 600px;
|
||||||
|
margin-left: $padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,26 +4,18 @@
|
|||||||
<div>数据汇总</div>
|
<div>数据汇总</div>
|
||||||
</div>
|
</div>
|
||||||
<a-divider :margin="16" />
|
<a-divider :margin="16" />
|
||||||
<a-grid class="finance-card" :cols="{ xs: 1, sm: 2, lg: 4, xl: 4 }" :col-gap="16" :row-gap="28">
|
<a-grid class="finance-card" :cols="{ xs: 1, sm: 2, lg: 3, xl: 5 }" :col-gap="16" :row-gap="20">
|
||||||
<a-grid-item v-for="(item, index) in financeData" :key="index">
|
<a-grid-item v-for="(item, index) in financeData" :key="index">
|
||||||
<a-card hoverable class="finance-a-card" :class="'animated-fade-up-' + index">
|
<a-card hoverable class="finance-a-card" :class="'animated-fade-up-' + index">
|
||||||
<div class="finance-nav">
|
<div class="finance-nav">
|
||||||
<div class="tag-dot" :style="{ border: `3px solid ${item.color}` }"></div>
|
<div class="tag-dot" :style="{ border: `3px solid ${item.color}` }"></div>
|
||||||
<span class="finance-nav-title">{{ item.title }}</span>
|
<span class="finance-nav-title">{{ item.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<a-statistic
|
<div class="finance-value">{{ item.value }}</div>
|
||||||
:value-style="{
|
<div class="finance-sub">
|
||||||
fontSize: '13px',
|
<span>{{ item.subLabel }}</span>
|
||||||
marginLeft: '16px',
|
<span>{{ item.subValue }}</span>
|
||||||
marginTop: '12px'
|
</div>
|
||||||
}"
|
|
||||||
:value="item.value"
|
|
||||||
:value-from="0"
|
|
||||||
:start="true"
|
|
||||||
animation
|
|
||||||
:show-group-separator="false"
|
|
||||||
:precision="item.precision"
|
|
||||||
/>
|
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-grid-item>
|
</a-grid-item>
|
||||||
</a-grid>
|
</a-grid>
|
||||||
@@ -35,47 +27,65 @@ const props = defineProps<{
|
|||||||
homeData: any;
|
homeData: any;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const financeData = ref([
|
const formatAmount = (value: any) => Number(value || 0).toFixed(2);
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
title: "累计订单",
|
|
||||||
value: props.homeData?.total_count || 0,
|
|
||||||
color: "#165DFF",
|
|
||||||
precision: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
title: "今日订单",
|
|
||||||
value: props.homeData?.today_count || 0,
|
|
||||||
color: "#6c73ff",
|
|
||||||
precision: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
title: "今日收款",
|
|
||||||
value: props.homeData?.today_money || 0,
|
|
||||||
color: "#39cbab",
|
|
||||||
precision: 2
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
const formatPeriod = (from?: string, to?: string) => {
|
||||||
id: 4,
|
if (!from || !to) return "--";
|
||||||
title: "总计收款",
|
return `${from.slice(5, 10).replace("-", "/")} - ${to.slice(5, 10).replace("-", "/")}`;
|
||||||
value: props.homeData?.total_money || 0,
|
};
|
||||||
color: "#ff8625",
|
|
||||||
precision: 2
|
const buildFinanceData = (data: any) => {
|
||||||
}
|
const kpi = data?.kpi || {};
|
||||||
]);
|
return [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
title: "订单总数",
|
||||||
|
value: kpi.orders_total || 0,
|
||||||
|
subLabel: "已支付订单:",
|
||||||
|
subValue: kpi.orders_success || 0,
|
||||||
|
color: "#165DFF"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
title: "收款金额",
|
||||||
|
value: formatAmount(kpi.gmv_paid),
|
||||||
|
subLabel: "支付成功率:",
|
||||||
|
subValue: `${formatAmount(kpi.order_success_rate)}%`,
|
||||||
|
color: "#14A058"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
title: "待付订单",
|
||||||
|
value: kpi.orders_pending || 0,
|
||||||
|
subLabel: "确认中订单:",
|
||||||
|
subValue: kpi.orders_confirming || 0,
|
||||||
|
color: "#F5A623"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
title: "失败订单",
|
||||||
|
value: kpi.orders_failed || 0,
|
||||||
|
subLabel: "通知失败:",
|
||||||
|
subValue: kpi.notify_failed || 0,
|
||||||
|
color: "#E33E38"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
title: "统计周期",
|
||||||
|
value: formatPeriod(data?.from, data?.to),
|
||||||
|
subLabel: "",
|
||||||
|
subValue: data?.timezone || "--",
|
||||||
|
color: "#722ED1"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
const financeData = ref(buildFinanceData(props.homeData));
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.homeData,
|
() => props.homeData,
|
||||||
newData => {
|
newData => {
|
||||||
if (newData) {
|
financeData.value = buildFinanceData(newData);
|
||||||
financeData.value[0].value = newData.total_count || 0;
|
|
||||||
financeData.value[1].value = newData.today_count || 0;
|
|
||||||
financeData.value[2].value = newData.today_money || 0;
|
|
||||||
financeData.value[3].value = newData.total_money || 0;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
@@ -108,6 +118,27 @@ watch(
|
|||||||
font-size: $font-size-body-3;
|
font-size: $font-size-body-3;
|
||||||
color: $color-text-1;
|
color: $color-text-1;
|
||||||
}
|
}
|
||||||
|
.finance-a-card {
|
||||||
|
min-height: 126px;
|
||||||
|
}
|
||||||
|
.finance-value {
|
||||||
|
margin: 14px 0 0 16px;
|
||||||
|
color: $color-text-1;
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 32px;
|
||||||
|
font-weight: 600;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
.finance-sub {
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
align-items: center;
|
||||||
|
margin: 8px 0 0 16px;
|
||||||
|
color: $color-text-2;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
.margin-left-text {
|
.margin-left-text {
|
||||||
margin-left: $margin-text;
|
margin-left: $margin-text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,89 +1,181 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="height: 100%" ref="sellHistogram"></div>
|
<div class="histogram-scroll" :class="{ empty: isEmpty, scrollable: isScrollable }" ref="histogramScroll">
|
||||||
|
<a-empty v-if="isEmpty" description="暂无订单数据" />
|
||||||
|
<div v-else class="histogram-canvas" :style="{ width: chartWidth }">
|
||||||
|
<s-echarts :options="option" :theme="theme" :update-options="{ notMerge: true }" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { default as VChart } from "@visactor/vchart";
|
import { use } from "echarts/core";
|
||||||
|
import { BarChart } from "echarts/charts";
|
||||||
|
import { CanvasRenderer } from "echarts/renderers";
|
||||||
|
import { TooltipComponent, GridComponent, LegendComponent } from "echarts/components";
|
||||||
|
import { useChart } from "@/hooks/useChart";
|
||||||
|
|
||||||
|
use([TooltipComponent, GridComponent, LegendComponent, BarChart, CanvasRenderer]);
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
homeData: any;
|
homeData: any;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const sellHistogram = ref();
|
const histogramScroll = ref<HTMLElement>();
|
||||||
let vchart: any = null;
|
const containerWidth = ref(0);
|
||||||
|
let resizeObserver: ResizeObserver | null = null;
|
||||||
|
|
||||||
const init = () => {
|
const points = computed(() => {
|
||||||
try {
|
const source = props.homeData?.points;
|
||||||
if (!props.homeData?.monthly || !sellHistogram.value) return;
|
return Array.isArray(source) ? source : [];
|
||||||
|
});
|
||||||
|
|
||||||
const monthlyData = props.homeData.monthly;
|
const dates = computed(() =>
|
||||||
if (typeof monthlyData !== "object" || monthlyData === null) return;
|
points.value.map(point =>
|
||||||
|
String(point.date || "")
|
||||||
const chartData = Object.entries(monthlyData).map(([month, sales]) => ({
|
.slice(5)
|
||||||
month,
|
.replace("-", "/")
|
||||||
sales: Number(Number(sales).toFixed(2)) || 0
|
)
|
||||||
}));
|
|
||||||
|
|
||||||
if (chartData.length === 0) return;
|
|
||||||
|
|
||||||
if (vchart) {
|
|
||||||
vchart.release();
|
|
||||||
vchart = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const spec = {
|
|
||||||
type: "bar",
|
|
||||||
data: [{ id: "sellHistogramData", values: chartData }],
|
|
||||||
xField: "month",
|
|
||||||
yField: "sales",
|
|
||||||
barWidth: 10,
|
|
||||||
barGapInGroup: 0,
|
|
||||||
animation: false,
|
|
||||||
width: sellHistogram.value?.clientWidth || 400,
|
|
||||||
height: sellHistogram.value?.clientHeight || 300
|
|
||||||
};
|
|
||||||
|
|
||||||
if (sellHistogram.value?.isConnected) {
|
|
||||||
vchart = new VChart(spec as any, { dom: sellHistogram.value });
|
|
||||||
vchart.renderSync();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("图表初始化错误:", error);
|
|
||||||
if (vchart) {
|
|
||||||
vchart.release();
|
|
||||||
vchart = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.homeData,
|
|
||||||
newData => {
|
|
||||||
try {
|
|
||||||
if (newData?.monthly) init();
|
|
||||||
} catch (error) {
|
|
||||||
console.error("图表更新失败:", error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true, deep: true }
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const ordersTotalData = computed(() => points.value.map(point => Number(point.orders_total || 0)));
|
||||||
|
const ordersPaidData = computed(() => points.value.map(point => Number(point.orders_paid ?? point.orders_success ?? 0)));
|
||||||
|
|
||||||
|
const gmvPaidByDate = computed(() => {
|
||||||
|
return points.value.reduce<Record<string, string>>((result, point, index) => {
|
||||||
|
result[dates.value[index]] = Number(point.gmv_paid || 0).toFixed(2);
|
||||||
|
return result;
|
||||||
|
}, {});
|
||||||
|
});
|
||||||
|
|
||||||
|
const isEmpty = computed(() => !ordersTotalData.value.some(Boolean) && !ordersPaidData.value.some(Boolean));
|
||||||
|
const isScrollable = computed(() => points.value.length > 7);
|
||||||
|
const chartWidth = computed(() => {
|
||||||
|
if (!isScrollable.value) return "100%";
|
||||||
|
return `${Math.max(containerWidth.value || 0, points.value.length * 58)}px`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const { option, theme } = useChart((isDark, palette = []) => {
|
||||||
|
return {
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
color: [palette[0] || "#4080FF", palette[3] || "#4CD263"],
|
||||||
|
tooltip: {
|
||||||
|
trigger: "axis",
|
||||||
|
borderWidth: 0,
|
||||||
|
axisPointer: {
|
||||||
|
type: "shadow",
|
||||||
|
shadowStyle: {
|
||||||
|
color: isDark ? "rgba(247, 248, 250,0.03)" : "rgba(0, 0, 0,0.03)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
formatter: (params: any) => {
|
||||||
|
const items = Array.isArray(params) ? params : [params];
|
||||||
|
const date = items[0]?.name || "";
|
||||||
|
const rows = items
|
||||||
|
.map(item => `${item.marker} ${item.seriesName} <b style="margin-left: 16px">${item.value}</b>`)
|
||||||
|
.join("<br/>");
|
||||||
|
const gmv = gmvPaidByDate.value[date] || "0.00";
|
||||||
|
return `<b>${date}</b><br/>${rows}<br/>已收款 <b style="margin-left: 16px">${gmv}</b>`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
top: 0,
|
||||||
|
left: "center",
|
||||||
|
icon: "circle"
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: "3%",
|
||||||
|
right: "4%",
|
||||||
|
top: 42,
|
||||||
|
bottom: "3%",
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: "category",
|
||||||
|
data: dates.value,
|
||||||
|
axisLabel: {
|
||||||
|
color: "#86909c",
|
||||||
|
fontSize: 10,
|
||||||
|
formatter: (value: string) => (gmvPaidByDate.value[value] ? `${value}\n${gmvPaidByDate.value[value]}` : value),
|
||||||
|
interval: 0,
|
||||||
|
lineHeight: 11
|
||||||
|
},
|
||||||
|
axisLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: isDark ? "#373738" : "#ebedf0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: "value",
|
||||||
|
min: 0,
|
||||||
|
axisLabel: {
|
||||||
|
color: "#86909c"
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: isDark ? "#373738" : "#ebedf0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: "订单总数",
|
||||||
|
type: "bar",
|
||||||
|
barWidth: 9,
|
||||||
|
barGap: "25%",
|
||||||
|
data: ordersTotalData.value
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "已支付订单",
|
||||||
|
type: "bar",
|
||||||
|
barWidth: 9,
|
||||||
|
data: ordersPaidData.value
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
try {
|
if (typeof ResizeObserver !== "undefined" && histogramScroll.value) {
|
||||||
if (props.homeData?.monthly) init();
|
resizeObserver = new ResizeObserver(entries => {
|
||||||
} catch (error) {
|
containerWidth.value = entries[0]?.contentRect.width || histogramScroll.value?.clientWidth || 0;
|
||||||
console.error("图表初始化失败:", error);
|
});
|
||||||
|
resizeObserver.observe(histogramScroll.value);
|
||||||
}
|
}
|
||||||
|
containerWidth.value = histogramScroll.value?.clientWidth || 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
try {
|
resizeObserver?.disconnect();
|
||||||
vchart?.release();
|
resizeObserver = null;
|
||||||
vchart = null;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("清理图表失败:", error);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
.histogram-scroll {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: hidden;
|
||||||
|
|
||||||
|
&.scrollable {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.histogram-canvas {
|
||||||
|
height: 100%;
|
||||||
|
min-width: 100%;
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
+130
-19
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="snow-page">
|
<div class="snow-page">
|
||||||
<div class="home-page">
|
<div class="home-page">
|
||||||
<!-- 法币选择器 -->
|
<div class="dashboard-toolbar">
|
||||||
<div class="fiat-selector-wrapper">
|
<!-- 法币选择器 -->
|
||||||
<div class="fiat-selector">
|
<div class="fiat-selector">
|
||||||
<span class="label">交易法币:</span>
|
<span class="label">交易法币:</span>
|
||||||
<div class="fiat-options">
|
<div class="fiat-options">
|
||||||
@@ -18,6 +18,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="range-actions">
|
||||||
|
<a-range-picker
|
||||||
|
v-if="range === 'custom'"
|
||||||
|
v-model="customDates"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
|
style="width: 240px"
|
||||||
|
@change="handleCustomDateChange"
|
||||||
|
/>
|
||||||
|
<a-select v-model="range" style="width: 132px" @change="handleRangeChange">
|
||||||
|
<a-option v-for="item in rangeOptions" :key="item.value" :value="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</a-option>
|
||||||
|
</a-select>
|
||||||
|
<a-button type="primary" :loading="loading" @click="forceRefresh">
|
||||||
|
<template #icon><icon-refresh /></template>
|
||||||
|
强制刷新
|
||||||
|
</a-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 财务指标 -->
|
<!-- 财务指标 -->
|
||||||
@@ -34,7 +53,12 @@ import DataBox from "@/views/home/components/data-box.vue";
|
|||||||
import { getDashboardHomeAPI } from "@/api/modules/home/index";
|
import { getDashboardHomeAPI } from "@/api/modules/home/index";
|
||||||
|
|
||||||
const fiat = ref("CNY");
|
const fiat = ref("CNY");
|
||||||
|
const range = ref("7d");
|
||||||
|
const customDates = ref<any[]>([]);
|
||||||
const home = ref<any>(null);
|
const home = ref<any>(null);
|
||||||
|
const loading = ref(false);
|
||||||
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || "Asia/Shanghai";
|
||||||
|
let dashboardRetryTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
|
||||||
const fiatOptions = ref([
|
const fiatOptions = ref([
|
||||||
{ value: "CNY", label: "人民币", symbol: "¥" },
|
{ value: "CNY", label: "人民币", symbol: "¥" },
|
||||||
@@ -44,9 +68,56 @@ const fiatOptions = ref([
|
|||||||
{ value: "JPY", label: "日元", symbol: "¥" }
|
{ value: "JPY", label: "日元", symbol: "¥" }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getDashboardHome = async () => {
|
const rangeOptions = [
|
||||||
const data = await getDashboardHomeAPI({ fiat: fiat.value });
|
{ value: "today", label: "今天" },
|
||||||
home.value = data.data;
|
{ value: "7d", label: "最近 7 天" },
|
||||||
|
{ value: "30d", label: "最近 30 天" },
|
||||||
|
{ value: "custom", label: "自定义" }
|
||||||
|
];
|
||||||
|
|
||||||
|
const clearDashboardRetry = () => {
|
||||||
|
if (dashboardRetryTimer) {
|
||||||
|
clearTimeout(dashboardRetryTimer);
|
||||||
|
dashboardRetryTimer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getDashboardHome = async (force = false, retryCount = 0) => {
|
||||||
|
if (range.value === "custom" && (!Array.isArray(customDates.value) || customDates.value.length !== 2)) return;
|
||||||
|
|
||||||
|
if (retryCount === 0) {
|
||||||
|
clearDashboardRetry();
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const params: any = {
|
||||||
|
range: range.value,
|
||||||
|
tz: timezone,
|
||||||
|
fiat: fiat.value,
|
||||||
|
force
|
||||||
|
};
|
||||||
|
if (range.value === "custom") {
|
||||||
|
params.from = customDates.value[0];
|
||||||
|
params.to = customDates.value[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await getDashboardHomeAPI(params);
|
||||||
|
if (!data?.data) {
|
||||||
|
throw new Error("仪表盘数据为空");
|
||||||
|
}
|
||||||
|
home.value = data.data;
|
||||||
|
} catch (error) {
|
||||||
|
if (retryCount < 3) {
|
||||||
|
dashboardRetryTimer = setTimeout(() => {
|
||||||
|
getDashboardHome(force, retryCount + 1);
|
||||||
|
}, (retryCount + 1) * 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.error("获取首页统计失败:", error);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理法币切换
|
// 处理法币切换
|
||||||
@@ -55,9 +126,27 @@ const handleFiatChange = (value: string) => {
|
|||||||
getDashboardHome();
|
getDashboardHome();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRangeChange = () => {
|
||||||
|
if (range.value !== "custom") {
|
||||||
|
getDashboardHome();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCustomDateChange = () => {
|
||||||
|
getDashboardHome();
|
||||||
|
};
|
||||||
|
|
||||||
|
const forceRefresh = () => {
|
||||||
|
getDashboardHome(true);
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDashboardHome();
|
getDashboardHome();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
clearDashboardRetry();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -66,10 +155,13 @@ onMounted(() => {
|
|||||||
background: $color-bg-1;
|
background: $color-bg-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fiat-selector-wrapper {
|
.dashboard-toolbar {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fiat-selector {
|
.fiat-selector {
|
||||||
@@ -77,15 +169,15 @@ onMounted(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
background: #fff;
|
background: $color-bg-2;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
|
||||||
border: 1px solid #f0f0f0;
|
border: 1px solid $color-border-2;
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #666;
|
color: $color-text-2;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,21 +194,21 @@ onMounted(() => {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
border: 1px solid #e6e6e6;
|
border: 1px solid $color-border-2;
|
||||||
background: #fafafa;
|
background: $color-fill-1;
|
||||||
min-width: 60px;
|
min-width: 60px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
border-color: #409eff;
|
border-color: $color-primary;
|
||||||
background: #f0f8ff;
|
background: rgb(var(--primary-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: linear-gradient(135deg, #409eff, #36a3f7);
|
background: $color-primary;
|
||||||
border-color: #409eff;
|
border-color: $color-primary;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.25);
|
box-shadow: 0 2px 8px rgb(var(--primary-6) / 25%);
|
||||||
|
|
||||||
.currency-symbol,
|
.currency-symbol,
|
||||||
.currency-name {
|
.currency-name {
|
||||||
@@ -127,19 +219,31 @@ onMounted(() => {
|
|||||||
.currency-symbol {
|
.currency-symbol {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #409eff;
|
color: $color-primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
.currency-name {
|
.currency-name {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #666;
|
color: $color-text-2;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.range-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
// 响应式设计
|
// 响应式设计
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
|
.dashboard-toolbar {
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
.fiat-selector {
|
.fiat-selector {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
@@ -158,5 +262,12 @@ onMounted(() => {
|
|||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.range-actions {
|
||||||
|
width: 100%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-start;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal width="680px" :visible="visible" @close="onClose" @cancel="onClose" @update:visible="onClose" unmount-on-close>
|
<a-modal :width="detailDialogWidth" :visible="visible" @close="onClose" @cancel="onClose" @update:visible="onClose" unmount-on-close>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="detail-modal-title">
|
<div class="detail-modal-title">
|
||||||
<icon-star />
|
<icon-star />
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<!-- 功能操作按钮 -->
|
<!-- 功能操作按钮 -->
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<a-space>
|
<a-space wrap>
|
||||||
<a-button
|
<a-button
|
||||||
v-if="detailData.status === 2 && detailData.notify_state === 0"
|
v-if="detailData.status === 2 && detailData.notify_state === 0"
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
</a-tag>
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-user />
|
<icon-user />
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<div class="detail-value">{{ detailData.name }}</div>
|
<div class="detail-value">{{ detailData.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-swap />
|
<icon-swap />
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-file />
|
<icon-file />
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-tag />
|
<icon-tag />
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-archive />
|
<icon-archive />
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-pushpin />
|
<icon-pushpin />
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
<!-- 回调信息卡片 -->
|
<!-- 回调信息卡片 -->
|
||||||
<a-card class="detail-card" title="回调信息" :bordered="false" v-if="detailData.status === 2 || detailData.status === 5">
|
<a-card class="detail-card" title="回调信息" :bordered="false" v-if="detailData.status === 2 || detailData.status === 5">
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-check />
|
<icon-check />
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12" v-if="detailData.return_url">
|
<a-col :xs="24" :sm="24" :md="12" v-if="detailData.return_url">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-link />
|
<icon-link />
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
<!-- 区块链信息卡片 -->
|
<!-- 区块链信息卡片 -->
|
||||||
<a-card class="detail-card" title="区块链数据" :bordered="false" v-if="detailData.status === 2 || detailData.status === 5">
|
<a-card class="detail-card" title="区块链数据" :bordered="false" v-if="detailData.status === 2 || detailData.status === 5">
|
||||||
<a-row :gutter="24" v-if="detailData.ref_hash">
|
<a-row :gutter="24" v-if="detailData.ref_hash">
|
||||||
<a-col :span="12" v-if="detailData.ref_block_num">
|
<a-col :xs="24" :sm="24" :md="12" v-if="detailData.ref_block_num">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-layers />
|
<icon-layers />
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
<div class="detail-value">{{ detailData.ref_block_num }}</div>
|
<div class="detail-value">{{ detailData.ref_block_num }}</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-safe />
|
<icon-safe />
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
<!-- 时间信息卡片 -->
|
<!-- 时间信息卡片 -->
|
||||||
<a-card class="detail-card" title="订单时间" :bordered="false">
|
<a-card class="detail-card" title="订单时间" :bordered="false">
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="12" v-if="detailData.created_at">
|
<a-col :xs="24" :sm="24" :md="12" v-if="detailData.created_at">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-plus-circle />
|
<icon-plus-circle />
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
<div class="detail-value">{{ formatDateTime(detailData.created_at) }}</div>
|
<div class="detail-value">{{ formatDateTime(detailData.created_at) }}</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :xs="24" :sm="24" :md="12">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<div class="detail-label">
|
<div class="detail-label">
|
||||||
<icon-check-circle v-if="detailData.confirmed_at && (detailData.status === 2 || detailData.status === 5)" />
|
<icon-check-circle v-if="detailData.confirmed_at && (detailData.status === 2 || detailData.status === 5)" />
|
||||||
@@ -261,6 +261,7 @@ import { getCryptoColor } from "@/views/rate/common";
|
|||||||
import { delOrderApi } from "@/api/modules/order/index";
|
import { delOrderApi } from "@/api/modules/order/index";
|
||||||
import { Notification, Modal } from "@arco-design/web-vue";
|
import { Notification, Modal } from "@arco-design/web-vue";
|
||||||
import { manualNotifyAPI } from "@/api/modules/order/index";
|
import { manualNotifyAPI } from "@/api/modules/order/index";
|
||||||
|
import { useLayoutModel } from "@/hooks/useLayoutModel";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
visible: Boolean,
|
visible: Boolean,
|
||||||
@@ -270,6 +271,9 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { dialogWidth } = useLayoutModel();
|
||||||
|
const detailDialogWidth = computed(() => dialogWidth("820px"));
|
||||||
|
|
||||||
const emits = defineEmits(["close", "refresh"]);
|
const emits = defineEmits(["close", "refresh"]);
|
||||||
|
|
||||||
const onClose = () => emits("close");
|
const onClose = () => emits("close");
|
||||||
@@ -358,7 +362,18 @@ const currencySymbolMap: Record<string, string> = {
|
|||||||
const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
|
:deep(.arco-modal-body) {
|
||||||
|
max-height: calc(100vh - 172px);
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 16px 20px;
|
||||||
|
scrollbar-width: none;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.detail-modal-title {
|
.detail-modal-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -366,13 +381,20 @@ const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
|||||||
}
|
}
|
||||||
|
|
||||||
.detail-content {
|
.detail-content {
|
||||||
padding: 8px 0;
|
padding: 0;
|
||||||
max-height: 70vh;
|
overflow-y: visible;
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-card {
|
.detail-card {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-card :deep(.arco-card-header) {
|
||||||
|
padding: 14px 20px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-card :deep(.arco-card-body) {
|
||||||
|
padding: 16px 20px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-card:last-child {
|
.detail-card:last-child {
|
||||||
@@ -387,11 +409,12 @@ const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
|||||||
}
|
}
|
||||||
|
|
||||||
.detail-item {
|
.detail-item {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 16px;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-item:last-child {
|
.detail-item:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-label {
|
.detail-label {
|
||||||
@@ -400,7 +423,7 @@ const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--color-text-2);
|
color: var(--color-text-2);
|
||||||
margin-bottom: 6px;
|
margin-bottom: 8px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +431,8 @@ const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: var(--color-text-1);
|
color: var(--color-text-1);
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
padding-left: 26px;
|
min-width: 0;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-value :deep(.arco-typography) {
|
.detail-value :deep(.arco-typography) {
|
||||||
@@ -417,12 +441,12 @@ const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
|||||||
}
|
}
|
||||||
|
|
||||||
.detail-value :deep(.arco-typography-operation-copy) {
|
.detail-value :deep(.arco-typography-operation-copy) {
|
||||||
color: #165dff;
|
color: $color-link;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-value :deep(.arco-typography-operation-copy:hover) {
|
.detail-value :deep(.arco-typography-operation-copy:hover) {
|
||||||
color: #0e42d2;
|
color: rgb(var(--link-5));
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-value {
|
.address-value {
|
||||||
@@ -432,12 +456,12 @@ const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
|||||||
}
|
}
|
||||||
|
|
||||||
.address-value :deep(.arco-typography-operation-copy) {
|
.address-value :deep(.arco-typography-operation-copy) {
|
||||||
color: #165dff;
|
color: $color-link;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-value :deep(.arco-typography-operation-copy:hover) {
|
.address-value :deep(.arco-typography-operation-copy:hover) {
|
||||||
color: #0e42d2;
|
color: rgb(var(--link-5));
|
||||||
}
|
}
|
||||||
|
|
||||||
.hash-value {
|
.hash-value {
|
||||||
@@ -488,7 +512,7 @@ const getCurrencySymbol = (fiat: string) => currencySymbolMap[fiat] || "";
|
|||||||
}
|
}
|
||||||
|
|
||||||
.detail-content {
|
.detail-content {
|
||||||
max-height: 80vh;
|
max-height: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -11,28 +11,16 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-row justify="center" class="margin-top">
|
<a-row justify="center" class="margin-top">
|
||||||
<a-col :xs="18" :sm="12" :md="12" :lg="12" :xl="8" :xxl="8">
|
<a-col :xs="18" :sm="12" :md="12" :lg="12" :xl="12" :xxl="12">
|
||||||
<a-form ref="formRef" auto-label-width :layout="formLayout" :model="form" :rules="rules" @submit="handleSubmit">
|
<a-form ref="formRef" auto-label-width :layout="formLayout" :model="form" :rules="rules" @submit="handleSubmit">
|
||||||
<div v-if="currentStep == 1">
|
<div v-if="currentStep == 1">
|
||||||
<a-form-item
|
<a-form-item field="name" label="收款项目" :validate-trigger="['change', 'input']">
|
||||||
field="name"
|
|
||||||
label="收款项目"
|
|
||||||
:validate-trigger="['change', 'input']"
|
|
||||||
>
|
|
||||||
<a-input :style="{ width: '100%' }" v-model="form.name" placeholder="请输入收款项目" allow-clear />
|
<a-input :style="{ width: '100%' }" v-model="form.name" placeholder="请输入收款项目" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item field="order_id" label="订单号" :validate-trigger="['change', 'input']">
|
||||||
field="order_id"
|
|
||||||
label="订单号"
|
|
||||||
:validate-trigger="['change', 'input']"
|
|
||||||
>
|
|
||||||
<a-input :style="{ width: '100%' }" v-model="form.order_id" placeholder="请输入订单号" allow-clear />
|
<a-input :style="{ width: '100%' }" v-model="form.order_id" placeholder="请输入订单号" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item field="amount" label="订单金额" :validate-trigger="['change', 'input']">
|
||||||
field="amount"
|
|
||||||
label="订单金额"
|
|
||||||
:validate-trigger="['change', 'input']"
|
|
||||||
>
|
|
||||||
<a-input-number :style="{ width: '100%' }" v-model="form.amount" placeholder="请输入订单金额" allow-clear />
|
<a-input-number :style="{ width: '100%' }" v-model="form.amount" placeholder="请输入订单金额" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="trade_fiat" label="法币币种" :rules="[{ required: true, message: '法币币种不能为空' }]">
|
<a-form-item field="trade_fiat" label="法币币种" :rules="[{ required: true, message: '法币币种不能为空' }]">
|
||||||
@@ -55,8 +43,11 @@
|
|||||||
<template #subtitle> {{ resultSubtitle }} </template>
|
<template #subtitle> {{ resultSubtitle }} </template>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-space direction="vertical" size="large">
|
<a-space direction="vertical" size="large">
|
||||||
<div v-if="resultStatus === 'success'">订单链接:<a :href="paymentUrl" class="link" target="_blank">{{ paymentUrl }}</a></div>
|
<a-space v-if="resultStatus === 'success'" class="payment-link-row" wrap>
|
||||||
<a-space>
|
<span>订单链接: </span>
|
||||||
|
<a-link class="payment-link" :href="paymentUrl" target="_blank" :hoverable="false">{{ paymentUrl }}</a-link>
|
||||||
|
</a-space>
|
||||||
|
<a-space wrap>
|
||||||
<a-button type="primary" v-if="resultStatus === 'success'" @click="copyLink">复制订单链接</a-button>
|
<a-button type="primary" v-if="resultStatus === 'success'" @click="copyLink">复制订单链接</a-button>
|
||||||
<a-button @click="resetForm">再次创建</a-button>
|
<a-button @click="resetForm">再次创建</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
@@ -75,7 +66,7 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
<a-row v-if="currentStep == 2">
|
<a-row v-if="currentStep == 2">
|
||||||
<a-col :span="16" :offset="4">
|
<a-col :span="16" :offset="4">
|
||||||
<a-typography style="padding: 24px; background: var(--color-fill-2)">
|
<a-typography class="result-tip">
|
||||||
<a-typography-paragraph>提示</a-typography-paragraph>
|
<a-typography-paragraph>提示</a-typography-paragraph>
|
||||||
<ul>
|
<ul>
|
||||||
<li>您可以将该链接发给客户让其支付</li>
|
<li>您可以将该链接发给客户让其支付</li>
|
||||||
@@ -209,7 +200,7 @@ const handleSubmit = async ({ errors, values }: ArcoDesign.ArcoSubmit) => {
|
|||||||
resultStatus.value = "error";
|
resultStatus.value = "error";
|
||||||
resultTitle.value = "订单创建失败";
|
resultTitle.value = "订单创建失败";
|
||||||
resultSubtitle.value = err.message || "请求失败";
|
resultSubtitle.value = err.message || "请求失败";
|
||||||
paymentUrl.value = "";
|
paymentUrl.value = "";
|
||||||
currentStep.value += 1;
|
currentStep.value += 1;
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@@ -224,7 +215,7 @@ const onLastStep = () => {
|
|||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
currentStep.value = 1;
|
currentStep.value = 1;
|
||||||
initForm();
|
initForm();
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -235,12 +226,33 @@ const resetForm = () => {
|
|||||||
margin-top: 60px;
|
margin-top: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.result-tip {
|
||||||
color: #409eff;
|
padding: 24px;
|
||||||
text-decoration: none;
|
background: var(--color-fill-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.link:hover {
|
.payment-link-row {
|
||||||
color: #66b1ff;
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-link {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.container {
|
||||||
|
padding: 32px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-top {
|
||||||
|
margin-top: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-tip {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="snow-page">
|
<div class="snow-page">
|
||||||
<div class="snow-inner">
|
<div class="snow-inner">
|
||||||
<a-form ref="formRef" :model="formData.form" auto-label-width>
|
<a-form ref="formRef" auto-label-width :model="formData.form">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6">
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
<a-form-item field="order_id" label="商户订单">
|
<a-form-item field="order_id" label="商户订单">
|
||||||
<a-input v-model="formData.form.order_id" placeholder="请输入商户订单" allow-clear />
|
<a-input v-model="formData.form.order_id" placeholder="请输入商户订单" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6">
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
<a-form-item field="trade_type" label="交易类型">
|
<a-form-item field="trade_type" label="交易类型">
|
||||||
<a-select v-model="formData.form.trade_type" placeholder="请选择交易类型" allow-clear allow-search>
|
<a-select v-model="formData.form.trade_type" placeholder="请选择交易类型" allow-clear allow-search>
|
||||||
<a-option v-for="item in tradeTypeOptions" :key="item.value" :value="item.value">
|
<a-option v-for="item in tradeTypeOptions" :key="item.value" :value="item.value">
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6">
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
<a-form-item field="status" label="订单状态">
|
<a-form-item field="status" label="订单状态">
|
||||||
<a-select v-model="formData.form.status" placeholder="请选择订单状态" allow-clear>
|
<a-select v-model="formData.form.status" placeholder="请选择订单状态" allow-clear>
|
||||||
<a-option v-for="item in statusOptions" :key="item.value" :value="item.value">
|
<a-option v-for="item in statusOptions" :key="item.value" :value="item.value">
|
||||||
@@ -27,48 +27,45 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" class="btn-col">
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
<a-form-item label=" " style="margin-bottom: 0">
|
<a-space class="search-btn" wrap>
|
||||||
<a-space>
|
<a-button type="primary" @click="getOrderList">
|
||||||
<a-button type="primary" @click="getOrderList">
|
<template #icon><icon-search /></template>
|
||||||
<template #icon><icon-search /></template>
|
查询
|
||||||
查询
|
</a-button>
|
||||||
|
<a-button @click="onReset">
|
||||||
|
<template #icon><icon-refresh /></template>
|
||||||
|
重置
|
||||||
|
</a-button>
|
||||||
|
<a-popconfirm :content="batchDelConfirm" type="warning" @ok="onBatchDelete">
|
||||||
|
<a-button v-show="selectedKeys.length > 0" type="primary" status="danger">
|
||||||
|
<template #icon><icon-delete /></template>
|
||||||
|
删除
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button @click="onReset">
|
</a-popconfirm>
|
||||||
<template #icon><icon-refresh /></template>
|
<a-button type="text" @click="formData.search = !formData.search">
|
||||||
重置
|
{{ formData.search ? "收起" : "展开" }}
|
||||||
</a-button>
|
<icon-down :class="{ 'rotate-icon': formData.search }" />
|
||||||
<a-popconfirm :content="batchDelConfirm" type="warning" @ok="onBatchDelete">
|
</a-button>
|
||||||
<a-button v-show="selectedKeys.length > 0" type="primary" status="danger">
|
</a-space>
|
||||||
<template #icon><icon-delete /></template>
|
</a-col>
|
||||||
删除
|
</a-row>
|
||||||
</a-button>
|
<a-row :gutter="16" v-if="formData.search">
|
||||||
</a-popconfirm>
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
<a-button type="text" @click="formData.search = !formData.search">
|
<a-form-item field="trade_id" label="交易ID">
|
||||||
{{ formData.search ? "收起" : "展开" }}
|
<a-input v-model="formData.form.trade_id" placeholder="请输入交易ID" allow-clear />
|
||||||
<icon-down :class="{ 'rotate-icon': formData.search }" />
|
</a-form-item>
|
||||||
</a-button>
|
</a-col>
|
||||||
</a-space>
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
|
<a-form-item field="address" label="钱包地址">
|
||||||
|
<a-input v-model="formData.form.address" placeholder="请输入钱包地址" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
|
<a-form-item field="createTime" label="创建时间">
|
||||||
|
<a-range-picker v-model="formData.form.createTime" show-time format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<template v-if="formData.search">
|
|
||||||
<a-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6">
|
|
||||||
<a-form-item field="trade_id" label="交易ID">
|
|
||||||
<a-input v-model="formData.form.trade_id" placeholder="请输入交易ID" allow-clear />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6">
|
|
||||||
<a-form-item field="address" label="钱包地址">
|
|
||||||
<a-input v-model="formData.form.address" placeholder="请输入钱包地址" allow-clear />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6">
|
|
||||||
<a-form-item field="createTime" label="创建时间">
|
|
||||||
<a-range-picker v-model="formData.form.createTime" show-time format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</template>
|
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
|
||||||
@@ -124,7 +121,7 @@
|
|||||||
|
|
||||||
<!-- 不常用的操作优先放置在详情页,尽量保持第一视角的干净整洁 -->
|
<!-- 不常用的操作优先放置在详情页,尽量保持第一视角的干净整洁 -->
|
||||||
<template #optional="{ record }">
|
<template #optional="{ record }">
|
||||||
<a-space>
|
<a-space wrap>
|
||||||
<a-button size="mini" type="primary" @click="showDetail(record)">详情</a-button>
|
<a-button size="mini" type="primary" @click="showDetail(record)">详情</a-button>
|
||||||
<a-button size="mini" type="primary" status="warning" :disabled="record.status === 2" @click="showPaidModal(record)">
|
<a-button size="mini" type="primary" status="warning" :disabled="record.status === 2" @click="showPaidModal(record)">
|
||||||
补单
|
补单
|
||||||
@@ -145,7 +142,7 @@
|
|||||||
@cancel="closePaidModal"
|
@cancel="closePaidModal"
|
||||||
ok-text="确认补单"
|
ok-text="确认补单"
|
||||||
cancel-text="取消"
|
cancel-text="取消"
|
||||||
width="500px"
|
:width="paidDialogWidth"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
>
|
>
|
||||||
<div class="paid-modal-content">
|
<div class="paid-modal-content">
|
||||||
@@ -180,12 +177,15 @@ import { listAPI, paidAPI, delOrderApi } from "@/api/modules/order/index";
|
|||||||
import { List, FormData, Pagination } from "./config";
|
import { List, FormData, Pagination } from "./config";
|
||||||
import { Notification } from "@arco-design/web-vue";
|
import { Notification } from "@arco-design/web-vue";
|
||||||
import { useUserInfoStore } from "@/store/modules/user-info";
|
import { useUserInfoStore } from "@/store/modules/user-info";
|
||||||
import DetailModal from "./detail.vue";
|
import DetailModal from "./components/detail.vue";
|
||||||
import { useOrderDetail } from "./detail";
|
import { useOrderDetail } from "./detail";
|
||||||
import { getCryptoColor } from "@/views/rate/common";
|
import { getCryptoColor } from "@/views/rate/common";
|
||||||
|
import { useLayoutModel } from "@/hooks/useLayoutModel";
|
||||||
|
|
||||||
const userStores = useUserInfoStore();
|
const userStores = useUserInfoStore();
|
||||||
const { detailVisible, detailData, showDetail, closeDetail } = useOrderDetail();
|
const { detailVisible, detailData, showDetail, closeDetail } = useOrderDetail();
|
||||||
|
const { dialogWidth } = useLayoutModel();
|
||||||
|
const paidDialogWidth = computed(() => dialogWidth("500px"));
|
||||||
const tradeTypeOptions = computed(() => Object.entries(userStores.trade_type).map(([value, label]) => ({ value, label })));
|
const tradeTypeOptions = computed(() => Object.entries(userStores.trade_type).map(([value, label]) => ({ value, label })));
|
||||||
|
|
||||||
const statusOptions = [
|
const statusOptions = [
|
||||||
@@ -355,20 +355,18 @@ getOrderList();
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.btn-col {
|
|
||||||
.arco-form-item {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rotate-icon {
|
.rotate-icon {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
transition: transform 0.3s;
|
transition: transform 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-btn {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.wallet-name {
|
.wallet-name {
|
||||||
cursor: help;
|
cursor: help;
|
||||||
color: #165dff;
|
color: $color-link;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
@@ -385,19 +383,19 @@ getOrderList();
|
|||||||
|
|
||||||
:deep(.arco-form-item-label-col) {
|
:deep(.arco-form-item-label-col) {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #1d2129;
|
color: $color-text-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.arco-input-wrapper) {
|
:deep(.arco-input-wrapper) {
|
||||||
&:hover {
|
&:hover {
|
||||||
border-color: #4080ff;
|
border-color: $color-primary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.arco-modal) {
|
:deep(.arco-modal) {
|
||||||
.arco-modal-header {
|
.arco-modal-header {
|
||||||
border-bottom: 1px solid #e5e6eb;
|
border-bottom: 1px solid var(--color-neutral-3);
|
||||||
padding: 16px 20px;
|
padding: 16px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,7 +404,7 @@ getOrderList();
|
|||||||
}
|
}
|
||||||
|
|
||||||
.arco-modal-footer {
|
.arco-modal-footer {
|
||||||
border-top: 1px solid #e5e6eb;
|
border-top: 1px solid var(--color-neutral-3);
|
||||||
padding: 12px 20px;
|
padding: 12px 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+68
-61
@@ -1,24 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="rate-list">
|
<div class="snow-page">
|
||||||
<div class="snow-page">
|
<div class="snow-inner">
|
||||||
<div class="snow-inner">
|
<a-form ref="formRef" auto-label-width :model="formData.form">
|
||||||
<a-form ref="formRef" auto-label-width :model="formData.form">
|
<a-row :gutter="16">
|
||||||
<a-row :gutter="16">
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
<a-form-item field="fiat" label="交易法币">
|
||||||
<a-select v-model="formData.form.fiat" placeholder="请选择交易法币" allow-clear allow-search>
|
<a-select v-model="formData.form.fiat" placeholder="请选择交易法币" allow-clear allow-search>
|
||||||
<a-option v-for="item in tradeFiatOptions" :key="item.value" :value="item.value">
|
<a-option v-for="item in tradeFiatOptions" :key="item.value" :value="item.value">
|
||||||
{{ item.value }}
|
{{ item.value }}
|
||||||
</a-option>
|
</a-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-col>
|
</a-form-item>
|
||||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
</a-col>
|
||||||
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
|
<a-form-item field="crypto" label="加密货币">
|
||||||
<a-select v-model="formData.form.crypto" placeholder="请选择加密货币" allow-clear allow-search>
|
<a-select v-model="formData.form.crypto" placeholder="请选择加密货币" allow-clear allow-search>
|
||||||
<a-option v-for="item in tradeCryptoOptions" :key="item.value" :value="item.value">
|
<a-option v-for="item in tradeCryptoOptions" :key="item.value" :value="item.value">
|
||||||
{{ item.value }}
|
{{ item.value }}
|
||||||
</a-option>
|
</a-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-col>
|
</a-form-item>
|
||||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
</a-col>
|
||||||
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
|
<a-form-item field="datetime" label="同步时间">
|
||||||
<a-range-picker
|
<a-range-picker
|
||||||
v-model="formData.form.datetime"
|
v-model="formData.form.datetime"
|
||||||
:placeholder="['开始时间', '结束时间']"
|
:placeholder="['开始时间', '结束时间']"
|
||||||
@@ -27,51 +31,51 @@
|
|||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
allow-clear
|
allow-clear
|
||||||
/>
|
/>
|
||||||
</a-col>
|
</a-form-item>
|
||||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
</a-col>
|
||||||
<a-space class="search-btn">
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||||
<a-button type="primary" @click="getCommonTableList">
|
<a-space class="search-btn" wrap>
|
||||||
<template #icon><icon-search /></template>
|
<a-button type="primary" @click="getCommonTableList">
|
||||||
查询
|
<template #icon><icon-search /></template>
|
||||||
</a-button>
|
查询
|
||||||
<a-button @click="onReset">
|
</a-button>
|
||||||
<template #icon><icon-refresh /></template>
|
<a-button @click="onReset">
|
||||||
重置
|
<template #icon><icon-refresh /></template>
|
||||||
</a-button>
|
重置
|
||||||
<a-button type="primary" status="success" @click="onSync">
|
</a-button>
|
||||||
<template #icon><icon-loop /></template>
|
<a-button type="primary" status="success" @click="onSync">
|
||||||
立刻同步
|
<template #icon><icon-loop /></template>
|
||||||
</a-button>
|
立刻同步
|
||||||
</a-space>
|
</a-button>
|
||||||
</a-col>
|
</a-space>
|
||||||
</a-row>
|
</a-col>
|
||||||
</a-form>
|
</a-row>
|
||||||
<a-divider :margin="10" />
|
</a-form>
|
||||||
<a-table
|
<a-divider :margin="10" />
|
||||||
row-key="key"
|
<a-table
|
||||||
size="medium"
|
row-key="key"
|
||||||
:bordered="{ cell: true }"
|
size="medium"
|
||||||
:scroll="{ x: 1400, y: 600 }"
|
:bordered="{ cell: true }"
|
||||||
:loading="loading"
|
:scroll="{ x: 510, y: 600 }"
|
||||||
:columns="columns"
|
:loading="loading"
|
||||||
:data="data"
|
:columns="columns"
|
||||||
v-model:selectedKeys="selectedKeys"
|
:data="data"
|
||||||
:pagination="pagination"
|
v-model:selectedKeys="selectedKeys"
|
||||||
@page-change="pageChange"
|
:pagination="pagination"
|
||||||
@page-size-change="pageSizeChange"
|
@page-change="pageChange"
|
||||||
>
|
@page-size-change="pageSizeChange"
|
||||||
<template #fiat="{ record }">
|
>
|
||||||
<span class="fiat-display">
|
<template #fiat="{ record }">
|
||||||
{{ getFiatFlag(record.fiat) }} <strong>{{ record.fiat }}</strong>
|
<span class="fiat-display">
|
||||||
</span>
|
{{ getFiatFlag(record.fiat) }} <strong>{{ record.fiat }}</strong>
|
||||||
</template>
|
</span>
|
||||||
<template #crypto="{ record }">
|
</template>
|
||||||
<a-tag :color="getCryptoColor(record.crypto)" bordered>
|
<template #crypto="{ record }">
|
||||||
{{ record.crypto }}
|
<a-tag :color="getCryptoColor(record.crypto)" bordered>
|
||||||
</a-tag>
|
{{ record.crypto }}
|
||||||
</template>
|
</a-tag>
|
||||||
</a-table>
|
</template>
|
||||||
</div>
|
</a-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -109,12 +113,11 @@ const loading = ref(false);
|
|||||||
const data = reactive<List[]>([]);
|
const data = reactive<List[]>([]);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: "ID", dataIndex: "id", align: "center", width: "100" },
|
{ title: "交易法币", align: "center", dataIndex: "fiat", width: 102, slotName: "fiat" },
|
||||||
{ title: "交易法币", align: "center", dataIndex: "fiat", width: "180", slotName: "fiat" },
|
{ title: "加密货币", align: "center", dataIndex: "crypto", width: 92, slotName: "crypto" },
|
||||||
{ title: "加密货币", align: "center", dataIndex: "crypto", width: "180", slotName: "crypto" },
|
{ title: "订单汇率", align: "center", dataIndex: "rate", width: 102 },
|
||||||
{ title: "订单汇率", align: "center", dataIndex: "rate" },
|
{ title: "基准汇率", dataIndex: "raw_rate", align: "center", slotName: "raw_rate", width: 102 },
|
||||||
{ title: "基准汇率", dataIndex: "raw_rate", align: "center", slotName: "raw_rate" },
|
{ title: "同步时间", dataIndex: "created_at", align: "center", slotName: "created_at", width: 212 }
|
||||||
{ title: "同步时间", dataIndex: "created_at", align: "center", slotName: "created_at" }
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const getCommonTableList = async () => {
|
const getCommonTableList = async () => {
|
||||||
@@ -169,6 +172,10 @@ getCommonTableList();
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.search-btn {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.fiat-display {
|
.fiat-display {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user