|
|
|
@ -3,12 +3,18 @@ package com.luoo.user.controller;
|
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
|
import api.Result;
|
|
|
|
|
import com.luoo.user.pojo.UserInfo;
|
|
|
|
|
import com.luoo.user.service.UserCollectService;
|
|
|
|
|
import com.luoo.user.service.UserInfoService;
|
|
|
|
|
import constants.Constants;
|
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
|
import dto.UserMessageDto;
|
|
|
|
|
import enums.MessageTypeEnum;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import util.JwtUtil;
|
|
|
|
@ -22,6 +28,12 @@ public class UserCollectController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserCollectService userCollectService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserInfoService userInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RabbitTemplate rabbitTemplate;
|
|
|
|
|
|
|
|
|
|
//@ApiOperation(value = "1.喜欢歌曲/收藏期刊/关注/黑名单/点赞")
|
|
|
|
|
@ApiOperation(value = "1.喜欢歌曲/收藏期刊/关注/黑名单")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
@ -36,6 +48,24 @@ public class UserCollectController {
|
|
|
|
|
@VerifyParam(required = true) @RequestParam("collectType") Integer collectType) {
|
|
|
|
|
UserLoginDto loginDto = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
|
userCollectService.saveCollect(loginDto.getUserId(), objectId, collectType);
|
|
|
|
|
|
|
|
|
|
if(collectType==2) {
|
|
|
|
|
|
|
|
|
|
UserInfo userInfo =userInfoService.findById(loginDto.getUserId());
|
|
|
|
|
/**
|
|
|
|
|
* 向friend发送消息
|
|
|
|
|
*/
|
|
|
|
|
UserMessageDto userMessageDto = new UserMessageDto();
|
|
|
|
|
userMessageDto.setType(MessageTypeEnum.FOLLOW.getType()); //消息类型 1私信 ,2新赞,3新关注, 4新评论 5.系统消息
|
|
|
|
|
userMessageDto.setUserId(objectId);
|
|
|
|
|
userMessageDto.setContent(userInfo.getNickName()+" 关注了你");
|
|
|
|
|
userMessageDto.setTitle("您有新的粉丝");
|
|
|
|
|
userMessageDto.setSendUserAvatar(Constants.RESOURCE_PREFIX+userInfo.getAvatar());
|
|
|
|
|
userMessageDto.setSendUserId(userInfo.getId());
|
|
|
|
|
userMessageDto.setSendUserNickName(userInfo.getNickName());
|
|
|
|
|
rabbitTemplate.convertAndSend("userMessage",userMessageDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|