mirror of https://github.com/elunez/eladmin
站点统计优化
parent
d140f3533f
commit
d787ed3058
|
@ -0,0 +1,18 @@
|
||||||
|
package me.zhengjie.monitor.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import me.zhengjie.monitor.service.VisitsService;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化站点统计
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
public class VisitsInitialization {
|
||||||
|
|
||||||
|
public VisitsInitialization(VisitsService visitsService){
|
||||||
|
log.info("--------------- 初始化站点统计,如果存在今日统计则跳过 ---------------");
|
||||||
|
visitsService.save();
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,9 +48,6 @@ public class VisitsServiceImpl implements VisitsService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void count(HttpServletRequest request) {
|
public void count(HttpServletRequest request) {
|
||||||
|
|
||||||
// 部署到线上后,可将save()删除
|
|
||||||
save();
|
|
||||||
LocalDate localDate = LocalDate.now();
|
LocalDate localDate = LocalDate.now();
|
||||||
Visits visits = visitsRepository.findByDate(localDate.toString());
|
Visits visits = visitsRepository.findByDate(localDate.toString());
|
||||||
visits.setPvCounts(visits.getPvCounts()+1);
|
visits.setPvCounts(visits.getPvCounts()+1);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<contextName>elune</contextName>
|
<contextName>elAdmin</contextName>
|
||||||
<property name="log.path" value="log" />
|
|
||||||
|
|
||||||
<!--输出到控制台-->
|
<!--输出到控制台-->
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -14,22 +13,9 @@
|
||||||
<filter class="me.zhengjie.monitor.config.LogFilter"></filter>
|
<filter class="me.zhengjie.monitor.config.LogFilter"></filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!--输出到文件-->
|
|
||||||
<!--<appender name="file" class="ch.qos.logback.system.rolling.RollingFileAppender">-->
|
|
||||||
<!--<rollingPolicy class="ch.qos.logback.system.rolling.TimeBasedRollingPolicy">-->
|
|
||||||
<!--<fileNamePattern>${log.path}/logback.%d{yyyy-MM-dd}.log</fileNamePattern>-->
|
|
||||||
<!--</rollingPolicy>-->
|
|
||||||
<!--<encoder>-->
|
|
||||||
<!--<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>-->
|
|
||||||
<!--</encoder>-->
|
|
||||||
<!--</appender>-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--普通日志输出到控制台-->
|
<!--普通日志输出到控制台-->
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="console" />
|
<appender-ref ref="console" />
|
||||||
<!--<appender-ref ref="file" />-->
|
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
<!-- logback为java中的包 -->
|
<!-- logback为java中的包 -->
|
||||||
|
|
Loading…
Reference in New Issue