Docker Build (Gitea) / Build and Push Docker Image (push) Successful in 47s
展示层与标识符全量改名: - 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 归零
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package task
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"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() {
|
|
Register(Task{Duration: time.Second * 3, Callback: notifyRetry})
|
|
Register(Task{Duration: time.Second * 30, Callback: notifyRoll})
|
|
}
|
|
|
|
// notifyRetry 回调失败重试
|
|
func notifyRetry(context.Context) {
|
|
tradeOrders, err := model.GetNotifyFailedTradeOrders()
|
|
if err != nil {
|
|
log.Task.Error("待回调订单获取失败", err)
|
|
|
|
return
|
|
}
|
|
|
|
for _, order := range tradeOrders {
|
|
next := utils.CalcNextNotifyTime(*order.ConfirmedAt, order.NotifyNum)
|
|
if time.Now().Unix() >= next.Unix() {
|
|
go notify.Handle(order)
|
|
}
|
|
}
|
|
}
|
|
|
|
func notifyRoll(context.Context) {
|
|
for _, o := range model.GetOrderByStatus(model.OrderStatusWaiting) {
|
|
notify.Vupay(o)
|
|
}
|
|
}
|
|
|
|
// notifyOrderSuccess 统一触发订单成功后的回调与订单通知。
|
|
func notifyOrderSuccess(order model.Order) {
|
|
go notify.Handle(order)
|
|
go notifier.Success(order)
|
|
}
|