|
@@ -483,14 +483,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_7004);
|
|
|
}
|
|
|
JSONObject jsonObject = JSON.parseObject(hotData);
|
|
|
- JSONArray media = jsonObject.getJSONArray("media");
|
|
|
- media.stream().forEach(v->{
|
|
|
- JSONObject o = (JSONObject) v;
|
|
|
- String type = o.getString("type");
|
|
|
- if(StrUtil.isNotEmpty(type) && type.equals("link")){
|
|
|
- linkSids.add(sid);
|
|
|
- }
|
|
|
- });
|
|
|
+ String type = jsonObject.getString("type");
|
|
|
+ if("link".equals(type)){
|
|
|
+ linkSids.add(sid);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//如果是修改,且由多媒体改成link的方式,将原有的多媒体文件删除
|
|
@@ -548,16 +544,42 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
deleteFileList.add(bgmSrc);
|
|
|
}
|
|
|
|
|
|
- //删除图片、视频
|
|
|
- JSONArray media = jsonObject.getJSONArray("media");
|
|
|
- media.stream().forEach(v->{
|
|
|
- JSONObject o = (JSONObject) v;
|
|
|
- String src = o.getString("src");
|
|
|
- String type = o.getString("type");
|
|
|
- if(StrUtil.isNotEmpty(src) && !type.equals("link")){
|
|
|
- deleteFileList.add(src);
|
|
|
+ String type = jsonObject.getString("type");
|
|
|
+
|
|
|
+ if("media".equals(type)){//V4.13.0版本改成这种方式
|
|
|
+ //删除图片、视频
|
|
|
+ JSONArray media = jsonObject.getJSONArray("media");
|
|
|
+ media.stream().forEach(v->{
|
|
|
+ JSONObject o = (JSONObject) v;
|
|
|
+ String src = o.getString("src");
|
|
|
+ if(StrUtil.isNotEmpty(src)){
|
|
|
+ deleteFileList.add(src);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /* v4.12版本之前是这种方式
|
|
|
+ "media": {
|
|
|
+ "image": [
|
|
|
+ {
|
|
|
+ "src": "FfRdi413774.jpg"
|
|
|
}
|
|
|
- });
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "type": "image"
|
|
|
+ */
|
|
|
+ if("image".equals(type) || "audio".equals(type) || "video".equals(type)){
|
|
|
+ //删除图片、视频
|
|
|
+ JSONObject media = jsonObject.getJSONObject("media");
|
|
|
+ JSONArray jsonArray = media.getJSONArray(type);
|
|
|
+ jsonArray.stream().forEach(v->{
|
|
|
+ JSONObject o = (JSONObject) v;
|
|
|
+ String src = o.getString("src");
|
|
|
+ if(StrUtil.isNotEmpty(src)){
|
|
|
+ deleteFileList.add(src);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if(CollUtil.isEmpty(deleteFileList)){
|