123
This commit is contained in:
@@ -57,6 +57,8 @@ public class ChatManager {
|
||||
private AccountService accountService;
|
||||
@Autowired
|
||||
private UserForbidManager userForbidManager;
|
||||
@Autowired
|
||||
private UserBlacklistService userBlacklistService;
|
||||
|
||||
private String setWsToken(Long roomId,Long fromUid,Long toUid,Long userId){
|
||||
String token = IdManager.nextIdStr();
|
||||
@@ -116,6 +118,10 @@ public class ChatManager {
|
||||
if(coin < anchor.getPrice()*2){
|
||||
throw new ServiceException("您的余额不足,请充值");
|
||||
}
|
||||
Boolean b = userBlacklistService.checkBlack(toUser.getId(), fromUser.getId());
|
||||
if(b){
|
||||
throw new ServiceException("对方拒绝接听");
|
||||
}
|
||||
Long roomId = null;
|
||||
Room room = webSocketManager.checkOnlineRoom(fromUser.getId(), toUser.getId());
|
||||
if(room == null){
|
||||
|
||||
@@ -32,4 +32,6 @@ public class AnchorAdminVo extends Anchor {
|
||||
|
||||
private Long cityId;
|
||||
private String city;
|
||||
|
||||
private Integer onlineStatus;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UserAdminVo extends User {
|
||||
|
||||
private Integer onlineStatus;
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
|
||||
@@ -6,10 +6,7 @@ import com.ruoyi.cai.manager.SystemConfigManager;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.yunxin.client.ImUserClient;
|
||||
import com.ruoyi.yunxin.client.ImUserRefClient;
|
||||
import com.ruoyi.yunxin.req.BlockReq;
|
||||
import com.ruoyi.yunxin.req.MuteModuleReq;
|
||||
import com.ruoyi.yunxin.req.UnblockReq;
|
||||
import com.ruoyi.yunxin.req.UpdateUinfoReq;
|
||||
import com.ruoyi.yunxin.req.*;
|
||||
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -27,6 +24,24 @@ public class ImManager {
|
||||
@Resource
|
||||
private ImUserClient imUserClient;
|
||||
|
||||
public boolean blockUser(Long userId,Long blackUserId){
|
||||
SetSpecialRelationReq req = new SetSpecialRelationReq();
|
||||
req.setAccid(userId+"");
|
||||
req.setTargetAcc(blackUserId+"");
|
||||
req.setValue(1);
|
||||
YxCommonR res = userRefClient.setSpecialRelation(req);
|
||||
return res != null && res.isSuccess();
|
||||
}
|
||||
|
||||
public boolean unBlockUser(Long userId,Long blackUserId){
|
||||
SetSpecialRelationReq req = new SetSpecialRelationReq();
|
||||
req.setAccid(userId+"");
|
||||
req.setTargetAcc(blackUserId+"");
|
||||
req.setValue(0);
|
||||
YxCommonR res = userRefClient.setSpecialRelation(req);
|
||||
return res != null && res.isSuccess();
|
||||
}
|
||||
|
||||
public boolean enSpeck(Long userId){
|
||||
MuteModuleReq req = new MuteModuleReq();
|
||||
req.setMuteP2P(false);
|
||||
|
||||
@@ -70,6 +70,7 @@ public class HomeManager {
|
||||
AnchorListQuery query = new AnchorListQuery();
|
||||
// 0-默认查询 1-活跃查询 2-新人查询 3-同城查询
|
||||
query.setType(1);
|
||||
query.setOnlineStatus(1);
|
||||
query.setOpenVideoStatus(1);
|
||||
Page<AnchorListVo> app = anchorService.pageApp(pageQuery, query);
|
||||
List<AnchorListVo> records = app.getRecords();
|
||||
@@ -84,6 +85,7 @@ public class HomeManager {
|
||||
AnchorListQuery query = new AnchorListQuery();
|
||||
// 0-默认查询 1-活跃查询 2-新人查询 3-同城查询
|
||||
query.setType(2);
|
||||
query.setOnlineStatus(1);
|
||||
query.setOpenVideoStatus(1);
|
||||
Page<AnchorListVo> app = anchorService.pageApp(pageQuery, query);
|
||||
List<AnchorListVo> records = app.getRecords();
|
||||
@@ -122,6 +124,8 @@ public class HomeManager {
|
||||
List<AnchorListVo> result = vos.subList(startIndex, endIndex);
|
||||
if(anchorListQueryTypeEnum == AnchorListQueryTypeEnum.DEFAULT && pageNum == 1){
|
||||
List<AnchorListVo> list = getAnchorTopList();
|
||||
Collections.shuffle(list);
|
||||
list = list.subList(0,Math.min(4,list.size()));
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
List<Long> topUserIds = list.stream().map(AnchorListVo::getUserId).collect(Collectors.toList());
|
||||
result = result.stream().filter(anchorListVo -> !topUserIds.contains(anchorListVo.getUserId())).collect(Collectors.toList());
|
||||
|
||||
@@ -59,4 +59,6 @@ public interface UserService extends IService<User> {
|
||||
void noSpeckIm(Long userId);
|
||||
|
||||
void enSpeckIm(Long userId);
|
||||
|
||||
void logout(Long id);
|
||||
}
|
||||
|
||||
@@ -89,6 +89,6 @@ public class AnchorTopServiceImpl extends ServiceImpl<AnchorTopMapper,AnchorTop>
|
||||
|
||||
@Override
|
||||
public List<AnchorListVo> anchorTop(int limit) {
|
||||
return baseMapper.anchorTop(limit);
|
||||
return baseMapper.anchorTop(150);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cai.domain.UserBlacklist;
|
||||
import com.ruoyi.cai.dto.app.vo.user.UserListVo;
|
||||
import com.ruoyi.cai.executor.ExecutorConstant;
|
||||
import com.ruoyi.cai.im.ImManager;
|
||||
import com.ruoyi.cai.mapper.UserBlacklistMapper;
|
||||
import com.ruoyi.cai.service.UserBlacklistService;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -20,6 +23,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class UserBlacklistServiceImpl extends ServiceImpl<UserBlacklistMapper, UserBlacklist> implements UserBlacklistService {
|
||||
|
||||
@Autowired
|
||||
private ImManager imManager;
|
||||
@Override
|
||||
public boolean existsBlack(Long userId,Long blackUserId){
|
||||
return this.exists(Wrappers.lambdaQuery(UserBlacklist.class)
|
||||
@@ -42,10 +47,16 @@ public class UserBlacklistServiceImpl extends ServiceImpl<UserBlacklistMapper, U
|
||||
userBlacklist.setBlackUid(blackUserId);
|
||||
this.save(userBlacklist);
|
||||
}
|
||||
ExecutorConstant.COMMON_EXECUTOR.execute(() -> {
|
||||
imManager.blockUser(userId,blackUserId);
|
||||
});
|
||||
}else { // 取消拉黑
|
||||
this.remove(Wrappers.lambdaQuery(UserBlacklist.class)
|
||||
.eq(UserBlacklist::getUserId,userId)
|
||||
.eq(UserBlacklist::getBlackUid,blackUserId));
|
||||
ExecutorConstant.COMMON_EXECUTOR.execute(() -> {
|
||||
imManager.unBlockUser(userId,blackUserId);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -432,4 +432,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logout(Long id) {
|
||||
LoginHelper.logoutApp(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,9 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.AnchorAdminVo">
|
||||
select
|
||||
t1.*,t2.age,t2.avatar,t2.usercode,t2.nickname,t2.mobile,t2.gender,t2.age,t2.city
|
||||
t1.*,t2.age,t2.avatar,t2.usercode,t2.nickname,t2.mobile,t2.gender,t2.age,t2.city,
|
||||
t3.status as online_status
|
||||
from cai_anchor t1
|
||||
left join cai_user t2 on t1.user_id = t2.id
|
||||
left join cai_user_online t3 on t1.user_id = t3.user_id
|
||||
<where>
|
||||
<if test="bo.mobile != null and bo.mobile != ''">
|
||||
and t2.mobile = #{bo.mobile}
|
||||
@@ -38,6 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="bo.usercode != null and bo.usercode != ''">
|
||||
and t2.usercode = #{bo.usercode}
|
||||
</if>
|
||||
<if test="bo.onlineStatus != null">
|
||||
and t3.status = #{bo.onlineStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
|
||||
@@ -6,11 +6,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.UserAdminVo">
|
||||
select t1.*,t2.last_login_ip,t2.last_login_time,t2.reg_ip,t2.reg_time,
|
||||
t3.usercode as invite_usercode, t3.nickname as invite_nickname, t3.avatar as invite_avatar
|
||||
t3.usercode as invite_usercode, t3.nickname as invite_nickname, t3.avatar as invite_avatar,
|
||||
t4.status as online_status
|
||||
from cai_user t1
|
||||
left join cai_user_info t2 on t1.id = t2.user_id
|
||||
left join cai_user t3 on t1.invite_id = t3.id
|
||||
left join cai_user_online t4 on t1.id = t4.user_id
|
||||
<where>
|
||||
<if test="query.onlineStatus != null">
|
||||
and t4.status = #{query.onlineStatus}
|
||||
</if>
|
||||
<if test="query.lastLoginIp != null">
|
||||
and t2.last_login_ip = #{query.lastLoginIp}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user