Browse Source

更新调整oss获取detail

wcc 9 months ago
parent
commit
78aeed32b4
2 changed files with 13 additions and 16 deletions
  1. 12 0
      src/task/task.go
  2. 1 16
      src/task/updatetask.go

+ 12 - 0
src/task/task.go

@@ -2,6 +2,7 @@ package task
 
 import (
 	"bytes"
+	"common_utils/mongodb"
 	"context"
 	"encoding/csv"
 	"encoding/json"
@@ -753,6 +754,17 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
 				}
 				res := map[string]interface{}{}
 				ksmap := make(map[string]map[string][]string)
+				// 针对detail内容,需要从oss 获取
+				if tools.IsOss {
+					id := mongodb.BsonIdToSId(tmp["_id"])
+					val := tools.OssGetObject(id, tools.BucketName)
+					if val == "" {
+						log.Println("获取oss 内容为空", id)
+					} else {
+						tmp["detail"] = val
+					}
+				}
+
 				if util.IntAll(tmp["infoformat"]) == 2 { //此处增加特例
 					res["toptype"] = "拟建"
 					res["subtype"] = "拟建"

+ 1 - 16
src/task/updatetask.go

@@ -1,7 +1,6 @@
 package task
 
 import (
-	"common_utils/mongodb"
 	//"classification"
 	"encoding/json"
 	"fmt"
@@ -287,21 +286,7 @@ func NewClassificationRun(tt *TTask, tmp map[string]interface{}) *tools.SortMap
 							}
 						}
 					} else {
-						//如果配置了OSS 配置
-						if tools.IsOss {
-							// 针对detail内容,需要从oss 获取
-							if f == "detail" {
-								id := mongodb.BsonIdToSId(tmp["_id"])
-								val = tools.OssGetObject(id, tools.BucketName)
-								if val == "" {
-									log.Println("获取oss 内容为空", id)
-								}
-							} else {
-								val = util.ObjToString(tmp[f]) //取识别内容
-							}
-						} else {
-							val = util.ObjToString(tmp[f]) //取识别内容
-						}
+						val = util.ObjToString(tmp[f]) //取识别字段内容
 					}
 					val = PreFilter(val, tt.Task_PreRule) //任务的前置过滤
 					rulval[f] = val                       //整个任务仅过滤一次,将其存储