Procházet zdrojové kódy

添加 采购单位 全量同步

wcc před 1 rokem
rodič
revize
5b025222fd

+ 230 - 6
createEsIndex/buyertask.go

@@ -7,10 +7,11 @@ import (
 	"go.uber.org/zap"
 	util "jygit.jydev.jianyu360.cn/data_processing/common_utils"
 	"jygit.jydev.jianyu360.cn/data_processing/common_utils/log"
+	"sync"
 	"time"
 )
 
-//buyerOnce  处理增量数据
+// buyerOnce  处理增量数据
 func buyerOnce() {
 	if len(specialNames) < 1 {
 		initSpecialNames()
@@ -190,7 +191,7 @@ func buyerOnce() {
 	log.Info("buyerOnce", zap.Int("结束,总数是:", total), zap.Int("realCount", realCount))
 }
 
-//dealSpecialNames 拿到凭安 特企数据 以及爬虫采购单位数据
+// dealSpecialNames 拿到凭安 特企数据 以及爬虫采购单位数据
 func initSpecialNames() {
 	sess := MgoS.GetMgoConn()
 	defer MgoS.DestoryMongoConn(sess)
@@ -201,7 +202,11 @@ func initSpecialNames() {
 
 	for tmp := make(map[string]interface{}); query.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
-			specialNames[tmp["company_name"].(string)] = true
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			} else {
+				specialNames[tmp["company_name"].(string)] = true
+			}
 		}
 	}
 
@@ -212,7 +217,11 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query2.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
-			specialNames[tmp["company_name"].(string)] = true
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			} else {
+				specialNames[tmp["company_name"].(string)] = true
+			}
 		}
 	}
 
@@ -223,7 +232,11 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query3.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
-			specialNames[tmp["company_name"].(string)] = true
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			} else {
+				specialNames[tmp["company_name"].(string)] = true
+			}
 		}
 	}
 
@@ -234,7 +247,11 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query4.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
-			specialNames[tmp["company_name"].(string)] = true
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			} else {
+				specialNames[tmp["company_name"].(string)] = true
+			}
 		}
 	}
 
@@ -245,6 +262,9 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query5.Next(tmp); count++ {
 		if tmp["use_name"] != nil && tmp["use_name"] != "" {
+			if specialNames[tmp["use_name"].(string)] {
+				continue
+			}
 			specialNames[tmp["use_name"].(string)] = true
 		}
 	}
@@ -255,6 +275,9 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query6.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			}
 			specialNames[tmp["company_name"].(string)] = true
 		}
 	}
@@ -266,6 +289,9 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query7.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			}
 			specialNames[tmp["company_name"].(string)] = true
 		}
 	}
@@ -276,6 +302,9 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query8.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			}
 			specialNames[tmp["company_name"].(string)] = true
 		}
 	}
@@ -284,8 +313,203 @@ func initSpecialNames() {
 	count = 0
 	for tmp := make(map[string]interface{}); query9.Next(tmp); count++ {
 		if tmp["company_name"] != nil && tmp["company_name"] != "" {
+			if specialNames[tmp["company_name"].(string)] {
+				continue
+			}
 			specialNames[tmp["company_name"].(string)] = true
 		}
 	}
 
 }
