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