mirror of
https://github.com/201206030/novel-plus.git
synced 2025-06-26 21:36:38 +00:00
增加新闻阅读数
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.java2nb.novel.mapper.FrontNewsMapper">
|
||||
<update id="addReadCount">
|
||||
update news set read_count = read_count + 1
|
||||
where id = #{newsId}
|
||||
</update>
|
||||
</mapper>
|
@ -10,6 +10,7 @@
|
||||
|
||||
<div th:replace="common/top :: top('')">
|
||||
</div>
|
||||
<input type="hidden" id="newsId" th:value="${news.id}"/>
|
||||
<div class="main box_center cf">
|
||||
<div class="newsMain cf">
|
||||
<div class="nav_sub">
|
||||
@ -19,7 +20,7 @@
|
||||
<div class="news_title">
|
||||
<h2 th:utext="${news.title}"></h2>
|
||||
<!--while [[...]] corresponds to th:text (i.e. result will be HTML-escaped), [(...)] corresponds to th:utext-->
|
||||
<p class="from">来源:[[${news.sourceName}]] <span class="time" th:text="'时间:'+${#dates.format(news.createTime, 'yy-MM-dd')}"></span> <span class="time" th:text="'点击:'+'888'"></span></p>
|
||||
<p class="from">来源:[[${news.sourceName}]] <span class="time" th:text="'时间:'+${#dates.format(news.createTime, 'yy-MM-dd')}"></span> <span class="time" th:text="'阅读量:'+${news.readCount}"></span></p>
|
||||
</div>
|
||||
<div class="news_info" th:utext="${news.content}">
|
||||
</div>
|
||||
@ -33,4 +34,8 @@
|
||||
</body>
|
||||
<div th:replace="common/js :: js"></div>
|
||||
<script src="/javascript/bookdetail.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$.post("/news/addReadCount", {"newsId": $("#newsId").val()}, function () {
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user