优化代码
This commit is contained in:
parent
199c44cff4
commit
8eee1fa0de
@ -88,10 +88,6 @@
|
||||
<name>aliyun maven</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>epay-sdk</id>
|
||||
<url>https://gitee.com/gitwcx/epay-sdk-java/raw/master/release/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</project>
|
@ -92,10 +92,15 @@ public class ApiHomeServiceImpl implements ApiHomeService {
|
||||
WebConfig webConfig = webConfigMapper.selectOne(null);
|
||||
|
||||
//获取访问量
|
||||
Object count = redisService.getCacheObject(RedisConstants.BLOG_VIEWS_COUNT);
|
||||
Long count = Optional.ofNullable(redisService.getCacheObject(RedisConstants.BLOG_VIEWS_COUNT))
|
||||
.map(Object::toString)
|
||||
.map(Long::valueOf)
|
||||
.orElse(0L);
|
||||
|
||||
//获取访客量
|
||||
Long visitorAccess = redisService.getCacheSetKeyNumber(RedisConstants.UNIQUE_VISITOR);
|
||||
return ResponseResult.success(webConfig).putExtra("siteAccess", Optional.ofNullable(count).orElse(0))
|
||||
|
||||
return ResponseResult.success(webConfig).putExtra("siteAccess", count)
|
||||
.putExtra("visitorAccess",visitorAccess);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user