+
+// buyerAll 采购单位全量数据
+func buyerAll() {
+	if len(specialNames) < 1 {
+		initSpecialNames()
+	}
+
+	countSql := fmt.Sprintf(`SELECT	count(id)	FROM dws_f_ent_tags `)
+	dataCounts := Mysql.CountBySql(countSql)
+	if dataCounts > 0 {
+		log.Info("buyerAll", zap.Any("采购单位全量:", dataCounts))
+	} else {
+		log.Info("buyerAll", zap.String("采购单位全量是0", "没有更新数据"))
+		return
+	}
+
+	finalId := 0
+	lastSql := fmt.Sprintf(`SELECT id  FROM	dws_f_ent_tags  ORDER BY id DESC  LIMIT 1`)
+	lastInfo := Mysql.SelectBySql(lastSql)
+	if len(*lastInfo) > 0 {
+		finalId = util.IntAll((*lastInfo)[0]["id"])
+	} else {
+		log.Info("buyerAll", zap.String("获取最大ID失败", "没有数据"))
+		return
+	}
+
+	log.Info("buyerAll", zap.Int("finalId", finalId))
+	buyerPool := make(chan bool, 3) //控制线程数
+	wg := &sync.WaitGroup{}
+
+	lastid, total := 0, 0
+	realCount := 0
+
+	for {
+		query := fmt.Sprintf(`
+ SELECT
+               b.name, 
+			   b.seo_id,
+               t.id,
+               t.name_id, 
+			   b.company_id,
+               t.createtime,
+               t.updatetime,
+               c.area, 
+               c.city, 
+               class.name AS buyerclass 
+              
+           FROM 
+               dws_f_ent_tags AS t 
+               LEFT JOIN code_buyerclass AS class ON class.code = t.labelvalues
+               LEFT JOIN dws_f_ent_baseinfo AS b ON b.name_id = t.name_id
+               LEFT JOIN code_area AS c ON b.city_code = c.code 
+
+			WHERE  t.id > %d 
+           ORDER BY t.id ASC
+          LIMIT %d;
+      `, lastid, 200)
+
+		ctx := context.Background()
+		rows, err := Mysql.DB.QueryContext(ctx, query)
+		if err != nil {
+			log.Info("buyerAll", zap.Any("QueryContext err", err))
+		}
+
+		if finalId == lastid {
+			log.Info("buyerAll over", zap.Any("total", total), zap.Any("lastid", lastid))
+			break
+		}
+
+		columns, err := rows.Columns()
+		if err != nil {
+			log.Info("buyerAll", zap.Any("rows.Columns", err))
+		}
+
+		for rows.Next() {
+			scanArgs := make([]interface{}, len(columns))
+			values := make([]interface{}, len(columns))
+			ret := make(map[string]interface{})
+
+			for k := range values {
+				scanArgs[k] = &values[k]
+			}
+
+			err = rows.Scan(scanArgs...)
+			if err != nil {
+				log.Info("buyerAll", zap.Any("rows.Scan", err))
+				break
+			}
+
+			for i, col := range values {
+				if v, ok := col.([]uint8); ok {
+					ret[columns[i]] = string(v)
+				} else {
+					ret[columns[i]] = col
+				}
+			}
+
+			lastid = util.IntAll(ret["id"])
+			total++
+			if total%1000 == 0 {
+				log.Info("buyerAll", zap.Int("current total", total), zap.Int("lastid", lastid))
+			}
+
+			buyerPool <- true
+			wg.Add(1)
+
+			go func(tmp map[string]interface{}) {
+				defer func() {
+					<-buyerPool
+					wg.Done()
+				}()
+				//MySQL 更新
+				update := map[string]interface{}{}
+				name := util.ObjToString(tmp["name"])
+				//company_id != ‘’ 或者在凭安 特殊企业或者在爬虫采购单位里
+				if util.ObjToString(tmp["company_id"]) != "" || specialNames[name] {
+					realCount++
+					update["status"] = 1
+				} else if ruleBuyer(name) { //不符合条件,排除
+					update["status"] = -1
+				} else { //默认2,认为可信
+					realCount++
+					update["status"] = 2
+				}
+				//1.更新MySQL
+				where := map[string]interface{}{
+					"name_id": tmp["name_id"],
+				}
+				if len(update) > 0 {
+					Mysql.Update("dws_f_ent_tags", where, update)
+				}
+
+				//2.生索引,status = 1或者2 才生索引
+				if util.IntAll(update["status"]) == 1 || util.IntAll(update["status"]) == 2 {
+					data := make(map[string]interface{}, 0)
+					data["name"] = name
+					data["name_id"] = tmp["name_id"]
+					if ret["seo_id"] != nil {
+						data["seo_id"] = tmp["seo_id"]
+					}
+					data["id"] = tmp["name_id"]
+					data["buyer_name"] = name
+					data["province"] = tmp["area"]
+					data["city"] = tmp["city"]
+					data["buyerclass"] = tmp["buyerclass"]
+					if ret["createtime"] != nil {
+						if createtime, ok := tmp["createtime"].(time.Time); ok {
+							data["createtime"] = createtime.Unix()
+							if ret["updatetime"] != nil {
+								if updatetime, ok := tmp["updatetime"].(time.Time); ok {
+									data["updatetime"] = updatetime.Unix()
+								}
+							} else {
+								data["updatetime"] = createtime.Unix()
+							}
+						}
+					}
+
+					sql := fmt.Sprintf(`select count(id) from dws_f_ent_contact where name_id = '%v'`, tmp["name_id"])
+					counts := Mysql.CountBySql(sql)
+					if counts > 0 {
+						data["is_contact"] = true
+					} else {
+						data["is_contact"] = false
+					}
+					arrEs := make([]map[string]interface{}, 0) //最终生索引数据
+					arrEs = append(arrEs, data)
+					err = Es.InsertOrUpdate(config.Conf.DB.Es.IndexBuyer, arrEs)
+					if err != nil {
+						log.Info("buyerAll", zap.Any("InsertOrUpdate err", err))
+					}
+				}
+
+			}(ret)
+
+		}
+
+		if err := rows.Err(); err != nil {
+			log.Info("buyerAll", zap.Any("rows.Err()", err))
+		}
+
+		err = rows.Close()
+		if err != nil {
+			log.Info("buyerAll", zap.Any("rows.Close() err", err))
+		}
+
+		wg.Wait()
+	}
+
+	log.Info("buyerAll", zap.Int("结束,总数是:", total), zap.Int("realCount", realCount))
+
+}

