xuzhiheng 9 months ago
parent
commit
1267dec044
1 changed files with 23 additions and 1 deletions
  1. 23 1
      field_sync/task.go

+ 23 - 1
field_sync/task.go

@@ -262,6 +262,11 @@ func doIndex(infos []map[string]interface{}, bkey, stype string) int {
 	var bidUpdate [][]map[string]interface{}
 	var extUpdate [][]map[string]interface{}
 	//SaveEsLock := &sync.Mutex{}
+	ygsiteArr := []map[string]interface{}{}
+	sitedata, _ := MgoE.Find("bidding_yg_site", map[string]interface{}{}, nil, nil, false, -1, -1)
+	if sitedata != nil && len(*sitedata) > 0 {
+		ygsiteArr = *sitedata
+	}
 	log.Println("start ...")
 	for n, tmp := range infos {
 		tid := mongodb.BsonIdToSId(tmp["_id"])
@@ -364,7 +369,24 @@ func doIndex(infos []map[string]interface{}, bkey, stype string) int {
 				extractMap["entidlist"] = cid
 			}
 		}
-
+		//阳光采购
+		spidercode := util.ObjToString(tmp["spidercode"])
+		site := util.ObjToString(tmp["site"])
+		infoAttribute := util.ObjToString(tmp["infoAttribute"])
+		if infoAttribute != "" {
+			MgoE.Save("bidding_yg", map[string]interface{}{"id": tid, "source": "user"})
+		} else {
+			for _, v := range ygsiteArr {
+				spidercodes := util.ObjToString(v["spidercode"])
+				sites := util.ObjToString(v["site"])
+				datatype := util.ObjToString(v["datatype"])
+				if datatype == "1" && spidercodes == spidercode {
+					MgoE.Save("bidding_yg", map[string]interface{}{"id": tid, "source": "spidercode"})
+				} else if datatype == "2" && site == sites {
+					MgoE.Save("bidding_yg", map[string]interface{}{"id": tid, "source": "site"})
+				}
+			}
+		}
 		// 6.10 剑鱼发布信息分类处理, 写在这里是为了修改抽取表
 		typeFunc(tmp, update, extractMap)
 		if len(extractMap) > 0 {