Skip to content

Commit

Permalink
主页显示增加访客量
Browse files Browse the repository at this point in the history
  • Loading branch information
TreasureJade committed Jan 17, 2020
1 parent 1045694 commit f40b824
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/swpu/uchain/blog/dao/VisitorMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public interface VisitorMapper {
int getCommentTotal();

int getLeaveMsgTotal();

int getVisitorTotal();
}
2 changes: 1 addition & 1 deletion src/main/java/com/swpu/uchain/blog/enums/ResultEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public enum ResultEnum {

USER_NOT_EXIST(1, "用户不存在"),
PASSWORD_ERROR(2, "用户名错误"),
PASSWORD_ERROR(2, "密码错误"),
PHONE_CODE_ERROR(3, "手机验证码错误"),
PHONE_CODE_SEND_ERROR(4, "手机验证码发送失败"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void addVisitorNum(HttpServletRequest request) {
public ResultVO getIndexMsg() {
IndexMsgVO vo = new IndexMsgVO();
vo.setArticleTotal(visitorMapper.getArticleTotal());
vo.setCommentTotal(visitorMapper.getCommentTotal());
vo.setLeaveMessageTotal(visitorMapper.getLeaveMsgTotal());
vo.setCommentTotal(visitorMapper.getCommentTotal() + visitorMapper.getLeaveMsgTotal());
vo.setVisitorTotal(visitorMapper.getVisitorTotal());
vo.setTagTotal(visitorMapper.getTagsTotal());
String updateTime = redisService.get(UpdateTimeKey.timeKey, "updateTime", String.class);
if (updateTime == null || "".equals(updateTime)) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/swpu/uchain/blog/vo/IndexMsgVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class IndexMsgVO {

private int tagTotal;

private int leaveMessageTotal;
private int visitorTotal;

private int commentTotal;

Expand Down
22 changes: 14 additions & 8 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server:
port: 8082
port: 7001
spring:
datasource:
username: root
Expand All @@ -17,10 +17,13 @@ spring:
time-between-eviction-runs-millis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
min-evictable-idle-time-millis: 300000
thymeleaf:
encoding: UTF-8
cache: false
mode: HTML5
servlet:
multipart:
enabled: true
file-size-threshold: 102400000
max-file-size: 10MB
max-request-size: 10MB


mybatis:
mapper-locations: classpath:mappers/*.xml
Expand All @@ -30,7 +33,7 @@ mybatis:
use-generated-keys: true
#redis
redis:
host: 49.234.63.223
host: 47.112.4.177
port: 6379
#超时时间
timeout: 10
Expand All @@ -40,7 +43,7 @@ redis:
poolMaxIdle: 500
#最大等待时间
poolMaxWait: 500
password: "cins1108"
password: "sunset0923"


jwt:
Expand All @@ -50,7 +53,10 @@ jwt:
tokenName: Authorization

file:
headPic: "/home/hobo/head-pic/defult.jpeg"
head-pic:
upload-pic: "/home/hobo/blog/head-pic/"
default-pic: "/home/hobo/blog/head-pic/defult.jpeg"
blog-pic: "/home/hobo/blog/blog-pic/"

pagehelper:
helper-dialect: mysql
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/mappers/VisitorMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@
<select id="getLeaveMsgTotal" resultType="java.lang.Integer">
select COUNT(*) from leave_message
</select>
<select id="getVisitorTotal" resultType="java.lang.Integer">
select total_num from visitor where page='total_page'
</select>
</mapper>

0 comments on commit f40b824

Please sign in to comment.