feat(novel-front): 作家专区增加作品完结功能
This commit is contained in:
1 parent
36c082ab53
commit
f10ffa664e
4 files changed
+86
-8
No files matched your search
@@ -95,6 +95,19 @@ public class AuthorController extends BaseController {
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 完结小说
|
||||
*/
|
||||
@PostMapping("finishBook")
|
||||
public RestResult<Void> finishBook(Long bookId, HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
//完结小说
|
||||
bookService.finishBook(bookId, author.getId());
|
||||
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除章节
|
||||
|
||||
@@ -304,4 +304,9 @@ public interface BookService {
|
||||
PageBean<BookCommentReplyVO> listCommentReplyByPage(Long userId, Long commentId, int page, int pageSize);
|
||||
|
||||
BookComment getBookComment(Long commentId);
|
||||
|
||||
/**
|
||||
* 完结小说
|
||||
* */
|
||||
void finishBook(Long bookId, Long authorId);
|
||||
}
|
||||
@@ -507,7 +507,7 @@ public class BookServiceImpl implements BookService {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
SelectStatementProvider selectStatement = select(id, bookName, picUrl, catName, visitCount, yesterdayBuy,
|
||||
lastIndexUpdateTime, updateTime, wordCount, lastIndexName, status)
|
||||
lastIndexUpdateTime, updateTime, wordCount, lastIndexName, bookStatus, status)
|
||||
.from(book)
|
||||
.where(authorId, isEqualTo(author.getId()))
|
||||
.orderBy(BookDynamicSqlSupport.createTime.descending())
|
||||
@@ -919,5 +919,18 @@ public class BookServiceImpl implements BookService {
|
||||
return bookCommentMapper.selectByPrimaryKey(commentId).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishBook(Long bookId, Long authorId) {
|
||||
bookMapper.update(update(book)
|
||||
.set(bookStatus)
|
||||
.equalTo((byte) 1)
|
||||
.set(updateTime)
|
||||
.equalTo(new Date())
|
||||
.where(id, isEqualTo(bookId))
|
||||
.and(BookDynamicSqlSupport.authorId, isEqualTo(authorId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
th.name, td.name {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</head>
|
||||
@@ -51,7 +55,8 @@
|
||||
</div>
|
||||
<div class="my_r">
|
||||
<div id="noContentDiv">
|
||||
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a></div>
|
||||
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="my_bookshelf" id="hasContentDiv" style="display: none">
|
||||
@@ -64,7 +69,7 @@
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="goread">
|
||||
<th class="name">
|
||||
书名
|
||||
</th>
|
||||
<th class="goread">
|
||||
@@ -82,6 +87,9 @@
|
||||
<th class="goread">
|
||||
总字数
|
||||
</th>
|
||||
<th class="goread">
|
||||
状态
|
||||
</th>
|
||||
<th class="goread">
|
||||
操作
|
||||
</th>
|
||||
@@ -186,13 +194,13 @@
|
||||
" ["+(i+1)+"]\n" +
|
||||
" </td>\n" +*/
|
||||
|
||||
" <td style=\"position: relative\" class=\"goread\">\n" +
|
||||
" <td style=\"position: relative\" class=\"name\">\n" +
|
||||
"<input class=\"opacity\" onchange=\"picChange('" + book.id + "')\"\n" +
|
||||
" type=\"file\" id=\"file" + book.id + "\" name=\"file\"\n" +
|
||||
" title=\"点击上传图片\"\n" +
|
||||
" style=\"z-index: 100;cursor: pointer;left: 30px; top: 0px; width: 60px; height: 80px; opacity: 0; position: absolute; \"\n" +
|
||||
" />" +
|
||||
"<img id=\"cover" + book.id + "\" width='50' height='70' src='" + book.picUrl + "'/><br/>" + " " + book.bookName + "</td>\n" +
|
||||
"<img id=\"cover" + book.id + "\" width='50' height='70' src='" + book.picUrl + "'/><br/>" + " <a target='_blank' href='/book/" + book.id + ".html'>" + book.bookName + "</a></td>\n" +
|
||||
" <td class=\"goread\" >"
|
||||
+ book.catName + "</td>\n" +
|
||||
|
||||
@@ -209,10 +217,13 @@
|
||||
" <td class=\"goread\" valsc=\"291|2037554|1\">"
|
||||
+ book.wordCount + "</td>\n" +
|
||||
|
||||
" <td class=\"goread\" valsc=\"291|2037554|1\">"
|
||||
+ (book.bookStatus == 0 ? "连载中" : "已完结") + "</td>\n" +
|
||||
|
||||
" <td class=\"goread\" id='opt" + book.id + "'>" +
|
||||
"<a target='_blank' class='redBtn' href='/author/index_list.html?bookId=" + book.id + "'>章节管理 </a><br/>" +
|
||||
"<a target='_blank' href='/author/author_income_detail.html?bookId=" + book.id + "'>薪酬查询 </a><br/>" +
|
||||
"<a target='_blank' href='/book/" + book.id + ".html'>作品信息</a>" +
|
||||
"<div><a target='_blank' class='redBtn' href='/author/index_list.html?bookId=" + book.id + "'>章节管理 </a></div>" +
|
||||
"<div><a target='_blank' href='/author/author_income_detail.html?bookId=" + book.id + "'>薪酬查询 </a></div>" +
|
||||
(book.bookStatus == 0 ? ("<div><a href='javascript:finishBook(\"" + book.id + "\")'>设为完结 </a></div>") : "") +
|
||||
"</td> </tr>");
|
||||
}
|
||||
$("#bookList").html(bookListHtml);
|
||||
@@ -340,6 +351,42 @@
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function finishBook(bookId) {
|
||||
|
||||
layer.confirm('确认要完结作品吗?该操作不可逆!', {
|
||||
btn: ['确定', '取消']//按钮
|
||||
}, function (index) {
|
||||
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/author/finishBook",
|
||||
data: {"bookId": bookId},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
|
||||
location.reload();
|
||||
|
||||
|
||||
} else if (data.code == 1001) {
|
||||
//未登录
|
||||
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||
|
||||
} else {
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('网络异常');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
Reference in new issue
Block a user