|
|
@@ -501,6 +501,49 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
+ articleTweetService.delArticleFile(articleTweetDto.getId());
|
|
|
+ //添加附件
|
|
|
+ List<String> fileStr = new ArrayList<>();
|
|
|
+ if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0) {
|
|
|
+ fileStr = articleTweetDto.getImages();
|
|
|
+ }
|
|
|
+ List<String> fileStrVideo = new ArrayList<>();
|
|
|
+ if (articleTweetDto.getVideo() != null && articleTweetDto.getVideo().length() > 0) {
|
|
|
+ fileStrVideo.add(articleTweetDto.getVideo());
|
|
|
+ }
|
|
|
+ List<ArticleFileInfo> afis = new ArrayList<>();
|
|
|
+ for (String f : fileStr) {
|
|
|
+ String[] split = f.split("/");
|
|
|
+ String fileName = split[split.length - 1];
|
|
|
+ ArticleFileInfo afi = new ArticleFileInfo();
|
|
|
+ afi.setLinkId(aId);
|
|
|
+ afi.setName(fileName);
|
|
|
+ afi.setType(1);
|
|
|
+ afi.setUrl(f);
|
|
|
+ afi.setCreateDate(now);
|
|
|
+ afi.setFileType(1);
|
|
|
+ afis.add(afi);
|
|
|
+ }
|
|
|
+ for (String f : fileStrVideo) {
|
|
|
+ String[] split = f.split("/");
|
|
|
+ String fileName = split[split.length - 1];
|
|
|
+ ArticleFileInfo afi = new ArticleFileInfo();
|
|
|
+ afi.setLinkId(aId);
|
|
|
+ afi.setName(fileName);
|
|
|
+ afi.setType(1);
|
|
|
+ afi.setUrl(f);
|
|
|
+ afi.setCreateDate(now);
|
|
|
+ afi.setFileType(2);
|
|
|
+ afis.add(afi);
|
|
|
+ }
|
|
|
+ int length = articleTweetService.insertArticleFileBatch(afis);
|
|
|
+ if (length <= 0) {
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
+ put("message", "推文附件新增失败");
|
|
|
+ put("code", 500);
|
|
|
+ }}.toString());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
System.out.println("推文发布异常:" + e.getMessage());
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|