mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-16 00:38:18 +08:00
update 添加消息标记为已读接口
This commit is contained in:
parent
44a9bd1006
commit
b69a8bc793
@ -6,9 +6,7 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
|||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.system.domain.vo.SysMessageBoxVo;
|
import org.dromara.system.domain.vo.SysMessageBoxVo;
|
||||||
import org.dromara.system.service.ISysMessageService;
|
import org.dromara.system.service.ISysMessageService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息记录控制器
|
* 消息记录控制器
|
||||||
@ -31,4 +29,27 @@ public class SysMessageController extends BaseController {
|
|||||||
public R<SysMessageBoxVo> getBox() {
|
public R<SysMessageBoxVo> getBox() {
|
||||||
return R.ok(messageService.queryMessageBox(LoginHelper.getUserId()));
|
return R.ok(messageService.queryMessageBox(LoginHelper.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定单条消息标记为已读
|
||||||
|
*
|
||||||
|
* @param messageId 消息主键ID
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/{messageId}/read")
|
||||||
|
public R<Void> markMessageRead(@PathVariable Long messageId) {
|
||||||
|
return toAjax(messageService.readMessage(LoginHelper.getUserId(), messageId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将当前用户指定分类下所有未读消息标记为已读
|
||||||
|
*
|
||||||
|
* @param category 消息分类标识
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/read/category/{category}")
|
||||||
|
public R<Void> markCategoryAllRead(@PathVariable String category) {
|
||||||
|
return toAjax(messageService.readAllMessages(LoginHelper.getUserId(), category));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,24 @@ public interface ISysMessageService {
|
|||||||
*/
|
*/
|
||||||
SysMessageBoxVo queryMessageBox(Long userId);
|
SysMessageBoxVo queryMessageBox(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定消息标记为已读
|
||||||
|
*
|
||||||
|
* @param userId 当前登录用户ID
|
||||||
|
* @param messageId 待标记的消息主键ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean readMessage(Long userId, Long messageId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将当前用户指定分类下所有未读消息标记为已读
|
||||||
|
*
|
||||||
|
* @param userId 当前登录用户ID
|
||||||
|
* @param category 消息分类标识
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean readAllMessages(Long userId, String category);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送指定用户文本消息
|
* 发送指定用户文本消息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -81,6 +81,32 @@ public class SysMessageServiceImpl implements ISysMessageService, MessageService
|
|||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定消息标记为已读
|
||||||
|
*
|
||||||
|
* @param userId 当前登录用户ID
|
||||||
|
* @param messageId 待标记的消息主键ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean readMessage(Long userId, Long messageId) {
|
||||||
|
// TODO 自行实现单条消息标记已读业务逻辑
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将当前用户指定分类下所有未读消息标记为已读
|
||||||
|
*
|
||||||
|
* @param userId 当前登录用户ID
|
||||||
|
* @param category 消息分类标识
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean readAllMessages(Long userId, String category) {
|
||||||
|
// TODO 自行实现全部消息批量标记已读业务逻辑
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送指定用户文本消息
|
* 发送指定用户文本消息
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user