优化表结构,重构模型,重新实现基于白银网关的提取节点流程
This commit is contained in:
@@ -2,14 +2,20 @@ package events
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/hibiken/asynq"
|
||||
"log/slog"
|
||||
|
||||
"github.com/hibiken/asynq"
|
||||
)
|
||||
|
||||
const RemoveChannel = "channel:remove"
|
||||
|
||||
func NewRemoveChannel(ids []int32) *asynq.Task {
|
||||
bytes, err := json.Marshal(ids)
|
||||
type RemoveChannelData struct {
|
||||
Batch string `json:"batch"`
|
||||
IDs []int32 `json:"ids"`
|
||||
}
|
||||
|
||||
func NewRemoveChannel(data RemoveChannelData) *asynq.Task {
|
||||
bytes, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
slog.Error("序列化删除通道任务失败", "error", err)
|
||||
return nil
|
||||
|
||||
9
web/events/proxy.go
Normal file
9
web/events/proxy.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package events
|
||||
|
||||
import "github.com/hibiken/asynq"
|
||||
|
||||
const FlushGateway = "gateway:flush"
|
||||
|
||||
func NewFlushGateway() *asynq.Task {
|
||||
return asynq.NewTask(FlushGateway, nil)
|
||||
}
|
||||
@@ -3,7 +3,8 @@ package events
|
||||
import (
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
trade2 "platform/web/domains/trade"
|
||||
|
||||
m "platform/web/models"
|
||||
|
||||
"github.com/hibiken/asynq"
|
||||
)
|
||||
@@ -12,7 +13,7 @@ const CancelTrade = "trade:update"
|
||||
|
||||
type CancelTradeData struct {
|
||||
TradeNo string `json:"trade_no" validate:"required"`
|
||||
Method trade2.Method `json:"method" validate:"required"`
|
||||
Method m.TradeMethod `json:"method" validate:"required"`
|
||||
}
|
||||
|
||||
func NewCancelTrade(data CancelTradeData) *asynq.Task {
|
||||
|
||||
Reference in New Issue
Block a user