hongze 3 年之前
父節點
當前提交
895f9bf647
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 5 4
      services/data_source_longzhong.go
  2. 1 2
      services/task.go

+ 5 - 4
services/data_source_longzhong.go

@@ -219,9 +219,10 @@ func GetLzProductList() (err error) {
 }
 
 func GetLzProductDetail() (err error) {
-	utils.FileLog.Info("start GetLzProductDetail")
+	utils.LzFileLog.Info("start GetLzProductDetail")
 	defer func() {
 		if err != nil {
+			utils.LzFileLog.Info("Err:"+err.Error())
 			fmt.Println("Err:" + err.Error())
 		}
 	}()
@@ -248,6 +249,7 @@ func GetLzProductDetail() (err error) {
 			}
 
 			fmt.Println("page:", i, totalPage)
+			utils.LzFileLog.Info("Page:%s",strconv.Itoa(i))
 			timestamp := fmt.Sprintf("%d", time.Now().Unix())
 			token := utils.MD5(username + timestamp + utils.MD5(password))
 
@@ -264,15 +266,14 @@ func GetLzProductDetail() (err error) {
 			utils.LzFileLog.Info("GetLzProductDetail Param: %s", param.Encode())
 			body, err := http.Post(postUrl, param.Encode())
 			if err != nil {
-				fmt.Println("err:", err.Error())
+				utils.LzFileLog.Info("Post Err:%s",err.Error())
 				return err
 			}
-			fmt.Println(string(body))
 			utils.LzFileLog.Info("GetLzProductDetail Result: %s",string(body))
 			resp := new(models.LzProductInfoDetailResp)
 			err = json.Unmarshal(body, &resp)
 			if err != nil {
-				fmt.Println("Unmarshal Err:" + err.Error())
+				utils.LzFileLog.Info("Unmarshal Err:%s",err.Error())
 				return err
 			}
 			if resp.Code != "1" {

+ 1 - 2
services/task.go

@@ -49,8 +49,7 @@ func Task() {
 	//GetLzProductDetail()
 	//LzExportExcel()
 	//GetLzProductList()GetLzProductDetail
-
-	GetLzProductDetail()
+	go GetLzProductDetail()
 	fmt.Println("task end")
 }