瀏覽代碼

检查配置 autoid seoid

wcc 1 年之前
父節點
當前提交
dabb54d1fe
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 5 0
      qyxy_std_new/main.go
  2. 2 3
      qyxy_std_new/task.go

+ 5 - 0
qyxy_std_new/main.go

@@ -49,6 +49,11 @@ func main() {
 	}
 	log.Info("main", zap.Any("qyxyEsAddr", qyxyEsAddr))
 
+	if int64(GF.Env.Autoid) == 0 || int64(GF.Env.Seoid) == 0 {
+		log.Error("配置文件错误", zap.String("配置文件", "autoid 或者 seoid 为 0"))
+		os.Exit(-1)
+	}
+
 	UdpClient.Listen(processUdpMsg)
 	log.Info("main", zap.String("Udp服务监听本地端口", localPort))
 

+ 2 - 3
qyxy_std_new/task.go

@@ -4,7 +4,6 @@ import (
 	"context"
 	"fmt"
 	util "jygit.jydev.jianyu360.cn/data_processing/common_utils"
-
 	//"github.com/cron"
 	"github.com/wangbin/jiebago"
 	"go.mongodb.org/mongo-driver/bson"
@@ -99,7 +98,7 @@ func updateStd() {
 
 	ctx, _ := context.WithTimeout(context.Background(), 99999*time.Hour)
 	coll := sess.M.C.Database("mixdata").Collection("qyxy_std")
-	find := options.Find().SetBatchSize(200).SetSort(bson.D{bson.E{"autoid", 1}}).SetProjection(bson.M{"_id": 1, "autoid": 1, "establish_date": 1, "create_time_msql": 1})
+	find := options.Find().SetBatchSize(200).SetSort(bson.D{bson.E{"autoid", 1}}).SetProjection(bson.M{"_id": 1, "autoid": 1, "establish_date": 1, "create_time_msql": 1, "nseo_id": 1})
 	cur, err := coll.Find(ctx, bson.M{"autoid": bson.M{"$gt": id}}, find)
 
 	if err != nil {
@@ -113,7 +112,7 @@ func updateStd() {
 			cur.Decode(&tmp)
 			id := util.Int64All(tmp["autoid"])
 			//存在就不处理
-			if _, ok := tmp["nseo_id"]; ok {
+			if nseoid, ok := tmp["nseo_id"]; ok && nseoid != "" {
 				continue
 			}