重复喜欢,需要幂等
This commit is contained in:
parent
2195eaad01
commit
2a0c46100a
|
|
@ -29,6 +29,14 @@ public class TbUserFollowAppController {
|
|||
@ApiOperation(value = "关注用户", httpMethod = "POST")
|
||||
public Result<String> addSave(@RequestBody TbUserFollow tbUserFollow)
|
||||
{
|
||||
// 判断是否已经关注了对方
|
||||
long count = tbUserFollowService.lambdaQuery()
|
||||
.eq(TbUserFollow::getFollowUserId, tbUserFollow.getFollowUserId())
|
||||
.eq(TbUserFollow::getUserId, tbUserFollow.getUserId())
|
||||
.count();
|
||||
if(count > 0){
|
||||
return Result.success("重复关注,忽略");
|
||||
}
|
||||
// 判断用户是否也关注自己
|
||||
TbUserFollow followUser = tbUserFollowService.lambdaQuery()
|
||||
.eq(TbUserFollow::getFollowUserId, tbUserFollow.getUserId())
|
||||
|
|
|
|||
Loading…
Reference in New Issue