fix(config): 更新配置文件和代理日志输出优化
- 修改数据库密码和 Redis 连接信息为新的配置 - 更新配置模型中 Redis 默认主机和密码 - 优化获取代理时日志记录,添加成功日志和失败错误日志 - 测试用例中使用 resty 检测代理有效性,替换 sleep 暂停方式
This commit is contained in:
@@ -23,14 +23,14 @@ maxdays=10
|
||||
dbhost = 127.0.0.1
|
||||
dbport = 3306
|
||||
dbuser = root
|
||||
dbpasswd = Woaizixkie!123
|
||||
dbpasswd = mysql123
|
||||
dbbase = kami
|
||||
debug = true
|
||||
|
||||
[redis]
|
||||
host = 127.0.0.1:6379
|
||||
host = 127.0.0.1:30567
|
||||
db = 0
|
||||
password = ""
|
||||
password = redis123
|
||||
|
||||
[mq]
|
||||
host = 127.0.0.1
|
||||
|
||||
@@ -127,8 +127,8 @@ type RedisConfig struct {
|
||||
|
||||
func (c *Config) GetRedisConfig() RedisConfig {
|
||||
return RedisConfig{
|
||||
Host: web.AppConfig.DefaultString("redis::host", "127.0.0.1:6379"),
|
||||
Password: web.AppConfig.DefaultString("redis::password", "123456"),
|
||||
Host: web.AppConfig.DefaultString("redis::host", "127.0.0.1:30567"),
|
||||
Password: web.AppConfig.DefaultString("redis::password", "redis123"),
|
||||
DB: web.AppConfig.DefaultInt("redis::db", 0),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,10 @@ func (s *SendCardTaskTypeFlyFishV2) HandleSendCardTask(ctx context.Context, orde
|
||||
SetHeader("referer", "https://apify.fkpay.online/show.html?orderId=FY17568845864231914279").
|
||||
SetTimeout(time.Second * 10).OnBeforeRequest(func(client *resty.Client, request *resty.Request) error {
|
||||
proxy, err2 := utils.GetProxy(ctx, utils.GenerateId(), "SendCardTaskTypeFlyFishV2_cardTask")
|
||||
otelTrace.Logger.WithContext(ctx).Info("获取代理", zap.String("proxy", proxy))
|
||||
if err2 != nil {
|
||||
otelTrace.Logger.WithContext(ctx).Error("获取代理失败", zap.Error(err2))
|
||||
}
|
||||
if proxy != "" {
|
||||
client.SetProxy(proxy)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package utils
|
||||
|
||||
import (
|
||||
"gateway/internal/cache"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGetProxy(t *testing.T) {
|
||||
@@ -12,7 +12,7 @@ func TestGetProxy(t *testing.T) {
|
||||
channel := []string{"channel_four", "channel_five", "channel_six"}
|
||||
for _, c := range channel {
|
||||
proxy, _ := GetProxy(t.Context(), "2434534543", c)
|
||||
t.Log(proxy, channel)
|
||||
time.Sleep(time.Second * 70)
|
||||
resp, err := resty.New().SetProxy(proxy).R().Get("https://www.qq.com")
|
||||
t.Log(resp.StatusCode(), err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user