Преглед изворни кода

针对迅雷偶尔查询接口报错,进行故障详细回复的记录,添加到维护人员监控通知中

Signed-off-by: allan716 <[email protected]>
allan716 пре 4 година
родитељ
комит
c46c76ab67
1 измењених фајлова са 7 додато и 2 уклоњено
  1. 7 2
      internal/logic/sub_supplier/xunlei/xunlei.go

+ 7 - 2
internal/logic/sub_supplier/xunlei/xunlei.go

@@ -7,6 +7,7 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/series"
@@ -67,10 +68,14 @@ func (s Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, error
 		return outSubList, common.XunLeiCIdIsEmpty
 	}
 	httpClient := pkg.NewHttpClient(s.reqParam)
-	_, err = httpClient.R().
+	resp, err := httpClient.R().
 		SetResult(&jsonList).
 		Get(fmt.Sprintf(common.SubXunLeiRootUrl, cid))
 	if err != nil {
+		if resp != nil {
+			s.log.Errorln("xunlei NewHttpClient:", resp.String())
+			notify_center.Notify.Add("xunlei NewHttpClient", fmt.Sprintf("resp: %s, error: %s", resp.String(), err.Error()))
+		}
 		return outSubList, err
 	}
 	// 剔除空的
@@ -103,7 +108,7 @@ func (s Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, error
 		tmpLang := language.LangConverter(v.Language)
 		data, filename, err := pkg.DownFile(v.Surl)
 		if err != nil {
-			s.log.Error(err)
+			s.log.Errorln("xunlei pkg.DownFile:", err)
 			continue
 		}
 		ext := ""