+ 22 - 9
createEsIndex/common.toml

@@ -17,12 +17,20 @@
     direct = true
 
 [db.mongoP] ## projectset 项目信息
-    addr = "192.168.3.206:27002"
-    dbname = "qfw_data"
-    coll = "projectset"
+#    addr = "192.168.3.206:27002"
+#    dbname = "qfw_data"
+#    coll = "projectset"
+#    size = 15
+#    user = "root"
+#    password = "root"
+
+    addr = "127.0.0.1:27080"
+    dbname = "qfw"
+    coll = "projectset_20230904"
     size = 15
-    user = "root"
-    password = "root"
+    user = ""
+    password = ""
+    direct = true
 
 [db.mongoQ] ##  winner
     addr = "192.168.3.206:27002"
@@ -42,10 +50,15 @@
     password = ""
 
 [db.mysqlB]  ## buyer 采购单位 MySQL配置
-    addr = "192.168.3.14:4000"      ## 测试环境
+#    addr = "192.168.3.14:4000"      ## 测试环境
+#    dbname = "global_common_data"
+#    username = "root"
+#    password = "=PDT49#80Z!RVv52_z"
+
+    addr = "127.0.0.1:4001"         ## 测试环境
     dbname = "global_common_data"
-    username = "root"
-    password = "=PDT49#80Z!RVv52_z"
+    username = "wangchengcheng"
+    password = "Wcc#20221209P"
 
 
 [db.oss]
@@ -66,7 +79,7 @@
 #    indextmp = "bidding_temporary"       ## 临时索引,其他程序需要;目前已不需要
     indexp = "projectset_v1"
     indexwinner = "winner_v1"
