diff --git a/server/ats-tracer.go b/server/ats-tracer.go index 80e7139..9fdf7d7 100644 --- a/server/ats-tracer.go +++ b/server/ats-tracer.go @@ -39,6 +39,7 @@ func (s *AtsTracerSvc) AddAtsTracer(ctx fiber.Ctx) (err error) { return err } skuID = strings.ReplaceAll(skuID, " ", "-") + skuID = strings.ReplaceAll(skuID, "+", "-") if err = s.ctl.Add(skuID); err != nil { return } @@ -54,6 +55,7 @@ func (s *AtsTracerSvc) DelAtsTracer(ctx fiber.Ctx) (err error) { return err } skuID = strings.ReplaceAll(skuID, " ", "-") + skuID = strings.ReplaceAll(skuID, "+", "-") if err = s.ctl.Delete(skuID); err != nil { return } @@ -70,6 +72,7 @@ func (s *AtsTracerSvc) StopAtsTracer(ctx fiber.Ctx) (err error) { return err } skuID = strings.ReplaceAll(skuID, " ", "-") + skuID = strings.ReplaceAll(skuID, "+", "-") if err = s.ctl.Stop(skuID); err != nil { return } diff --git a/server/spider.go b/server/spider.go index 0a30231..810da81 100644 --- a/server/spider.go +++ b/server/spider.go @@ -4,6 +4,7 @@ import ( "fmt" "net/url" "strconv" + "strings" "gitea.timerzz.com/kedaya_haitao/coach-spider/spider" "gitea.timerzz.com/kedaya_haitao/common/pkg/web" @@ -55,6 +56,8 @@ func (s *SpiderSvc) FetchArticleDetail(ctx fiber.Ctx) error { if err != nil { return err } + pid = strings.ReplaceAll(pid, " ", "-") + pid = strings.ReplaceAll(pid, "+", "-") if err = s.ctl.FetchArticleDetail(ctx.Context(), pid); err != nil { return err } @@ -66,6 +69,8 @@ func (s *SpiderSvc) FetchArticleAts(ctx fiber.Ctx) error { if err != nil { return err } + pid = strings.ReplaceAll(pid, " ", "-") + pid = strings.ReplaceAll(pid, "+", "-") if err = s.ctl.FetchArticleAts(ctx.Context(), pid); err != nil { return err } @@ -77,6 +82,8 @@ func (s *SpiderSvc) GetArticleAts(ctx fiber.Ctx) error { if err != nil { return err } + pid = strings.ReplaceAll(pid, " ", "-") + pid = strings.ReplaceAll(pid, "+", "-") ats, err := s.ctl.GetArticleAts(ctx.Context(), pid) if err != nil { return err diff --git a/server/watcher.go b/server/watcher.go index fcc037a..121a1ab 100644 --- a/server/watcher.go +++ b/server/watcher.go @@ -39,6 +39,7 @@ func (s *WatcherSvc) AddWatcher(ctx fiber.Ctx) (err error) { return err } skuID = strings.ReplaceAll(skuID, " ", "-") + skuID = strings.ReplaceAll(skuID, "+", "-") if err = s.ctl.Add(skuID); err != nil { return } @@ -54,6 +55,7 @@ func (s *WatcherSvc) DelWatcher(ctx fiber.Ctx) (err error) { return err } skuID = strings.ReplaceAll(skuID, " ", "-") + skuID = strings.ReplaceAll(skuID, "+", "-") if err = s.ctl.Delete(skuID); err != nil { return } @@ -70,6 +72,7 @@ func (s *WatcherSvc) StopWatcher(ctx fiber.Ctx) (err error) { return err } skuID = strings.ReplaceAll(skuID, " ", "-") + skuID = strings.ReplaceAll(skuID, "+", "-") if err = s.ctl.Stop(skuID); err != nil { return }