Browse Source

feat: 新增字段

zhangxinlei1996 11 months ago
parent
commit
e353542fc1
2 changed files with 28 additions and 5 deletions
  1. 27 4
      data_tidb/bidding.go
  2. 1 1
      data_tidb/field-criteria.json

+ 27 - 4
data_tidb/bidding.go

@@ -3,10 +3,6 @@ package main
 import (
 	"data_tidb/config"
 	"fmt"
-	"github.com/shopspring/decimal"
-	util "jygit.jydev.jianyu360.cn/data_processing/common_utils"
-	"jygit.jydev.jianyu360.cn/data_processing/common_utils/log"
-	"jygit.jydev.jianyu360.cn/data_processing/common_utils/mongodb"
 	"reflect"
 	"regexp"
 	"sort"
@@ -14,6 +10,11 @@ import (
 	"strings"
 	"sync"
 	"time"
+
+	"github.com/shopspring/decimal"
+	util "jygit.jydev.jianyu360.cn/data_processing/common_utils"
+	"jygit.jydev.jianyu360.cn/data_processing/common_utils/log"
+	"jygit.jydev.jianyu360.cn/data_processing/common_utils/mongodb"
 )
 
 var (
@@ -66,6 +67,11 @@ func doBiddingTask(gtid, lteid string, mapInfo map[string]interface{}) {
 	log.Info(fmt.Sprintf("over --- %d", count))
 }
 
+func Tbase(tmp map[string]interface{}) {
+
+	taskBase(tmp)
+}
+
 func taskB() {
 	sess := MongoB.GetMgoConn()
 	defer MongoB.DestoryMongoConn(sess)
@@ -175,6 +181,22 @@ func taskBase(tmp map[string]interface{}) {
 					saveM[f] = tmp[f]
 				}
 			}
+		} else if f == "tag_topinformation" {
+
+			if tmp["tag_topinformation"] != nil {
+				tag, _ := tmp["tag_topinformation"].([]interface{})
+				tag_topinformation_arr := util.ObjArrToStringArr(tag)
+				tag_topinformation := ""
+				for k, v := range tag_topinformation_arr {
+					tag_topinformation += v
+					if k != len(tag_topinformation_arr)-1 {
+						tag_topinformation += ","
+					}
+				}
+				saveM["tag_topinformation"] = tag_topinformation
+			} else {
+				saveM[f] = nil
+			}
 		} else {
 			if tmp[f] != nil {
 				if BaseVMap[f] != nil {
@@ -190,6 +212,7 @@ func taskBase(tmp map[string]interface{}) {
 			}
 		}
 	}
+	// fmt.Println(saveM)
 	saveBasePool <- saveM
 	if len(errf) > 0 {
 		saveErrPool <- map[string]interface{}{"infoid": mongodb.BsonIdToSId(tmp["_id"]), "f": strings.Join(errf, ",")}

+ 1 - 1
data_tidb/field-criteria.json

@@ -2,7 +2,7 @@
   "dws_f_bid_baseinfo": {
     "field_array": ["infoid", "area_code", "city_code", "district_code", "budget", "bidamount", "biddiscount", "title", "toptype_code",
       "subtype_code", "projectname", "projectcode", "buyerclass_code", "publishtime", "bidopentime", "comeintime", "isValidFile", "multipackage",
-      "projectscope_id", "detail_id", "href", "purchasing", "site", "updatetime", "createtime", "buyer_id", "agency_id"],
+      "projectscope_id", "detail_id", "href", "purchasing", "site", "updatetime", "createtime", "buyer_id", "agency_id","tag_topinformation"],
     "field_criteria": {
       "budget": {
         "stype": "float",