前言:
上一章节,留言的智能合约代码已经编写成功,并且测试通过。这个章节我们改造我们的应用程序。
正文:
改造前后台代码,从下面的代码我们可以在// todo 处添加我们上链的代码,因为上链需要的参数全部在comment对象中了。
@RequiresPermissions("comment:audit")
@PostMapping("/audit")
@BussinessLog("审核评论")
public ResponseVO audit(Comment comment, String contentText, Boolean sendEmail) {
try {
commentService.updateSelective(comment);
if(!StringUtils.isEmpty(contentText)){
comment.setContent(contentText);
commentService.commentForAdmin(comment);
}
if(null != sendEmail && sendEmail){
Comment commentDB = commentService.getByPrimaryKey(comment.getId());
mailService.send(commentDB, TemplateKeyEnum.TM_COMMENT_AUDIT, true);
}
// todo
} catch (Exception e) {
e.printStackTrace();
retu