关于互粉,互关问题
来源:7-9 实现互粉标记显示

我没钱吃饭了
2022-03-27
这个有啥问题,帮我看看
@Override
public PagedGridResult queryMyFans(String myId, Integer page, Integer pageSize) {
IPage<FansVo> fansVoIPage = this.fansMapperCustom.selectJoinPage(new Page<>(page, pageSize), FansVo.class,
new MPJLambdaWrapper<FansVo>()
.selectAs(Users::getId, FansVo::getFanId)
.select(Users::getNickname)
.select(Users::getFace)
.leftJoin(Users.class, Users::getId, Fans::getFanId)
.eq(true, Fans::getVlogerId, myId).orderBy(true, false, Users::getNickname));
// 判断是否互相关注
for (FansVo record : fansVoIPage.getRecords()) {
String isFans = this.redis.get(BaseInfoProperties.REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + myId + ":" + record.getFanId());
record.setFollowed(StringUtils.isNotBlank(isFans) && "1".equalsIgnoreCase(isFans));
}
PagedGridResult pagedGridResult = new PagedGridResult();
pagedGridResult.setRows(fansVoIPage.getRecords());
pagedGridResult.setPage((int) fansVoIPage.getCurrent());
pagedGridResult.setTotal(fansVoIPage.getPages());
pagedGridResult.setRecords(fansVoIPage.getTotal());
return pagedGridResult;
}
互粉之后,退出界面,关注是+1了,但是再次进入我的粉丝界面,还是互粉标识, isFollowed
是 false
写回答
1回答
-
风间影月
2022-03-27
看下逻辑对不对。建议把redis清空了测试。感觉是逻辑问题,之前群里同学也这样。后来就好了~
00
相似问题