Skip to content

Commit 12fa216

Browse files
author
danbai225
committed
整理代码,小功能增加
1 parent c425482 commit 12fa216

File tree

18 files changed

+398
-383
lines changed

18 files changed

+398
-383
lines changed

.idea/workspace.xml

Lines changed: 293 additions & 289 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/com/danbai/ys/controller/MainController.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.danbai.ys.service.impl.*;
99
import com.github.pagehelper.PageInfo;
1010
import org.springframework.beans.factory.annotation.Autowired;
11-
import org.springframework.data.redis.core.RedisTemplate;
1211
import org.springframework.stereotype.Controller;
1312
import org.springframework.ui.Model;
1413
import org.springframework.web.bind.annotation.*;
@@ -30,17 +29,12 @@ public class MainController {
3029
@Autowired
3130
UserServiceImpl userService;
3231
@Autowired
33-
RegisterValidateServiceImpl registerValidateService;
34-
@Autowired
35-
RedisTemplate redisTemplate;
36-
@Autowired
3732
AdminServiceImpl adminService;
38-
33+
@Autowired
34+
CommImpl comm;
3935
@ModelAttribute
4036
public void bif(Model model) {
41-
model.addAttribute(Config.GG, adminService.getConfig(Config.GG));
42-
model.addAttribute(Config.YLINK, adminService.getYlink());
43-
model.addAttribute(Config.AD, adminService.getConfig(Config.AD));
37+
model.addAllAttributes(comm.getAllComm());
4438
}
4539

4640
@RequestMapping(value = {"/", "index"}, produces = "text/plain;charset=UTF-8", method = RequestMethod.GET)

src/main/java/com/danbai/ys/controller/YsController.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,17 @@
33
import com.alibaba.fastjson.JSON;
44
import com.alibaba.fastjson.JSONObject;
55
import com.danbai.ys.entity.*;
6-
import com.danbai.ys.service.YsService;
76
import com.danbai.ys.service.impl.AdminServiceImpl;
7+
import com.danbai.ys.service.impl.CommImpl;
88
import com.danbai.ys.service.impl.YsServiceImpl;
9-
import com.danbai.ys.utils.HtmlUtils;
109
import com.github.pagehelper.PageInfo;
1110
import org.springframework.beans.factory.annotation.Autowired;
1211
import org.springframework.data.redis.core.RedisTemplate;
13-
import org.springframework.http.HttpHeaders;
14-
import org.springframework.http.HttpStatus;
15-
import org.springframework.http.MediaType;
16-
import org.springframework.http.ResponseEntity;
1712
import org.springframework.stereotype.Controller;
1813
import org.springframework.ui.Model;
1914
import org.springframework.web.bind.annotation.*;
2015

2116
import javax.servlet.http.HttpServletRequest;
22-
import javax.servlet.http.HttpServletResponse;
23-
import java.io.FileInputStream;
24-
import java.io.IOException;
25-
import java.io.OutputStream;
2617
import java.util.HashMap;
2718
import java.util.List;
2819
import java.util.Map;
@@ -40,11 +31,11 @@ public class YsController {
4031
@Autowired
4132
AdminServiceImpl adminService;
4233

34+
@Autowired
35+
CommImpl comm;
4336
@ModelAttribute
4437
public void bif(Model model) {
45-
model.addAttribute(Config.GG, adminService.getConfig(Config.GG));
46-
model.addAttribute(Config.YLINK, adminService.getYlink());
47-
model.addAttribute(Config.AD, adminService.getConfig(Config.AD));
38+
model.addAllAttributes(comm.getAllComm());
4839
}
4940

5041
@RequestMapping(value = "/ys", produces = "text/plain;charset=UTF-8", method = RequestMethod.GET)

src/main/java/com/danbai/ys/entity/Config.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class Config {
1414
public static String GG = "gg";
1515
public static String AD = "ad";
1616
public static String DMCACHE = "dmcache";
17+
public static String HEAD = "head";
18+
public static String FOOTER = "footer";
1719
public Config(String item, String value) {
1820
this.item = item;
1921
this.value = value;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.danbai.ys.service;
2+
3+
import java.util.HashMap;
4+
5+
/**
6+
* @author danbai
7+
*/
8+
public interface Comm {
9+
/**
10+
* 获取所有公共内容
11+
* @return
12+
*/
13+
HashMap getAllComm();
14+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.danbai.ys.service.impl;
2+
3+
import com.danbai.ys.entity.Config;
4+
import com.danbai.ys.service.Comm;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.stereotype.Service;
7+
8+
import java.util.HashMap;
9+
import java.util.Map;
10+
11+
/**
12+
* @author danbai
13+
* @date 2019-11-07 09:57
14+
*/
15+
@Service
16+
public class CommImpl implements Comm {
17+
@Autowired
18+
AdminServiceImpl adminService;
19+
@Override
20+
public HashMap getAllComm() {
21+
HashMap<String,Object> map = new HashMap(20);
22+
map.put(Config.GG,adminService.getConfig(Config.GG));
23+
map.put(Config.YLINK,adminService.getYlink());
24+
map.put(Config.AD,adminService.getConfig(Config.AD));
25+
map.put(Config.FOOTER,adminService.getConfig(Config.FOOTER));
26+
map.put(Config.HEAD,adminService.getConfig(Config.HEAD));
27+
return map;
28+
}
29+
}

src/main/resources/templates/admin/config.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,31 @@
2525
<div class="form-group">
2626
<label class="col-sm-2 control-label">公告</label>
2727
<div class="col-sm-10">
28-
<textarea rows="3" name="gg" cols="40" th:text="${gg}"></textarea>
28+
<textarea rows="3" name="gg" cols="60" th:text="${gg}"></textarea>
2929
</div>
3030
</div>
3131
<div class="form-group">
3232
<label class="col-sm-2 control-label">友链</label>
3333
<div class="col-sm-10">
34-
<textarea rows="3" name="ylink" cols="40" th:text="${ylink}"></textarea>
34+
<textarea rows="3" name="ylink" cols="60" th:text="${ylink}"></textarea>
3535
</div>
3636
</div>
3737
<div class="form-group">
3838
<label class="col-sm-2 control-label">广告</label>
3939
<div class="col-sm-10">
40-
<textarea rows="3" name="ad" cols="40" th:text="${ad}"></textarea>
40+
<textarea rows="3" name="ad" cols="60" th:text="${ad}"></textarea>
41+
</div>
42+
</div>
43+
<div class="form-group">
44+
<label class="col-sm-2 control-label">head</label>
45+
<div class="col-sm-10">
46+
<textarea rows="3" name="head" cols="60" th:text="${head}"></textarea>
47+
</div>
48+
</div>
49+
<div class="form-group">
50+
<label class="col-sm-2 control-label">footer</label>
51+
<div class="col-sm-10">
52+
<textarea rows="3" name="footer" cols="60" th:text="${footer}"></textarea>
4153
</div>
4254
</div>
4355
<div class="form-group">

src/main/resources/templates/include/include.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
<!DOCTYPE html>
22
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
33
xmlns:th="http://www.thymeleaf.org">
4-
<body>
54

5+
<head th:fragment="common_header(title,meta)">
6+
<title th:replace="${title}">淡白影视</title>
7+
<meta charset="utf-8">
8+
<th:block th:replace="${meta}" />
9+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
10+
<link rel="icon" href="https://cdn.p00q.cn/favicon.ico">
11+
<link rel="stylesheet" href="https://cdn.p00q.cn/ys/css/bootstrap.min.css">
12+
<link rel="stylesheet" rev="stylesheet" type="text/css" media="all" href="https://cdn.p00q.cn/ys/css/bootadd.css">
13+
<link rel="stylesheet" rev="stylesheet" type="text/css" media="all" href="https://cdn.p00q.cn/ys/css/css2.css">
14+
<script src="https://cdn.p00q.cn/ys/js/jquery.min.js"></script>
15+
<script src="https://cdn.p00q.cn/ys/js/bootstrap.min.js"></script>
16+
<th:block th:utext="${head}" />
17+
</head>
18+
19+
<body>
620
<div style="background:#FFF" th:fragment="dhl">
721
<div style="padding:5px 0;border-bottom:1px solid #DDD;">
822
<div class="container">
@@ -63,7 +77,7 @@
6377
<div class="gg" style="margin: 0px auto; font-size: 2rem" th:utext="${ad}"></div>
6478
</div>
6579

66-
<footer class="footer" th:fragment="foot">
80+
<footer class="footer" th:fragment="foot" >>
6781
友情链接:
6882
<span th:each="l:${ylink}">
6983
<a th:href="${l.url}" target="_blank" th:text="${l.name}"></a>|
@@ -81,6 +95,7 @@
8195
s.parentNode.insertBefore(hm, s);
8296
})();
8397
</script>
98+
[(${footer})]
8499
</footer>
85100
</body>
86101
</html>

src/main/resources/templates/index.html

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
<!DOCTYPE html>
22
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
33
xmlns:th="http://www.thymeleaf.org">
4-
<head>
5-
<meta charset="utf-8">
4+
<head th:replace="include/include :: common_header(~{::title},~{::meta})">
65
<title>淡白影视 - 看你想看</title>
76
<meta name="Keywords" content="淡白影视,淡白电影,淡白电视剧,淡白综艺,在线观看电影,免vip弹幕影视,弹幕影视,最新电影,最新电影观看,2019最新电影观看网站"/>
87
<meta name="Description" content="淡白影视是一个在线免vip观看影视的网站,还能观看发送弹幕."/>
9-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
10-
<link rel="icon" href="https://cdn.p00q.cn/favicon.ico">
11-
<link rel="stylesheet" href="https://cdn.p00q.cn/ys/css/bootstrap.min.css">
12-
<script src="https://cdn.p00q.cn/ys/js/jquery.min.js"></script>
13-
<script src="https://cdn.p00q.cn/ys/js/bootstrap.min.js"></script>
14-
<link rel="stylesheet" rev="stylesheet" type="text/css" media="all" href="https://cdn.p00q.cn/ys/css/bootadd.css">
15-
<link rel="stylesheet" rev="stylesheet" type="text/css" media="all" href="https://cdn.p00q.cn/ys/css/css2.css">
16-
<script data-ad-client="ca-pub-8241098886005013" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
178
</head>
189
<body>
1910
<div style="background:#FFF" th:include="include/include :: dhl">
@@ -103,11 +94,6 @@ <h3 style="padding-left:10px;border-left:8px solid #00A6DE;">最新动漫:</h3
10394
</div>
10495
</div>
10596
</div>
106-
<script type="text/javascript">
107-
var wid = '522746';
108-
var uid = '253281';
109-
</script>
110-
<script type="text/javascript" src="//cdn.popcash.net/pop.js"></script>
11197
</div>
11298
<footer class="footer" th:include="include/include :: foot"></footer>
11399
</body>

src/main/resources/templates/login.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<link href="https://cdn.p00q.cn/hAdmin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
1212
<link href="https://cdn.p00q.cn/hAdmin/css/animate.css" rel="stylesheet">
1313
<link href="https://cdn.p00q.cn/hAdmin/css/style.css?v=4.1.0" rel="stylesheet">
14+
1415
<!--[if lt IE 9]>
1516
<meta http-equiv="refresh" content="0;ie.html"/>
1617
<![endif]-->

0 commit comments

Comments
 (0)