fix: 微信小程序接口对接修改。
This commit is contained in:
@@ -65,4 +65,20 @@ public interface IMessageWarnService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 已读一条消息
|
||||
*
|
||||
* @param id 消息ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean readMessage(Long id);
|
||||
|
||||
/**
|
||||
* 已读全部消息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean readAllMessages(Long userId);
|
||||
}
|
||||
|
||||
@@ -197,4 +197,38 @@ public class MessageWarnServiceImpl implements IMessageWarnService {
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已读一条消息
|
||||
*
|
||||
* @param id 消息ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean readMessage(Long id) {
|
||||
MessageWarn messageWarn = baseMapper.selectById(id);
|
||||
if (messageWarn == null) {
|
||||
return false;
|
||||
}
|
||||
messageWarn.setIsRead(1);
|
||||
return baseMapper.updateById(messageWarn) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已读全部消息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean readAllMessages(Long userId) {
|
||||
MessageWarn update = new MessageWarn();
|
||||
update.setIsRead(1);
|
||||
|
||||
LambdaQueryWrapper<MessageWarn> wrapper = Wrappers.lambdaQuery(MessageWarn.class)
|
||||
.eq(MessageWarn::getUserId, userId)
|
||||
.eq(MessageWarn::getIsRead, 0);
|
||||
|
||||
return baseMapper.update(update, wrapper) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user