|
@@ -3,6 +3,7 @@ package util
|
|
|
import (
|
|
|
"JySEPlatform/models"
|
|
|
sql "JySEPlatform/sqlmodel"
|
|
|
+ "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
@@ -223,46 +224,46 @@ func UtilEsFind1(tags map[string]interface{}) (error, int64) {
|
|
|
}
|
|
|
}
|
|
|
//匹配公告附件
|
|
|
- //info, _ := MgoBidding.FindOne("bidding", bson.M{"_id": mongodb.StringTOBsonId(info_id)})
|
|
|
- //if info != nil {
|
|
|
- // log.Println("匹配附件, id-", item["info_id"])
|
|
|
- // if (*info)["projectinfo"] != nil {
|
|
|
- // projectInfo := qu.ObjToMap((*info)["projectinfo"])
|
|
|
- // if projectInfo != nil && len(*projectInfo) > 0 {
|
|
|
- // if (*projectInfo)["attachments"] != nil {
|
|
|
- // filesArr := []map[string]interface{}{}
|
|
|
- // fileUrl := qu.ObjToString(Sysconfig["file_downloadurl"])
|
|
|
- // if attachments, oks := (*projectInfo)["attachments"].(map[string]interface{}); oks {
|
|
|
- // for _, v := range attachments {
|
|
|
- // if atta, ok := v.(map[string]interface{}); ok {
|
|
|
- // if atta["fid"] != nil && qu.ObjToString(atta["fid"]) != "" {
|
|
|
- // fileMap := map[string]interface{}{
|
|
|
- // "filename": atta["filename"],
|
|
|
- // "url": fileUrl + qu.ObjToString(atta["fid"]),
|
|
|
- // }
|
|
|
- // filesArr = append(filesArr, fileMap)
|
|
|
- // } else {
|
|
|
- // if atta["org_url"] != nil {
|
|
|
- // fileMap := map[string]interface{}{
|
|
|
- // "filename": atta["filename"],
|
|
|
- // "url": qu.ObjToString(atta["org_url"]),
|
|
|
- // }
|
|
|
- // filesArr = append(filesArr, fileMap)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // log.Println("查询附件结果:", info_id, "附件数量:", len(filesArr))
|
|
|
- // if len(filesArr) > 0 {
|
|
|
- // item["filehref"] = filesArr
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- //} else {
|
|
|
- // log.Println("id", item["info_id"], "bidding为空")
|
|
|
- //}
|
|
|
+ info, _ := MgoBidding.FindOne("bidding", bson.M{"_id": mongodb.StringTOBsonId(info_id)})
|
|
|
+ if info != nil {
|
|
|
+ log.Println("匹配附件, id-", item["info_id"])
|
|
|
+ if (*info)["projectinfo"] != nil {
|
|
|
+ projectInfo := qu.ObjToMap((*info)["projectinfo"])
|
|
|
+ if projectInfo != nil && len(*projectInfo) > 0 {
|
|
|
+ if (*projectInfo)["attachments"] != nil {
|
|
|
+ filesArr := []map[string]interface{}{}
|
|
|
+ fileUrl := qu.ObjToString(Sysconfig["file_downloadurl"])
|
|
|
+ if attachments, oks := (*projectInfo)["attachments"].(map[string]interface{}); oks {
|
|
|
+ for _, v := range attachments {
|
|
|
+ if atta, ok := v.(map[string]interface{}); ok {
|
|
|
+ if atta["fid"] != nil && qu.ObjToString(atta["fid"]) != "" {
|
|
|
+ fileMap := map[string]interface{}{
|
|
|
+ "filename": atta["filename"],
|
|
|
+ "url": fileUrl + qu.ObjToString(atta["fid"]),
|
|
|
+ }
|
|
|
+ filesArr = append(filesArr, fileMap)
|
|
|
+ } else {
|
|
|
+ if atta["org_url"] != nil {
|
|
|
+ fileMap := map[string]interface{}{
|
|
|
+ "filename": atta["filename"],
|
|
|
+ "url": qu.ObjToString(atta["org_url"]),
|
|
|
+ }
|
|
|
+ filesArr = append(filesArr, fileMap)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.Println("查询附件结果:", info_id, "附件数量:", len(filesArr))
|
|
|
+ if len(filesArr) > 0 {
|
|
|
+ item["filehref"] = filesArr
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.Println("id", item["info_id"], "bidding为空")
|
|
|
+ }
|
|
|
//项目id
|
|
|
//projectId := GetProjectId(info_id)
|
|
|
//if projectId != "" {
|