This commit is contained in:
parent
a4e217d17a
commit
3b321f099d
@ -2,6 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gitea.timerzz.com/kedaya_haitao/coach-spider/spider"
|
"gitea.timerzz.com/kedaya_haitao/coach-spider/spider"
|
||||||
@ -50,31 +51,31 @@ func (s *SpiderSvc) FetchArticlePrice(ctx fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SpiderSvc) FetchArticleDetail(ctx fiber.Ctx) error {
|
func (s *SpiderSvc) FetchArticleDetail(ctx fiber.Ctx) error {
|
||||||
pid := ctx.Params("pid")
|
pid, err := url.QueryUnescape(ctx.Params("pid"))
|
||||||
if pid == "" {
|
if err != nil {
|
||||||
return fmt.Errorf("pid is empty")
|
return err
|
||||||
}
|
}
|
||||||
if err := s.ctl.FetchArticleDetail(ctx.Context(), pid); err != nil {
|
if err = s.ctl.FetchArticleDetail(ctx.Context(), pid); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ctx.JSON(web.NewResponse("ok"))
|
return ctx.JSON(web.NewResponse("ok"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SpiderSvc) FetchArticleAts(ctx fiber.Ctx) error {
|
func (s *SpiderSvc) FetchArticleAts(ctx fiber.Ctx) error {
|
||||||
pid := ctx.Params("pid")
|
pid, err := url.QueryUnescape(ctx.Params("pid"))
|
||||||
if pid == "" {
|
if err != nil {
|
||||||
return fmt.Errorf("pid is empty")
|
return err
|
||||||
}
|
}
|
||||||
if err := s.ctl.FetchArticleAts(ctx.Context(), pid); err != nil {
|
if err = s.ctl.FetchArticleAts(ctx.Context(), pid); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ctx.JSON(web.NewResponse("ok"))
|
return ctx.JSON(web.NewResponse("ok"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SpiderSvc) GetArticleAts(ctx fiber.Ctx) error {
|
func (s *SpiderSvc) GetArticleAts(ctx fiber.Ctx) error {
|
||||||
pid := ctx.Params("pid")
|
pid, err := url.QueryUnescape(ctx.Params("pid"))
|
||||||
if pid == "" {
|
if err != nil {
|
||||||
return fmt.Errorf("pid is empty")
|
return err
|
||||||
}
|
}
|
||||||
ats, err := s.ctl.GetArticleAts(ctx.Context(), pid)
|
ats, err := s.ctl.GetArticleAts(ctx.Context(), pid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user