Commit 8ff4dadd by giaogiao

增加接口: 允许客户端修改是否单向隐藏会话

parent 68a1456a
......@@ -56,10 +56,10 @@ public class ImConversationController extends BaseController {
/**
* 修改是否单向隐藏会话
*/
@PostMapping("/display")
@PostMapping("/displayUpdate")
@ApiOperation(value = "修改是否单向隐藏会话", notes = "云端聊天记录不删除;假设有A和B两个用户,A删会话,B还能发; 如果B发了消息,A这边要重新把会话显示出来,并能显示之前的聊天记录")
public ApiResult<Boolean> displayConversation(@RequestBody ImConversationDisplayUpdate imConversationDisplayUpdate) throws Exception {
boolean flag = imConversationService.displayConversation(imConversationDisplayUpdate);
public ApiResult<Boolean> updateDisplayConversation(@RequestBody ImConversationDisplayUpdate imConversationDisplayUpdate) throws Exception {
boolean flag = imConversationService.updateDisplayConversation(imConversationDisplayUpdate);
return ApiResult.result(flag);
}
......
......@@ -42,9 +42,9 @@ public class WsReadHandler extends SimpleChannelInboundHandler<TextWebSocketFram
* io密集型任务配置尽可能多的线程数量
*/
private final static ExecutorService TASK_THREAD_POOL_EXECUTOR =
new ThreadPoolExecutor(WsConstants.CPU_PROCESSORS * 10, WsConstants.CPU_PROCESSORS * 500,
1L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(), NAMED_THREAD_FACTORY, new ThreadPoolExecutor.CallerRunsPolicy());
new ThreadPoolExecutor(WsConstants.CPU_PROCESSORS * 10, WsConstants.CPU_PROCESSORS * 20,
3L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(2048), NAMED_THREAD_FACTORY, new ThreadPoolExecutor.CallerRunsPolicy());
@Override
protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg) {
......
......@@ -20,11 +20,9 @@ import lombok.experimental.Accessors;
public class ImConversationDisplayUpdate extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("会话id")
@ApiModelProperty(value = "会话id", required = true)
private Long conversationId;
@ApiModelProperty("显示状态 1显示 0不显示")
@ApiModelProperty(value = "显示状态 1显示 0不显示", required = true)
private Integer displayStatus;
}
......@@ -54,7 +54,7 @@ public interface ImConversationService extends BaseService<ImConversation> {
* @return
* @throws Exception
*/
boolean displayConversation(ImConversationDisplayUpdate imConversationDisplayUpdate) throws Exception;
boolean updateDisplayConversation(ImConversationDisplayUpdate imConversationDisplayUpdate) throws Exception;
/**
* 根据ID获取查询对象
......
......@@ -185,7 +185,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean displayConversation(ImConversationDisplayUpdate imConversationDisplayUpdate) throws Exception {
public boolean updateDisplayConversation(ImConversationDisplayUpdate imConversationDisplayUpdate) throws Exception {
ImClient curentClient = imClientService.getCurentClient();
// 修改为删除隐藏状态
......
......@@ -92,9 +92,12 @@ public class ImConcreteReceiveStrategy extends AbstractReceiveStrategy {
}
JsonMapper jsonMapper = new JsonMapper();
// 获取会话id
Long toConversationId = Long.valueOf(receiveModel.getData().get("toConversation").toString());
receiveModel.getData().remove("toConversation");
// 生成消息id
long messageId = SnowflakeUtil.getId();
String content = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment