Răsfoiți Sursa

feat:增加方法

wangchuanjin 11 luni în urmă
părinte
comite
3668e3ac0e
1 a modificat fișierele cu 28 adăugiri și 0 ștergeri
  1. 28 0
      p/public.go

+ 28 - 0
p/public.go

@@ -860,3 +860,31 @@ func ResourceCenterPowers(msl *Mysql, positionId int64) map[string]bool {
 	}
 	return powers
 }
+
+//
+func MergeDiffIndustry(wuye, other *[]map[string]interface{}) *[]map[string]interface{} {
+	m := map[string]map[string]interface{}{}
+	for _, v := range *wuye {
+		_id := BsonIdToSId(v["_id"])
+		tag_topinformation, _ := v["tag_topinformation"].([]interface{})
+		for _, vv := range tag_topinformation {
+			if vv != "情报_物业" {
+				continue
+			}
+			m[_id] = v
+		}
+	}
+	for _, v := range *other {
+		_id := BsonIdToSId(v["_id"])
+		tag_topinformation, _ := v["tag_topinformation"].([]interface{})
+		if len(tag_topinformation) == 1 && tag_topinformation[0] == "情报_物业" {
+			continue
+		}
+		m[_id] = v
+	}
+	datas := []map[string]interface{}{}
+	for _, v := range m {
+		datas = append(datas, v)
+	}
+	return &datas
+}