Jelajahi Sumber

project_rate精度问题

maxiaoshan 4 tahun lalu
induk
melakukan
1a8b20b267
2 mengubah file dengan 5 tambahan dan 5 penghapusan
  1. 4 4
      udpcreateindex/src/config.json
  2. 1 1
      udpcreateindex/src/projectindex.go

+ 4 - 4
udpcreateindex/src/config.json

@@ -4,7 +4,7 @@
     "mongodb": {
         "addr": "192.168.3.207:27092",
         "pool": 10,
-        "db": "mxs"
+        "db": "qfw_data"
     },
 	"savedb": {
         "addr": "192.168.3.207:27092",
@@ -56,8 +56,8 @@
     "filelength": 50000,
     "detaillength": 50000,
     "project": {
-        "db": "mxs",
-        "collect": "test2",
+        "db": "qfw_data",
+        "collect": "projectset",
         "index": "projectset_v5",
         "type": "projectset"
     },
@@ -99,7 +99,7 @@
 		}
     },
     "elastic": {
-        "addr": "http://192.168.3.11:9800",
+        "addr": "http://192.168.3.128:9800",
         "pool": 12
     }
 }

+ 1 - 1
udpcreateindex/src/projectindex.go

@@ -117,7 +117,7 @@ func projectTask(data []byte, project, mapInfo map[string]interface{}) {
 			}
 			if isOk {
 				rate := float64(1) - float64(bidamount)/float64(budget)
-				f, _ := strconv.ParseFloat(strconv.FormatFloat(rate, 'f', 2, 64), 64)
+				f, _ := strconv.ParseFloat(strconv.FormatFloat(rate, 'f', 4, 64), 64)
 				if f > 0 {
 					tmp["project_rate"] = f
 				}