瀏覽代碼

Merge branch 'dev3.4' of http://192.168.3.207:10080/qmx/jy-data-extract into dev3.4

apple 5 年之前
父節點
當前提交
3b4ab157c0
共有 1 個文件被更改,包括 24 次插入10 次删除
  1. 24 10
      udpcreateindex/src/bidingpurchasing.go

+ 24 - 10
udpcreateindex/src/bidingpurchasing.go

@@ -42,8 +42,19 @@ func biddingPurchaingTask(q map[string]interface{}) {
 			continue
 		}
 		newTmp := map[string]interface{}{} //最终生索引的数据
+		saveArr := []map[string]interface{}{}
 		//oss拼装filetext
 		if filetext := getFileText(tmp); len(filetext) > 0 {
+			if site, _ := tmp["site"].(string); site == "中国招标投标公共服务平台" { //site:中国招标投标公共服务平台 detail替换成filetext 并加入标记filedetail=1
+				tmp["detail"] = filetext
+				saveArr = append(saveArr, map[string]interface{}{"_id": tmp["_id"]})
+				saveArr = append(saveArr, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"filedetail": 1,
+						"detail":     filetext,
+					},
+				})
+			}
 			newTmp["filetext"] = filetext
 		}
 		//purchasing
@@ -128,16 +139,19 @@ func biddingPurchaingTask(q map[string]interface{}) {
 			}
 		}
 		arrEs = append(arrEs, newTmp)
-		arrMgo = append(arrMgo, []map[string]interface{}{ //要更新数据
-			map[string]interface{}{
-				"_id": tmp["_id"],
-			},
-			map[string]interface{}{
-				"$set": map[string]interface{}{
-					"extract_state": 4,
-				},
-			},
-		})
+		if len(saveArr) > 0 {
+			arrMgo = append(arrMgo, saveArr) //要更新数据
+		}
+		// arrMgo = append(arrMgo, []map[string]interface{}{ //要更新数据
+		// 	map[string]interface{}{
+		// 		"_id": tmp["_id"],
+		// 	},
+		// 	map[string]interface{}{
+		// 		"$set": map[string]interface{}{
+		// 			"extract_state": 4,
+		// 		},
+		// 	},
+		// })
 		//批量更新
 		if len(arrMgo) >= savesizei-1 {
 			mgo.UpdateBulkAll(db, c, arrMgo...)