wcc 1 year ago
parent
commit
ee9d0fee96

+ 2 - 1
company_invest/allData.go

@@ -484,7 +484,8 @@ func updateInfoId() {
 		}
 
 		page++
-
+		// 释放查询结果的内存
+		entMapCodes = nil
 	}
 
 	log.Println("迭代结束")

+ 19 - 4
company_invest/increment.go

@@ -20,11 +20,18 @@ import (
 func increInvest() {
 	//每周三执行,查询 11天之前,update_time 的数据
 	now := time.Now()
-	start := now.AddDate(0, 0, -11)
+	//start := now.AddDate(0, 0, -2)
+	//start := time.Date(now.Year(), now.Month(), now.Day()-2, 0, 0, 0, 0, now.Location())
+	offset := int(time.Monday - now.Weekday())
+	if offset > 0 {
+		offset = -6
+	}
+	weekBeginDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()).AddDate(0, 0, offset)
+	//weekMonday := weekBeginDate.Format("2006-01-02")
 
 	where := map[string]interface{}{
-		"update_time": map[string]interface{}{
-			"$gt": start.Format("2006-01-02"),
+		"jy_updatetime": map[string]interface{}{
+			"$gte": weekBeginDate.Unix(),
 		},
 	}
 
@@ -44,7 +51,8 @@ func increInvest() {
 	} else {
 		log.Info("increInvest", zap.String("clickhouse 打开成功", db.Name()))
 	}
-	query := sess.DB("mixdata").C("company_partner").Find(where).Select(nil).Sort("update_time").Iter()
+	log.Info("increInvest", zap.Any("where", where))
+	query := sess.DB("mixdata").C("company_partner").Find(where).Select(nil).Iter()
 	count := 0
 	//datas := make([]EntMapCode, 0)
 	for tmp := make(map[string]interface{}); query.Next(tmp); count++ {
@@ -203,7 +211,14 @@ func increBidding() {
 				db.Where(&EntMapCode{AName: util.ObjToString(tmp["buyer"]), BName: winer}).First(&exist)
 
 				if exist.CreateTime == 0 {
+					AInfo := EntInfo{}
+					BInfo := EntInfo{}
+					db.Model(&EntInfo{}).Where("company_name = ? ", util.ObjToString(tmp["buyer"])).Select("company_name", "id").First(&AInfo)
+					db.Model(&EntInfo{}).Where("company_name = ? ", winer).Select("company_name", "id").First(&BInfo)
+
 					data := EntMapCode{
+						AId:        AInfo.ID,
+						BId:        BInfo.ID,
 						AName:      util.ObjToString(tmp["buyer"]),
 						BName:      winer,
 						Code:       "0301",

+ 2 - 0
company_invest/main.go

@@ -101,6 +101,8 @@ func main() {
 
 	//updateInfoId()
 	//areaData()
+	//increBidding()
+	//increInvest()
 	//return
 
 	local, _ := time.LoadLocation("Asia/Shanghai")

+ 31 - 0
operator/config.go

@@ -0,0 +1,31 @@
+package main
+
+type MgoConf struct {
+	Host     string
+	DB       string
+	Coll     string // 查询表
+	Username string
+	Password string
+	Size     int
+	Name     string
+	Direct   bool
+}
+
+type GlobalConf struct {
+	MongoPA    MgoConf
+	MongoB     MgoConf
+	Clickhouse CkConf
+	Env        EnvConf
+}
+
+type CkConf struct {
+	Host     string
+	Username string
+	Password string
+}
+
+type EnvConf struct {
+	Spec1 string
+	Spec2 string
+	Spec3 string
+}

+ 0 - 0
operator/config.toml


+ 1 - 0
operator/main.go

@@ -0,0 +1 @@
+package operator

+ 0 - 0
operator/readme.txt