|
|
|
@ -6,8 +6,12 @@ import api.Result;
|
|
|
|
|
import api.StatusCode;
|
|
|
|
|
import com.luoo.comment.pojo.*;
|
|
|
|
|
import com.luoo.comment.service.CommentService;
|
|
|
|
|
import constants.Constants;
|
|
|
|
|
import controller.BaseController;
|
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
|
import dto.UserMessageDto;
|
|
|
|
|
import enums.MessageTypeEnum;
|
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
@ -35,6 +39,10 @@ public class CommentController extends BaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private HttpServletRequest request;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RabbitTemplate rabbitTemplate;
|
|
|
|
|
|
|
|
|
|
@GetMapping
|
|
|
|
|
public Result findAll(){
|
|
|
|
|
return Result.success(commentService.findAll());
|
|
|
|
@ -76,6 +84,20 @@ public class CommentController extends BaseController {
|
|
|
|
|
comment.setNickName(userLoginDto.getNickName());
|
|
|
|
|
comment.setLocation(getIpAddr(request));
|
|
|
|
|
commentService.save(comment);
|
|
|
|
|
|
|
|
|
|
// UserInfo userInfo =userInfoService.findById(userId);
|
|
|
|
|
// /**
|
|
|
|
|
// * 向friend发送消息
|
|
|
|
|
// */
|
|
|
|
|
// UserMessageDto userMessageDto = new UserMessageDto();
|
|
|
|
|
// userMessageDto.setType(MessageTypeEnum.FOLLOW.getType()); //消息类型 1私信 ,2新赞,3新关注, 4新评论 5.系统消息
|
|
|
|
|
// userMessageDto.setUserId(friendid);
|
|
|
|
|
// userMessageDto.setContent(userInfo.getNickName()+" 关注了你");
|
|
|
|
|
// userMessageDto.setTitle("您有新的粉丝");
|
|
|
|
|
// userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX+userInfo.getAvatar());
|
|
|
|
|
// userMessageDto.setSendUserId(userid);
|
|
|
|
|
// userMessageDto.setSendUserNickName(userInfo.getNickName());
|
|
|
|
|
// rabbitTemplate.convertAndSend("userMessage",userMessageDto);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|