本文整理了Java中com.zyd.blog.framework.exception.ZhydArticleException
类的一些代码示例,展示了ZhydArticleException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZhydArticleException
类的具体详情如下:
包路径:com.zyd.blog.framework.exception.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("请至少选择一个标签");
内容来源于网络,如有侵权,请联系作者删除!