2025-05-13 15:44:44 +08:00
|
|
|
package jobs
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"go-admin/config"
|
2025-05-15 18:39:19 +08:00
|
|
|
helper "go-admin/utils/redishelper"
|
2025-05-13 15:44:44 +08:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/go-admin-team/go-admin-core/sdk"
|
|
|
|
|
"gorm.io/driver/mysql"
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestTransferJob(t *testing.T) {
|
|
|
|
|
dsn := "root:123456@tcp(127.0.0.1:3306)/eth_transfer?charset=utf8mb4&parseTime=True&loc=Local&timeout=1000ms"
|
|
|
|
|
db, _ := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
|
|
|
|
sdk.Runtime.SetDb("default", db)
|
|
|
|
|
|
|
|
|
|
config.ExtConfig.ApiEndpoint = "https://stylish-cool-fire.ethereum-sepolia.quiknode.pro/17572db4c091accfa5dc6faa0c60a805e5173459"
|
|
|
|
|
config.ExtConfig.ProxyUrl = "http://127.0.0.1:7890"
|
|
|
|
|
|
2025-05-15 18:39:19 +08:00
|
|
|
helper.InitDefaultRedis("http://127.0.0.1:6379", "", 15) // 初始化配置
|
|
|
|
|
|
2025-05-13 15:44:44 +08:00
|
|
|
job := TransferJob{}
|
|
|
|
|
|
|
|
|
|
job.Exec(nil)
|
|
|
|
|
}
|
2025-05-15 18:39:19 +08:00
|
|
|
|
|
|
|
|
// 测试状态任务
|
|
|
|
|
func TestTransferStatusJob(t *testing.T) {
|
|
|
|
|
dsn := "root:123456@tcp(127.0.0.1:3306)/eth_transfer?charset=utf8mb4&parseTime=True&loc=Local&timeout=1000ms"
|
|
|
|
|
db, _ := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
|
|
|
|
sdk.Runtime.SetDb("default", db)
|
|
|
|
|
|
|
|
|
|
config.ExtConfig.ApiEndpoint = "https://stylish-cool-fire.ethereum-sepolia.quiknode.pro/17572db4c091accfa5dc6faa0c60a805e5173459"
|
|
|
|
|
config.ExtConfig.ProxyUrl = "http://127.0.0.1:7890"
|
|
|
|
|
|
|
|
|
|
job := TransferStatusJob{}
|
|
|
|
|
|
|
|
|
|
job.Exec(nil)
|
|
|
|
|
}
|