com.zyd.blog.framework.exception.ZhydArticleException类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中com.zyd.blog.framework.exception.ZhydArticleException类的一些代码示例,展示了ZhydArticleException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZhydArticleException类的具体详情如下:
包路径:com.zyd.blog.framework.exception.ZhydArticleException
类名称:ZhydArticleException

ZhydArticleException介绍

暂无

代码示例

代码示例来源:origin: zhangyd-c/OneBlog

@PostMapping("/doPraise/{id}")
@BussinessLog(value = "点赞文章{1}", platform = PlatformEnum.WEB)
public ResponseVO doPraise(@PathVariable("id") Long id) {
  try {
    articleService.doPraise(id);
  } catch (ZhydArticleException e) {
    return ResultUtil.error(e.getMessage());
  }
  return ResultUtil.success("");
}

代码示例来源:origin: zhangyd-c/OneBlog

/**
 * 文章点赞
 *
 * @param id
 */
@Override
@RedisCache(flush = true)
public void doPraise(Long id) {
  String ip = IpUtil.getRealIp(RequestHolder.getRequest());
  String key = ip + "_doPraise_" + id;
  ValueOperations<String, Object> operations = redisTemplate.opsForValue();
  if (redisTemplate.hasKey(key)) {
    throw new ZhydArticleException("一个小时只能点赞一次哈,感谢支持~~");
  }
  User user = SessionUtil.getUser();
  BizArticleLove love = new BizArticleLove();
  if (null != user) {
    love.setUserId(user.getId());
  }
  love.setArticleId(id);
  love.setUserIp(IpUtil.getRealIp(RequestHolder.getRequest()));
  love.setLoveTime(new Date());
  love.setCreateTime(new Date());
  love.setUpdateTime(new Date());
  bizArticleLoveMapper.insert(love);
  operations.set(key, id, 1, TimeUnit.HOURS);
}

代码示例来源:origin: zhangyd-c/OneBlog

public boolean publish(Article article, Long[] tags, MultipartFile file) {
  if (null == tags || tags.length <= 0) {
    throw new ZhydArticleException("请至少选择一个标签");

相关文章