feat sku + => -
All checks were successful
Build image / build (push) Successful in 6m11s

This commit is contained in:
timerzz 2024-12-03 09:24:20 +08:00
parent 87eafce24b
commit 22c1cb4382
3 changed files with 13 additions and 0 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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
}