|
@@ -50,7 +50,7 @@ func winnerStandarData(db string, query map[string]interface{}) {
|
|
|
province = qu.ObjToString(data["province"])
|
|
|
if province == "" { //省份为空,buyer优先提取区域信息再company_address
|
|
|
province, city, district = GetProvinceCityDistrict([]string{winner}) //先buyer
|
|
|
- if province == "" { //再address
|
|
|
+ if province == "" { //再address
|
|
|
if address := qu.ObjToString(data["company_address"]); address != "" {
|
|
|
province, city, district = GetProvinceCityDistrict([]string{address})
|
|
|
}
|
|
@@ -82,9 +82,9 @@ func winnerStandarData(db string, query map[string]interface{}) {
|
|
|
"topscopeclass": comRepTopscopeclass(topscopeclass),
|
|
|
"check": comMarkdata(winner, "winner"),
|
|
|
"updatetime": time.Now().Unix(),
|
|
|
- "province": province,
|
|
|
- "city": city,
|
|
|
- "district": district,
|
|
|
+ "province": province,
|
|
|
+ "city": city,
|
|
|
+ "district": district,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -99,7 +99,7 @@ func winnerStandarData(db string, query map[string]interface{}) {
|
|
|
data := winMegerIndustry(entid, v)
|
|
|
MongoTo.UpdateById(winnerent, entid,
|
|
|
map[string]interface{}{
|
|
|
- "$set": data,
|
|
|
+ "$set": data,
|
|
|
//"$push": map[string]interface{}{"contact": v},
|
|
|
},
|
|
|
)
|
|
@@ -141,7 +141,8 @@ func historywinner(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, "winner": 1, "winnertel": 1, "winnerperson": 1, "topscopeclass": 1}).Sort("_id").Iter()
|
|
|
+ it := sess.DB(db).C(fromcoll).Find(map[string]interface{}{}).Select(bson.M{
|
|
|
+ "repeat": 1, "winner": 1, "winnertel": 1, "winnerperson": 1, "topscopeclass": 1}).Sort("_id").Iter()
|
|
|
index := 0
|
|
|
for tmp := make(map[string]interface{}); it.Next(&tmp); index++ {
|
|
|
if qu.IntAll(tmp["repeat"]) > 0 { //重复数据跳过
|
|
@@ -175,29 +176,28 @@ func historywinner(db, fromcoll string) {
|
|
|
bs, _ := json.Marshal(ps)
|
|
|
redis.PutRedis("winner", winnerbd, winner, bs, -1)
|
|
|
//log.Println(_id, index, winner)
|
|
|
- } else {
|
|
|
- log.Println("jsonErr", err)
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- val := []map[string]interface{}{}
|
|
|
- if winnerperson != "" || winnertel != "" {
|
|
|
- tmp := map[string]interface{}{
|
|
|
- "contact_person": winnerperson,
|
|
|
- "phone": winnertel,
|
|
|
- "topscopeclass": comRepTopscopeclass(topscopeclass),
|
|
|
- "infoid": _id,
|
|
|
- }
|
|
|
- val = append(val, tmp)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ val := []map[string]interface{}{}
|
|
|
+ if winnerperson != "" || winnertel != "" {
|
|
|
+ tmp := map[string]interface{}{
|
|
|
+ "contact_person": winnerperson,
|
|
|
+ "phone": winnertel,
|
|
|
+ "topscopeclass": comRepTopscopeclass(topscopeclass),
|
|
|
+ "infoid": _id,
|
|
|
}
|
|
|
- bs, _ := json.Marshal(val)
|
|
|
- redis.PutRedis("winner", winnerbd, winner, bs, -1)
|
|
|
- MongoTo.Save(winnererr, map[string]interface{}{
|
|
|
- "name": winner,
|
|
|
- "topscopeclass": comRepTopscopeclass(topscopeclass),
|
|
|
- "updatetime": time.Now().Unix(),
|
|
|
- })
|
|
|
+ val = append(val, tmp)
|
|
|
}
|
|
|
+ bs, _ := json.Marshal(val)
|
|
|
+ redis.PutRedis("winner", winnerbd, winner, bs, -1)
|
|
|
+ MongoTo.Save(winnererr, map[string]interface{}{
|
|
|
+ "name": winner,
|
|
|
+ "topscopeclass": comRepTopscopeclass(topscopeclass),
|
|
|
+ "updatetime": time.Now().Unix(),
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
}(tmp)
|
|
|
tmp = map[string]interface{}{}
|
|
@@ -262,8 +262,8 @@ func winMegerIndustry(id string, ps map[string]interface{}) map[string]interface
|
|
|
return nil
|
|
|
}
|
|
|
data := map[string]interface{}{}
|
|
|
- industry,ok := tmp["industry"].(primitive.A)
|
|
|
- if ok{
|
|
|
+ industry, ok := tmp["industry"].(primitive.A)
|
|
|
+ if ok {
|
|
|
tmpindustry := map[string]bool{}
|
|
|
for _, v := range industry {
|
|
|
tt := qu.ObjToString(v)
|
|
@@ -286,7 +286,7 @@ func winMegerIndustry(id string, ps map[string]interface{}) map[string]interface
|
|
|
contact := tmp["contact"].(primitive.A)
|
|
|
contact = append(contact, ps)
|
|
|
//bid_contact
|
|
|
- bid_contacts,contacts := bid_contact(contact)
|
|
|
+ bid_contacts, contacts := bid_contact(contact)
|
|
|
if len(bid_contacts) > 0 {
|
|
|
data["bid_contact"] = bid_contacts
|
|
|
}
|
|
@@ -437,15 +437,10 @@ func comHisMegerNewData(name, datatype string, ps []map[string]interface{}) map[
|
|
|
data["industry"] = industry
|
|
|
} else if datatype == "buyer" {
|
|
|
data["buyer_name"] = name
|
|
|
- tmpbuyerclass := map[string]bool{}
|
|
|
- for _, p := range ps {
|
|
|
- tmpbuyerclass[qu.ObjToString(p["buyerclass"])] = true
|
|
|
- }
|
|
|
- buyerclass := []interface{}{}
|
|
|
- for k, _ := range tmpbuyerclass {
|
|
|
- buyerclass = append(buyerclass, k)
|
|
|
+ lennum := len(ps)
|
|
|
+ if lennum > 1 {
|
|
|
+ data["buyerclass"] = qu.ObjToString(ps[lennum-1]["buyerclass"])
|
|
|
}
|
|
|
- data["buyerclass"] = buyerclass
|
|
|
data["ranks"] = ""
|
|
|
data["type"] = ""
|
|
|
data["address"] = ""
|