|
@@ -41,13 +41,13 @@ var (
|
|
|
|
|
|
func Init() {
|
|
|
MgoB = &mongodb.MongodbSim{
|
|
|
- //MongodbAddr: "172.31.31.202:27081,172.20.45.128:27080",
|
|
|
- MongodbAddr: "127.0.0.1:27083",
|
|
|
- DbName: "qfw",
|
|
|
- Size: 10,
|
|
|
- UserName: "SJZY_RWbid_ES",
|
|
|
- Password: "SJZY@B4i4D5e6S",
|
|
|
- Direct: true,
|
|
|
+ MongodbAddr: "172.31.31.202:27081,172.20.45.128:27080",
|
|
|
+ //MongodbAddr: "127.0.0.1:27083",
|
|
|
+ DbName: "qfw",
|
|
|
+ Size: 10,
|
|
|
+ UserName: "SJZY_RWbid_ES",
|
|
|
+ Password: "SJZY@B4i4D5e6S",
|
|
|
+ //Direct: true,
|
|
|
}
|
|
|
MgoB.InitPool()
|
|
|
|
|
@@ -108,8 +108,8 @@ func Init() {
|
|
|
|
|
|
//es
|
|
|
Es = &elastic.Elastic{
|
|
|
- S_esurl: "http://127.0.0.1:19908",
|
|
|
- //S_esurl: "http://172.17.4.184:19908",
|
|
|
+ //S_esurl: "http://127.0.0.1:19908",
|
|
|
+ S_esurl: "http://172.17.4.184:19908",
|
|
|
I_size: 5,
|
|
|
Username: "jybid",
|
|
|
Password: "Top2023_JEB01i@31",
|
|
@@ -118,8 +118,8 @@ func Init() {
|
|
|
|
|
|
//es 新集群
|
|
|
EsNew = &elastic.Elastic{
|
|
|
- S_esurl: "http://127.0.0.1:19905",
|
|
|
- //S_esurl: "http://172.17.4.184:19905",
|
|
|
+ //S_esurl: "http://127.0.0.1:19905",
|
|
|
+ S_esurl: "http://172.17.4.184:19905",
|
|
|
I_size: 5,
|
|
|
Username: "jybid",
|
|
|
Password: "Top2023_JEB01i@31",
|
|
@@ -197,7 +197,7 @@ func taskRunBidding() {
|
|
|
//}
|
|
|
|
|
|
//selected := map[string]interface{}{"contenthtml": 0, "detail": 0}
|
|
|
- it := sess.DB("qfw").C("zktest_0428").Find(nil).Select(nil).Iter()
|
|
|
+ it := sess.DB("qfw").C("zktest_unit_0430_data").Find(nil).Select(nil).Iter()
|
|
|
|
|
|
fmt.Println("taskRun 开始")
|
|
|
count := 0
|
|
@@ -235,24 +235,41 @@ func taskRunBidding() {
|
|
|
//
|
|
|
//}
|
|
|
//-------------------------------------------//
|
|
|
- // 2.更新中标单位
|
|
|
- //biddingID := util.ObjToString(tmp["id"])
|
|
|
- ////biddingID := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
- //update["winner"] = ""
|
|
|
- //update["s_winner"] = ""
|
|
|
+ // 2.更新中标单位、采购单位、代理机构
|
|
|
+ biddingID := util.ObjToString(tmp["id"])
|
|
|
+ //biddingID := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
+
|
|
|
+ if _, ok := tmp["buyer"]; ok {
|
|
|
+ update["buyer"] = tmp["buyer"]
|
|
|
+ }
|
|
|
+
|
|
|
+ if _, ok := tmp["agency"]; ok {
|
|
|
+ update["agency"] = tmp["agency"]
|
|
|
+ }
|
|
|
+ if _, ok := tmp["s_winner"]; ok {
|
|
|
+ update["s_winner"] = tmp["s_winner"]
|
|
|
+ }
|
|
|
+ if _, ok := tmp["winner"]; ok {
|
|
|
+ update["winner"] = tmp["winner"]
|
|
|
+ }
|
|
|
//-------------------------------------------//
|
|
|
//3. 更新中标金额
|
|
|
- biddingID := util.ObjToString(tmp["tmpid"])
|
|
|
- update["bidamount"] = tmp["bidamount"]
|
|
|
- // 更新 MongoDB + ES
|
|
|
+ //biddingID := util.ObjToString(tmp["id"])
|
|
|
+ //if _, ok := tmp["nb"]; !ok {
|
|
|
+ // continue
|
|
|
+ //} else {
|
|
|
+ // update["bidamount"] = tmp["nb"]
|
|
|
+ //}
|
|
|
+ //update["bidamount"] = tmp["bidamount"]
|
|
|
+ //// 更新 MongoDB + ES
|
|
|
if len(update) > 0 {
|
|
|
MgoB.UpdateById("bidding", biddingID, map[string]interface{}{"$set": update})
|
|
|
//2.es 项目 更新字段
|
|
|
- //err := Es.UpdateDocument("bidding", biddingID, update)
|
|
|
- //err = EsNew.UpdateDocument("bidding", biddingID, update)
|
|
|
- //if err != nil && err.Error() != "Document not updated: noop" {
|
|
|
- // log.Info("bidding es update err", err, biddingID)
|
|
|
- //}
|
|
|
+ err := Es.UpdateDocument("bidding", biddingID, update)
|
|
|
+ err = EsNew.UpdateDocument("bidding", biddingID, update)
|
|
|
+ if err != nil && err.Error() != "Document not updated: noop" {
|
|
|
+ log.Info("bidding es update err", err, biddingID)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|