Jelajahi Sumber

Merge branch 'master' of http://git.daboryhost.com:10880/dabory/kkscrap-go

hakjinlee 1 tahun lalu
induk
melakukan
fbb2ef1168
1 mengubah file dengan 6 tambahan dan 5 penghapusan
  1. 6 5
      controllers/scraper/tct-main.go

+ 6 - 5
controllers/scraper/tct-main.go

@@ -2,7 +2,6 @@ package controllers_scraper
 
 import (
 	"encoding/json"
-	"fmt"
 	"kkscrap-go/controllers/scraper/cafe24"
 	"kkscrap-go/controllers/scraper/godo"
 	"kkscrap-go/controllers/scraper/magento"
@@ -17,6 +16,8 @@ import (
 	"regexp"
 	"strings"
 
+	e "github.com/dabory/abango-rest/etc"
+
 	// "golang.org/x/crypto/bcrypt"
 
 	"github.com/labstack/echo"
@@ -37,10 +38,10 @@ func SolutionTypeGet(c echo.Context) error {
 
 	body, err := util.Get(v.Url)
 	if err != nil {
-		return err
+		return c.JSON(404, err.Error())
 	}
 
-	fmt.Println(v.Url)
+	// fmt.Println(v.Url)
 	st, theme, err := getSolutionType(body)
 	if err != nil {
 		return c.JSONBlob(http.StatusOK, []byte(err.Error()))
@@ -72,7 +73,7 @@ func ProductPageGet(c echo.Context) error {
 
 		body, err := util.Get(p.Uri)
 		if err != nil {
-			return err
+			e.ErrLog(e.FuncRun("03uoaiuor0", e.CurrFuncName()), err)
 		}
 
 		// 전체 웹사이트가 아니라 개별 상품페이지(1개페이지)의 경우 SolutionType 없이 request됨
@@ -80,7 +81,7 @@ func ProductPageGet(c echo.Context) error {
 			var err error
 			v.SolutionType, v.ThemeType, err = getSolutionType(body)
 			if err != nil {
-				return c.String(http.StatusBadRequest, err.Error())
+				return c.String(705, "Solution Type Not Found:"+err.Error())
 			}
 		}