ソースを参照

wip:交付地点

wangshan 9 ヶ月 前
コミット
10a0fe273f
1 ファイル変更25 行追加1 行削除
  1. 25 1
      jy_publishing/tool/task.go

+ 25 - 1
jy_publishing/tool/task.go

@@ -15,6 +15,7 @@ import (
 	util "jygit.jydev.jianyu360.cn/data_processing/common_utils"
 	"jygit.jydev.jianyu360.cn/data_processing/common_utils/mongodb"
 	"jygit.jydev.jianyu360.cn/data_processing/common_utils/udp"
+	"log"
 	"net"
 	"regexp"
 	"strconv"
@@ -25,7 +26,7 @@ import (
 var (
 	JyUrl      = "https://www.jianyu360.cn/article/content/%s.html"
 	InfoFields = []string{"title", "project_code", "province", "city", "industry", "buyer", "budget", "winner", "amount",
-		"detail", "attch", "contact_person", "contact_phone", "attach", "discern_attach", "type", "recommended_service"}
+		"detail", "attch", "contact_person", "contact_phone", "attach", "discern_attach", "type", "recommended_service", "deliveryAddress"}
 )
 
 var SaveFields = map[string]string{
@@ -200,6 +201,13 @@ func AttsMethod(att map[string]interface{}) (*pb.FileResponse, error) {
 	return rep, nil
 }
 
+type DeliveryAddress struct {
+	Area        string `json:"area"`
+	City        string `json:"city"`
+	Districts   string `json:"districts "`
+	DetailsAddr string `json:"detailsAddr"`
+}
+
 // @Description 信息发布
 // @Author J 2022/4/12 1:57 PM
 func InfoPub(info map[string]interface{}) {
@@ -211,6 +219,22 @@ func InfoPub(info map[string]interface{}) {
 		if tmp[f] == nil {
 			continue
 		}
+		switch f {
+		case "deliveryAddress":
+			b, err := json.Marshal(tmp[f])
+			if err == nil && len(b) > 0 {
+				var da = DeliveryAddress{}
+				err = json.Unmarshal(b, &da)
+				if err == nil && da.Area != "" {
+					saveMap["deliver_area"] = da.Area
+					saveMap["deliver_city"] = da.City
+					saveMap["deliver_district"] = da.Districts
+					saveMap["deliver_detail"] = da.DetailsAddr
+				}
+				log.Println("deliveryAddress  info :", da)
+			}
+			log.Println("deliveryAddress  err :", err)
+		}
 		if f == "budget" || f == "amount" {
 			saveMap[SaveFields[f]] = util.Float64All(tmp[f])
 			jyMap[f] = util.Float64All(tmp[f])