Skip to content

Commit

Permalink
add visit count
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Feb 19, 2024
1 parent 00fd3f6 commit 8260305
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 125 deletions.
2 changes: 1 addition & 1 deletion cfg/feather.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"db_name": "feather",
"timeout": 2,
"db_conn_num": 4,
"drop_all_table": 0,
"drop_all_table": false,
"log_path": "/tmp",
"log_name": "feather.log",
"roll_file_size": 2
Expand Down
3 changes: 2 additions & 1 deletion entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ struct pp_posts {
int comment_count;
std::string category;
std::string raw_content;
int visit_count;
};
REFLECTION(pp_posts, ID, post_author, post_date, post_title, post_content,
post_status, post_modified, content_abstract, url, comment_count,
category, raw_content);
category, raw_content, visit_count);

struct pp_user {
int ID;
Expand Down
3 changes: 2 additions & 1 deletion feather.sql
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ CREATE TABLE `pp_posts` (
`content_abstract` text NOT NULL,
`url` varchar(255) NOT NULL,
`comment_count` bigint(20) NOT NULL,
`visit_count` bigint(20) NOT NULL,
`category` varchar(255) NOT NULL,
`raw_content` text NOT NULL,
PRIMARY KEY (`ID`)
Expand All @@ -179,7 +180,7 @@ CREATE TABLE `pp_posts` (

LOCK TABLES `pp_posts` WRITE;
/*!40000 ALTER TABLE `pp_posts` DISABLE KEYS */;
INSERT INTO `pp_posts` VALUES (2058,2535,'2018-12-12 10:16:44','1','# 初始数据放这里','publish','2018-12-12 10:16:44','# 初始数据放这里...','',0,'3','');
INSERT INTO `pp_posts` VALUES (2058,2535,'2018-12-12 10:16:44','1','# 初始数据放这里','publish','2018-12-12 10:16:44','# 初始数据放这里...','',0,0,'3','');
/*!40000 ALTER TABLE `pp_posts` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down
110 changes: 59 additions & 51 deletions purecpp/html/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@
<link href="./purecpp/plug/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<!--全局样式表-->
<link href="./purecpp/css/global.css" rel="stylesheet" />
<!-- 比较好用的代码着色插件 -->
<link href="./purecpp/css/prettify.css" rel="stylesheet" />
<!-- 比较好用的代码着色插件 -->
<link href="./purecpp/css/prettify.css" rel="stylesheet" />
<!-- 本页样式表 -->
<link href="./purecpp/css/detail.css" rel="stylesheet" />
<link rel="stylesheet" href="./purecpp/css/github-markdown.css">
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}

.markdown-body li {
list-style: disc;
}
.markdown-body li {
list-style: disc;
}

@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
</style>
</head>

Expand Down Expand Up @@ -67,10 +67,13 @@
<span class="fa fa-clock-o">编辑时间:${post_modified}</span>
<span class="fa fa-user">作者:${user_login}</span>
<span class="fa fa-commenting">${total}条评论</span>
<span class="fa">总访问量: ${visit_count}</span>
</div>
<div class="markdown-body">
<p style="text-align:center;">
<span style="font-size:18px;"><div id="md_post_content"></div></span>
<span style="font-size:18px;">
<div id="md_post_content"></div>
</span>
</p>
<hr /> &nbsp; &nbsp; 出自:purecpp
<p>
Expand All @@ -85,90 +88,95 @@
</p>
</div>
</div>
<textarea style="display: none;" id="pre_md_post_content">${post_content}</textarea>
<textarea style="display: none;" id="pre_md_post_content">${post_content}</textarea>
<!-- 评论区域 -->
<div class="blog-module shadow" style="box-shadow: 0 1px 8px #a6a6a6;">
<fieldset class="layui-elem-field layui-field-title" style="margin-bottom:0">
<legend>来说两句吧</legend>
<div class="layui-field-box">
<form class="layui-form blog-editor" method="post" action="/comment">
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea name="post_id" placeholder="请输入内容" class="layui-textarea layui-hide">${post_id}</textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea name="post_id" placeholder="请输入内容"
class="layui-textarea layui-hide">${post_id}</textarea>
</div>
</div>
<div class="layui-form-item">
<textarea name="editorContent" lay-verify="content" id="remarkEditor" placeholder="请输入内容" class="layui-textarea layui-hide"></textarea>
<textarea name="editorContent" lay-verify="content" id="remarkEditor" placeholder="请输入内容"
class="layui-textarea layui-hide"></textarea>
</div>
<div class="layui-form-item">
$if has_login{{
<button class="layui-btn" lay-submit="formRemark" lay-filter="formRemark">提交评论</button>
<button class="layui-btn" lay-submit="formRemark" lay-filter="formRemark">提交评论</button>
}}
$else{{
<button class="layui-btn layui-disabled" disabled lay-submit="formRemark" lay-filter="formRemark">提交评论</button>
<span>登录才能发表评论。</span>
<button class="layui-btn layui-disabled" disabled lay-submit="formRemark"
lay-filter="formRemark">提交评论</button>
<span>登录才能发表评论。</span>
}}
</div>
</form>
</div>
</fieldset>
<div class="blog-module-title">最新评论</div>
<ul class="blog-comment">
$if has_comment{{
$for item in comment_list{{
$if has_comment{{
$for item in comment_list{{
<li>
<div class="comment-parent">
<img src="./purecpp/images/cover/logo6.png" alt="qicosmos" />
<div class="info">
<span class="username">${item.comment_user}</span>
<span class="time">${item.comment_date}</span>
$if item.is_owner{{
<span>
<i class="fa fa-tag"></i><a href="./remove_comment?id=${item.comment_id}&post_id=${post_id}">删除</a>
</span>
}}
$if item.is_admin{{
<span>
<i class="fa fa-tag"></i><a href="./remove_comment?id=${item.comment_id}&post_id=${post_id}">删除</a>
</span>
}}
$if item.is_owner{{
<span>
<i class="fa fa-tag"></i><a
href="./remove_comment?id=${item.comment_id}&post_id=${post_id}">删除</a>
</span>
}}
$if item.is_admin{{
<span>
<i class="fa fa-tag"></i><a
href="./remove_comment?id=${item.comment_id}&post_id=${post_id}">删除</a>
</span>
}}
</div>
<div class="content">
${item.comment_content}
</div>
</div>
</li>
}}
}}
}}
}}
</ul>
</div>
</div>
<!--右边小栏目-->
$inline {{
./purecpp/html/righter.html
}}
./purecpp/html/righter.html
}}
<div class="clear"></div>
</div>
</div>
</div>
<!-- 底部 -->
$inline {{
./purecpp/html/footer.html
./purecpp/html/footer.html
}}
<!--遮罩-->
<div class="blog-mask animated layui-hide"></div>
<!-- layui.js -->
<script src="./purecpp/plug/layui/layui.js"></script>
<!-- 全局脚本 -->
<script src="./purecpp/js/global.js"></script>
<!-- 比较好用的代码着色插件 -->
<script src="./purecpp/js/prettify.js"></script>
<!-- 比较好用的代码着色插件 -->
<script src="./purecpp/js/prettify.js"></script>
<!-- 本页脚本 -->
<script src="./purecpp/js/detail.js"></script>
</body>

</html>
<script src="/purecpp/plug/laymd/laymd/marked.min.js"></script>
<script>
document.getElementById("md_post_content").innerHTML = marked(document.getElementById("pre_md_post_content").value);
</script>
<script src="/purecpp/plug/laymd/laymd/marked.min.js"></script>
<script>
document.getElementById("md_post_content").innerHTML = marked(document.getElementById("pre_md_post_content").value);
</script>
Loading

0 comments on commit 8260305

Please sign in to comment.