-    indexbuyer = "buyer_v2"
+    indexbuyer = "buyer_v3"
 detailfilter = ["(招标网|千里马|采招网|招标采购导航网|招标与采购网|中国招投标网|中国采购与招标网|中国采购与招标|优质采)[\\w\\W]{0,15}[http|https|htpps]?[a-z0-9:\\/\\/.]{0,20}(qianlima|zhaobiao|okcis|zbytb|infobidding|bidcenter|youzhicai|chinabidding|Chinabidding|CHINABIDDING)[a-z0-9.\\/\\/]{0,40}",
     "招标网[\\w\\W]{0,15}[http|https|htpps]?[a-z0-9:\\/\\/.]{0,20}zhaobiao[a-z0-9.\\/\\/]{0,40}",
     "千里马[\\w\\W]{0,15}[a-z0-9:\\/\\/.]{0,20}qianlima[a-z0-9.\\/\\/]{0,10}",

+ 3 - 1
createEsIndex/go.mod

@@ -24,12 +24,14 @@ require (
 	github.com/fsnotify/fsnotify v1.7.0 // indirect
 	github.com/go-logr/logr v1.2.4 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
-	github.com/go-sql-driver/mysql v1.6.0 // indirect
+	github.com/go-sql-driver/mysql v1.7.0 // indirect
 	github.com/gogf/gf/v2 v2.5.7 // indirect
 	github.com/golang/snappy v0.0.1 // indirect
 	github.com/gorilla/websocket v1.5.0 // indirect
 	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
 	github.com/hashicorp/hcl v1.0.0 // indirect
+	github.com/jinzhu/inflection v1.0.0 // indirect
+	github.com/jinzhu/now v1.1.5 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/klauspost/compress v1.17.0 // indirect
 	github.com/magiconair/properties v1.8.7 // indirect

+ 11 - 0
createEsIndex/go.sum

@@ -87,6 +87,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
 github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
 github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
 github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
+github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
 github.com/gogf/gf/v2 v2.5.7 h1:h+JSoD6z3d2q0uGszvtahrSm4DiM2ECyNjyTwKIo8wE=
 github.com/gogf/gf/v2 v2.5.7/go.mod h1:x2XONYcI4hRQ/4gMNbWHmZrNzSEIg20s2NULbzom5k0=
 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
@@ -160,6 +162,10 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
+github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
+github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
+github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
 github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
 github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@@ -613,6 +619,11 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs=
+gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8=
+gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
+gorm.io/gorm v1.25.6 h1:V92+vVda1wEISSOMtodHVRcUIOPYa2tgQtyF+DfFx+A=
+gorm.io/gorm v1.25.6/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

+ 7 - 4
createEsIndex/init.go

@@ -72,6 +72,7 @@ func InitMgo() {
 		Size:        config.Conf.DB.MongoP.Size,
 		UserName:    config.Conf.DB.MongoP.User,
 		Password:    config.Conf.DB.MongoP.Password,
+		Direct:      config.Conf.DB.MongoP.Direct,
 	}
 	MgoP.InitPool()
 	if config.Conf.DB.MongoP.Addr == "" || config.Conf.DB.MongoP.Dbname == "" {
@@ -89,6 +90,7 @@ func InitMgo() {
 		Size:        config.Conf.DB.MongoQ.Size,
 		UserName:    config.Conf.DB.MongoQ.User,
 		Password:    config.Conf.DB.MongoQ.Password,
+		Direct:      config.Conf.DB.MongoQ.Direct,
 	}
 	MgoQ.InitPool()
 	if config.Conf.DB.MongoQ.Addr == "" || config.Conf.DB.MongoQ.Dbname == "" {
@@ -103,6 +105,7 @@ func InitMgo() {
 		Size:        config.Conf.DB.MongoS.Size,
 		UserName:    config.Conf.DB.MongoS.User,
 		Password:    config.Conf.DB.MongoS.Password,
+		Direct:      config.Conf.DB.MongoS.Direct,
 	}
 	MgoS.InitPool()
 	if config.Conf.DB.MongoS.Addr == "" || config.Conf.DB.MongoS.Dbname == "" {
@@ -206,7 +209,7 @@ func InitField() {
 	log.Info("InitField", zap.Any("duration", time.Since(now).Seconds()))
 }
 
-//InitPreProcessField 预处理阶段字段
+// InitPreProcessField 预处理阶段字段
 func InitPreProcessField() {
 	now := time.Now()
 	info, _ := MgoB.Find("bidding_processing_field", `{"stype": "pre_process"}`, nil, nil, false, -1, -1)
@@ -221,7 +224,7 @@ func InitPreProcessField() {
 	log.Info("InitPreProcessField", zap.Any("duration", time.Since(now).Seconds()))
 }
 
-//InitPreEsClient 实例化预处理 索引客户端
+// InitPreEsClient 实例化预处理 索引客户端
 func InitPreEsClient() {
 	if len(config.Conf.Pre) > 0 {
 		for k, v := range config.Conf.Pre {
@@ -237,7 +240,7 @@ func InitPreEsClient() {
 	}
 }
 
-//InitEsBiddingField 初始化 bidding 索引字段
+// InitEsBiddingField 初始化 bidding 索引字段
 func InitEsBiddingField() {
 	now := time.Now()
 	info, _ := MgoB.Find("bidding_processing_field", `{"stype": "bidding"}`, nil, nil, false, -1, -1)
@@ -261,7 +264,7 @@ func InitEsBiddingField() {
 	log.Info("InitEsBiddingField", zap.Any("duration", time.Since(now).Seconds()))
 }
 
-//verifyESFields 验证es 定义字段类型和 MongoDB 数据字段
+// verifyESFields 验证es 定义字段类型和 MongoDB 数据字段
 func verifyESFields() {
 	now := time.Now()
 	log.Info("verifyESFields", zap.String("开始类型检测", ""))

+ 11 - 2
createEsIndex/main.go

@@ -233,6 +233,14 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 					}()
 					buyerOnce()
 				}()
+			case "buyer_all": // 采购单位全量数据
+				pool <- true
+				go func() {
+					defer func() {
+						<-pool
+					}()
+					buyerAll()
+				}()
 			case "winner_once": // 中标单位昨天增量数据
 				pool <- true
 				go func() {
@@ -286,10 +294,11 @@ func task_index() {
 
 	c := cron.New()
 
-	_ = c.AddFunc("0 0 0 * * ?", func() { task_winneres() }) //每天凌晨执行一次winner生索引
-	_ = c.AddFunc("0 0 1 * * ?", func() { task_buyeres() })  //每天1点执行一次buyer生索引
+	_ = c.AddFunc("0 00 00 * * *", func() { task_winneres() }) //每天凌晨执行一次winner生索引
+	_ = c.AddFunc("0 00 01 * * *", func() { task_buyeres() })  //每天1点执行一次buyer生索引
 	c.Start()
 }
+
 func task_winneres() {
 	log.Info("定时任务,winneres")
 	winnerEsTaskOnce()

+ 5 - 5
createEsIndex/winnertask.go

@@ -13,7 +13,7 @@ import (
 	"time"
 )
 
-//winnerEsTaskOnce 中标单位每天新增数据
+// winnerEsTaskOnce 中标单位每天新增数据
 func winnerEsTaskOnce() {
 	defer util.Catch()
 	arrEs := []map[string]interface{}{}
@@ -188,12 +188,12 @@ SELECT
 
 }
 
-//winnerEsAll 存量中标单位
+// winnerEsAll 存量中标单位
 func winnerEsAll() {
 	arrEs := []map[string]interface{}{}
 	winerEsLock := &sync.Mutex{}
 	defer util.Catch()
-	pool := make(chan bool, 15) //控制线程数
+	winnerPool := make(chan bool, 15) //控制线程数
 	wg := &sync.WaitGroup{}
 	rowsPerPage := 10000
 
@@ -291,12 +291,12 @@ SELECT
 			}
 			lastid = util.IntAll(ret["id"])
 
-			pool <- true
+			winnerPool <- true
 			wg.Add(1)
 
 			go func(tmp map[string]interface{}) {
 				defer func() {
-					<-pool
+					<-winnerPool
 					wg.Done()
 				}()
 				savetmp := map[string]interface{}{}