Browse Source

统计流量暂时取消

maxiaoshan 3 years ago
parent
commit
7438f13309
3 changed files with 9 additions and 9 deletions
  1. 1 1
      src/main.go
  2. 6 6
      src/spider/download.go
  3. 2 2
      src/spider/spider.go

+ 1 - 1
src/main.go

@@ -104,7 +104,7 @@ func initConfig(addr, alias, db string, dbsize int) {
 //
 func main() {
 	//定时上传流量信息
-	go spider.TimeTask()
+	//go spider.TimeTask()
 	//定时清理日志
 	go clearLogs()
 	//初始化爬虫服务

+ 6 - 6
src/spider/download.go

@@ -61,8 +61,8 @@ func Download(retLen *int64, downloaderid, url, method string, head map[string]i
 			return ""
 		}
 	}
-	retLenTmp := int64(len(ret))
-	*retLen = retLenTmp
+	//retLenTmp := int64(len(ret))
+	//*retLen = retLenTmp
 	if err != nil {
 		str := code + "方法DownloadAdv,url:" + url + ",err:" + err.Error()
 		logger.Error(str, timeout)
@@ -122,8 +122,8 @@ func DownloadAdv(retLen *int64, downloaderid, url, method string, reqparam, head
 			return "", nil, nil
 		}
 	}
-	retLenTmp := int64(len(ret))
-	retLen = &retLenTmp
+	//retLenTmp := int64(len(ret))
+	//*retLen = retLenTmp
 	if err != nil {
 		str := code + "方法DownloadAdv,url:" + url + ",err:" + err.Error()
 		logger.Error(str, timeout)
@@ -236,8 +236,8 @@ func DownloadFile(retLen *int64, downloaderid, url, method string, reqparam, hea
 			return nil
 		}
 	}
-	retLenTmp := int64(len(ret))
-	retLen = &retLenTmp
+	//retLenTmp := int64(len(ret))
+	//*retLen = retLenTmp
 	if err != nil {
 		str := code + "方法DownloadFile,url:" + url + ",err:" + err.Error()
 		logger.Error(str, timeout)

+ 2 - 2
src/spider/spider.go

@@ -916,7 +916,7 @@ func (s *Spider) DownloadHighDetail() {
 					}
 
 					if !success { //下载失败更新次数和状态
-						ss := map[string]interface{}{"times": times}
+						ss := map[string]interface{}{"times": times, "updatetime": time.Now().Unix()}
 						if times >= 3 { //3次下载失败今天不再下载,state置为1
 							ss["state"] = -1
 						}
@@ -1064,7 +1064,7 @@ func (s *Spider) DownloadListDetail() {
 				}
 			}
 			if !success { //下载失败更新次数和状态
-				ss := map[string]interface{}{"times": times}
+				ss := map[string]interface{}{"times": times, "updatetime": time.Now().Unix()}
 				if times >= 3 { //3次下载失败今天不再下载,state置为1
 					ss["state"] = -1
 				}