Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
智布道
OneBlog
提交
57ef29e2
O
OneBlog
项目概览
智布道
/
OneBlog
大约 1 年 前同步成功
通知
11
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OneBlog
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
57ef29e2
编写于
9月 20, 2018
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
首页友情链接优化、BaseTag缓存class
上级
62597ec2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
83 addition
and
39 deletion
+83
-39
blog-core/src/main/java/com/zyd/blog/framework/tag/BaseTag.java
...ore/src/main/java/com/zyd/blog/framework/tag/BaseTag.java
+16
-6
blog-web/src/main/resources/static/css/zhyd.core.css
blog-web/src/main/resources/static/css/zhyd.core.css
+19
-1
blog-web/src/main/resources/templates/index.ftl
blog-web/src/main/resources/templates/index.ftl
+0
-20
blog-web/src/main/resources/templates/layout/footer.ftl
blog-web/src/main/resources/templates/layout/footer.ftl
+48
-12
未找到文件。
blog-core/src/main/java/com/zyd/blog/framework/tag/BaseTag.java
浏览文件 @
57ef29e2
...
...
@@ -10,12 +10,14 @@ import freemarker.template.TemplateDirectiveModel;
import
freemarker.template.TemplateException
;
import
freemarker.template.TemplateModel
;
import
freemarker.template.TemplateModelException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.StringUtils
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* 所有自定义标签的父类,负责调用具体的子类方法
...
...
@@ -26,12 +28,22 @@ import java.util.Map;
* @date 2018/9/18 16:19
* @since 1.8
*/
@Slf4j
public
abstract
class
BaseTag
implements
TemplateDirectiveModel
{
private
static
final
ConcurrentHashMap
<
String
,
Class
>
classBucket
=
new
ConcurrentHashMap
<>();
private
String
clazzPath
=
null
;
public
BaseTag
(
String
targetClassPath
)
{
clazzPath
=
targetClassPath
;
if
(
classBucket
.
get
(
clazzPath
)
==
null
)
{
try
{
Class
clazz
=
Class
.
forName
(
clazzPath
);
classBucket
.
put
(
clazzPath
,
clazz
);
}
catch
(
ClassNotFoundException
e
)
{
log
.
error
(
"无法从[{}]获取对应的class"
,
clazzPath
,
e
);
}
}
}
private
String
getMethod
(
Map
params
)
{
...
...
@@ -67,22 +79,20 @@ public abstract class BaseTag implements TemplateDirectiveModel {
return
this
.
getBuilder
().
wrap
(
o
);
}
@Override
public
void
execute
(
Environment
environment
,
Map
map
,
TemplateModel
[]
templateModels
,
TemplateDirectiveBody
templateDirectiveBody
)
throws
TemplateException
,
IOException
{
this
.
verifyParameters
(
map
);
String
funName
=
getMethod
(
map
);
Method
method
=
null
;
Class
clazz
=
classBucket
.
get
(
clazzPath
);
try
{
Class
clazz
=
Class
.
forName
(
clazzPath
);
method
=
clazz
.
getDeclaredMethod
(
funName
,
Map
.
class
);
if
(
method
!=
null
)
{
if
(
clazz
!=
null
&&
(
method
=
clazz
.
getDeclaredMethod
(
funName
,
Map
.
class
))
!=
null
)
{
// 核心处理,调用子类的具体方法,获取返回值
Object
res
=
method
.
invoke
(
this
,
map
);
environment
.
setVariable
(
funName
,
getModel
(
res
));
}
}
catch
(
NoSuchMethodException
|
IllegalAccessException
|
InvocationTargetException
|
ClassNotFoundException
e
)
{
e
.
printStackTrace
(
);
}
catch
(
NoSuchMethodException
|
IllegalAccessException
|
InvocationTargetException
e
)
{
log
.
error
(
"无法获取[{}]的方法,或者调用[{}]方法发生异常"
,
clazzPath
,
method
,
e
);
}
templateDirectiveBody
.
render
(
environment
.
getOut
());
}
...
...
blog-web/src/main/resources/static/css/zhyd.core.css
浏览文件 @
57ef29e2
...
...
@@ -675,6 +675,11 @@ span.separation:AFTER {
background-color
:
#eeeeee
;
}
.footer
.external-links
a
{
font-size
:
12px
;
color
:
#919191
!important
;
;
}
.footer
a
{
color
:
#555
;
}
...
...
@@ -2872,4 +2877,17 @@ nav a:first-child .meta-nav {
filter
:
alpha
(
opacity
=
70
);
opacity
:
.7
;
}
/* 轮播图 */
\ No newline at end of file
/* 轮播图 */
.img-widget
{
display
:
inline-block
;
position
:
relative
;
}
.img-widget
.widget-header
img
{
width
:
100px
;
}
.img-widget
.widget-footer
{
text-align
:
center
;
padding
:
5px
;
font-size
:
12px
;
}
\ No newline at end of file
blog-web/src/main/resources/templates/index.ftl
浏览文件 @
57ef29e2
...
...
@@ -138,26 +138,6 @@
<#include "layout/sidebar.ftl"/>
</div>
</div>
<section class="links index-links">
<ul class="list-unstyled list-inline">
<#if indexLinkList?exists && (indexLinkList?size > 0)>
<#list indexLinkList as item>
<li>
<a href="${item.url}" target="_blank" title="${item.description?if_exists}" data-toggle="tooltip" data-placement="bottom">
<img src="${item.favicon}" alt="${item.name?if_exists}" onerror="this.src='${config.staticWebSite}/img/user.png'">${item.name?if_exists}
</a>
</li>
</#list>
<li>
<a href="${config.siteUrl}/links" title="更多链接" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-plus"></i>更多链接</a>
</li>
<#else>
<li>
<a href="${config.siteUrl}/links" title="申请友链" data-toggle="tooltip" data-placement="bottom">申请友链</a>
</li>
</#if>
</ul>
</section>
<@footer></@footer>
</@compress>
\ No newline at end of file
blog-web/src/main/resources/templates/layout/footer.ftl
浏览文件 @
57ef29e2
...
...
@@ -109,7 +109,7 @@
<ul class="list-unstyled list-inline">
<li><a href="http://shang.qq.com/wpa/qunwpa?idkey=9f986e9b33b1de953e1ef9a96cdeec990affd0ac7855e00ff103514de2027b60" target="_blank" title="加入我的QQ交流群:190886500" data-toggle="tooltip" data-placement="bottom" rel="external nofollow"><i class="fa fa-qq"></i>QQ交流群</a></li>
<li><a href="https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=wylo59db" target="_blank" title="史上最全的阿里云优惠券" data-toggle="tooltip" data-placement="bottom" rel="external nofollow"><i class="fa fa-fire fa-fw"></i>阿里云券</a></li>
<li><a href="https://mi.aliyun.com/shop/19462" target="_blank" title="闲置域名出售" data-toggle="tooltip" data-placement="bottom" rel="external nofollow"><i class="fa fa-globe fa-fw fa-spin
red
"></i>域名出售</a></li>
<li><a href="https://mi.aliyun.com/shop/19462" target="_blank" title="闲置域名出售" data-toggle="tooltip" data-placement="bottom" rel="external nofollow"><i class="fa fa-globe fa-fw fa-spin"></i>域名出售</a></li>
<li><a href="${config.siteUrl}/sitemap.html" target="_blank" title="网站地图" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-map-o fa-fw"></i>网站地图</a></li>
<li><a href="${config.siteUrl}/recommended" title="站长推荐" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-thumbs-o-up fa-fw"></i>站长推荐</a></li>
<li><a href="${config.siteUrl}/updateLog" title="更新记录" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-file-o fa-fw"></i>更新记录</a></li>
...
...
@@ -127,17 +127,38 @@
</div>
<div class="col-xs-12 col-sm-4 col-md-4 text-left fade-in">
<h4>问题交流</h4>
<div class="row" style="padding: 4px;padding-left:
10px
;">
<div class="row" style="padding: 4px;padding-left:
0
;">
<div class="col-xs-12 col-sm-12 col-md-12">
<a href="${config.staticWebSite}/img/wechat_account.jpg" target="_blank" class="showImage" title="[码一码]公众号" rel="external nofollow">
<img data-original="${config.staticWebSite}/img/wechat_account.jpg" alt="[码一码]公众号" class="img-responsive img-rounded auto-shake lazy-img" style="width: 100px;display: inline-block">
</a>
<a href="${config.staticWebSite}/img/mayima.jpg" target="_blank" class="showImage" title="[码一码]小程序" rel="external nofollow">
<img data-original="${config.staticWebSite}/img/mayima.jpg" alt="[码一码]小程序" class="img-responsive img-rounded auto-shake lazy-img" style="width: 100px;display: inline-block">
</a>
<a href="${config.staticWebSite}/img/qq_group.png" class="showImage" title="QQ群(190886500)二维码" rel="external nofollow">
<img data-original="${config.staticWebSite}/img/qq_group.png" alt="QQ群(190886500)二维码" class="img-responsive img-rounded auto-shake lazy-img" style="width: 100px;display: inline-block">
</a>
<div class="img-widget">
<div class="widget-header">
<a href="${config.wxCode}" target="_blank" class="showImage" title="[码一码]公众号" rel="external nofollow">
<img data-original="${config.wxCode}" alt="[码一码]公众号" class="img-responsive img-rounded auto-shake lazy-img">
</a>
</div>
<div class="widget-footer">
<span>公众号</span>
</div>
</div>
<div class="img-widget">
<div class="widget-header">
<a href="https://gitee.com/yadong.zhang/static/raw/master/wx/wx.png" target="_blank" class="showImage" title="添加微信(备注:加群)" rel="external nofollow">
<img data-original="https://gitee.com/yadong.zhang/static/raw/master/wx/wx.png" alt="添加微信(备注:加群)" class="img-responsive img-rounded auto-shake lazy-img" >
</a>
</div>
<div class="widget-footer">
<span>微信(备注:加群)</span>
</div>
</div>
<div class="img-widget">
<div class="widget-header">
<a href="${config.staticWebSite}/img/qq_group.png" class="showImage" title="QQ群(190886500)二维码" rel="external nofollow">
<img data-original="${config.staticWebSite}/img/qq_group.png" alt="QQ群(190886500)二维码" class="img-responsive img-rounded auto-shake lazy-img" >
</a>
</div>
<div class="widget-footer">
<span>QQ群</span>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -146,7 +167,22 @@
<footer class="footer">
<div class="clear">
<p>托管于<a href="https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=wylo59db" target="_blank" title="阿里云-为了无法计算的价值" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">阿里云</a> & <a href="https://portal.qiniu.com/signup?code=3l8yx2v0f21ci" target="_blank" title="七牛云-国内领先的企业级云服务商" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">七牛云</a> · <a href="http://www.miitbeian.gov.cn/publish/query/indexFirst.action" target="_blank" title="查看备案信息" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">鲁ICP备17054970号-1</a></p>
<p>Copyright©2016-${.now?string("yyyy")} ${config.siteName} · Powered by <a href="https://gitee.com/yadong.zhang/DBlog" title="DBlog是一款简洁美观、自适应的Java博客系统..." data-toggle="tooltip" data-placement="right" target="_blank"><strong>DBlog</strong></a> · <a href="http://tongji.baidu.com/web/welcome/ico?s=590226d2f4ffbf051442eb75f37333c9" target="_blank" title="点击查看${config.siteName}网站统计详情" data-toggle="tooltip" data-placement="right" rel="external nofollow"><i class="fa fa-bar-chart-o fa-fw fa-spin"></i>网站统计</a></p>
<p>Copyright©2016-${.now?string("yyyy")} ${config.siteName} · Powered by <a href="https://gitee.com/yadong.zhang/DBlog" title="OneBlog是一款简洁美观、自适应的Java博客系统..." data-toggle="tooltip" data-placement="right" target="_blank"><strong>OneBlog</strong></a> · <a href="http://tongji.baidu.com/web/welcome/ico?s=590226d2f4ffbf051442eb75f37333c9" target="_blank" title="点击查看${config.siteName}网站统计详情" data-toggle="tooltip" data-placement="right" rel="external nofollow"><i class="fa fa-bar-chart-o fa-fw"></i>网站统计</a></p>
<#if url?exists && (url == "index")>
<div class="inline external-links">
<a>友情链接:</a>
<#if indexLinkList?exists && (indexLinkList?size > 0)>
<#list indexLinkList as item>
<a href="${item.url}" target="_blank" title="${item.description?if_exists}" data-toggle="tooltip" data-placement="right">
${item.name?if_exists}
</a>
</#list>
<a href="${config.siteUrl}/links" title="更多链接" data-toggle="tooltip" data-placement="right"><i class="fa fa-plus"></i>更多链接</a>
<#else>
<a href="${config.siteUrl}/links" title="申请友链" data-toggle="tooltip" data-placement="right">申请友链</a>
</#if>
</div>
</#if>
</div>
</footer>
<a class="to-top" title="点击返回顶部" data-toggle="tooltip" data-placement="bottom"></a>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录