123
This commit is contained in:
@@ -102,6 +102,14 @@ public class UserController extends BaseController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/logout")
|
||||||
|
@SaCheckPermission("cai:user:lock")
|
||||||
|
@Log(title = "强制APP退出登录", businessType = BusinessType.UPDATE)
|
||||||
|
public R<Void> logout(@RequestBody IdReq res){
|
||||||
|
userService.logout(res.getId());
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户详细信息
|
* 获取用户详细信息
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class ChatManager {
|
|||||||
private AccountService accountService;
|
private AccountService accountService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserForbidManager userForbidManager;
|
private UserForbidManager userForbidManager;
|
||||||
|
@Autowired
|
||||||
|
private UserBlacklistService userBlacklistService;
|
||||||
|
|
||||||
private String setWsToken(Long roomId,Long fromUid,Long toUid,Long userId){
|
private String setWsToken(Long roomId,Long fromUid,Long toUid,Long userId){
|
||||||
String token = IdManager.nextIdStr();
|
String token = IdManager.nextIdStr();
|
||||||
@@ -116,6 +118,10 @@ public class ChatManager {
|
|||||||
if(coin < anchor.getPrice()*2){
|
if(coin < anchor.getPrice()*2){
|
||||||
throw new ServiceException("您的余额不足,请充值");
|
throw new ServiceException("您的余额不足,请充值");
|
||||||
}
|
}
|
||||||
|
Boolean b = userBlacklistService.checkBlack(toUser.getId(), fromUser.getId());
|
||||||
|
if(b){
|
||||||
|
throw new ServiceException("对方拒绝接听");
|
||||||
|
}
|
||||||
Long roomId = null;
|
Long roomId = null;
|
||||||
Room room = webSocketManager.checkOnlineRoom(fromUser.getId(), toUser.getId());
|
Room room = webSocketManager.checkOnlineRoom(fromUser.getId(), toUser.getId());
|
||||||
if(room == null){
|
if(room == null){
|
||||||
|
|||||||
@@ -32,4 +32,6 @@ public class AnchorAdminVo extends Anchor {
|
|||||||
|
|
||||||
private Long cityId;
|
private Long cityId;
|
||||||
private String city;
|
private String city;
|
||||||
|
|
||||||
|
private Integer onlineStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import java.time.LocalDateTime;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UserAdminVo extends User {
|
public class UserAdminVo extends User {
|
||||||
|
|
||||||
|
private Integer onlineStatus;
|
||||||
/**
|
/**
|
||||||
* 最后登录IP
|
* 最后登录IP
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ import com.ruoyi.cai.manager.SystemConfigManager;
|
|||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.yunxin.client.ImUserClient;
|
import com.ruoyi.yunxin.client.ImUserClient;
|
||||||
import com.ruoyi.yunxin.client.ImUserRefClient;
|
import com.ruoyi.yunxin.client.ImUserRefClient;
|
||||||
import com.ruoyi.yunxin.req.BlockReq;
|
import com.ruoyi.yunxin.req.*;
|
||||||
import com.ruoyi.yunxin.req.MuteModuleReq;
|
|
||||||
import com.ruoyi.yunxin.req.UnblockReq;
|
|
||||||
import com.ruoyi.yunxin.req.UpdateUinfoReq;
|
|
||||||
import com.ruoyi.yunxin.resp.YxCommonR;
|
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -27,6 +24,24 @@ public class ImManager {
|
|||||||
@Resource
|
@Resource
|
||||||
private ImUserClient imUserClient;
|
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){
|
public boolean enSpeck(Long userId){
|
||||||
MuteModuleReq req = new MuteModuleReq();
|
MuteModuleReq req = new MuteModuleReq();
|
||||||
req.setMuteP2P(false);
|
req.setMuteP2P(false);
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class HomeManager {
|
|||||||
AnchorListQuery query = new AnchorListQuery();
|
AnchorListQuery query = new AnchorListQuery();
|
||||||
// 0-默认查询 1-活跃查询 2-新人查询 3-同城查询
|
// 0-默认查询 1-活跃查询 2-新人查询 3-同城查询
|
||||||
query.setType(1);
|
query.setType(1);
|
||||||
|
query.setOnlineStatus(1);
|
||||||
query.setOpenVideoStatus(1);
|
query.setOpenVideoStatus(1);
|
||||||
Page<AnchorListVo> app = anchorService.pageApp(pageQuery, query);
|
Page<AnchorListVo> app = anchorService.pageApp(pageQuery, query);
|
||||||
List<AnchorListVo> records = app.getRecords();
|
List<AnchorListVo> records = app.getRecords();
|
||||||
@@ -84,6 +85,7 @@ public class HomeManager {
|
|||||||
AnchorListQuery query = new AnchorListQuery();
|
AnchorListQuery query = new AnchorListQuery();
|
||||||
// 0-默认查询 1-活跃查询 2-新人查询 3-同城查询
|
// 0-默认查询 1-活跃查询 2-新人查询 3-同城查询
|
||||||
query.setType(2);
|
query.setType(2);
|
||||||
|
query.setOnlineStatus(1);
|
||||||
query.setOpenVideoStatus(1);
|
query.setOpenVideoStatus(1);
|
||||||
Page<AnchorListVo> app = anchorService.pageApp(pageQuery, query);
|
Page<AnchorListVo> app = anchorService.pageApp(pageQuery, query);
|
||||||
List<AnchorListVo> records = app.getRecords();
|
List<AnchorListVo> records = app.getRecords();
|
||||||
@@ -122,6 +124,8 @@ public class HomeManager {
|
|||||||
List<AnchorListVo> result = vos.subList(startIndex, endIndex);
|
List<AnchorListVo> result = vos.subList(startIndex, endIndex);
|
||||||
if(anchorListQueryTypeEnum == AnchorListQueryTypeEnum.DEFAULT && pageNum == 1){
|
if(anchorListQueryTypeEnum == AnchorListQueryTypeEnum.DEFAULT && pageNum == 1){
|
||||||
List<AnchorListVo> list = getAnchorTopList();
|
List<AnchorListVo> list = getAnchorTopList();
|
||||||
|
Collections.shuffle(list);
|
||||||
|
list = list.subList(0,Math.min(4,list.size()));
|
||||||
if(CollectionUtils.isNotEmpty(list)){
|
if(CollectionUtils.isNotEmpty(list)){
|
||||||
List<Long> topUserIds = list.stream().map(AnchorListVo::getUserId).collect(Collectors.toList());
|
List<Long> topUserIds = list.stream().map(AnchorListVo::getUserId).collect(Collectors.toList());
|
||||||
result = result.stream().filter(anchorListVo -> !topUserIds.contains(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 noSpeckIm(Long userId);
|
||||||
|
|
||||||
void enSpeckIm(Long userId);
|
void enSpeckIm(Long userId);
|
||||||
|
|
||||||
|
void logout(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,6 @@ public class AnchorTopServiceImpl extends ServiceImpl<AnchorTopMapper,AnchorTop>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AnchorListVo> anchorTop(int limit) {
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.cai.domain.UserBlacklist;
|
import com.ruoyi.cai.domain.UserBlacklist;
|
||||||
import com.ruoyi.cai.dto.app.vo.user.UserListVo;
|
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.mapper.UserBlacklistMapper;
|
||||||
import com.ruoyi.cai.service.UserBlacklistService;
|
import com.ruoyi.cai.service.UserBlacklistService;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,6 +23,8 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class UserBlacklistServiceImpl extends ServiceImpl<UserBlacklistMapper, UserBlacklist> implements UserBlacklistService {
|
public class UserBlacklistServiceImpl extends ServiceImpl<UserBlacklistMapper, UserBlacklist> implements UserBlacklistService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ImManager imManager;
|
||||||
@Override
|
@Override
|
||||||
public boolean existsBlack(Long userId,Long blackUserId){
|
public boolean existsBlack(Long userId,Long blackUserId){
|
||||||
return this.exists(Wrappers.lambdaQuery(UserBlacklist.class)
|
return this.exists(Wrappers.lambdaQuery(UserBlacklist.class)
|
||||||
@@ -42,10 +47,16 @@ public class UserBlacklistServiceImpl extends ServiceImpl<UserBlacklistMapper, U
|
|||||||
userBlacklist.setBlackUid(blackUserId);
|
userBlacklist.setBlackUid(blackUserId);
|
||||||
this.save(userBlacklist);
|
this.save(userBlacklist);
|
||||||
}
|
}
|
||||||
|
ExecutorConstant.COMMON_EXECUTOR.execute(() -> {
|
||||||
|
imManager.blockUser(userId,blackUserId);
|
||||||
|
});
|
||||||
}else { // 取消拉黑
|
}else { // 取消拉黑
|
||||||
this.remove(Wrappers.lambdaQuery(UserBlacklist.class)
|
this.remove(Wrappers.lambdaQuery(UserBlacklist.class)
|
||||||
.eq(UserBlacklist::getUserId,userId)
|
.eq(UserBlacklist::getUserId,userId)
|
||||||
.eq(UserBlacklist::getBlackUid,blackUserId));
|
.eq(UserBlacklist::getBlackUid,blackUserId));
|
||||||
|
ExecutorConstant.COMMON_EXECUTOR.execute(() -> {
|
||||||
|
imManager.unBlockUser(userId,blackUserId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return true;
|
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>
|
</update>
|
||||||
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.AnchorAdminVo">
|
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.AnchorAdminVo">
|
||||||
select
|
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
|
from cai_anchor t1
|
||||||
left join cai_user t2 on t1.user_id = t2.id
|
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>
|
<where>
|
||||||
<if test="bo.mobile != null and bo.mobile != ''">
|
<if test="bo.mobile != null and bo.mobile != ''">
|
||||||
and t2.mobile = #{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 != ''">
|
<if test="bo.usercode != null and bo.usercode != ''">
|
||||||
and t2.usercode = #{bo.usercode}
|
and t2.usercode = #{bo.usercode}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="bo.onlineStatus != null">
|
||||||
|
and t3.status = #{bo.onlineStatus}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by t1.create_time desc
|
order by t1.create_time desc
|
||||||
</select>
|
</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 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,
|
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
|
from cai_user t1
|
||||||
left join cai_user_info t2 on t1.id = t2.user_id
|
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 t3 on t1.invite_id = t3.id
|
||||||
|
left join cai_user_online t4 on t1.id = t4.user_id
|
||||||
<where>
|
<where>
|
||||||
|
<if test="query.onlineStatus != null">
|
||||||
|
and t4.status = #{query.onlineStatus}
|
||||||
|
</if>
|
||||||
<if test="query.lastLoginIp != null">
|
<if test="query.lastLoginIp != null">
|
||||||
and t2.last_login_ip = #{query.lastLoginIp}
|
and t2.last_login_ip = #{query.lastLoginIp}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.dtflys.forest.annotation.Post;
|
|||||||
import com.ruoyi.yunxin.interceptor.GlodonTokenInterceptor;
|
import com.ruoyi.yunxin.interceptor.GlodonTokenInterceptor;
|
||||||
import com.ruoyi.yunxin.req.CreateUserReq;
|
import com.ruoyi.yunxin.req.CreateUserReq;
|
||||||
import com.ruoyi.yunxin.req.GetUnifoReq;
|
import com.ruoyi.yunxin.req.GetUnifoReq;
|
||||||
|
import com.ruoyi.yunxin.req.SetSpecialRelationReq;
|
||||||
import com.ruoyi.yunxin.req.UpdateUinfoReq;
|
import com.ruoyi.yunxin.req.UpdateUinfoReq;
|
||||||
import com.ruoyi.yunxin.resp.YxCommonR;
|
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||||
import com.ruoyi.yunxin.resp.YxInfoR;
|
import com.ruoyi.yunxin.resp.YxInfoR;
|
||||||
@@ -20,4 +21,9 @@ public interface ImUserRefClient {
|
|||||||
|
|
||||||
@Post(url = "nimserver/user/getUinfos.action")
|
@Post(url = "nimserver/user/getUinfos.action")
|
||||||
YxUpdateUinfoR getUinfos(@Body GetUnifoReq query);
|
YxUpdateUinfoR getUinfos(@Body GetUnifoReq query);
|
||||||
|
|
||||||
|
@Post(url = "nimserver/user/setSpecialRelation.action")
|
||||||
|
YxCommonR setSpecialRelation(@Body SetSpecialRelationReq query);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,5 @@ public class YunxinManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ruoyi.yunxin.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SetSpecialRelationReq {
|
||||||
|
private String accid;
|
||||||
|
private String targetAcc;
|
||||||
|
private Integer relationType = 1;
|
||||||
|
// 0 取消拉黑或静音;1 加入黑名单或静音
|
||||||
|
private Integer value;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user