Browse Source

添加瓦片图处理失败情况

liwei 2 years ago
parent
commit
9e80f22011
2 changed files with 13 additions and 3 deletions
  1. 2 0
      3dshow-supplier/api/asset.go
  2. 11 3
      3dshow-supplier/bus/tileResult.go

+ 2 - 0
3dshow-supplier/api/asset.go

@@ -46,6 +46,8 @@ func regAssetApi(r *GinRouter) {
 		SearchFilter: func(c *gin.Context, apictx *ApiSession, query map[string]interface{}) map[string]interface{} {
 			if query["supplyId"] != nil {
 				query["supplyId"], _ = primitive.ObjectIDFromHex(query["supplyId"].(string))
+			} else {
+				query["supplyId"], _ = primitive.ObjectIDFromHex(apictx.User.Parent)
 			}
 			return query
 		},

+ 11 - 3
3dshow-supplier/bus/tileResult.go

@@ -19,6 +19,7 @@ type TileConvertorResult struct {
 	GroupId    string `json:"groupId"`
 	SourcePath string `json:"sourcePath"`
 	TilePath   string `json:"tilePath"`
+	Error      string `json:"error"`
 }
 
 func CreateTileConvResultWather(app *conf.AppConf) *comm.NatsStreamWather {
@@ -58,7 +59,7 @@ func CreateRepoCtx() *repo.RepoSession {
 
 func RepoTileConvResult(data *TileConvertorResult) error {
 
-	fmt.Println("RepoTileConvResult", data.AssetId, data.GroupId, data.TilePath)
+	fmt.Println("RepoTileConvResult", data.AssetId, data.GroupId, data.TilePath, data.Error)
 
 	asset := &model.Asset360Fake3d{}
 	ok, _ := repo.RepoSeachDoc(CreateRepoCtx(), &repo.DocSearchOptions{
@@ -78,8 +79,15 @@ func RepoTileConvResult(data *TileConvertorResult) error {
 				if len(strs) == 2 {
 					asset.Thumbnail = path.Join(strs[1], "00_00_cover.png")
 				}
-				g.Url = data.TilePath
-				g.State = model.GROUPSTATE_SUCC
+
+				if len(data.Error) > 0 { //有错误
+					g.Url = data.TilePath
+					g.State = model.GROUPSTATE_FAIL
+				} else {
+					g.Url = data.TilePath
+					g.State = model.GROUPSTATE_SUCC
+				}
+				break
 			}
 		}
 	}