use of com.moxi.mogublog.commons.entity.Link in project mogu_blog_v2 by moxi624.
the class LinkServiceImpl method editLink.
@Override
public String editLink(LinkVO linkVO) {
Link link = linkService.getById(linkVO.getUid());
Integer linkStatus = link.getLinkStatus();
link.setTitle(linkVO.getTitle());
link.setSummary(linkVO.getSummary());
link.setLinkStatus(linkVO.getLinkStatus());
link.setUrl(linkVO.getUrl());
link.setSort(linkVO.getSort());
link.setEmail(linkVO.getEmail());
link.setFileUid(linkVO.getFileUid());
link.setUpdateTime(new Date());
link.updateById();
// 友链从申请状态到发布状态,需要发送邮件到站长邮箱
if (StringUtils.isNotEmpty(link.getEmail()) && CheckUtils.checkEmail(link.getEmail())) {
if (ELinkStatus.APPLY.equals(linkStatus) && ELinkStatus.PUBLISH.equals(linkVO.getLinkStatus())) {
log.info("发送友链申请通过的邮件通知");
String linkApplyText = "<a href=\" " + link.getUrl() + "\">" + link.getTitle() + "</a> 站长,您申请的友链已经成功上架~";
rabbitMqUtil.sendSimpleEmail(link.getEmail(), linkApplyText);
}
}
// 删除Redis中的BLOG_LINK
deleteRedisBlogLinkList();
return ResultUtil.successWithMessage(MessageConf.UPDATE_SUCCESS);
}
use of com.moxi.mogublog.commons.entity.Link in project mogu_blog_v2 by moxi624.
the class LinkServiceImpl method stickLink.
@Override
public String stickLink(LinkVO linkVO) {
Link link = linkService.getById(linkVO.getUid());
// 查找出最大的那一个
QueryWrapper<Link> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc(SQLConf.SORT);
Page<Link> page = new Page<>();
page.setCurrent(0);
page.setSize(1);
IPage<Link> pageList = linkService.page(page, queryWrapper);
List<Link> list = pageList.getRecords();
Link maxSort = list.get(0);
if (StringUtils.isEmpty(maxSort.getUid())) {
return ResultUtil.errorWithMessage(MessageConf.PARAM_INCORRECT);
}
if (maxSort.getUid().equals(link.getUid())) {
return ResultUtil.errorWithMessage(MessageConf.OPERATION_FAIL);
}
Integer sortCount = maxSort.getSort() + 1;
link.setSort(sortCount);
link.setUpdateTime(new Date());
link.updateById();
// 删除Redis中的BLOG_LINK
deleteRedisBlogLinkList();
return ResultUtil.successWithMessage(MessageConf.OPERATION_SUCCESS);
}
use of com.moxi.mogublog.commons.entity.Link in project mogu_blog_v2 by moxi624.
the class LinkServiceImpl method deleteLink.
@Override
public String deleteLink(LinkVO linkVO) {
Link link = linkService.getById(linkVO.getUid());
link.setStatus(EStatus.DISABLED);
link.setUpdateTime(new Date());
link.updateById();
// 删除Redis中的BLOG_LINK
deleteRedisBlogLinkList();
return ResultUtil.successWithMessage(MessageConf.DELETE_SUCCESS);
}
Aggregations