Files
admin a950fd2ead
Docker Build (Gitea) / Build and Push Docker Image (push) Successful in 47s
rebrand: BEpusdt → VUPAY
展示层与标识符全量改名:
- module github.com/v03413/bepusdt → git.viaeon.com/admin/vupay(含全部 import)
- 二进制/镜像/容器/DB 名 bepusdt → vupay(Dockerfile、workflow IMAGE、compose、docs)
- 显示名 BEpusdt → VUPAY(前端 title、后端 banner、version 命令、通知文案)
- 默认路径 /var/lib/bepusdt → /var/lib/vupay,/var/log/bepusdt → /var/log/vupay
- Telegram 通知的频道按钮原来指向上游 t.me 群,改成站点链接(否则改名后是死链)

刻意保留(运行语义,改了会坏):
- api_type 取值 "epusdt" / "epusdt_order"(库里存量数据按此匹配)
- 表前缀 bep_(bep_order / bep_conf / …,改需 RENAME TABLE 迁移)
- 签名函数 EpusdtSign 与 handler 包名 epusdt(对外协议语义,非品牌)
- 所有加密/会话派生的字面量原样不动

验证:gofmt 通过、go build ./... 通过、全仓 grep -i bepusdt 归零
2026-11-25 09:06:06 +08:00

57 lines
1.0 KiB
Go

package core
import (
"errors"
"fmt"
"io"
"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"
)
type Api struct {
api string
}
func New() Api {
return Api{
api: conf.Api,
}
}
func (Api) get(url string) ([]byte, error) {
client := &http.Client{Timeout: 5 * time.Second}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, fmt.Errorf("创建请求失败: %w", err)
}
req.Header.Set("User-Agent", fmt.Sprintf("VUPAY/%s", app.Version))
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("请求失败: %w", err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("读取响应失败: %w", err)
}
if resp.StatusCode != http.StatusOK {
return nil, errors.New(gjson.GetBytes(body, "error").String())
}
return body, nil
}
func (Api) error(err error) {
log.Warn("Api Error:", err.Error())
}