|
|
|
@ -18,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/userMessage")
|
|
|
|
@ -60,9 +62,9 @@ public class UserMessageController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取消息分页列表")
|
|
|
|
|
@GetMapping("/list/{page}/{size}")
|
|
|
|
|
public Result list(@PathVariable int page,@PathVariable int size,@RequestHeader(value = "Authorization", required = true) String authorization){
|
|
|
|
|
@ApiOperation(value = "获取消息")
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public Result list(@RequestHeader(value = "Authorization", required = true) String authorization){
|
|
|
|
|
// List list = userMessageService.findByUserId(userId);
|
|
|
|
|
//验证是否登录,并且拿到ID
|
|
|
|
|
UserLoginDto userLoginDto = getUserLoginDto(authorization);
|
|
|
|
@ -70,8 +72,25 @@ public class UserMessageController extends BaseController {
|
|
|
|
|
return Result.unauthorized(null);
|
|
|
|
|
}
|
|
|
|
|
String userId = userLoginDto.getUserId();
|
|
|
|
|
Page<UserMessage> pageList = userMessageService.findSearch(userId,page,size);
|
|
|
|
|
return Result.success(new PageResult<UserMessage>(pageList.getTotalElements(),pageList.getContent()));
|
|
|
|
|
|
|
|
|
|
Map map = new HashMap();
|
|
|
|
|
map.put("comment","");
|
|
|
|
|
map.put("follow","");
|
|
|
|
|
map.put("thumbup","");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 消息类型 消息类型 1私信 ,2新赞,3新关注, 4新评论 5.系统消息
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
UserMessage userMessageComment = userMessageService.findByUseridAndType(userId,MessageTypeEnum.COMMENT.getType());// 评论
|
|
|
|
|
UserMessage userMessageFollow = userMessageService.findByUseridAndType(userId,MessageTypeEnum.FOLLOW.getType());//
|
|
|
|
|
UserMessage userMessageThumbup = userMessageService.findByUseridAndType(userId,MessageTypeEnum.THUMB_UP.getType());//
|
|
|
|
|
map.put("comment",userMessageComment);
|
|
|
|
|
map.put("follow",userMessageFollow);
|
|
|
|
|
map.put("thumbup",userMessageThumbup);
|
|
|
|
|
// Page<UserMessage> pageList = userMessageService.findSearch(userId,page,size);
|
|
|
|
|
// return Result.success(new PageResult<UserMessage>(pageList.getTotalElements(),pageList.getContent()));
|
|
|
|
|
return Result.success(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "更新消息状态为已读")
|
|
|
|
|