diff --git a/sql/picturebed.sql b/sql/picturebed.sql
index 37ef31a..d67ba61 100644
--- a/sql/picturebed.sql
+++ b/sql/picturebed.sql
@@ -1,17 +1,17 @@
/*
Navicat Premium Data Transfer
- Source Server : localhost
+ Source Server : 129.28.173.126
Source Server Type : MySQL
- Source Server Version : 50720
- Source Host : localhost:3306
+ Source Server Version : 50562
+ Source Host : 129.28.173.126:3306
Source Schema : picturebed
Target Server Type : MySQL
- Target Server Version : 50720
+ Target Server Version : 50562
File Encoding : 65001
- Date: 10/08/2019 16:24:06
+ Date: 15/08/2019 16:49:51
*/
SET NAMES utf8mb4;
@@ -35,14 +35,14 @@ CREATE TABLE `config` (
`domain` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点域名',
`background1` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '首页背景图',
`background2` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上传页面背景图',
- `sett` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `sett` int(2) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of config
-- ----------------------------
-INSERT INTO `config` VALUES (1, 3, 1, 'Hellohao', '网站由JAVA语言编写应用SpringBoot框架开发,前端全部组件由BootStrap/Layui框架编写。由作者个人更新维护,后期会加入更全面的功能供大家使用,如有BUG请与我反馈。', 'https://hellohao.nos-eastchina1.126.net/%E7%BD%91%E7%AB%99%E7%B4%A0%E6%9D%90/logo2.png', 'Hellohao 切勿上传违反中华人民共和国互联网法律条约资源', '
作者博客高清壁纸json格式化', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://tc.hellohao.cn', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/eb83a0714030248.jpg', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/086650714030248.jpg', NULL);
+INSERT INTO `config` VALUES (1, 1, 1, 'Hellohao', '本站是Hellohao图床测试站,账号/密码:admin,为了更多人测试,切勿修改账号密码,恶意使用永久拉黑IP,并公布于众。', 'https://hellohao.nos-eastchina1.126.net/%E7%BD%91%E7%AB%99%E7%B4%A0%E6%9D%90/logo2.png', 'Hellohao 切勿上传违反中华人民共和国互联网法律条约资源', '作者博客高清壁纸json格式化', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://129.28.173.126:8088', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/eb83a0714030248.jpg', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/086650714030248.jpg', 1);
-- ----------------------------
-- Table structure for emailconfig
@@ -78,13 +78,7 @@ CREATE TABLE `imgdata` (
`abnormal` int(2) NULL DEFAULT NULL COMMENT '异常',
`source` int(2) NULL DEFAULT NULL COMMENT '存储源',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-
--- ----------------------------
--- Records of imgdata
--- ----------------------------
-INSERT INTO `imgdata` VALUES (1, 'admin/09bf60810015053.png', 'http://img.wwery.com/admin/09bf60810015053.png', 1, '2019-08-10', 71, NULL, 3);
-INSERT INTO `imgdata` VALUES (2, 'admin/d5b2c0810025302.png', 'http://img.wwery.com/admin/d5b2c0810025302.png', 1, '2019-08-10', 120, NULL, 3);
+) ENGINE = InnoDB AUTO_INCREMENT = 89 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for imgreview
@@ -103,7 +97,7 @@ CREATE TABLE `imgreview` (
-- ----------------------------
-- Records of imgreview
-- ----------------------------
-INSERT INTO `imgreview` VALUES (1, NULL, NULL, NULL, 0, 0);
+INSERT INTO `imgreview` VALUES (1, '1111111111111111', '11111111111111111', '111111111111111', 0, 0);
-- ----------------------------
-- Table structure for keys
@@ -123,13 +117,13 @@ CREATE TABLE `keys` (
-- ----------------------------
-- Records of keys
-- ----------------------------
-INSERT INTO `keys` VALUES (1, '', '', '', '', '', 1);
-INSERT INTO `keys` VALUES (2, '11111111', '222222222222', '444444444444', '555555555', 'http://1.1.1', 2);
-INSERT INTO `keys` VALUES (3, '', '', '0', '', '', 3);
-INSERT INTO `keys` VALUES (4, '123', '123', '4', '412', 'https://0.0', 4);
+INSERT INTO `keys` VALUES (1, '547046ec6495457783f040df098a8ce3', '255b334a4d174e95a3d9e5938f1966ab', 'https://nos-eastchina1.126.net', 'hellohao', 'https://hellohao.nos-eastchina1.126.net', 1);
+INSERT INTO `keys` VALUES (2, '', '', '', '', '', 2);
+INSERT INTO `keys` VALUES (3, '', '', '', '', '', 3);
+INSERT INTO `keys` VALUES (4, '', '', '', '', '', 4);
INSERT INTO `keys` VALUES (5, '0', '0', '0', '0', '0', 5);
INSERT INTO `keys` VALUES (6, '', '', '', '', '', 6);
-INSERT INTO `keys` VALUES (7, '234', '234124', '234124', '', '234142', 7);
+INSERT INTO `keys` VALUES (7, '', '', '', '', '', 7);
INSERT INTO `keys` VALUES (8, '', '', '', '', '', 8);
INSERT INTO `keys` VALUES (9, '', '', '', '', '', 9);
INSERT INTO `keys` VALUES (10, '0', '', '0', '0', '0', 10);
@@ -143,6 +137,26 @@ CREATE TABLE `notice` (
`text` varchar(10000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+-- ----------------------------
+-- Records of notice
+-- ----------------------------
+INSERT INTO `notice` VALUES (1, '2019-07-25');
+
+-- ----------------------------
+-- Table structure for sysconfig
+-- ----------------------------
+DROP TABLE IF EXISTS `sysconfig`;
+CREATE TABLE `sysconfig` (
+ `id` int(2) NOT NULL AUTO_INCREMENT,
+ `register` int(2) NOT NULL COMMENT '是否可以注册',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+
+-- ----------------------------
+-- Records of sysconfig
+-- ----------------------------
+INSERT INTO `sysconfig` VALUES (1, 1);
+
-- ----------------------------
-- Table structure for uploadconfig
-- ----------------------------
@@ -163,7 +177,7 @@ CREATE TABLE `uploadconfig` (
-- ----------------------------
-- Records of uploadconfig
-- ----------------------------
-INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 1, 1, 0);
+INSERT INTO `uploadconfig` VALUES (1, 2, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 2, 0, 1);
-- ----------------------------
-- Table structure for user
@@ -179,7 +193,7 @@ CREATE TABLE `user` (
`uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户唯一标识',
`isok` int(2) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of user
diff --git a/src/main/java/cn/hellohao/controller/AdminRootController.java b/src/main/java/cn/hellohao/controller/AdminRootController.java
index 87af2d8..9b684f9 100644
--- a/src/main/java/cn/hellohao/controller/AdminRootController.java
+++ b/src/main/java/cn/hellohao/controller/AdminRootController.java
@@ -6,6 +6,7 @@ import cn.hellohao.utils.StringUtils;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
@@ -31,7 +32,10 @@ public class AdminRootController {
private UploadConfigService uploadConfigService;
@Autowired
private NoticeService noticeService;
-
+ @Autowired
+ private SysConfigService sysConfigService;
+ @Value("${systemupdate}")
+ private String systemupdate;
//返回对象存储界面
@RequestMapping(value = "/touser")
public String touser() {
@@ -151,8 +155,10 @@ public class AdminRootController {
public String towebconfig(Model model) {
Config config = configService.getSourceype();
UploadConfig updateConfig = uploadConfigService.getUpdateConfig();
+ SysConfig sysConfig = sysConfigService.getstate();
model.addAttribute("config",config);
model.addAttribute("updateConfig",updateConfig);
+ model.addAttribute("sysconfig",sysConfig);
return "admin/webconfig";
}
//修改站点配置
@@ -160,7 +166,7 @@ public class AdminRootController {
@ResponseBody
public Integer updateconfig(String webname,String explain, String logos,
String footed, String links, String notice,String baidu,
- String domain,String background1,String background2 ) {
+ String domain,String background1,String background2,Integer sett ) {
Config config = new Config();
config.setWebname(webname);
config.setExplain(explain);
@@ -172,6 +178,7 @@ public class AdminRootController {
config.setDomain(domain);
config.setBackground1(background1);
config.setBackground2(background2);
+ config.setSett(sett);
Integer ret = configService.setSourceype(config);
return ret;
}
@@ -192,6 +199,15 @@ public class AdminRootController {
jsonArray.add(ret);
return jsonArray.toString();
}
+ //修改注册开关
+ @PostMapping("/setstate")
+ @ResponseBody
+ public Integer setstate(HttpSession session, SysConfig sysConfig) {
+ Integer ret =-1;
+ ret = sysConfigService.setstate(sysConfig);
+ return ret;
+ }
+
//关于系统
@RequestMapping("/about")
@@ -199,6 +215,7 @@ public class AdminRootController {
//Integer ret = uploadConfigService.setUpdateConfig(updateConfig);
User u = (User) session.getAttribute("user");
model.addAttribute("level",u.getLevel());
+ model.addAttribute("systemupdate",systemupdate);
return "admin/about";
}
//检查更新
diff --git a/src/main/java/cn/hellohao/controller/UpdateImgController.java b/src/main/java/cn/hellohao/controller/UpdateImgController.java
index 3412e2b..13604cb 100644
--- a/src/main/java/cn/hellohao/controller/UpdateImgController.java
+++ b/src/main/java/cn/hellohao/controller/UpdateImgController.java
@@ -126,7 +126,6 @@ public class UpdateImgController {
@ResponseBody
public String upimg( HttpSession session
, @RequestParam(value = "file", required = false) MultipartFile[] file) throws Exception {
-
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
User u = (User) session.getAttribute("user");
diff --git a/src/main/java/cn/hellohao/dao/SysConfigMapper.java b/src/main/java/cn/hellohao/dao/SysConfigMapper.java
new file mode 100644
index 0000000..eb57199
--- /dev/null
+++ b/src/main/java/cn/hellohao/dao/SysConfigMapper.java
@@ -0,0 +1,15 @@
+package cn.hellohao.dao;
+
+import cn.hellohao.pojo.SysConfig;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author Tiansh
+ * @version 1.0
+ * @date 2019/8/15 13:33
+ */
+@Mapper
+public interface SysConfigMapper {
+ SysConfig getstate();
+ Integer setstate(SysConfig sysConfig);
+}
diff --git a/src/main/java/cn/hellohao/pojo/Config.java b/src/main/java/cn/hellohao/pojo/Config.java
index 182a777..4533014 100644
--- a/src/main/java/cn/hellohao/pojo/Config.java
+++ b/src/main/java/cn/hellohao/pojo/Config.java
@@ -14,13 +14,13 @@ public class Config {
private String domain;
private String background1;
private String background2;
- private String sett;
+ private Integer sett;
public Config() {
}
- public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String logos, String footed, String links, String notice, String baidu, String domain, String background1, String background2, String sett) {
+ public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String logos, String footed, String links, String notice, String baidu, String domain, String background1, String background2, Integer sett) {
this.id = id;
this.sourcekey = sourcekey;
this.emails = emails;
@@ -141,11 +141,11 @@ public class Config {
this.background2 = background2;
}
- public String getSett() {
+ public Integer getSett() {
return sett;
}
- public void setSett(String sett) {
+ public void setSett(Integer sett) {
this.sett = sett;
}
}
diff --git a/src/main/java/cn/hellohao/pojo/SysConfig.java b/src/main/java/cn/hellohao/pojo/SysConfig.java
new file mode 100644
index 0000000..4f63747
--- /dev/null
+++ b/src/main/java/cn/hellohao/pojo/SysConfig.java
@@ -0,0 +1,35 @@
+package cn.hellohao.pojo;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/15 13:27
+ */
+public class SysConfig {
+ private Integer id;
+ private String register;
+
+ public SysConfig() {
+ }
+
+ public SysConfig(Integer id, String register) {
+ this.id = id;
+ this.register = register;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getRegister() {
+ return register;
+ }
+
+ public void setRegister(String register) {
+ this.register = register;
+ }
+}
diff --git a/src/main/java/cn/hellohao/service/SysConfigService.java b/src/main/java/cn/hellohao/service/SysConfigService.java
new file mode 100644
index 0000000..a47d7c1
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/SysConfigService.java
@@ -0,0 +1,16 @@
+package cn.hellohao.service;
+
+import cn.hellohao.dao.SysConfigMapper;
+import cn.hellohao.pojo.SysConfig;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/15 13:46
+ */
+@Service
+public interface SysConfigService {
+ SysConfig getstate();
+ Integer setstate(SysConfig sysConfig);
+}
diff --git a/src/main/java/cn/hellohao/service/impl/SysConfigServiceImpl.java b/src/main/java/cn/hellohao/service/impl/SysConfigServiceImpl.java
new file mode 100644
index 0000000..ab11f05
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/impl/SysConfigServiceImpl.java
@@ -0,0 +1,27 @@
+package cn.hellohao.service.impl;
+
+import cn.hellohao.dao.SysConfigMapper;
+import cn.hellohao.pojo.SysConfig;
+import cn.hellohao.service.SysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/15 13:48
+ */
+@Service
+public class SysConfigServiceImpl implements SysConfigService {
+ @Autowired
+ private SysConfigMapper sysConfigMapper;
+ @Override
+ public SysConfig getstate() {
+ return sysConfigMapper.getstate();
+ }
+
+ @Override
+ public Integer setstate(SysConfig sysConfig) {
+ return sysConfigMapper.setstate(sysConfig);
+ }
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 055f64e..c67d80f 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -24,7 +24,7 @@ multipart.maxFileSize=10240KB
multipart.maxRequestSize=10240KB
spring.thymeleaf.mode = LEGACYHTML5
spring.http.multipart.location=/data/upload_tmp
-systemupdate=2019-08-10
+systemupdate=2019-08-15
diff --git a/src/main/resources/mapper/SysConfigMapper.xml b/src/main/resources/mapper/SysConfigMapper.xml
new file mode 100644
index 0000000..c5abccd
--- /dev/null
+++ b/src/main/resources/mapper/SysConfigMapper.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+ UPDATE sysconfig
+
+
+ `register` = #{register}
+
+
+ where id=1
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/admin/about.html b/src/main/resources/templates/admin/about.html
index 4233d20..4e9513e 100644
--- a/src/main/resources/templates/admin/about.html
+++ b/src/main/resources/templates/admin/about.html
@@ -27,7 +27,7 @@
开发者交流群:32452345342
- 当前系统版本:2019-08-10 检查更新
+
支持一下作者吧:
@@ -46,7 +46,8 @@
})
});
- function sysupdate(v) {
+ function sysupdate() {
+ var v = $('#dates').text();
$.ajax({
type: "POST",
url: "/admin/root/sysupdate",
diff --git a/src/main/resources/templates/admin/index.html b/src/main/resources/templates/admin/index.html
index e46398b..0c81af1 100644
--- a/src/main/resources/templates/admin/index.html
+++ b/src/main/resources/templates/admin/index.html
@@ -15,6 +15,9 @@
.layui-logo{
font-family: 'Old English Text MT', 'EngraversOldEnglishBT-Bold', 'Lato', "PingFang SC", "Microsoft YaHei", sans-serif;
}
+ #titles{
+ font-size: 1.2em;
+ }
@@ -24,7 +27,7 @@
- 图床后台管理
+ Console
diff --git a/src/main/resources/templates/admin/webconfig.html b/src/main/resources/templates/admin/webconfig.html
index 22c8ea9..25aba21 100644
--- a/src/main/resources/templates/admin/webconfig.html
+++ b/src/main/resources/templates/admin/webconfig.html
@@ -15,11 +15,11 @@
- 首页设置
- 百度统计
- 上传配置
+ - 站点配置
@@ -209,6 +233,7 @@