|
|
@@ -8,6 +8,7 @@ import com.happy.Model.*;
|
|
|
import com.happy.Model.weixin.Users;
|
|
|
import com.happy.Until.*;
|
|
|
import com.happy.common.controller.BaseController;
|
|
|
+import com.happy.constant.ConstDefault;
|
|
|
import com.happy.constant.ResultStatusCode;
|
|
|
import com.happy.dto.ArticleCommentDto;
|
|
|
import com.happy.dto.ArticleTweetDto;
|
|
|
@@ -115,7 +116,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
data.setApprove(1);//正在审批
|
|
|
data.setStatus(1);
|
|
|
data.setUserName(user.getUser_name());
|
|
|
- data.setUserPhoto(user.getHeadPhoto());
|
|
|
+ data.setUserPhoto(user.getHeadPhoto() == null ? ConstDefault.DefaultHeadPhoto : user.getHeadPhoto());
|
|
|
int aId = articleTweetService.insert(data);
|
|
|
if (aId <= 0) {
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
@@ -235,14 +236,21 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
if (fileInfoList != null) {
|
|
|
if (fileInfoList.size() > 1) {
|
|
|
result.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
|
|
|
- } else {
|
|
|
- result.setVideo(fileInfoList.get(0).getUrl());
|
|
|
+ } else if (fileInfoList.size() == 1) {
|
|
|
+ String url = fileInfoList.get(0).getUrl();
|
|
|
+ if (!url.endsWith("jpg") && !url.endsWith("png")) {
|
|
|
+ result.setVideo(fileInfoList.get(0).getUrl());
|
|
|
+ } else {
|
|
|
+ List<String> images = new ArrayList<>();
|
|
|
+ images.add(url);
|
|
|
+ result.setImages(images);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.setUserId(data.getUserId());
|
|
|
result.setUserName(data.getUserName());
|
|
|
- result.setUserPhoto(data.getUserPhoto());
|
|
|
+ result.setUserPhoto(data.getUserPhoto() == null ? ConstDefault.DefaultHeadPhoto : data.getUserPhoto());
|
|
|
//region 关注
|
|
|
if (articleTweetDto.getUserId().equals(data.getUserId())) {
|
|
|
result.setIsFollow(2);//自己的推文
|
|
|
@@ -869,7 +877,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
articleComment.setCommentParentId(articleCommentDto.getParentId());
|
|
|
articleComment.setCommentId(articleCommentDto.getUserId());
|
|
|
articleComment.setCommentName(user.getUser_name());
|
|
|
- articleComment.setCommentImage(user.getHeadPhoto());
|
|
|
+ articleComment.setCommentImage(user.getHeadPhoto() == null ? ConstDefault.DefaultHeadPhoto : user.getHeadPhoto());
|
|
|
articleComment.setContent(articleCommentDto.getContent());
|
|
|
articleComment.setCreateId(articleCommentDto.getUserId());
|
|
|
articleComment.setCreateDate(now);
|
|
|
@@ -988,7 +996,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
data.setArticleId(articleTweetDto.getId());
|
|
|
data.setLikeId(articleTweetDto.getUserId());
|
|
|
data.setLikeName(user.getUser_name());
|
|
|
- data.setLikeImage(user.getHeadPhoto());
|
|
|
+ data.setLikeImage(user.getHeadPhoto() == null ? ConstDefault.DefaultHeadPhoto : user.getHeadPhoto());
|
|
|
data.setIsLose(0);
|
|
|
data.setCreateId(articleTweetDto.getUserId());
|
|
|
data.setCreateDate(now);
|