fengweiqiang 5 rokov pred
rodič
commit
cf6bf73936

+ 5 - 3
udp_winner/timedTaskAgency.go

@@ -13,6 +13,7 @@ import (
 	"strconv"
 	"strings"
 	"time"
+	"unicode/utf8"
 )
 
 //之前main方法,只更新
@@ -63,7 +64,7 @@ func TaskAgency(mapinfo *map[string]interface{}) {
 		tmp := make(map[string]interface{})
 		for cursor.Next(&tmp) {
 			agency, ok := tmp["agency"].(string)
-			if !ok || agency == "" {
+			if !ok ||utf8.RuneCountInString(agency)<4{
 				continue
 			}
 			//判断redis key是否存在
@@ -212,13 +213,14 @@ func TaskAgency(mapinfo *map[string]interface{}) {
 		for cursor.Next(&tmp) {
 			overid = tmp["_id"].(bson.ObjectId).Hex()
 			//log.Println(tmp["_id"])
-			if tmp["agency"] == nil || tmp["agency"] == "" {
+			agency, ok := tmp["agency"].(string)
+			if !ok ||utf8.RuneCountInString(agency)<4{
 				continue
 			}
 			//redis查询是否存在
 			rdb := RedisPool.Get()
 			rdb.Do("SELECT", Config["redis_agency_db"])
-			if reply, err := redis.String(rdb.Do("GET", tmp["agency"])); err != nil {
+			if reply, err := redis.String(rdb.Do("GET", agency)); err != nil {
 				//redis不存在存到临时表,定时任务处理
 				FClient.DbName = Config["mgodb_extract_kf"]
 				if err := FClient.SaveForOld("agency_new", tmp); err!=nil {

+ 5 - 3
udp_winner/timedTaskBuyer.go

@@ -13,6 +13,7 @@ import (
 	"strconv"
 	"strings"
 	"time"
+	"unicode/utf8"
 )
 
 //之前main方法,只更新
@@ -63,7 +64,7 @@ func TaskBuyer(mapinfo *map[string]interface{}) {
 		tmp := make(map[string]interface{})
 		for cursor.Next(&tmp) {
 			buyer, ok := tmp["buyer"].(string)
-			if !ok || buyer == "" {
+			if !ok || utf8.RuneCountInString(buyer)<4{
 				continue
 			}
 			//判断redis key是否存在
@@ -231,13 +232,14 @@ func TaskBuyer(mapinfo *map[string]interface{}) {
 		for cursor.Next(&tmp) {
 			overid = tmp["_id"].(bson.ObjectId).Hex()
 			//log.Println(tmp["_id"])
-			if tmp["buyer"] == nil || tmp["buyer"] == "" {
+			buyer, ok := tmp["buyer"].(string)
+			if !ok || utf8.RuneCountInString(buyer)<4{
 				continue
 			}
 			//redis查询是否存在
 			rdb := RedisPool.Get()
 			rdb.Do("SELECT", Config["redis_buyer_db"])
-			if reply, err := redis.String(rdb.Do("GET", tmp["buyer"])); err != nil {
+			if reply, err := redis.String(rdb.Do("GET", buyer)); err != nil {
 				//redis不存在存到临时表,定时任务处理
 				FClient.DbName = Config["mgodb_extract_kf"]
 				if err := FClient.SaveForOld("buyer_new", tmp); err!=nil {

+ 5 - 3
udp_winner/timedTaskWinner.go

@@ -13,6 +13,7 @@ import (
 	"strconv"
 	"strings"
 	"time"
+	"unicode/utf8"
 )
 
 //之前main方法,只更新
@@ -63,7 +64,7 @@ func TaskWinner(mapinfo *map[string]interface{}) {
 		tmp := make(map[string]interface{})
 		for cursor.Next(&tmp) {
 			winner, ok := tmp["winner"].(string)
-			if !ok || winner == "" {
+			if !ok ||utf8.RuneCountInString(winner)<4 {
 				continue
 			}
 			//判断redis key是否存在
@@ -222,13 +223,14 @@ func TaskWinner(mapinfo *map[string]interface{}) {
 		for cursor.Next(&tmp) {
 			overid = tmp["_id"].(bson.ObjectId).Hex()
 			//log.Println(tmp["_id"])
-			if tmp["winner"] == nil || tmp["winner"] == "" {
+			winner, ok := tmp["winner"].(string)
+			if !ok || utf8.RuneCountInString(winner) < 4 {
 				continue
 			}
 			//redis查询是否存在
 			rdb := RedisPool.Get()
 			rdb.Do("SELECT", Config["redis_winner_db"])
-			if reply, err := redis.String(rdb.Do("GET", tmp["winner"])); err != nil {
+			if reply, err := redis.String(rdb.Do("GET", winner)); err != nil {
 				//redis不存在存到临时表,定时任务处理
 				FClient.DbName = Config["mgodb_extract_kf"]
 				if err := FClient.SaveForOld("winner_new", tmp); err != nil {