Compare commits
15
Commits
ci/docs
...
ci/ca-root-ye
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6658614db0 | ||
|
|
051e475b44 | ||
|
|
2ece12d44b | ||
|
|
79b6b914aa | ||
|
|
38231b15cb | ||
|
|
a950fd2ead | ||
|
|
7421d8574b | ||
|
|
92cca8a420 | ||
|
|
f94687788d | ||
|
|
fee63db19e | ||
|
|
4a866731f3 | ||
|
|
bf686e6f08 | ||
|
|
b5c330e311 | ||
|
|
eea05adea1 | ||
|
|
a3f4587d1e |
+4
-4
@@ -2,14 +2,14 @@
|
||||
LISTEN=127.0.0.1:8080
|
||||
|
||||
# 日志文件保存路径
|
||||
LOG=/var/log/bepusdt/
|
||||
LOG=/var/log/vupay/
|
||||
|
||||
# SQLite 数据库文件路径(如果使用 MySQL,此项可忽略)
|
||||
SQLITE=/var/lib/bepusdt/sqlite.db
|
||||
SQLITE=/var/lib/vupay/sqlite.db
|
||||
|
||||
# PostgreSQL 数据库
|
||||
# POSTGRESQL_DSN=postgres://user:password@localhost:5432/bepusdt?sslmode=disable&connect_timeout=3&timezone=Asia/Shanghai
|
||||
# POSTGRESQL_DSN=postgres://user:password@localhost:5432/vupay?sslmode=disable&connect_timeout=3&timezone=Asia/Shanghai
|
||||
|
||||
# MySQL 数据库(本仓库支持;DSN 里 charset=utf8mb4&parseTime=True&loc=Local 不能省)
|
||||
# 优先级:MYSQL_DSN > POSTGRESQL_DSN > SQLITE
|
||||
# MYSQL_DSN=user:password@tcp(127.0.0.1:3306)/bepusdt?charset=utf8mb4&parseTime=True&loc=Local&timeout=5s
|
||||
# MYSQL_DSN=user:password@tcp(127.0.0.1:3306)/vupay?charset=utf8mb4&parseTime=True&loc=Local&timeout=5s
|
||||
|
||||
@@ -11,7 +11,7 @@ on:
|
||||
|
||||
env:
|
||||
REGISTRY: git.viaeon.com
|
||||
IMAGE: git.viaeon.com/admin/bepusdt
|
||||
IMAGE: git.viaeon.com/admin/vupay
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: BUG 反馈|使用异常|功能建议|其它问题
|
||||
description: "提交在使用 BEpusdt 过程中遇到的 BUG 反馈、使用异常、对接失败等问题"
|
||||
description: "提交在使用 VUPAY 过程中遇到的 BUG 反馈、使用异常、对接失败等问题"
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
@@ -45,7 +45,7 @@ body:
|
||||
attributes:
|
||||
value: |-
|
||||
## 日志信息
|
||||
默认的日志目录在 `/var/log/bepusdt/` 下,请将相关时间段的日志内容粘贴在下面的代码块中。
|
||||
默认的日志目录在 `/var/log/vupay/` 下,请将相关时间段的日志内容粘贴在下面的代码块中。
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 日志内容
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Telegram Group
|
||||
url: https://t.me/BEpusdtChat
|
||||
url: https://t.me/VUPAYChat
|
||||
about: Telegram 交流群组
|
||||
|
||||
@@ -7,8 +7,8 @@ on:
|
||||
tags:
|
||||
- v*
|
||||
env:
|
||||
APP_NAME: bepusdt
|
||||
DOCKERHUB_REPO: v03413/bepusdt
|
||||
APP_NAME: vupay
|
||||
DOCKERHUB_REPO: admin/vupay
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -4,9 +4,9 @@ on:
|
||||
- cron: '0 16 * * *'
|
||||
workflow_dispatch:
|
||||
env:
|
||||
APP_NAME: bepusdt
|
||||
APP_NAME: vupay
|
||||
DOCKER_HUB_USER: v03413
|
||||
DOCKER_HUB_REPO: v03413/bepusdt
|
||||
DOCKER_HUB_REPO: admin/vupay
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -14,7 +14,7 @@ concurrency:
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
APP_NAME: bepusdt
|
||||
APP_NAME: vupay
|
||||
jobs:
|
||||
docker-build:
|
||||
name: Docker Build
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
version: 2
|
||||
project_name: BEpusdt
|
||||
project_name: VUPAY
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./main
|
||||
binary: bepusdt
|
||||
binary: vupay
|
||||
ldflags:
|
||||
- -X '{{ .ModulePath }}/app.Version={{ .Env.VERSION }}'
|
||||
- -s -w -buildid=
|
||||
@@ -25,7 +25,7 @@ archives:
|
||||
formats: [ zip ]
|
||||
files:
|
||||
- .env.example
|
||||
- src: docs/bepusdt.service
|
||||
- src: docs/vupay.service
|
||||
dst: .
|
||||
strip_parent: true
|
||||
changelog:
|
||||
|
||||
@@ -4,34 +4,33 @@
|
||||
|
||||
---
|
||||
|
||||
# BEpusdt (Better Easy Payment USDT)
|
||||
# VUPAY (Better Easy Payment USDT)
|
||||
|
||||
<p align="center">
|
||||
<img src="./static/checkout/official/assets/img/bepusdt.svg" width="15%" alt="tether">
|
||||
<img src="./static/checkout/official/assets/img/vupay.svg" width="15%" alt="tether">
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://www.gnu.org/licenses/gpl-3.0.html">
|
||||
<img src="https://img.shields.io/github/license/v03413/bepusdt" alt="license GPLV3">
|
||||
<img src="https://img.shields.io/github/license/admin/vupay" alt="license GPLV3">
|
||||
</a>
|
||||
<a href="https://github.com/v03413/bepusdt">
|
||||
<img src="https://img.shields.io/github/v/release/v03413/bepusdt" alt="GitHub Release">
|
||||
<a href="https://git.viaeon.com/admin/vupay">
|
||||
<img src="https://img.shields.io/github/v/release/admin/vupay" alt="GitHub Release">
|
||||
</a>
|
||||
<a href="https://github.com/v03413/bepusdt">
|
||||
<img src="https://img.shields.io/github/downloads/v03413/bepusdt/total" alt="GitHub Release">
|
||||
<a href="https://git.viaeon.com/admin/vupay">
|
||||
<img src="https://img.shields.io/github/downloads/admin/vupay/total" alt="GitHub Release">
|
||||
</a>
|
||||
<a href="https://hub.docker.com/r/v03413/bepusdt">
|
||||
<img src="https://img.shields.io/docker/pulls/v03413/bepusdt?style=flat-square&logo=docker" alt="Docker Pulls">
|
||||
<a href="https://hub.docker.com/r/admin/vupay">
|
||||
<img src="https://img.shields.io/docker/pulls/admin/vupay?style=flat-square&logo=docker" alt="Docker Pulls">
|
||||
</a>
|
||||
<a href="https://github.com/gin-gonic/gin">
|
||||
<img src="https://img.shields.io/github/stars/v03413/bepusdt?style=flat-square&logo=github" alt="GitHub Stars">
|
||||
<img src="https://img.shields.io/github/stars/admin/vupay?style=flat-square&logo=github" alt="GitHub Stars">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## 🪧 介绍
|
||||
|
||||
缘起于`Epusdt`,但不仅限于此,加入了一些新特性,致力于成为一款更好用的个人`加密货币`收款网关。
|
||||
VUPAY 是一款个人`加密货币`收款网关:多链收款、订单自动回调、后台可视化管理。
|
||||
|
||||
> 原始 EPusdt 项目已被转手,现与本项目再没任何联系、两个项目完全独立运营,[具体说明](./docs/faq/epusdt.md)。
|
||||
|
||||
## 🎉 新特性
|
||||
|
||||
@@ -40,7 +39,7 @@
|
||||
🔥 主流网络:TRON Ethereum BSC Polygon<br>
|
||||
⚡ 其他网络: X-Layer Solana Aptos Arbitrum-One Base [完整列表](./docs/trade-type.md)
|
||||
|
||||
- ✅ 完全兼容 `Epusdt` 插件无缝替换
|
||||
- ✅ 完全兼容 `Vupay` 插件无缝替换
|
||||
- ️✅ 支持主流区块网络 不仅限于`USDT`
|
||||
- ✅ 支持主流法定货币 汇率自动更新
|
||||
- ✅ 轻依赖 单体二进制文件 部署便捷
|
||||
@@ -55,11 +54,11 @@
|
||||
Docker 快速启动,执行完命令打开地址`http://服务器IP:8080`即可看到初始页面
|
||||
|
||||
```bash
|
||||
docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
|
||||
docker run -d --restart=unless-stopped -p 8080:8080 admin/vupay:latest
|
||||
```
|
||||
|
||||
> **本仓库(admin/BEPUSDT)额外提供:**
|
||||
> - CI 自动构建镜像并推到 `git.viaeon.com/admin/bepusdt`(`.gitea/workflows/docker.yaml`)
|
||||
> **本仓库(admin/VUPAY)额外提供:**
|
||||
> - CI 自动构建镜像并推到 `git.viaeon.com/admin/vupay`(`.gitea/workflows/docker.yaml`)
|
||||
> - 三份 compose 示例:`docker-compose.example.yml`(SQLite)、`docker-compose.postgres.example.yml`、
|
||||
> `docker-compose.mysql.example.yml`
|
||||
> - **新增 MySQL 支持**(`MYSQL_DSN`),上游只有 SQLite/PostgreSQL;用法见
|
||||
@@ -67,8 +66,8 @@ 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)
|
||||
- 开发:[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)
|
||||
- 对接:[独角Next](docs/api/dujiao-next/dujiao-next.md) [彩虹易支付](https://github.com/v03413/Epay-BEpusdt) [whmcs](https://github.com/v03413/whmcs-gateway-epusdt) [其它](docs/api/other.md)
|
||||
- 开发:[API对接](docs/api/api.md) [订单回调](docs/notify/readme.md) [Python](https://github.com/luoyanglang/vupay-python-sdk) [PHP](https://git.viaeon.com/admin/vupay-php-sdk)
|
||||
- 对接:[独角Next](docs/api/dujiao-next/dujiao-next.md) [彩虹易支付](https://github.com/v03413/Epay-VUPAY) [whmcs](https://github.com/v03413/whmcs-gateway-vupay) [其它](docs/api/other.md)
|
||||
- 其它:[https 配置](./docs/ssl.md) [时钟同步](docs/linux/systemd-timesyncd.md) [收银台修改](docs/checkout/README.md)
|
||||
|
||||
## 🖼 功能截图
|
||||
@@ -87,22 +86,19 @@ docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
|
||||
|
||||
## 🏝️ 社区交流
|
||||
|
||||
- **Telegram 群组**:[https://t.me/BEpusdtChat](https://t.me/BEpusdtChat)
|
||||
- **Telegram 频道**:[https://t.me/BEpusdtChannel](https://t.me/BEpusdtChannel)
|
||||
- **安全问题反馈/联系作者**:[contact@bepusdt.online](mailto:contact@bepusdt.online)
|
||||
- **Telegram 群组**:[https://t.me/VUPAYChat](https://t.me/VUPAYChat)
|
||||
- **Telegram 频道**:[https://t.me/VUPAYChannel](https://t.me/VUPAYChannel)
|
||||
- **安全问题反馈/联系**:https://u.viaeon.com
|
||||
|
||||
## 🙏 致谢
|
||||
|
||||
感谢原项目提供的灵感和参考:
|
||||
|
||||
- [EPusdt](./docs/faq/epusdt.md)
|
||||
|
||||
感谢为本项目作出贡献的开发者:
|
||||
|
||||
<a href="https://github.com/v03413/BEpusdt/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=v03413/BEpusdt" alt="BEpusdt 贡献者清单">
|
||||
<a href="https://git.viaeon.com/admin/vupay/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=admin/vupay" alt="VUPAY 贡献者清单">
|
||||
</a>
|
||||
|
||||
## 🌟 Star 历史
|
||||
|
||||
[](https://www.star-history.com/?repos=v03413%2Fbepusdt&type=date&legend=top-left)
|
||||
[](https://www.star-history.com/?repos=v03413%2Fvupay&type=date&legend=top-left)
|
||||
+4
-4
@@ -4,7 +4,7 @@ import "github.com/urfave/cli/v3"
|
||||
|
||||
var SQLiteFlag = &cli.StringFlag{
|
||||
Name: "sqlite",
|
||||
Value: "/var/lib/bepusdt/sqlite.db",
|
||||
Value: "/var/lib/vupay/sqlite.db",
|
||||
Usage: "SQLite 数据库文件路径",
|
||||
Sources: cli.EnvVars("SQLITE"),
|
||||
}
|
||||
@@ -12,20 +12,20 @@ var SQLiteFlag = &cli.StringFlag{
|
||||
var PostgresDSNFlag = &cli.StringFlag{
|
||||
Name: "postgres",
|
||||
Value: "",
|
||||
Usage: "PostgreSQL 数据库连接字符串 (DSN),例如: postgres://user:password@localhost:5432/bepusdt?sslmode=disable&connect_timeout=3",
|
||||
Usage: "PostgreSQL 数据库连接字符串 (DSN),例如: postgres://user:password@localhost:5432/vupay?sslmode=disable&connect_timeout=3",
|
||||
Sources: cli.EnvVars("POSTGRESQL_DSN"),
|
||||
}
|
||||
|
||||
var MysqlDSNFlag = &cli.StringFlag{
|
||||
Name: "mysql",
|
||||
Value: "",
|
||||
Usage: "MySQL 数据库连接字符串 (DSN),例如: user:pass@tcp(127.0.0.1:3306)/bepusdt?charset=utf8mb4&parseTime=True&loc=Local&timeout=3s",
|
||||
Usage: "MySQL 数据库连接字符串 (DSN),例如: user:pass@tcp(127.0.0.1:3306)/vupay?charset=utf8mb4&parseTime=True&loc=Local&timeout=3s",
|
||||
Sources: cli.EnvVars("MYSQL_DSN"),
|
||||
}
|
||||
|
||||
var LogFlag = &cli.StringFlag{
|
||||
Name: "log",
|
||||
Value: "/var/log/bepusdt/",
|
||||
Value: "/var/log/vupay/",
|
||||
Usage: "日志文件保存路径",
|
||||
Sources: cli.EnvVars("LOG"),
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/task"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/urfave/cli/v3"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/task"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
|
||||
+7
-7
@@ -12,12 +12,12 @@ import (
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/v03413/bepusdt/app"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/notifier"
|
||||
"github.com/v03413/bepusdt/app/router"
|
||||
"github.com/v03413/bepusdt/app/task"
|
||||
"git.viaeon.com/admin/vupay/app"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/notifier"
|
||||
"git.viaeon.com/admin/vupay/app/router"
|
||||
"git.viaeon.com/admin/vupay/app/task"
|
||||
)
|
||||
|
||||
import (
|
||||
@@ -84,7 +84,7 @@ func start(ctx context.Context, cmd *cli.Command) error {
|
||||
notifier.Welcome()
|
||||
|
||||
fmt.Println(fmt.Sprintf("日志保存路径:%s", log.GetPath()))
|
||||
fmt.Println(fmt.Sprintf("BEpusdt 启动成功(%s),当前版本:%s", listen, app.Version))
|
||||
fmt.Println(fmt.Sprintf("VUPAY 启动成功(%s),当前版本:%s", listen, app.Version))
|
||||
|
||||
// 等待中断信号
|
||||
var signals = make(chan os.Signal, 1)
|
||||
|
||||
+2
-2
@@ -4,15 +4,15 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app"
|
||||
"github.com/urfave/cli/v3"
|
||||
"github.com/v03413/bepusdt/app"
|
||||
)
|
||||
|
||||
var Version = &cli.Command{
|
||||
Name: "version",
|
||||
Usage: "显示版本信息",
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
fmt.Println("BEpusdt 版本:" + app.Version)
|
||||
fmt.Println("VUPAY 版本:" + app.Version)
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
+2
-2
@@ -2,14 +2,14 @@ package conf
|
||||
|
||||
const (
|
||||
Desc = "一款更好用的个人加密货币收款网关"
|
||||
Github = "https://github.com/v03413/BEpusdt"
|
||||
Github = "https://git.viaeon.com/admin/vupay"
|
||||
)
|
||||
|
||||
const Debug = false
|
||||
|
||||
const (
|
||||
Pid = "1000" // 暂时固定易支付商户ID
|
||||
Api = "https://api.bepusdt.online"
|
||||
Api = "https://api.vupay.online"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+4
-4
@@ -7,10 +7,10 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app"
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
)
|
||||
|
||||
type Api struct {
|
||||
@@ -30,7 +30,7 @@ func (Api) get(url string) ([]byte, error) {
|
||||
return nil, fmt.Errorf("创建请求失败: %w", err)
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("BEpusdt/%s", app.Version))
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("VUPAY/%s", app.Version))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := client.Do(req)
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/handler/base"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/notifier"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/handler/base"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/notifier"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/handler/base"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/handler/base"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/go-cache"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ package admin
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/handler/base"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/task/notify"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/v03413/bepusdt/app/handler/base"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/task/notify"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
type Order struct {
|
||||
|
||||
@@ -3,9 +3,9 @@ package admin
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/handler/base"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/handler/base"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
type Rate struct {
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/handler/base"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/handler/base"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
type Wallet struct {
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/handler/base"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/handler/base"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"github.com/v03413/go-cache"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
@@ -3,8 +3,8 @@ package base
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
)
|
||||
|
||||
type Result struct {
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"net/http"
|
||||
"sort"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
const Pid = "1000" // 固定商户号
|
||||
@@ -121,7 +121,7 @@ func (e Epay) verify(data map[string]string) (submit, error) {
|
||||
pid, ok := data["pid"]
|
||||
if !ok || pid != Pid {
|
||||
|
||||
return params, fmt.Errorf("BEpusdt 易支付兼容模式,商户号【PID】必须固定为" + Pid)
|
||||
return params, fmt.Errorf("VUPAY 易支付兼容模式,商户号【PID】必须固定为" + Pid)
|
||||
}
|
||||
|
||||
var requiredFields = []string{"pid", "type", "out_trade_no", "notify_url", "return_url", "name", "money", "sign"}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package epusdt
|
||||
package vupay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -8,14 +8,14 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
type Epusdt struct{}
|
||||
type Vupay struct{}
|
||||
|
||||
type createReq struct {
|
||||
OrderID string `json:"order_id" binding:"required"`
|
||||
@@ -78,7 +78,7 @@ func loadPayOrder(ctx *gin.Context, tradeID string) (model.Order, bool) {
|
||||
return order, true
|
||||
}
|
||||
|
||||
func (Epusdt) Notify(ctx *gin.Context) {
|
||||
func (Vupay) Notify(ctx *gin.Context) {
|
||||
rawData, err := ctx.GetRawData()
|
||||
if err != nil {
|
||||
ctx.String(200, "fail")
|
||||
@@ -97,7 +97,7 @@ func (Epusdt) Notify(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if utils.EpusdtSign(m, model.AuthToken()) != sign {
|
||||
if utils.VupaySign(m, model.AuthToken()) != sign {
|
||||
ctx.String(200, "fail")
|
||||
return
|
||||
}
|
||||
@@ -105,7 +105,7 @@ func (Epusdt) Notify(ctx *gin.Context) {
|
||||
ctx.String(200, "ok")
|
||||
}
|
||||
|
||||
func (Epusdt) CreateOrder(ctx *gin.Context) {
|
||||
func (Vupay) CreateOrder(ctx *gin.Context) {
|
||||
var req createOrderReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("CreateOrder: request error: %s", err.Error())))
|
||||
@@ -137,7 +137,7 @@ func (Epusdt) CreateOrder(ctx *gin.Context) {
|
||||
// 创建待付款订单
|
||||
order, err := model.BuildPendingOrder(model.OrderParams{
|
||||
Money: decimal.NewFromFloat(req.Amount),
|
||||
ApiType: model.OrderApiTypeEpusdtOrder,
|
||||
ApiType: model.OrderApiTypeVupayOrder,
|
||||
OrderId: req.OrderID,
|
||||
RedirectUrl: req.RedirectURL,
|
||||
NotifyUrl: req.NotifyURL,
|
||||
@@ -168,7 +168,7 @@ func (Epusdt) CreateOrder(ctx *gin.Context) {
|
||||
}))
|
||||
}
|
||||
|
||||
func (Epusdt) UpdateOrder(ctx *gin.Context) {
|
||||
func (Vupay) UpdateOrder(ctx *gin.Context) {
|
||||
// 接收 trade_id, currency, network 三个参数
|
||||
var req updateOrderReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
@@ -250,7 +250,7 @@ func (Epusdt) UpdateOrder(ctx *gin.Context) {
|
||||
}))
|
||||
}
|
||||
|
||||
func (Epusdt) CreateTransaction(ctx *gin.Context) {
|
||||
func (Vupay) CreateTransaction(ctx *gin.Context) {
|
||||
var req createReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("请求参数错误:%s", err.Error())))
|
||||
@@ -278,7 +278,7 @@ func (Epusdt) CreateTransaction(ctx *gin.Context) {
|
||||
|
||||
order, err := model.StartBuildOrder(model.OrderParams{
|
||||
Money: decimal.NewFromFloat(req.Amount),
|
||||
ApiType: model.OrderApiTypeEpusdt,
|
||||
ApiType: model.OrderApiTypeVupay,
|
||||
Address: req.Address,
|
||||
AddressLocked: req.Amount == 0,
|
||||
OrderId: req.OrderID,
|
||||
@@ -313,7 +313,7 @@ func (Epusdt) CreateTransaction(ctx *gin.Context) {
|
||||
}))
|
||||
}
|
||||
|
||||
func (Epusdt) CancelTransaction(ctx *gin.Context) {
|
||||
func (Vupay) CancelTransaction(ctx *gin.Context) {
|
||||
var req cancelReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("请求参数错误:%s", err.Error())))
|
||||
@@ -343,7 +343,7 @@ func (Epusdt) CancelTransaction(ctx *gin.Context) {
|
||||
ctx.JSON(200, respSuccJson(gin.H{"trade_id": req.TradeID}))
|
||||
}
|
||||
|
||||
func (Epusdt) Checkout(ctx *gin.Context) {
|
||||
func (Vupay) Checkout(ctx *gin.Context) {
|
||||
tradeId := ctx.Param("trade_id")
|
||||
if _, ok := model.GetTradeOrder(tradeId); !ok {
|
||||
ctx.String(200, "order not found")
|
||||
@@ -357,7 +357,7 @@ func (Epusdt) Checkout(ctx *gin.Context) {
|
||||
ctx.HTML(200, tmpl, gin.H{"trade_id": tradeId})
|
||||
}
|
||||
|
||||
func (Epusdt) GetMethods(ctx *gin.Context) {
|
||||
func (Vupay) GetMethods(ctx *gin.Context) {
|
||||
var req methodsReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("request error: %s", err.Error())))
|
||||
@@ -385,7 +385,7 @@ func (Epusdt) GetMethods(ctx *gin.Context) {
|
||||
}))
|
||||
}
|
||||
|
||||
func (Epusdt) Info(ctx *gin.Context) {
|
||||
func (Vupay) Info(ctx *gin.Context) {
|
||||
var req infoReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("参数错误:%s", err.Error())))
|
||||
@@ -417,7 +417,7 @@ func (Epusdt) Info(ctx *gin.Context) {
|
||||
}))
|
||||
}
|
||||
|
||||
func (Epusdt) SignVerify(ctx *gin.Context) {
|
||||
func (Vupay) SignVerify(ctx *gin.Context) {
|
||||
rawData, err := ctx.GetRawData()
|
||||
if err != nil {
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("json 数据读取错误 %s", err.Error())))
|
||||
@@ -442,7 +442,7 @@ func (Epusdt) SignVerify(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if utils.EpusdtSign(m, model.AuthToken()) != sign {
|
||||
if utils.VupaySign(m, model.AuthToken()) != sign {
|
||||
ctx.JSON(200, respFailJson("签名错误"))
|
||||
ctx.Abort()
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ func Init(dir string) error {
|
||||
|
||||
var err error
|
||||
|
||||
be, err = newLogger(filepath.Join(dir, "bepusdt.log"))
|
||||
be, err = newLogger(filepath.Join(dir, "vupay.log"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+4
-4
@@ -7,9 +7,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"github.com/v03413/go-cache"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"gorm.io/gorm"
|
||||
@@ -51,7 +51,7 @@ var defaultConf = map[ConfKey]string{
|
||||
SystemInstallLock: "0",
|
||||
RateSyncCoingeckoApiUrl: "https://api.coingecko.com",
|
||||
RateSyncHistoryDays: "30",
|
||||
MqttTopicPrefix: "bepusdt",
|
||||
MqttTopicPrefix: "vupay",
|
||||
HomeRedirectUrl: "",
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ type Conf struct {
|
||||
|
||||
func (c Conf) TableName() string {
|
||||
|
||||
return "bep_conf"
|
||||
return "vupay_conf"
|
||||
}
|
||||
|
||||
func SetK(k ConfKey, v string) {
|
||||
@@ -168,7 +168,7 @@ func ConfInit() {
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println("╔═══════════════════════════════════════════════════════════════════════")
|
||||
fmt.Println("║ 🎉 欢迎使用 BEpusdt - 首次运行检测,初始化配置完成")
|
||||
fmt.Println("║ 🎉 欢迎使用 VUPAY - 首次运行检测,初始化配置完成")
|
||||
fmt.Println("╚═══════════════════════════════════════════════════════════════════════")
|
||||
fmt.Println()
|
||||
fmt.Println("┏━━ 🔐 后台登录信息 (请立即保存!)")
|
||||
|
||||
@@ -5,25 +5,25 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// 202607081430 - 删除 bep_order.trade_type_reselect 列
|
||||
// 202607081430 - 删除 vupay_order.trade_type_reselect 列
|
||||
func m202607081430DropOrderTradeTypeReselect() *gormigrate.Migration {
|
||||
return &gormigrate.Migration{
|
||||
ID: "202607081430_drop_order_trade_type_reselect",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
if !tx.Migrator().HasTable("bep_order") {
|
||||
if !tx.Migrator().HasTable("vupay_order") {
|
||||
return nil
|
||||
}
|
||||
if tx.Migrator().HasColumn("bep_order", "trade_type_reselect") {
|
||||
return tx.Exec("ALTER TABLE bep_order DROP COLUMN trade_type_reselect").Error
|
||||
if tx.Migrator().HasColumn("vupay_order", "trade_type_reselect") {
|
||||
return tx.Exec("ALTER TABLE vupay_order DROP COLUMN trade_type_reselect").Error
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error {
|
||||
if !tx.Migrator().HasTable("bep_order") {
|
||||
if !tx.Migrator().HasTable("vupay_order") {
|
||||
return nil
|
||||
}
|
||||
if !tx.Migrator().HasColumn("bep_order", "trade_type_reselect") {
|
||||
return tx.Exec("ALTER TABLE bep_order ADD COLUMN trade_type_reselect INTEGER NOT NULL DEFAULT 0").Error
|
||||
if !tx.Migrator().HasColumn("vupay_order", "trade_type_reselect") {
|
||||
return tx.Exec("ALTER TABLE vupay_order ADD COLUMN trade_type_reselect INTEGER NOT NULL DEFAULT 0").Error
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableName = "bep_migration"
|
||||
const TableName = "vupay_migration"
|
||||
|
||||
var migrations = []*gormigrate.Migration{
|
||||
m202607081430DropOrderTradeTypeReselect(),
|
||||
|
||||
+1
-1
@@ -6,8 +6,8 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/model/migration"
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/v03413/bepusdt/app/model/migration"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ type NotifyRecord struct {
|
||||
|
||||
func (nr NotifyRecord) TableName() string {
|
||||
|
||||
return "bep_notify"
|
||||
return "vupay_notify"
|
||||
}
|
||||
|
||||
func IsNeedNotifyByTxid(txid string) bool {
|
||||
|
||||
+13
-13
@@ -9,12 +9,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/core"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/core"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -55,17 +55,17 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
OrderApiTypeEpusdt = "epusdt" // epusdt
|
||||
OrderApiTypeEpusdtOrder = "epusdt_order" // epusdt create-order
|
||||
OrderApiTypeEpay = "epay" // 彩虹易支付
|
||||
OrderApiTypeAdmin = "admin" // 管理后台
|
||||
OrderApiTypeVupay = "vupay" // vupay
|
||||
OrderApiTypeVupayOrder = "vupay_order" // vupay create-order
|
||||
OrderApiTypeEpay = "epay" // 彩虹易支付
|
||||
OrderApiTypeAdmin = "admin" // 管理后台
|
||||
)
|
||||
|
||||
type Order struct {
|
||||
Id
|
||||
OrderId string `gorm:"column:order_id;type:varchar(128);not null;index;comment:商户ID" json:"order_id"`
|
||||
TradeId string `gorm:"column:trade_id;type:varchar(128);not null;uniqueIndex;comment:本地ID" json:"trade_id"`
|
||||
TradeType TradeType `gorm:"column:trade_type;type:varchar(20);not null;index;comment:交易类型" json:"trade_type"`
|
||||
TradeType TradeType `gorm:"column:trade_type;type:varchar(20);not null;index;index:idx_order_status_trade,priority:2;comment:交易类型" json:"trade_type"`
|
||||
Fiat Fiat `gorm:"column:fiat;type:varchar(16);not null;index;default:CNY;comment:法定货币" json:"fiat"`
|
||||
Crypto Crypto `gorm:"column:crypto;type:varchar(16);not null;index;default:USDT;comment:加密货币" json:"crypto"`
|
||||
CurrencyLimit string `gorm:"column:currency_limit;type:varchar(255);not null;default:'';comment:限定币种" json:"currency_limit"`
|
||||
@@ -76,9 +76,9 @@ type Order struct {
|
||||
FromAddress string `gorm:"column:from_address;type:varchar(128);not null;default:'';comment:支付地址" json:"from_address"`
|
||||
MatchAddress string `gorm:"column:match_address;type:varchar(128);not null;default:'';comment:校验地址" json:"match_address"`
|
||||
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"`
|
||||
Status int `gorm:"column:status;not null;default:1;index;index:idx_order_notify_retry,priority:1;index:idx_order_status_trade,priority:1;comment:交易状态" json:"status"`
|
||||
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:'vupay';comment:API类型" json:"api_type"`
|
||||
ReturnUrl string `gorm:"column:return_url;type:varchar(1024);not null;default:'';comment:同步地址" json:"return_url"`
|
||||
NotifyUrl string `gorm:"column:notify_url;type:varchar(1024);not null;default:'';comment:异步地址" json:"notify_url"`
|
||||
NotifyNum int `gorm:"column:notify_num;not null;default:0;index:idx_order_notify_retry,priority:3;comment:回调次数" json:"notify_num"`
|
||||
@@ -116,7 +116,7 @@ func (o *Order) CanReselectPayment() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if o.ApiType != OrderApiTypeEpusdtOrder && o.ApiType != OrderApiTypeAdmin {
|
||||
if o.ApiType != OrderApiTypeVupayOrder && o.ApiType != OrderApiTypeAdmin {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ func (o *Order) Network() any {
|
||||
}
|
||||
|
||||
func (o *Order) TableName() string {
|
||||
return "bep_order"
|
||||
return "vupay_order"
|
||||
}
|
||||
|
||||
func GetTradeOrder(tradeId string) (Order, bool) {
|
||||
|
||||
+5
-5
@@ -10,12 +10,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ type Rate struct {
|
||||
}
|
||||
|
||||
func (r *Rate) TableName() string {
|
||||
return "bep_rate"
|
||||
return "vupay_rate"
|
||||
}
|
||||
|
||||
func (r *Rate) BeforeCreate(*gorm.DB) error {
|
||||
@@ -68,7 +68,7 @@ func CoingeckoRate() error {
|
||||
}
|
||||
|
||||
req.Header.Set("x-cg-demo-api-key", GetC(RateSyncCoingeckoApiKey))
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("BEpusdt/%s", app.Version))
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("VUPAY/%s", app.Version))
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
)
|
||||
|
||||
// supportFiat 支持的法定货币
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
type OrderParams struct {
|
||||
|
||||
+3
-3
@@ -4,8 +4,8 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/xssnick/tonutils-go/address"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ type Wallet struct {
|
||||
|
||||
func (wa *Wallet) TableName() string {
|
||||
|
||||
return "bep_wallet"
|
||||
return "vupay_wallet"
|
||||
}
|
||||
|
||||
func (wa *Wallet) SetStatus(status uint8) {
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
type activeConf struct {
|
||||
@@ -55,7 +55,7 @@ func Reload() error {
|
||||
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.SetClientID(fmt.Sprintf("VUPAY %d", os.Getpid()))
|
||||
opts.SetAutoReconnect(true)
|
||||
opts.SetOrderMatters(false)
|
||||
opts.SetOnConnectHandler(onConnectHandler)
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package mqtt
|
||||
|
||||
import (
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
)
|
||||
|
||||
// Publish 发布消息。若 MQTT 未连接则静默丢弃,返回 nil。
|
||||
|
||||
@@ -3,8 +3,8 @@ package mqtt
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
)
|
||||
|
||||
type callback struct {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package notifier
|
||||
|
||||
import "github.com/v03413/bepusdt/app/model"
|
||||
import "git.viaeon.com/admin/vupay/app/model"
|
||||
|
||||
type None struct{}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package notifier
|
||||
|
||||
import (
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -6,15 +6,15 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app"
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"github.com/v03413/tronprotocol/core"
|
||||
)
|
||||
|
||||
@@ -201,7 +201,7 @@ func (t *Telegram) TronResourceChange(res model.TronResource) {
|
||||
|
||||
func (t *Telegram) Welcome() {
|
||||
text := `
|
||||
👋 欢迎使用 BEpusdt,` + conf.Desc + `,如果您看到此消息,说明系统已启动成功!
|
||||
👋 欢迎使用 VUPAY,` + conf.Desc + `,如果您看到此消息,说明系统已启动成功!
|
||||
|
||||
📌当前版本:` + app.Version + `
|
||||
🎉开源地址:` + conf.Github + `
|
||||
@@ -212,8 +212,7 @@ func (t *Telegram) Welcome() {
|
||||
ReplyMarkup: models.InlineKeyboardMarkup{
|
||||
InlineKeyboard: [][]models.InlineKeyboardButton{
|
||||
{
|
||||
{Text: "📢 关注频道", URL: "https://t.me/BEpusdtChannel"},
|
||||
{Text: "💬 社区交流", URL: "https://t.me/BEpusdtChat"},
|
||||
{Text: "🌐 访问站点", URL: "https://u.viaeon.com"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ package notifier
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
func TestNonOrderTransferTitleUsesMatchAddress(t *testing.T) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package notifier
|
||||
|
||||
import (
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
type Wechat struct{}
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"git.viaeon.com/admin/vupay/app/handler/admin"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/handler/admin"
|
||||
)
|
||||
|
||||
func adminInit(e *gin.Engine) {
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"git.viaeon.com/admin/vupay/app/handler/auth"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/handler/auth"
|
||||
)
|
||||
|
||||
func authInit(e *gin.Engine) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/v03413/bepusdt/static"
|
||||
"git.viaeon.com/admin/vupay/static"
|
||||
)
|
||||
|
||||
func TestLangGeCheckoutTemplateIsEmbedded(t *testing.T) {
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"git.viaeon.com/admin/vupay/app/handler/epay"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/handler/epay"
|
||||
)
|
||||
|
||||
func epayInit(engine *gin.Engine) {
|
||||
|
||||
@@ -5,13 +5,13 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-contrib/sessions/memstore"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/go-cache"
|
||||
)
|
||||
|
||||
@@ -59,7 +59,7 @@ func Handler() *gin.Engine {
|
||||
|
||||
{
|
||||
staticInit(engine)
|
||||
epusdtInit(engine)
|
||||
vupayInit(engine)
|
||||
epayInit(engine)
|
||||
adminInit(engine)
|
||||
authInit(engine)
|
||||
@@ -131,7 +131,7 @@ func noRoute() gin.HandlerFunc {
|
||||
|
||||
func copyright() gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
ctx.Writer.Header().Set("Payment-Gateway", "https://github.com/v03413/BEpusdt")
|
||||
ctx.Writer.Header().Set("Payment-Gateway", "https://git.viaeon.com/admin/vupay")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/static"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/static"
|
||||
)
|
||||
|
||||
func staticInit(e *gin.Engine) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"git.viaeon.com/admin/vupay/app/handler/vupay"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/v03413/bepusdt/app/handler/epusdt"
|
||||
)
|
||||
|
||||
func epusdtInit(engine *gin.Engine) {
|
||||
func vupayInit(engine *gin.Engine) {
|
||||
epGrp := engine.Group("/pay")
|
||||
epHdr := new(epusdt.Epusdt)
|
||||
epHdr := new(vupay.Vupay)
|
||||
{
|
||||
epGrp.GET("/checkout/:trade_id", epHdr.Checkout)
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package task
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
func TestAmountMatchHasPrefix(t *testing.T) {
|
||||
|
||||
+5
-5
@@ -10,16 +10,16 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
blockapi "git.viaeon.com/admin/vupay/app/core"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
blockapi "github.com/v03413/bepusdt/app/core"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
type aptos struct {
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
func arbitrumInit() {
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
func baseInit() {
|
||||
|
||||
+3
-3
@@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
func bscInit() {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
type rConf struct {
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
func ethInit() {
|
||||
|
||||
+5
-5
@@ -12,16 +12,16 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
blockapi "git.viaeon.com/admin/vupay/app/core"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
blockapi "github.com/v03413/bepusdt/app/core"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+2
-2
@@ -7,10 +7,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
appMqtt "git.viaeon.com/admin/vupay/app/mqtt"
|
||||
"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"
|
||||
)
|
||||
|
||||
|
||||
+6
-6
@@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/notifier"
|
||||
"github.com/v03413/bepusdt/app/task/notify"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/notifier"
|
||||
"git.viaeon.com/admin/vupay/app/task/notify"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -35,7 +35,7 @@ func notifyRetry(context.Context) {
|
||||
|
||||
func notifyRoll(context.Context) {
|
||||
for _, o := range model.GetOrderByStatus(model.OrderStatusWaiting) {
|
||||
notify.Bepusdt(o)
|
||||
notify.Vupay(o)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-19
@@ -10,12 +10,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/notifier"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/notifier"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
|
||||
"github.com/v03413/go-cache"
|
||||
"gorm.io/gorm"
|
||||
@@ -45,7 +45,7 @@ func Handle(order model.Order) error {
|
||||
if order.ApiType == model.OrderApiTypeEpay {
|
||||
err = epay(ctx, order)
|
||||
} else {
|
||||
err = epusdt(ctx, order)
|
||||
err = vupay(ctx, order)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@@ -66,7 +66,7 @@ func epay(ctx context.Context, order model.Order) error {
|
||||
return err2
|
||||
}
|
||||
|
||||
postReq.Header.Set("Powered-By", "https://github.com/v03413/bepusdt")
|
||||
postReq.Header.Set("Powered-By", "https://git.viaeon.com/admin/vupay")
|
||||
resp, err := client.Do(postReq)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -102,7 +102,7 @@ func epay(ctx context.Context, order model.Order) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func epusdt(ctx context.Context, order model.Order) error {
|
||||
func vupay(ctx context.Context, order model.Order) error {
|
||||
var data = make(map[string]interface{})
|
||||
var body = EpNotify{
|
||||
TradeId: order.TradeId,
|
||||
@@ -123,7 +123,7 @@ func epusdt(ctx context.Context, order model.Order) error {
|
||||
}
|
||||
|
||||
// 签名
|
||||
body.Signature = utils.EpusdtSign(data, model.AuthToken())
|
||||
body.Signature = utils.VupaySign(data, model.AuthToken())
|
||||
|
||||
// 再次序列化
|
||||
jsonBody, err = json.Marshal(body)
|
||||
@@ -136,8 +136,8 @@ func epusdt(ctx context.Context, order model.Order) error {
|
||||
}
|
||||
|
||||
postReq.Header.Set("Content-Type", "application/json")
|
||||
postReq.Header.Set("Powered-By", "https://github.com/v03413/bepusdt")
|
||||
postReq.Header.Set("User-Agent", "BEpusdt/"+app.Version)
|
||||
postReq.Header.Set("Powered-By", "https://git.viaeon.com/admin/vupay")
|
||||
postReq.Header.Set("User-Agent", "VUPAY/"+app.Version)
|
||||
resp, err := client.Do(postReq)
|
||||
if err != nil {
|
||||
markNotifyFail(order, err.Error())
|
||||
@@ -160,8 +160,8 @@ func epusdt(ctx context.Context, order model.Order) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Bepusdt(o model.Order) {
|
||||
if o.ApiType != model.OrderApiTypeEpusdt && o.ApiType != model.OrderApiTypeEpusdtOrder {
|
||||
func Vupay(o model.Order) {
|
||||
if o.ApiType != model.OrderApiTypeVupay && o.ApiType != model.OrderApiTypeVupayOrder {
|
||||
|
||||
return
|
||||
}
|
||||
@@ -169,13 +169,13 @@ func Bepusdt(o model.Order) {
|
||||
var authToken = model.AuthToken()
|
||||
var client = &http.Client{Timeout: time.Second * 5}
|
||||
go func() {
|
||||
if err := deliverBepusdtStatusUpdate(model.Db, client, authToken, o); err != nil {
|
||||
log.Warn("notify BEpusdt Error:", err.Error())
|
||||
if err := deliverVupayStatusUpdate(model.Db, client, authToken, o); err != nil {
|
||||
log.Warn("notify VUPAY Error:", err.Error())
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func deliverBepusdtStatusUpdate(db *gorm.DB, client *http.Client, authToken string, o model.Order) error {
|
||||
func deliverVupayStatusUpdate(db *gorm.DB, client *http.Client, authToken string, o model.Order) error {
|
||||
if client == nil {
|
||||
client = &http.Client{Timeout: time.Second * 5}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ func deliverBepusdtStatusUpdate(db *gorm.DB, client *http.Client, authToken stri
|
||||
return nil
|
||||
}
|
||||
|
||||
var key = fmt.Sprintf("bepusdt_notify_%d_%s", current.Status, current.TradeId)
|
||||
var key = fmt.Sprintf("vupay_notify_%d_%s", current.Status, current.TradeId)
|
||||
if _, ok := cache.Get(key); ok {
|
||||
return nil
|
||||
}
|
||||
@@ -215,7 +215,7 @@ func deliverBepusdtStatusUpdate(db *gorm.DB, client *http.Client, authToken stri
|
||||
return err
|
||||
}
|
||||
|
||||
body.Signature = utils.EpusdtSign(data, authToken)
|
||||
body.Signature = utils.VupaySign(data, authToken)
|
||||
|
||||
jsonBody, _ = json.Marshal(body)
|
||||
req, err := http.NewRequest("POST", current.NotifyUrl, strings.NewReader(string(jsonBody)))
|
||||
@@ -224,7 +224,7 @@ func deliverBepusdtStatusUpdate(db *gorm.DB, client *http.Client, authToken stri
|
||||
}
|
||||
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("Powered-By", "https://github.com/v03413/BEpusdt")
|
||||
req.Header.Set("Powered-By", "https://git.viaeon.com/admin/vupay")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
applog "github.com/v03413/bepusdt/app/log"
|
||||
applog "git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -52,25 +52,25 @@ func newWaitingOrder(notifyURL string) model.Order {
|
||||
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)},
|
||||
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.OrderApiTypeVupay,
|
||||
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) {
|
||||
func TestDeliverVupayStatusUpdateDoesNotHoldDBWhileHTTPIsPending(t *testing.T) {
|
||||
db := newNotifyTestDB(t)
|
||||
initNotifyTestLog(t)
|
||||
|
||||
@@ -90,7 +90,7 @@ func TestDeliverBepusdtStatusUpdateDoesNotHoldDBWhileHTTPIsPending(t *testing.T)
|
||||
|
||||
errCh := make(chan error, 1)
|
||||
go func() {
|
||||
errCh <- deliverBepusdtStatusUpdate(db, &http.Client{Timeout: 2 * time.Second}, "test-auth-token", order)
|
||||
errCh <- deliverVupayStatusUpdate(db, &http.Client{Timeout: 2 * time.Second}, "test-auth-token", order)
|
||||
}()
|
||||
|
||||
select {
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
func plasmaInit() {
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
func polygonInit() {
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
+5
-5
@@ -12,17 +12,17 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
blockapi "git.viaeon.com/admin/vupay/app/core"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/btcsuite/btcd/btcutil/base58"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
blockapi "github.com/v03413/bepusdt/app/core"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
// 参考文档
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
func TestSolanaConfirmOffsetUsesRPCSlot(t *testing.T) {
|
||||
@@ -44,7 +44,7 @@ func TestSolanaConfirmOffsetUsesRPCSlot(t *testing.T) {
|
||||
Money: "2736.93",
|
||||
Address: "F7p3dFrjRTbtRp8FRF6qHLomXbKRBzpvBLjtQcfcgmNe",
|
||||
Status: model.OrderStatusConfirming,
|
||||
ApiType: model.OrderApiTypeEpusdt,
|
||||
ApiType: model.OrderApiTypeVupay,
|
||||
NotifyUrl: srv.URL + "/notify",
|
||||
RefHash: "DohbsAfxAerDTAX9XS1b9jXY5XYMXQsCnyY3qu42eEEcTeJ6UzMbFs3JTdY14QgNKQPdy6yezdgbqLbnRVj6YB6",
|
||||
RefBlockNum: slot,
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
func scanSolanaTestBlock(t *testing.T, block []byte) []transfer {
|
||||
@@ -143,7 +143,7 @@ func TestSolanaTradeConfirmIgnoresFailedTransaction(t *testing.T) {
|
||||
Money: "1581.77",
|
||||
Address: "GpsvqTPP7triXkqH8mVtXEM6at9DJ41UHy5dYPTFe16H",
|
||||
Status: model.OrderStatusConfirming,
|
||||
ApiType: model.OrderApiTypeEpusdt,
|
||||
ApiType: model.OrderApiTypeVupay,
|
||||
NotifyUrl: srv.URL + "/notify",
|
||||
RefHash: "53bZ2UeqMGryYjbjKgB2nAo8umAMsPTP4dzBhR94SdV7f4YaxDvWqEdL5WQ46JSHsmLph3hBmEdHzTMdnYKMsbRz",
|
||||
RefBlockNum: 458281527,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
// 模拟 n 个 slot 正在等待重试
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
func newSolanaSlotTestServer(t *testing.T, head *atomic.Int64) *httptest.Server {
|
||||
@@ -34,7 +34,7 @@ func createSolanaWaitingOrder(t *testing.T) {
|
||||
Money: "8.61",
|
||||
Address: "GpsvqTPP7triXkqH8mVtXEM6at9DJ41UHy5dYPTFe16H",
|
||||
Status: model.OrderStatusWaiting,
|
||||
ApiType: model.OrderApiTypeEpusdt,
|
||||
ApiType: model.OrderApiTypeVupay,
|
||||
ExpiredAt: time.Now().Add(10 * time.Minute),
|
||||
}, time.Now().Add(-time.Minute))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
func createSolanaLookbackOrder(t *testing.T, tradeID string, status int) model.Order {
|
||||
@@ -19,7 +19,7 @@ func createSolanaLookbackOrder(t *testing.T, tradeID string, status int) model.O
|
||||
Money: "8.61",
|
||||
Address: "GpsvqTPP7triXkqH8mVtXEM6at9DJ41UHy5dYPTFe16H",
|
||||
Status: status,
|
||||
ApiType: model.OrderApiTypeEpusdt,
|
||||
ApiType: model.OrderApiTypeVupay,
|
||||
ExpiredAt: time.Now().Add(10 * time.Minute),
|
||||
}, time.Now().Add(-time.Minute))
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
// 预期结果由独立的解码脚本从主网交易得出:只统计两端代币账户都在 token balances 中的 USDT/USDC transfer、transferChecked
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
const solanaBlockCleanedUpResponse = `{"jsonrpc":"2.0","error":{"code":-32001,"message":"Block 459552217 cleaned up, does not exist on node. First available block: 461715420"},"id":1}`
|
||||
|
||||
@@ -12,11 +12,11 @@ import (
|
||||
"time"
|
||||
|
||||
"filippo.io/edwards25519"
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/btcsuite/btcd/btcutil/base58"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
// 订单过期后,按收款账户的链上历史对账一次。
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -96,7 +96,7 @@ func createReconcileTestOrder(t *testing.T, tradeID, amount string) model.Order
|
||||
Money: "2736.93",
|
||||
Address: reconcileTestOwner,
|
||||
Status: model.OrderStatusExpired,
|
||||
ApiType: model.OrderApiTypeEpusdt,
|
||||
ApiType: model.OrderApiTypeVupay,
|
||||
ExpiredAt: time.Now().Add(-5 * time.Minute),
|
||||
}, time.Now().Add(-15*time.Minute))
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
// 模拟重试定时器到期并再次扫描失败:取消定时器,下一次 scheduleSlotRetry 计为新的失败
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
// 区块扫描队列最大长度,避免可能因为 Rpc Rate Limit 问题导致消费队列堆积,进而导致OOM,暂时简单限制队列长度
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
applog "git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/tidwall/gjson"
|
||||
applog "github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
)
|
||||
|
||||
// 任务测试的公共环境:临时日志目录、临时 SQLite 和主网交易 fixture
|
||||
@@ -22,7 +22,7 @@ func initTaskTestEnv(t *testing.T, kv map[model.ConfKey]string) {
|
||||
}
|
||||
t.Cleanup(applog.Close)
|
||||
|
||||
if err := model.Init(filepath.Join(t.TempDir(), "task-test.db"), ""); err != nil {
|
||||
if err := model.Init(filepath.Join(t.TempDir(), "task-test.db"), "", ""); err != nil {
|
||||
t.Fatalf("init db: %v", err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
@@ -68,7 +68,7 @@ func getTestOrder(t *testing.T, tradeID string) model.Order {
|
||||
func waitOrderNotified(t *testing.T, tradeID string) {
|
||||
t.Helper()
|
||||
|
||||
file := filepath.Join(applog.GetPath(), "bepusdt.log")
|
||||
file := filepath.Join(applog.GetPath(), "vupay.log")
|
||||
for deadline := time.Now().Add(5 * time.Second); time.Now().Before(deadline); time.Sleep(50 * time.Millisecond) {
|
||||
body, _ := os.ReadFile(file)
|
||||
if strings.Contains(string(body), "订单回调成功") && strings.Contains(string(body), tradeID) {
|
||||
|
||||
+5
-5
@@ -7,14 +7,14 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
blockapi "git.viaeon.com/admin/vupay/app/core"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
blockapi "github.com/v03413/bepusdt/app/core"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"github.com/xssnick/tonutils-go/address"
|
||||
"github.com/xssnick/tonutils-go/tlb"
|
||||
tgo "github.com/xssnick/tonutils-go/ton"
|
||||
|
||||
@@ -3,7 +3,7 @@ package task
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"github.com/xssnick/tonutils-go/address"
|
||||
"github.com/xssnick/tonutils-go/tlb"
|
||||
tgo "github.com/xssnick/tonutils-go/ton"
|
||||
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/notifier"
|
||||
"git.viaeon.com/admin/vupay/app/task/notify"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/notifier"
|
||||
"github.com/v03413/bepusdt/app/task/notify"
|
||||
"github.com/v03413/tronprotocol/core"
|
||||
)
|
||||
|
||||
@@ -380,7 +380,7 @@ func expireWaitingOrders() {
|
||||
}
|
||||
|
||||
t.SetExpired()
|
||||
notify.Bepusdt(t)
|
||||
notify.Vupay(t)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ func getConfirmingOrders(tradeType []model.TradeType) []model.Order {
|
||||
if time.Now().Unix() >= order.ExpiredAt.Unix() {
|
||||
if order.ConfirmedAt == nil || order.ConfirmedAt.IsZero() || !order.ConfirmedAt.Before(order.ExpiredAt) {
|
||||
order.SetFailed()
|
||||
notify.Bepusdt(order)
|
||||
notify.Vupay(order)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
)
|
||||
|
||||
func TestPendingLookbackUnixCoversEveryOrderWindow(t *testing.T) {
|
||||
@@ -52,7 +52,7 @@ func TestPendingLookbackUnixCoversEveryOrderWindow(t *testing.T) {
|
||||
Money: "7.00",
|
||||
Address: "GpsvqTPP7triXkqH8mVtXEM6at9DJ41UHy5dYPTFe16H",
|
||||
Status: w.status,
|
||||
ApiType: model.OrderApiTypeEpusdt,
|
||||
ApiType: model.OrderApiTypeVupay,
|
||||
ExpiredAt: now.Add(w.expired),
|
||||
}, now.Add(w.created))
|
||||
}
|
||||
|
||||
+5
-5
@@ -9,17 +9,17 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
blockapi "git.viaeon.com/admin/vupay/app/core"
|
||||
"git.viaeon.com/admin/vupay/app/log"
|
||||
"git.viaeon.com/admin/vupay/app/model"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/btcsuite/btcd/btcutil/base58"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
blockapi "github.com/v03413/bepusdt/app/core"
|
||||
"github.com/v03413/bepusdt/app/log"
|
||||
"github.com/v03413/bepusdt/app/model"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
"github.com/v03413/tronprotocol/api"
|
||||
"github.com/v03413/tronprotocol/core"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.viaeon.com/admin/vupay/app/conf"
|
||||
"git.viaeon.com/admin/vupay/app/utils"
|
||||
"github.com/smallnest/chanx"
|
||||
"github.com/v03413/bepusdt/app/conf"
|
||||
"github.com/v03413/bepusdt/app/utils"
|
||||
)
|
||||
|
||||
func xlayerInit() {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ func IsExist(path string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func EpusdtSign(data map[string]interface{}, token string) string {
|
||||
func VupaySign(data map[string]interface{}, token string) string {
|
||||
keys := make([]string, 0, len(data))
|
||||
for k := range data {
|
||||
if k == "signature" {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICpjCCAiugAwIBAgIRAIchZfw0tuX7qK3Vs3BftTowCgYIKoZIzj0EAwMwTzEL
|
||||
MAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNo
|
||||
IEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDIwHhcNMjYwNTEzMDAwMDAwWhcN
|
||||
MzIwOTAyMjM1OTU5WjAuMQswCQYDVQQGEwJVUzENMAsGA1UEChMESVNSRzEQMA4G
|
||||
A1UEAxMHUm9vdCBZRTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDwS/6vhrcVqcbBo
|
||||
+wgdI3fwn9x7DNJJOY/lTOti0vkwuRN87RhEhTH17E7XyFjWsPYhIPt/wzOqxTd2
|
||||
b+4ZJNy9ID04YywF9U5zasDVyGSNErVNtz8uSGh5izW87j77GaOB6zCB6DAOBgNV
|
||||
HQ8BAf8EBAMCAQYwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB
|
||||
/zAdBgNVHQ4EFgQUo8gmWo6hTNA1Y/ybI8g6rlbzT1YwHwYDVR0jBBgwFoAUfEKW
|
||||
rt5LSDv6kviejM9ti6lyN5UwMgYIKwYBBQUHAQEEJjAkMCIGCCsGAQUFBzAChhZo
|
||||
dHRwOi8veDIuaS5sZW5jci5vcmcvMBMGA1UdIAQMMAowCAYGZ4EMAQIBMCcGA1Ud
|
||||
HwQgMB4wHKAaoBiGFmh0dHA6Ly94Mi5jLmxlbmNyLm9yZy8wCgYIKoZIzj0EAwMD
|
||||
aQAwZgIxAMU19WCtmxVND8UHBZRoma49Z7jPs64Dma0eTu1OChVbB/2J7GV3nvYK
|
||||
Ax54uk1G9QIxAO0miLVJu8PLNiXXXkiE/gsK3CTRTF/aeo4bMX42Zw40csRU6AC2
|
||||
6hSW1/IWaas6dg==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,12 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIB2TCCAWCgAwIBAgIRAKQCa6LvbHwg1AR+XmWmk4AwCgYIKoZIzj0EAwMwLjEL
|
||||
MAkGA1UEBhMCVVMxDTALBgNVBAoTBElTUkcxEDAOBgNVBAMTB1Jvb3QgWUUwHhcN
|
||||
MjUwOTAzMDAwMDAwWhcNNDUwOTAyMjM1OTU5WjAuMQswCQYDVQQGEwJVUzENMAsG
|
||||
A1UEChMESVNSRzEQMA4GA1UEAxMHUm9vdCBZRTB2MBAGByqGSM49AgEGBSuBBAAi
|
||||
A2IABDwS/6vhrcVqcbBo+wgdI3fwn9x7DNJJOY/lTOti0vkwuRN87RhEhTH17E7X
|
||||
yFjWsPYhIPt/wzOqxTd2b+4ZJNy9ID04YywF9U5zasDVyGSNErVNtz8uSGh5izW8
|
||||
7j77GaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
|
||||
BBYEFKPIJlqOoUzQNWP8myPIOq5W809WMAoGCCqGSM49BAMDA2cAMGQCMHhMr8N9
|
||||
LdL1VQKs9BdV81r76eXRB6mtjuNjzk6/lBsPNToWLTDzGYgtQKO1jl63uAIwGV7m
|
||||
onyF377c+MM1oqVNs17sgu7F9YKZwgLmVbeOMDbKAXHtKMDLbiGllCcs8f47
|
||||
-----END CERTIFICATE-----
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
# BEpusdt(SQLite 版)—— 单机最简部署
|
||||
# VUPAY(SQLite 版)—— 单机最简部署
|
||||
#
|
||||
# 用法:
|
||||
# 1) docker login git.viaeon.com # 私有镜像仓库,用 Gitea 账号/token
|
||||
@@ -6,14 +6,14 @@
|
||||
# 3) 浏览器打开 http://服务器IP:8080 走安装向导(记下「安全入口」和后台账号)
|
||||
#
|
||||
# 关键点:
|
||||
# - SQLite 数据库在容器内 /var/lib/bepusdt/sqlite.db,必须挂出来,否则删容器=丢单
|
||||
# - 日志在 /var/log/bepusdt/,也挂出来,排查掉单要靠它
|
||||
# - SQLite 数据库在容器内 /var/lib/vupay/sqlite.db,必须挂出来,否则删容器=丢单
|
||||
# - 日志在 /var/log/vupay/,也挂出来,排查掉单要靠它
|
||||
# - 默认 LISTEN 就是 :8080(0.0.0.0),容器内不用改;要只让反代访问就绑 127.0.0.1
|
||||
|
||||
services:
|
||||
bepusdt:
|
||||
image: git.viaeon.com/admin/bepusdt:latest # 想用官方镜像就换成 v03413/bepusdt:latest
|
||||
container_name: bepusdt
|
||||
vupay:
|
||||
image: git.viaeon.com/admin/vupay:latest # 想用官方镜像就换成 admin/vupay:latest
|
||||
container_name: vupay
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
# 前面有 Nginx/Caddy 反代时绑本机,别把后台裸奔在公网
|
||||
@@ -23,11 +23,11 @@ services:
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
LISTEN: ":8080"
|
||||
SQLITE: /var/lib/bepusdt/sqlite.db
|
||||
LOG: /var/log/bepusdt/
|
||||
SQLITE: /var/lib/vupay/sqlite.db
|
||||
LOG: /var/log/vupay/
|
||||
volumes:
|
||||
- ./data:/var/lib/bepusdt # sqlite.db 就在这里
|
||||
- ./logs:/var/log/bepusdt
|
||||
- ./data:/var/lib/vupay # sqlite.db 就在这里
|
||||
- ./logs:/var/log/vupay
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
|
||||
@@ -1,60 +1,88 @@
|
||||
# BEpusdt + MySQL 8 —— 需要 MySQL 的场景
|
||||
# VUPAY + MySQL 8 —— 需要 MySQL 的场景
|
||||
#
|
||||
# 注意:这是**本仓库(admin/BEPUSDT)加了 MySQL 支持之后**才能用的写法。
|
||||
# 上游 v03413/bepusdt 的代码只有 SQLite 和 PostgreSQL,文档里那段 MYSQL_DSN 是过期内容。
|
||||
# 镜像:git.viaeon.com/admin/bepusdt:latest(>= e7a8dd9)
|
||||
# 注意:这是**本仓库(admin/VUPAY)加了 MySQL 支持之后**才能用的写法。
|
||||
# 上游 admin/vupay 的代码只有 SQLite 和 PostgreSQL,文档里那段 MYSQL_DSN 是过期内容。
|
||||
# 镜像:git.viaeon.com/admin/vupay:latest(>= e7a8dd9)
|
||||
#
|
||||
# 用法:
|
||||
# echo "DB_ROOT_PASSWORD=$(openssl rand -base64 24 | tr -d '/+=')" > .env
|
||||
# echo "DB_PASSWORD=$(openssl rand -base64 24 | tr -d '/+=')" >> .env
|
||||
# docker login git.viaeon.com
|
||||
# docker compose -f docker-compose.mysql.yml up -d
|
||||
#
|
||||
# 关于共享:MySQL 服务名/容器名都叫 `mysql`,挂在 external 网络 `shared-db` 上,
|
||||
# 这样同机的其它容器也能用 `mysql:3306` 复用它(每个应用给独立库 + 独立账号)。
|
||||
# 没有这个网络就先建:docker network create shared-db
|
||||
# 如果你用 AcePanel 面板,把下面的 `shared-db` 换成 `acepanel-network` 即可
|
||||
# (那是面板自带的共享网络,面板创建的容器都在里面)。
|
||||
|
||||
services:
|
||||
db:
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: bepusdt-db
|
||||
container_name: mysql
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_unicode_ci
|
||||
- --default-time-zone=+08:00
|
||||
# 小机器(1~2G 内存)建议打开下面三行,省内存也省 CPU
|
||||
# - --innodb-buffer-pool-size=256M
|
||||
# - --performance-schema=OFF
|
||||
# - --disable-log-bin
|
||||
# - --slow-query-log=ON # 慢查询落 ./mysqldata/<host>-slow.log
|
||||
# - --long-query-time=1
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:?先把 DB_ROOT_PASSWORD 写进 .env}
|
||||
MYSQL_DATABASE: bepusdt
|
||||
MYSQL_USER: bepusdt
|
||||
MYSQL_DATABASE: vupay
|
||||
MYSQL_USER: vupay
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD:?先把 DB_PASSWORD 写进 .env}
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- ./mysqldata:/var/lib/mysql
|
||||
ports:
|
||||
# 只绑本机:宿主机命令行 / SSH 隧道能用,公网访问不到
|
||||
- "127.0.0.1:3306:3306"
|
||||
networks:
|
||||
- shared-db
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-u", "root", "-p$${DB_ROOT_PASSWORD}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
start_period: 40s
|
||||
expose:
|
||||
- "3306"
|
||||
|
||||
bepusdt:
|
||||
image: git.viaeon.com/admin/bepusdt:latest
|
||||
container_name: bepusdt
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
LISTEN: ":8080"
|
||||
LOG: /var/log/bepusdt/
|
||||
# DSN 三个参数别省:charset=utf8mb4(中文)、parseTime=True(时间列)、loc=Local(时区)
|
||||
MYSQL_DSN: bepusdt:${DB_PASSWORD}@tcp(db:3306)/bepusdt?charset=utf8mb4&parseTime=True&loc=Local&timeout=5s&readTimeout=10s&writeTimeout=10s
|
||||
volumes:
|
||||
- ./logs:/var/log/bepusdt
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
vupay:
|
||||
image: git.viaeon.com/admin/vupay:latest
|
||||
container_name: vupay
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
networks:
|
||||
- shared-db
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
LISTEN: ":8080"
|
||||
LOG: /var/log/vupay/
|
||||
# DSN 三个参数别省:charset=utf8mb4(中文)、parseTime=True(时间列)、loc=Local(时区)
|
||||
# host 用服务名 mysql(同类容器里写 127.0.0.1 会指向容器自身)
|
||||
MYSQL_DSN: vupay:${DB_PASSWORD}@tcp(mysql:3306)/vupay?charset=utf8mb4&parseTime=True&loc=Local&timeout=5s&readTimeout=10s&writeTimeout=10s
|
||||
volumes:
|
||||
- ./logs:/var/log/vupay
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
networks:
|
||||
# 用面板(AcePanel)就把名字换成 acepanel-network,同样写 external: true
|
||||
shared-db:
|
||||
external: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# BEpusdt + PostgreSQL —— 生产推荐
|
||||
# VUPAY + PostgreSQL —— 生产推荐
|
||||
#
|
||||
# 说明:官方文档里那套 MySQL 写法是**过期的**(代码里已经没有任何 MySQL 分支),
|
||||
# 现在只支持 SQLite 和 PostgreSQL 两种。数据量大/要多实例就看这份。
|
||||
@@ -11,17 +11,17 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:18-alpine
|
||||
container_name: bepusdt-db
|
||||
container_name: vupay-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: bepusdt
|
||||
POSTGRES_USER: bepusdt
|
||||
POSTGRES_DB: vupay
|
||||
POSTGRES_USER: vupay
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:?先把 DB_PASSWORD 写进 .env}
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- ./pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U bepusdt -d bepusdt"]
|
||||
test: ["CMD-SHELL", "pg_isready -U vupay -d vupay"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
@@ -29,9 +29,9 @@ services:
|
||||
expose:
|
||||
- "5432"
|
||||
|
||||
bepusdt:
|
||||
image: git.viaeon.com/admin/bepusdt:latest
|
||||
container_name: bepusdt
|
||||
vupay:
|
||||
image: git.viaeon.com/admin/vupay:latest
|
||||
container_name: vupay
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
@@ -41,10 +41,10 @@ services:
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
LISTEN: ":8080"
|
||||
LOG: /var/log/bepusdt/
|
||||
POSTGRESQL_DSN: postgres://bepusdt:${DB_PASSWORD}@db:5432/bepusdt?sslmode=disable&connect_timeout=3&timezone=Asia/Shanghai
|
||||
LOG: /var/log/vupay/
|
||||
POSTGRESQL_DSN: postgres://vupay:${DB_PASSWORD}@db:5432/vupay?sslmode=disable&connect_timeout=3&timezone=Asia/Shanghai
|
||||
volumes:
|
||||
- ./logs:/var/log/bepusdt
|
||||
- ./logs:/var/log/vupay
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
|
||||
+16
-5
@@ -21,11 +21,16 @@ COPY --from=web_builder /web/dist ./static/secure
|
||||
|
||||
ARG VERSION=unknown
|
||||
|
||||
RUN set -x \
|
||||
# 编译缓存 + 并行度限制:
|
||||
# - cache mount 让依赖只编一次,之后每次提交只重编 main 包(原来每次都全量重编)
|
||||
# - -p 4 把 go 的并行编译进程数钉死在 4,构建期间留一半核给同机的生产服务
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
set -x \
|
||||
&& MODULE_PATH=$(go list -m) \
|
||||
&& CGO_ENABLED=0 go build -trimpath \
|
||||
&& CGO_ENABLED=0 go build -trimpath -p 4 \
|
||||
-ldflags="-X '${MODULE_PATH}/app.Version=${VERSION}' -s -w -buildid=" \
|
||||
-o bepusdt ./main
|
||||
-o vupay ./main
|
||||
|
||||
FROM alpine:3.20
|
||||
|
||||
@@ -34,11 +39,17 @@ ENV TZ=Asia/Shanghai
|
||||
# 安装所需的依赖
|
||||
RUN apk add --no-cache tzdata ca-certificates
|
||||
|
||||
COPY --from=builder /go/release/bepusdt /usr/local/bin/bepusdt
|
||||
# 补充根证书:Let's Encrypt 的 "ISRG Root YE"(2025 起签发的新根)
|
||||
# alpine/debian 的 ca-certificates 包里还没有它,缺了会导致对使用新根签发的站点
|
||||
# 发 HTTPS 回调时 TLS 校验失败(错误形如 x509: certificate signed by unknown authority)。
|
||||
COPY ca/ /usr/local/share/ca-certificates/
|
||||
RUN update-ca-certificates
|
||||
|
||||
COPY --from=builder /go/release/vupay /usr/local/bin/vupay
|
||||
|
||||
# 设置时区
|
||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["bepusdt"]
|
||||
ENTRYPOINT ["vupay"]
|
||||
CMD ["start"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 1Panel 部署 BEpusdt 完整指南
|
||||
# 1Panel 部署 VUPAY 完整指南
|
||||
|
||||
> 📋 **前置条件**:本教程假定您已成功安装并配置好 1Panel 面板。
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
| 配置项 | 说明 |
|
||||
|----------|-----------------------------------------------------------------------------------------|
|
||||
| **镜像选择** | • **正式版**:`v03413/bepusdt:latest`(推荐生产环境)<br>• **开发版**:`v03413/bepusdt:nightly`(体验最新特性) |
|
||||
| **镜像选择** | • **正式版**:`admin/vupay:latest`(推荐生产环境)<br>• **开发版**:`admin/vupay:nightly`(体验最新特性) |
|
||||
| **端口映射** | • **本机访问**:`127.0.0.1:8080:8080`(推荐配合反向代理)<br>• **外网暴露**:`8080:8080`(不推荐,存在安全隐患) |
|
||||
|
||||
> ⚠️ **安全建议**:为确保服务安全,建议使用 `127.0.0.1` 绑定本地端口,再通过反向代理对外提供服务。
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
## 验证部署
|
||||
|
||||
配置完成后,通过浏览器访问您的域名,应能正常访问 BEpusdt 服务。
|
||||
配置完成后,通过浏览器访问您的域名,应能正常访问 VUPAY 服务。
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# 异次元发卡 BEpusdt 对接
|
||||
# 异次元发卡 VUPAY 对接
|
||||
|
||||
当前异次元官方应用商店里面已经上架了支付插件`BEpusdt`,直接在商店搜索安装使用即可。
|
||||
当前异次元官方应用商店里面已经上架了支付插件`VUPAY`,直接在商店搜索安装使用即可。
|
||||
+9
-9
@@ -3,7 +3,7 @@
|
||||
> 📡 **MQTT 实时推送**:系统支持将扫描到的链上交易广播到 MQTT 服务器,其它系统通过订阅即可实时获取数据,无需轮询
|
||||
> API。详见 [《MQTT 对接开发文档》](./mqtt.md)。
|
||||
|
||||
> 💡 **推荐阅读**:在开始对接前,建议先阅读 [《BEpusdt 执行原理说明》](./how-it-works.md)
|
||||
> 💡 **推荐阅读**:在开始对接前,建议先阅读 [《VUPAY 执行原理说明》](./how-it-works.md)
|
||||
> ,了解订单匹配机制、金额匹配模式与汇率浮动等核心原理,有助于更准确地理解本文档中的参数设计。
|
||||
|
||||
### 基础信息
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
> **两种订单模式说明**
|
||||
>
|
||||
> BEpusdt 的订单创建接口支持两种工作模式,通过 `amount` 参数决定:
|
||||
> VUPAY 的订单创建接口支持两种工作模式,通过 `amount` 参数决定:
|
||||
>
|
||||
> | 模式 | 触发条件 | 地址分配 | 匹配规则 | 典型场景 |
|
||||
> |------|---------|---------|---------|---------|
|
||||
@@ -449,7 +449,7 @@ POST /api/v1/pay/methods
|
||||
}
|
||||
```
|
||||
|
||||
假设 API Token 为:`epusdt_password_xasddawqe`
|
||||
假设 API Token 为:`vupay_password_xasddawqe`
|
||||
|
||||
**步骤 1:排序拼接**
|
||||
|
||||
@@ -460,7 +460,7 @@ amount=42¬ify_url=http://example.com/notify&order_id=20220201030210321&redire
|
||||
**步骤 2:追加 Token 并加密**
|
||||
|
||||
```text
|
||||
MD5(amount=42¬ify_url=http://example.com/notify&order_id=20220201030210321&redirect_url=http://example.com/redirectepusdt_password_xasddawqe)
|
||||
MD5(amount=42¬ify_url=http://example.com/notify&order_id=20220201030210321&redirect_url=http://example.com/redirectvupay_password_xasddawqe)
|
||||
```
|
||||
|
||||
**最终签名**:`1cd4b52df5587cfb1968b0c0c6e156cd`
|
||||
@@ -468,8 +468,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)
|
||||
- **Python 实现**:[BEpusdt Python SDK](https://github.com/luoyanglang/bepusdt-python-sdk)
|
||||
**:[点击查看](https://github.com/v03413/Epay-VUPAY/blob/b7fa8fd608d71ce50e0f8eabb1717783c96761ac/vupay_plugin.php#L108:L127)
|
||||
- **Python 实现**:[VUPAY Python SDK](https://github.com/luoyanglang/vupay-python-sdk)
|
||||
|
||||
### 签名规则总结
|
||||
|
||||
@@ -533,6 +533,6 @@ MD5(amount=42¬ify_url=http://example.com/notify&order_id=20220201030210321&re
|
||||
|
||||
- [交易类型完整列表](../trade-type.md)
|
||||
- [订单回调通知](../notify/readme.md)
|
||||
- [易支付对接插件](https://github.com/v03413/Epay-BEpusdt)
|
||||
- [Python SDK](https://github.com/luoyanglang/bepusdt-python-sdk)
|
||||
- [原项目参考](https://github.com/assimon/epusdt/blob/master/wiki/API.md)
|
||||
- [易支付对接插件](https://github.com/v03413/Epay-VUPAY)
|
||||
- [Python SDK](https://github.com/luoyanglang/vupay-python-sdk)
|
||||
- [原项目参考](https://github.com/assimon/vupay/blob/master/wiki/API.md)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# DuJiao Next 对接 BEpusdt 集成指南
|
||||
# DuJiao Next 对接 VUPAY 集成指南
|
||||
|
||||
**当前教程针对的是新版独角 [Dujiao Next](https://dujiao-next.com/),旧版独角数卡对接[请看这个](../dujiaoka/dujiaoka.md)**
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
在开始配置前,请确保已满足以下条件:
|
||||
|
||||
**BEpusdt 部署信息**
|
||||
**VUPAY 部署信息**
|
||||
|
||||
- API 服务地址:`https://your-bepusdt.com`
|
||||
- API 服务地址:`https://your-vupay.com`
|
||||
- API 密钥:`your_api_token`
|
||||
|
||||
**DuJiao Next 部署信息**
|
||||
@@ -19,16 +19,16 @@
|
||||
|
||||
## 配置步骤
|
||||
|
||||
在 DuJiao Next 后台中选择渠道类型为 BEpusdt,按照以下格式进行配置。
|
||||
在 DuJiao Next 后台中选择渠道类型为 VUPAY,按照以下格式进行配置。
|
||||
|
||||

|
||||

|
||||
|
||||
**必填配置项**
|
||||
|
||||
| 配置项 | 说明 | 示例 |
|
||||
|-----------|--------------------|----------------------------------------------------|
|
||||
| 网关地址 | BEpusdt 的 API 服务地址 | `https://your-bepusdt.com` |
|
||||
| API Token | BEpusdt 的 API 密钥 | `your_api_token` |
|
||||
| 网关地址 | VUPAY 的 API 服务地址 | `https://your-vupay.com` |
|
||||
| API Token | VUPAY 的 API 密钥 | `your_api_token` |
|
||||
| 支付币种 | 支持的加密资产类型,严格区分大小写 | `usdt.trc20` |
|
||||
| 法币类型 | 支持的法定货币类型 | `CNY`、`USD`、`EUR`、`JPY`、`GBP` |
|
||||
| 异步通知地址 | 交易完成时的服务器异步回调地址 | `https://your-dujiao.com/api/v1/payments/callback` |
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
**配置说明**
|
||||
|
||||
- **支付币种**:详见 [支持的币种列表](https://github.com/v03413/BEpusdt/blob/main/docs/trade-type.md),必须严格区分大小写。
|
||||
- **支付币种**:详见 [支持的币种列表](https://git.viaeon.com/admin/vupay/blob/main/docs/trade-type.md),必须严格区分大小写。
|
||||
- **法币类型**:仅支持 `CNY`、`USD`、`EUR`、`JPY`、`GBP` 五种,必须严格区分大小写。
|
||||
|
||||
**⚠️ 重要说明:异步通知地址和同步回跳地址**
|
||||
@@ -62,6 +62,6 @@
|
||||
|
||||
若出现网关错误提示,请按照以下步骤排查:
|
||||
|
||||
- **检查网络连通性**:确认 DuJiao Next API 所在服务器能够正常访问 BEpusdt API 地址。
|
||||
- **检查 API Token**:确认所配置的 API Token 与 BEpusdt 中的密钥一致。
|
||||
- **查看日志**:检查 DuJiao Next 和 BEpusdt 的应用日志,获取更详细的错误信息。
|
||||
- **检查网络连通性**:确认 DuJiao Next API 所在服务器能够正常访问 VUPAY API 地址。
|
||||
- **检查 API Token**:确认所配置的 API Token 与 VUPAY 中的密钥一致。
|
||||
- **查看日志**:检查 DuJiao Next 和 VUPAY 的应用日志,获取更详细的错误信息。
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
## 重要提示
|
||||
|
||||
由于新版 `BEpusdt` 支持多区块链 USDT、超时回调等新特性,独角数卡自带的 `Epusdt` 插件已无法兼容,**必须替换原有插件**。
|
||||
由于新版 `VUPAY` 支持多区块链 USDT、超时回调等新特性,独角数卡自带的 `Vupay` 插件已无法兼容,**必须替换原有插件**。
|
||||
|
||||
> ⚠️ **重要警告**
|
||||
>
|
||||
> 独角数卡自带的 `Epusdt` 插件无法直接使用,强行使用必定出现问题!
|
||||
> 独角数卡自带的 `Vupay` 插件无法直接使用,强行使用必定出现问题!
|
||||
|
||||
## 插件替换说明
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
|
||||
下载更新后的控制器文件:
|
||||
```
|
||||
https://raw.githubusercontent.com/v03413/dujiaoka/refs/heads/master/app/Http/Controllers/Pay/EpusdtController.php
|
||||
https://raw.githubusercontent.com/v03413/dujiaoka/refs/heads/master/app/Http/Controllers/Pay/VupayController.php
|
||||
```
|
||||
|
||||
2. **替换原有文件**
|
||||
|
||||
将下载的文件替换到独角数卡网站目录:
|
||||
```
|
||||
app/Http/Controllers/Pay/EpusdtController.php
|
||||
app/Http/Controllers/Pay/VupayController.php
|
||||
```
|
||||
|
||||
## 配置步骤
|
||||
|
||||
确保 `BEpusdt` 已成功安装并运行后,按照以下步骤配置:
|
||||
确保 `VUPAY` 已成功安装并运行后,按照以下步骤配置:
|
||||
|
||||
### 1. 进入支付配置
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
|
||||
| 参数名称 | 填写内容 | 说明 |
|
||||
|------------|-----------------------------------------------------------|---------------------------------------------------------------------------|
|
||||
| **商户ID** | 与 `BEpusdt` 中 `AUTH_TOKEN` 参数保持一致 | 用于身份验证 |
|
||||
| **商户ID** | 与 `VUPAY` 中 `AUTH_TOKEN` 参数保持一致 | 用于身份验证 |
|
||||
| **支付标识** | 收款交易类型 | 可选值:`tron.trx`、`usdt.trc20`、`usdt.erc20` 等<br/>[完整列表参考](../../trade-type.md) |
|
||||
| **商户密钥** | `https://your-domain.com/api/v1/order/create-transaction` | ⚠️ 请将 `your-domain.com` 替换为实际域名 |
|
||||
| **支付处理路由** | `pay/epusdt` | 固定值,无需修改 |
|
||||
| **支付处理路由** | `pay/vupay` | 固定值,无需修改 |
|
||||
|
||||
### 3. 完成配置
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
## 常见问题
|
||||
|
||||
- 如果遇到支付失败,请检查 `BEpusdt` 服务是否正常运行
|
||||
- 如果遇到支付失败,请检查 `VUPAY` 服务是否正常运行
|
||||
- 确认商户密钥中的域名是否正确配置
|
||||
- 验证 `AUTH_TOKEN` 是否与独角数卡中的商户ID一致
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
# EdgeKey 对接 BEpusdt 教程
|
||||
# EdgeKey 对接 VUPAY 教程
|
||||
|
||||
**当前教程对接BEpusdt(v1.23.5)通过测试验收**
|
||||
**当前教程对接VUPAY(v1.23.5)通过测试验收**
|
||||
|
||||
## 配置步骤
|
||||
|
||||
**配置说明**
|
||||
|
||||
- **网关地址**:只需填写域名,如 `https://test.shop.com`,系统会自动拼接 API 路径(`/api/v1/order/create-order`)。
|
||||
- **App ID 和 App Secret**:在 BEpusdt 后台「系统管理 → 基本设置 → API 设置」中获取。
|
||||
- **支付币种**:用户在 BEpusdt 收银台页面自由选择支付币种,具体在 BEpusdt 后台配置。
|
||||
- **App ID 和 App Secret**:在 VUPAY 后台「系统管理 → 基本设置 → API 设置」中获取。
|
||||
- **支付币种**:用户在 VUPAY 收银台页面自由选择支付币种,具体在 VUPAY 后台配置。
|
||||
|
||||
**配置步骤示例**:
|
||||
1. 登录 EdgeKey 管理后台
|
||||
2. 进入「支付配置」页面
|
||||
3. 选择 BEpusdt 标签页
|
||||
3. 选择 VUPAY 标签页
|
||||
4. 填写具体配置
|
||||
5. 启用支付方式:点击右上角的启用开关
|
||||
6. 保存配置:点击「保存配置」按钮
|
||||
@@ -34,18 +34,18 @@
|
||||
- **Notify URL**:异步通知地址,支付完成后系统会回调此地址
|
||||
- **Return URL**:同步回跳地址,用户支付完成后跳转的页面
|
||||
|
||||
**BEpusdt专用字段**:
|
||||
- **App ID**:BEpusdt后台获取的应用ID
|
||||
- **App Secret**:BEpusdt后台获取的应用密钥(API密钥)
|
||||
**VUPAY专用字段**:
|
||||
- **App ID**:VUPAY后台获取的应用ID
|
||||
- **App Secret**:VUPAY后台获取的应用密钥(API密钥)
|
||||
|
||||
|
||||
## 异步通知地址和同步回跳地址
|
||||
|
||||
这两个地址的路由部分 **严格按要求填写**,只需将域名部分替换为您实际部署的 EdgeKey 服务器地址:
|
||||
|
||||
- **异步通知地址**:`/api/payments/bepusdt/notify`
|
||||
- 路由固定为 `/api/payments/bepusdt/notify`
|
||||
- 示例:若部署地址为 `https://example.com`,则填写 `/api/payments/bepusdt/notify`
|
||||
- **异步通知地址**:`/api/payments/vupay/notify`
|
||||
- 路由固定为 `/api/payments/vupay/notify`
|
||||
- 示例:若部署地址为 `https://example.com`,则填写 `/api/payments/vupay/notify`
|
||||
|
||||
- **同步回跳地址**:`/order/{orderNo}?token={token}`
|
||||
- 路由固定为 `/order/{orderNo}?token={token}`(`:orderNo` 和 `{token}` 为动态参数)
|
||||
@@ -56,24 +56,24 @@
|
||||
配置完成后,请按照以下步骤进行测试:
|
||||
|
||||
1. 进入 EdgeKey 前台,选择一个商品进行购买。
|
||||
2. 在结算页面选择 BEpusdt 支付方式。
|
||||
2. 在结算页面选择 VUPAY 支付方式。
|
||||
3. 观察是否正常跳转到收银台页面。
|
||||
|
||||
## 故障排查
|
||||
|
||||
若出现网关错误提示,请按照以下步骤排查:
|
||||
|
||||
- **检查网络连通性**:确认 EdgeKey 服务器能够正常访问 BEpusdt API 地址。
|
||||
- **检查 App ID 和 App Secret**:确认所配置的 App ID 和 App Secret 与 BEpusdt 中的一致。
|
||||
- **检查网络连通性**:确认 EdgeKey 服务器能够正常访问 VUPAY API 地址。
|
||||
- **检查 App ID 和 App Secret**:确认所配置的 App ID 和 App Secret 与 VUPAY 中的一致。
|
||||
- **检查回调地址**:确保异步通知地址可以从外部访问,且格式正确。
|
||||
- **检查站点设置**:确保在「站点设置」中配置了正确的网站地址。
|
||||
- **查看日志**:检查 EdgeKey 和 BEpusdt 的应用日志,获取更详细的错误信息。
|
||||
- **查看日志**:检查 EdgeKey 和 VUPAY 的应用日志,获取更详细的错误信息。
|
||||
|
||||
## BEpusdt 工作模式
|
||||
## VUPAY 工作模式
|
||||
|
||||
本项目使用 **收银台模式**(`/api/v1/order/create-order`),用户在 BEpusdt 收银台页面自由选择支付链,无需在代码中指定 `trade_type`。
|
||||
本项目使用 **收银台模式**(`/api/v1/order/create-order`),用户在 VUPAY 收银台页面自由选择支付链,无需在代码中指定 `trade_type`。
|
||||
|
||||
## 相关链接
|
||||
|
||||
- [BEpusdt 项目主页](https://github.com/v03413/bepusdt)
|
||||
- [VUPAY 项目主页](https://git.viaeon.com/admin/vupay)
|
||||
- [EdgeKey 项目主页](https://github.com/34892002/edgeKey)
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
# BEpusdt 执行原理说明
|
||||
# VUPAY 执行原理说明
|
||||
|
||||
> 本文档基于源代码逐层拆解 BEpusdt 的核心运行机制,适合开发者对接或二次开发时参考。
|
||||
> 本文档基于源代码逐层拆解 VUPAY 的核心运行机制,适合开发者对接或二次开发时参考。
|
||||
|
||||
---
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
### 1.1 整体扫描架构
|
||||
|
||||
BEpusdt 的区块扫描采用 **全链路扫块 + 本地匹配** 的方式,而非对每个地址发起单独的查询请求。
|
||||
VUPAY 的区块扫描采用 **全链路扫块 + 本地匹配** 的方式,而非对每个地址发起单独的查询请求。
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
@@ -78,7 +78,7 @@ BEpusdt 的区块扫描采用 **全链路扫块 + 本地匹配** 的方式,而
|
||||
|
||||
市面上许多同类项目的做法是:对每个收款地址,定时调用 `getTransactionsByAddress` 之类的 API 来查询该地址的交易记录。
|
||||
|
||||
BEpusdt 采用 **全量扫块** 的策略,具体区别如下:
|
||||
VUPAY 采用 **全量扫块** 的策略,具体区别如下:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
@@ -94,7 +94,7 @@ BEpusdt 采用 **全量扫块** 的策略,具体区别如下:
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ BEpusdt「全量扫块」模式 │
|
||||
│ VUPAY「全量扫块」模式 │
|
||||
│ │
|
||||
│ 区块 #N ──→ getBlock(N) ──→ API 调用 ×1 │
|
||||
│ │ │
|
||||
@@ -107,7 +107,7 @@ BEpusdt 采用 **全量扫块** 的策略,具体区别如下:
|
||||
|
||||
**核心优势:**
|
||||
|
||||
| 维度 | 单地址轮询 | 全量扫块 (BEpusdt) |
|
||||
| 维度 | 单地址轮询 | 全量扫块 (VUPAY) |
|
||||
|----------|------------------|-------------------|
|
||||
| API 调用量 | 与地址数线性增长 | **固定**,与地址数无关 |
|
||||
| RPC 节点压力 | 高(易触发限流) | **低**,易满足免费节点限额 |
|
||||
@@ -304,7 +304,7 @@ key := t.Address + string(t.TradeType)
|
||||
**触发条件:** 创建订单时不传 `amount` 字段(或传 `0`)。
|
||||
|
||||
```go
|
||||
// app/handler/epusdt/epusdt.go · CreateTransaction()
|
||||
// app/handler/vupay/vupay.go · CreateTransaction()
|
||||
AddressLocked: req.Amount == 0, // 金额为0 → 独占模式
|
||||
|
||||
// app/model/trade.go · BuildOrder()
|
||||
@@ -387,7 +387,7 @@ o.Money = rate.Mul(amount).String() // 折算法币金额
|
||||
|
||||
### 4.1 汇率来源
|
||||
|
||||
BEpusdt 通过 **CoinGecko API** 定期同步加密货币对多种法币(CNY / USD / JPY / EUR / GBP)的实时汇率。
|
||||
VUPAY 通过 **CoinGecko API** 定期同步加密货币对多种法币(CNY / USD / JPY / EUR / GBP)的实时汇率。
|
||||
|
||||
```
|
||||
定时任务(默认间隔 3600 秒)
|
||||
@@ -398,7 +398,7 @@ GET https://api.coingecko.com/api/v3/simple/price
|
||||
&vs_currencies=cny,usd,jpy,eur,gbp
|
||||
│
|
||||
▼
|
||||
写入数据库 bep_rate 表
|
||||
写入数据库 vupay_rate 表
|
||||
(含 raw_rate 原始汇率 + syntax 浮动语法 + 最终 rate)
|
||||
```
|
||||
|
||||
@@ -448,7 +448,7 @@ CoinGecko 当前 USDT/CNY = 7.2456
|
||||
```
|
||||
创建订单
|
||||
│
|
||||
├─ 从 bep_rate 获取最新汇率(含浮动计算)
|
||||
├─ 从 vupay_rate 获取最新汇率(含浮动计算)
|
||||
│
|
||||
├─ 法币金额 ÷ 汇率 = 加密货币金额(按精度取整)
|
||||
│
|
||||
@@ -476,7 +476,7 @@ CoinGecko 当前 USDT/CNY = 7.2456
|
||||
API 支持通过 `rate` 参数**强制指定本次订单汇率**,此时将忽略数据库中的汇率记录:
|
||||
|
||||
```json
|
||||
POST /api/v1/epusdt/create
|
||||
POST /api/v1/vupay/create
|
||||
{
|
||||
"order_id": "xxx",
|
||||
"amount": 100.0,
|
||||
@@ -505,5 +505,5 @@ POST /api/v1/epusdt/create
|
||||
|
||||
---
|
||||
|
||||
*文档生成时间:2026-04-14 · 基于 BEpusdt 源码分析*
|
||||
*文档生成时间:2026-04-14 · 基于 VUPAY 源码分析*
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 萌次元商城系统对接教程
|
||||
|
||||
原本以为萌次元会和异次元一样适配至少`epusdt`一个插件,哪怕根本用不了;应用商店倒是存在一个`TRC20-USDT`收费插件。
|
||||
说回正题,萌次元并没对`epusdt`适配,但不影响,`Bepusdt`兼容易支付接口,同样可以顺利接入。
|
||||
原本以为萌次元会和异次元一样适配至少`vupay`一个插件,哪怕根本用不了;应用商店倒是存在一个`TRC20-USDT`收费插件。
|
||||
说回正题,萌次元并没对`vupay`适配,但不影响,`VUPAY`兼容易支付接口,同样可以顺利接入。
|
||||
|
||||
## 对接教程
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
### 2.支付配置
|
||||
|
||||
点击添加配置,配置自己的`Bepusdt`信息,参考如下:
|
||||
点击添加配置,配置自己的`VUPAY`信息,参考如下:
|
||||
|
||||

|
||||
|
||||
### 3.增加支付通道
|
||||
|
||||
原版易支付不支持`usdt`和`trx`
|
||||
,需有对原版代码进行替换;请把这个文件[Pay.php](https://raw.githubusercontent.com/v03413/bepusdt/refs/heads/main/docs/mcy-shop/Pay.php)
|
||||
,需有对原版代码进行替换;请把这个文件[Pay.php](https://raw.githubusercontent.com/admin/vupay/refs/heads/main/docs/mcy-shop/Pay.php)
|
||||
下载下来,替换到你的网站路径`/app/Plugin/Epay/Config`下的同名文件。
|
||||
|
||||

|
||||
|
||||
+22
-22
@@ -6,7 +6,7 @@
|
||||
|
||||
## 概述
|
||||
|
||||
BEpusdt 内置了 MQTT 发布能力,每当区块扫描器捕获到一笔**金额合法**的链上转账时,系统会立即将该交易信息以 JSON 格式发布到对应的
|
||||
VUPAY 内置了 MQTT 发布能力,每当区块扫描器捕获到一笔**金额合法**的链上转账时,系统会立即将该交易信息以 JSON 格式发布到对应的
|
||||
MQTT Topic。
|
||||
|
||||
外部系统(如监控大屏、自动充值系统、风控系统等)只需连接同一 MQTT Broker 并订阅对应 Topic,即可**实时、被动地**获取链上交易数据,无需轮询
|
||||
@@ -16,7 +16,7 @@ API。
|
||||
区块链网络
|
||||
│
|
||||
▼
|
||||
BEpusdt(扫块)
|
||||
VUPAY(扫块)
|
||||
│ 检测到合法转账
|
||||
▼
|
||||
MQTT Broker(广播)
|
||||
@@ -30,7 +30,7 @@ MQTT Broker(广播)
|
||||
|
||||
## 一、后台配置
|
||||
|
||||
在 BEpusdt 后台 → **系统管理 → 基本设置 → MQTT 设置** 中填写以下参数:
|
||||
在 VUPAY 后台 → **系统管理 → 基本设置 → MQTT 设置** 中填写以下参数:
|
||||
|
||||
| 配置项 | 说明 | 示例 |
|
||||
|-----------|--------------------------------------------|---------------------|
|
||||
@@ -43,7 +43,7 @@ MQTT Broker(广播)
|
||||
|
||||
> ⚠️ **注意**:系统当前仅支持 `tcp://` 连接协议,不支持 WebSocket(`ws://`)或 TLS(`ssl://`)。
|
||||
>
|
||||
> 客户端 ID 由系统自动生成,格式为 `BEpusdt {进程PID}`,每次启动可能不同,请勿依赖客户端 ID 做业务判断。
|
||||
> 客户端 ID 由系统自动生成,格式为 `VUPAY {进程PID}`,每次启动可能不同,请勿依赖客户端 ID 做业务判断。
|
||||
|
||||
---
|
||||
|
||||
@@ -52,36 +52,36 @@ MQTT Broker(广播)
|
||||
系统按**区块链网络**维度发布消息,Topic 格式如下:
|
||||
|
||||
```
|
||||
bepusdt/transfer/{network}
|
||||
vupay/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 | `vupay/transfer/tron` | USDT (TRC20)、USDC (TRC20)、TRX |
|
||||
| Ethereum | `vupay/transfer/ethereum` | USDT (ERC20)、USDC (ERC20)、ETH |
|
||||
| BSC | `vupay/transfer/bsc` | USDT (BEP20)、USDC (BEP20)、BNB |
|
||||
| Polygon | `vupay/transfer/polygon` | USDT、USDC |
|
||||
| Arbitrum | `vupay/transfer/arbitrum` | USDT、USDC |
|
||||
| Base | `vupay/transfer/base` | USDC |
|
||||
| Solana | `vupay/transfer/solana` | USDT、USDC |
|
||||
| Aptos | `vupay/transfer/aptos` | USDT、USDC |
|
||||
| X Layer | `vupay/transfer/xlayer` | USDT、USDC |
|
||||
| Plasma | `vupay/transfer/plasma` | USDT |
|
||||
|
||||
### 订阅示例
|
||||
|
||||
```
|
||||
# 仅订阅 Tron 网络
|
||||
bepusdt/transfer/tron
|
||||
vupay/transfer/tron
|
||||
|
||||
# 同时订阅 BSC 和 Polygon(分两次 Subscribe)
|
||||
bepusdt/transfer/bsc
|
||||
bepusdt/transfer/polygon
|
||||
vupay/transfer/bsc
|
||||
vupay/transfer/polygon
|
||||
|
||||
# 使用通配符订阅所有网络(MQTT v3.1.1)
|
||||
bepusdt/transfer/#
|
||||
vupay/transfer/#
|
||||
```
|
||||
|
||||
---
|
||||
@@ -137,7 +137,7 @@ MQTT 消息在**扫块阶段**触发,此时交易已出现在区块链上,
|
||||
|
||||
### 网络断线重连
|
||||
|
||||
BEpusdt 的 MQTT 客户端已启用自动重连,断线后会自动恢复并重新订阅所有 Topic。订阅方同样建议使用支持自动重连的 MQTT 客户端库。
|
||||
VUPAY 的 MQTT 客户端已启用自动重连,断线后会自动恢复并重新订阅所有 Topic。订阅方同样建议使用支持自动重连的 MQTT 客户端库。
|
||||
|
||||
### QoS 建议
|
||||
|
||||
@@ -161,7 +161,7 @@ BEpusdt 的 MQTT 客户端已启用自动重连,断线后会自动恢复并重
|
||||
|
||||
**Q:没有活跃订单时为什么收不到消息?**
|
||||
|
||||
> 默认情况下,BEpusdt 仅在有待支付订单时才对对应网络扫块。需在后台**「持续监控网络」**中填入目标网络标识(如 `tron,bsc`
|
||||
> 默认情况下,VUPAY 仅在有待支付订单时才对对应网络扫块。需在后台**「持续监控网络」**中填入目标网络标识(如 `tron,bsc`
|
||||
> ),才能保证无订单时也持续推送。
|
||||
|
||||
**Q:支持 WebSocket 或 TLS 连接吗?**
|
||||
@@ -179,4 +179,4 @@ BEpusdt 的 MQTT 客户端已启用自动重连,断线后会自动恢复并重
|
||||
- [交易类型完整列表](../trade-type.md)
|
||||
- [API 对接文档](./api.md)
|
||||
- [订单回调通知](../notify/readme.md)
|
||||
- [BEpusdt GitHub](https://github.com/v03413/BEpusdt)
|
||||
- [VUPAY GitHub](https://git.viaeon.com/admin/vupay)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user