zhangjinkun 5 tahun lalu
induk
melakukan
d285dba1f0

TEMPAT SAMPAH
standardata/src/sss


+ 19 - 19
standardata/src/standaragency.go

@@ -19,11 +19,11 @@ func agencyStandarData(db string, query map[string]interface{}) {
 	defer qu.Catch()
 	sess := MongoFrom.GetMgoConn()
 	defer MongoFrom.Close()
-	it := sess.DB(db).C(extractcoll).Find(query).Select(bson.M{"repeat": 1,"agency": 1, "agencytel": 1, "agencyperson": 1, "topscopeclass": 1,
+	it := sess.DB(db).C(extractcoll).Find(query).Select(bson.M{"repeat": 1, "agency": 1, "agencytel": 1, "agencyperson": 1, "topscopeclass": 1,
 		"agencyaddr": 1}).Sort("_id").Iter()
 	index := 0
 	for tmp := make(map[string]interface{}); it.Next(&tmp); index++ {
-		if qu.IntAll(tmp["repeat"]) > 0  { //重复数据跳过
+		if qu.IntAll(tmp["repeat"]) > 0 { //重复数据跳过
 			continue
 		}
 		agency := qu.ObjToString(tmp["agency"])
@@ -36,7 +36,7 @@ func agencyStandarData(db string, query map[string]interface{}) {
 		ps := []map[string]interface{}{}
 		agencyperson := qu.ObjToString(tmp["agencyperson"])
 		agencytel := qu.ObjToString(tmp["agencytel"])
-		if entid == "" {//redis 未存
+		if entid == "" { //redis 未存
 			savetoerr := true
 			if agencytel != "" {
 				v := map[string]interface{}{
@@ -65,14 +65,14 @@ func agencyStandarData(db string, query map[string]interface{}) {
 			}
 		} else {
 			if agencytel != "" {
-				is_exist:=false //电话是否存在
-				for _,v := range ps{
-					if v["phone"]==agencytel{
+				is_exist := false //电话是否存在
+				for _, v := range ps {
+					if v["phone"] == agencytel {
 						is_exist = true
-						if agencyperson!=""&&v["contact_person"]!=agencyperson {
-							v["contact_person"]=agencyperson
+						if agencyperson != "" && v["contact_person"] != agencyperson {
+							v["contact_person"] = agencyperson
 							v["infoid"] = infoid
-							bs, _ := json.Marshal(ps)//替换数据,更新
+							bs, _ := json.Marshal(ps) //替换数据,更新
 							redis.PutRedis("agency", agencybd, agency, bs, -1)
 						}
 						continue
@@ -87,7 +87,7 @@ func agencyStandarData(db string, query map[string]interface{}) {
 					}
 					MongoTo.UpdateById(agencyent, entid,
 						map[string]interface{}{
-							"$set":  v,
+							"$set":  map[string]interface{}{"updatetime": time.Now().Unix()},
 							"$push": map[string]interface{}{"contact": v},
 						},
 					)
@@ -108,7 +108,7 @@ func historyagency(db, fromcoll string) {
 	log.Println("history  start")
 	sess := MongoFrom.GetMgoConn()
 	defer MongoFrom.Close()
-	it := sess.DB(db).C(fromcoll).Find(map[string]interface{}{}).Select(bson.M{"repeat": 1,"agency": 1, "agencytel": 1, "agencyperson": 1, "topscopeclass": 1,
+	it := sess.DB(db).C(fromcoll).Find(map[string]interface{}{}).Select(bson.M{"repeat": 1, "agency": 1, "agencytel": 1, "agencyperson": 1, "topscopeclass": 1,
 		"agencyaddr": 1}).Sort("_id").Iter()
 	index := 0
 	for tmp := make(map[string]interface{}); it.Next(&tmp); index++ {
@@ -127,20 +127,20 @@ func historyagency(db, fromcoll string) {
 				agencyperson := qu.ObjToString(tmp["agencyperson"])
 				agencytel := qu.ObjToString(tmp["agencytel"])
 				b, _ := redis.ExistRedis("agency", agencybd, agency)
-				if b {//redis 存在
-					if  agencytel != "" {
+				if b { //redis 存在
+					if agencytel != "" {
 						strs, _ := redis.GetRedisStr("agency", agencybd, agency)
 						ps := []map[string]interface{}{}
 						err := json.Unmarshal([]byte(strs), &ps)
 						if err == nil {
-							is_exist:=false //电话是否存在
-							for _,v := range ps{
-								if v["phone"]==agencytel{
+							is_exist := false //电话是否存在
+							for _, v := range ps {
+								if v["phone"] == agencytel {
 									is_exist = true
-									if agencyperson!=""&&v["contact_person"]!=agencyperson {
-										v["contact_person"]=agencyperson
+									if agencyperson != "" && v["contact_person"] != agencyperson {
+										v["contact_person"] = agencyperson
 										v["infoid"] = _id
-										bs, _ := json.Marshal(ps)//替换数据,更新
+										bs, _ := json.Marshal(ps) //替换数据,更新
 										redis.PutRedis("agency", agencybd, agency, bs, -1)
 									}
 									continue

+ 1 - 0
standardata/src/standarbuyer.go

@@ -232,5 +232,6 @@ func buyerMegerBuyerclass(id string, ps map[string]interface{}) map[string]inter
 		newbuyerclass = append(newbuyerclass, k)
 	}
 	data["buyerclass"] = newbuyerclass
+	data["updatetime"] = time.Now().Unix()
 	return data
 }

+ 1 - 0
standardata/src/standarwinner.go

@@ -253,6 +253,7 @@ func winMegerIndustry(id string, ps map[string]interface{}) map[string]interface
 		newindustry = append(newindustry, k)
 	}
 	data["industry"] = newindustry
+	data["updatetime"] = time.Now().Unix()
 	return data
 }