diff --git a/pom.xml b/pom.xml
index 80dbc3e..d6f085a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,21 +10,19 @@
cn.hellohao
Tbed
- 0.0.1-SNAPSHOT
+ Pro
Tbed
Hellohao Picture Bed for Spring Boot
1.8
+ springboot
-
org.springframework.boot
spring-boot-starter-thymeleaf
-
-
com.alibaba
fastjson
@@ -174,6 +172,7 @@
org.springframework.boot
spring-boot-maven-plugin
+
diff --git a/sql/picturebed.sql b/sql/picturebed.sql
index 8e46211..4eabf1b 100644
--- a/sql/picturebed.sql
+++ b/sql/picturebed.sql
@@ -1,183 +1,432 @@
-/*
- Navicat Premium Data Transfer
+-- phpMyAdmin SQL Dump
+-- version 4.7.9
+-- https://www.phpmyadmin.net/
+--
+-- Host: localhost
+-- Generation Time: 2019-08-25 16:13:11
+-- 服务器版本: 5.5.62-log
+-- PHP Version: 7.2.18
- Source Server : localhost
- Source Server Type : MySQL
- Source Server Version : 50720
- Source Host : localhost:3306
- Source Schema : picturebed
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET AUTOCOMMIT = 0;
+START TRANSACTION;
+SET time_zone = "+00:00";
- Target Server Type : MySQL
- Target Server Version : 50720
- File Encoding : 65001
- Date: 07/08/2019 23:21:26
-*/
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
-SET NAMES utf8mb4;
-SET FOREIGN_KEY_CHECKS = 0;
+--
+-- Database: `picturebedpro`
+--
--- ----------------------------
--- Table structure for config
--- ----------------------------
-DROP TABLE IF EXISTS `config`;
-CREATE TABLE `config` (
- `id` int(4) NOT NULL AUTO_INCREMENT,
- `sourcekey` int(4) NULL DEFAULT NULL,
- `emails` int(4) NULL DEFAULT NULL,
- `webname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网站名',
- `explain` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '首页左下角说明',
- `logos` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '左下角的图片地址',
- `footed` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '页脚版权',
- `links` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '友链',
- `notice` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公告',
- `baidu` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '百度统计',
- `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,
- 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, 7, 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);
+--
+-- 表的结构 `code`
+--
--- ----------------------------
--- Table structure for emailconfig
--- ----------------------------
-DROP TABLE IF EXISTS `emailconfig`;
-CREATE TABLE `emailconfig` (
- `id` int(2) NOT NULL AUTO_INCREMENT,
- `emails` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
- `emailkey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权码',
- `emailurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务器',
- `port` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口',
- `emailname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
- `using` int(4) NULL DEFAULT NULL COMMENT '1为可用,其他为不使用',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+CREATE TABLE `code` (
+ `id` int(255) NOT NULL,
+ `value` int(20) NOT NULL,
+ `code` varchar(500) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--- ----------------------------
--- Records of emailconfig
--- ----------------------------
-INSERT INTO `emailconfig` VALUES (1, NULL, NULL, NULL, NULL, NULL, 0);
+-- --------------------------------------------------------
--- ----------------------------
--- Table structure for imgdata
--- ----------------------------
-DROP TABLE IF EXISTS `imgdata`;
-CREATE TABLE `imgdata` (
- `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `imgname` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片名',
- `imgurl` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片链接',
- `userid` int(10) NULL DEFAULT NULL COMMENT '用户名',
- `updatetime` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上传时间',
- `sizes` int(255) NULL DEFAULT NULL COMMENT '文件大小',
- `abnormal` int(2) NULL DEFAULT NULL COMMENT '异常',
- `source` int(2) NULL DEFAULT NULL COMMENT '存储源',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+--
+-- 表的结构 `config`
+--
--- ----------------------------
--- Table structure for imgreview
--- ----------------------------
-DROP TABLE IF EXISTS `imgreview`;
-CREATE TABLE `imgreview` (
- `id` int(4) NOT NULL AUTO_INCREMENT,
- `app_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `api_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `secret_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `Using` int(4) NULL DEFAULT NULL,
- `count` int(10) NULL DEFAULT NULL COMMENT '拦截数量',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-
--- ----------------------------
--- Records of imgreview
--- ----------------------------
-INSERT INTO `imgreview` VALUES (1, NULL, NULL, NULL, 0, 0);
-
--- ----------------------------
--- Table structure for keys
--- ----------------------------
-DROP TABLE IF EXISTS `keys`;
-CREATE TABLE `keys` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `AccessKey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `AccessSecret` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `Endpoint` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `Bucketname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `RequestAddress` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `storageType` int(11) NULL DEFAULT NULL,
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-
--- ----------------------------
--- 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, '123', '123', '0', '123', '123', 3);
-INSERT INTO `keys` VALUES (4, '123', '123', '4', '412', 'https://0.0', 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 (8, '', '', '', '', '', 8);
-INSERT INTO `keys` VALUES (9, '', '', '', '', '', 9);
-INSERT INTO `keys` VALUES (10, '0', '', '0', '0', '0', 10);
-
--- ----------------------------
--- Table structure for notice
--- ----------------------------
-DROP TABLE IF EXISTS `notice`;
-CREATE TABLE `notice` (
+CREATE TABLE `config` (
`id` int(4) NOT NULL,
- `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;
+ `sourcekey` int(4) DEFAULT NULL,
+ `emails` int(4) DEFAULT NULL,
+ `webname` varchar(255) DEFAULT NULL COMMENT '网站名',
+ `explain` varchar(500) DEFAULT NULL COMMENT '首页左下角说明',
+ `video` varchar(500) DEFAULT NULL COMMENT '视频地址',
+ `backtype` varchar(500) DEFAULT NULL COMMENT '背景类型',
+ `links` varchar(255) DEFAULT NULL COMMENT '友链',
+ `notice` varchar(500) DEFAULT NULL COMMENT '公告',
+ `baidu` varchar(500) DEFAULT NULL COMMENT '百度统计',
+ `domain` varchar(255) DEFAULT NULL COMMENT '站点域名',
+ `background1` varchar(500) DEFAULT NULL COMMENT '首页背景图',
+ `background2` varchar(500) DEFAULT NULL COMMENT '上传页面背景图',
+ `sett` int(2) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
--- ----------------------------
--- Table structure for uploadconfig
--- ----------------------------
-DROP TABLE IF EXISTS `uploadconfig`;
-CREATE TABLE `uploadconfig` (
- `id` int(2) NOT NULL AUTO_INCREMENT,
- `filesizetourists` int(10) NULL DEFAULT NULL COMMENT '游客上传文件最大',
- `filesizeuser` int(10) NULL DEFAULT NULL COMMENT '用户上传文件最大',
- `imgcounttourists` int(10) NULL DEFAULT NULL COMMENT '游客文件总数量, 超出则不允许加入队列',
- `imgcountuser` int(10) NULL DEFAULT NULL COMMENT '用户文件总数量, 超出则不允许加入队列',
- `suffix` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支持后缀',
- `urltype` int(2) NULL DEFAULT NULL,
- `isupdate` int(2) NOT NULL COMMENT '游客是否可以上传',
+--
+-- 转存表中的数据 `config`
+--
+
+INSERT INTO `config` (`id`, `sourcekey`, `emails`, `webname`, `explain`, `video`, `backtype`, `links`, `notice`, `baidu`, `domain`, `background1`, `background2`, `sett`) VALUES
+(1, 5, 1, 'Hellohao', '网站由JAVA语言编写应用SpringBoot框架开发,前端全部组件由BootStrap/Layui框架编写。由作者个人更新维护,后期会加入更全面的功能供大家使用,如有BUG请与我反馈。', 'https://hellohao-cloud.oss-cn-beijing.aliyuncs.com/Pexels.mp4', '2', '作者博客高清壁纸json格式化', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://tc.hellohao.cn', 'https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1565769264&di=74d809d6cfae81bbab83bf9d573d8f9a&src=http://pic17.nipic.com/20110917/7420038_160826355111_2.jpg', 'https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1565769264&di=74d809d6cfae81bbab83bf9d573d8f9a&src=http://pic17.nipic.com/20110917/7420038_160826355111_2.jpg', 1);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `emailconfig`
+--
+
+CREATE TABLE `emailconfig` (
+ `id` int(2) NOT NULL,
+ `emails` varchar(255) DEFAULT NULL COMMENT '邮箱',
+ `emailkey` varchar(255) DEFAULT NULL COMMENT '授权码',
+ `emailurl` varchar(255) DEFAULT NULL COMMENT '服务器',
+ `port` varchar(255) DEFAULT NULL COMMENT '端口',
+ `emailname` varchar(255) DEFAULT NULL COMMENT '用户名',
+ `using` int(4) DEFAULT NULL COMMENT '1为可用,其他为不使用'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
+
+--
+-- 转存表中的数据 `emailconfig`
+--
+
+INSERT INTO `emailconfig` (`id`, `emails`, `emailkey`, `emailurl`, `port`, `emailname`, `using`) VALUES
+(1, '', '', '', '', '', 0);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `group`
+--
+
+CREATE TABLE `group` (
+ `id` int(255) NOT NULL,
+ `groupname` varchar(255) NOT NULL COMMENT '组名称',
+ `keyid` int(255) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- 转存表中的数据 `group`
+--
+
+INSERT INTO `group` (`id`, `groupname`, `keyid`) VALUES
+(1, '默认群组', 5);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `imgdata`
+--
+
+CREATE TABLE `imgdata` (
+ `id` int(10) NOT NULL COMMENT '主键',
+ `imgname` varchar(500) DEFAULT NULL COMMENT '图片名',
+ `imgurl` varchar(500) DEFAULT NULL COMMENT '图片链接',
+ `userid` int(10) DEFAULT NULL COMMENT '用户名',
+ `updatetime` varchar(50) DEFAULT NULL COMMENT '上传时间',
+ `sizes` int(255) DEFAULT NULL COMMENT '文件大小',
+ `abnormal` int(2) DEFAULT NULL COMMENT '异常',
+ `source` int(2) DEFAULT NULL COMMENT '存储源'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
+
+--
+-- 转存表中的数据 `imgdata`
+--
+
+INSERT INTO `imgdata` (`id`, `imgname`, `imgurl`, `userid`, `updatetime`, `sizes`, `abnormal`, `source`) VALUES
+(28, 'admin/4cc700823104929.png', 'https://hellohao.nos-eastchina1.126.net/admin/4cc700823104929.png', 1, '2019-08-23', 263, NULL, 1),
+(29, 'tourist/9c6560823105311.png', 'https://hellohao.nos-eastchina1.126.net/tourist/9c6560823105311.png', 0, '2019-08-23', 273, NULL, 1);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `imgreview`
+--
+
+CREATE TABLE `imgreview` (
+ `id` int(4) NOT NULL,
+ `app_id` varchar(255) DEFAULT NULL,
+ `api_key` varchar(255) DEFAULT NULL,
+ `secret_key` varchar(255) DEFAULT NULL,
+ `Using` int(4) DEFAULT NULL,
+ `count` int(10) DEFAULT NULL COMMENT '拦截数量'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
+
+--
+-- 转存表中的数据 `imgreview`
+--
+
+INSERT INTO `imgreview` (`id`, `app_id`, `api_key`, `secret_key`, `Using`, `count`) VALUES
+(1, NULL, NULL, NULL, 0, 0);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `keys`
+--
+
+CREATE TABLE `keys` (
+ `id` int(11) NOT NULL,
+ `AccessKey` varchar(255) DEFAULT NULL,
+ `AccessSecret` varchar(255) DEFAULT NULL,
+ `Endpoint` varchar(255) DEFAULT NULL,
+ `Bucketname` varchar(255) DEFAULT NULL,
+ `RequestAddress` varchar(255) DEFAULT NULL,
+ `storageType` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
+
+--
+-- 转存表中的数据 `keys`
+--
+
+INSERT INTO `keys` (`id`, `AccessKey`, `AccessSecret`, `Endpoint`, `Bucketname`, `RequestAddress`, `storageType`) VALUES
+(1, '', '', '', '', 'https://hellohao.nos-eastchina1.126.net', 1),
+(2, '', '', '', '', '', 2),
+(3, '', '', '', '', '', 3),
+(4, '', '', '', '', '', 4),
+(5, '0', '0', '0', '0', '0', 5),
+(6, '', '', '', '', '', 6),
+(7, '', '', '', '', '', 7),
+(8, '', '', '', '', '', 8),
+(9, '', '', '', '', '', 9),
+(10, '0', '', '0', '0', '0', 10);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `notice`
+--
+
+CREATE TABLE `notice` (
+ `id` int(4) NOT NULL,
+ `text` varchar(10000) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `sysconfig`
+--
+
+CREATE TABLE `sysconfig` (
+ `id` int(2) NOT NULL,
+ `register` int(2) NOT NULL COMMENT '是否可以注册'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- 转存表中的数据 `sysconfig`
+--
+
+INSERT INTO `sysconfig` (`id`, `register`) VALUES
+(1, 1);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `uploadconfig`
+--
+
+CREATE TABLE `uploadconfig` (
+ `id` int(2) NOT NULL,
+ `filesizetourists` int(10) DEFAULT NULL COMMENT '游客上传文件最大',
+ `filesizeuser` int(10) DEFAULT NULL COMMENT '用户上传文件最大',
+ `imgcounttourists` int(10) DEFAULT NULL COMMENT '游客文件总数量, 超出则不允许加入队列',
+ `imgcountuser` int(10) DEFAULT NULL COMMENT '用户文件总数量, 超出则不允许加入队列',
+ `suffix` varchar(255) DEFAULT NULL COMMENT '支持后缀',
+ `urltype` int(2) DEFAULT NULL,
+ `isupdate` int(2) DEFAULT NULL COMMENT '禁止游客上传',
`api` int(2) NOT NULL COMMENT '开启api',
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+ `visitormemory` int(10) DEFAULT NULL COMMENT '游客限制大小',
+ `usermemory` int(10) DEFAULT '0' COMMENT '用户默认大小'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
--- ----------------------------
--- Records of uploadconfig
--- ----------------------------
-INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 1, 1, 0);
+--
+-- 转存表中的数据 `uploadconfig`
+--
--- ----------------------------
--- Table structure for user
--- ----------------------------
-DROP TABLE IF EXISTS `user`;
-CREATE TABLE `user` (
- `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
- `password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
- `email` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '邮箱',
- `birthder` date NULL DEFAULT NULL COMMENT '注册时间',
- `level` int(10) NULL DEFAULT NULL COMMENT '等级',
- `uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户唯一标识',
+INSERT INTO `uploadconfig` (`id`, `filesizetourists`, `filesizeuser`, `imgcounttourists`, `imgcountuser`, `suffix`, `urltype`, `isupdate`, `api`, `visitormemory`, `usermemory`) VALUES
+(1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 1, 1, 0, 500, 1024);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `user`
+--
+
+CREATE TABLE `user` (
+ `id` int(10) NOT NULL COMMENT '主键',
+ `username` varchar(50) NOT NULL COMMENT '用户名',
+ `password` varchar(50) NOT NULL COMMENT '密码',
+ `email` varchar(20) NOT NULL COMMENT '邮箱',
+ `birthder` date DEFAULT NULL COMMENT '注册时间',
+ `level` int(10) DEFAULT NULL COMMENT '等级',
+ `uid` varchar(50) DEFAULT NULL COMMENT '用户唯一标识',
`isok` int(2) NOT NULL,
- PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+ `memory` int(10) DEFAULT NULL COMMENT '用户内存大小',
+ `groupid` int(255) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
--- ----------------------------
--- Records of user
--- ----------------------------
-INSERT INTO `user` VALUES (1, 'admin', 'admin', 'admin', '2019-06-12', 2, 'admin', 1);
+--
+-- 转存表中的数据 `user`
+--
-SET FOREIGN_KEY_CHECKS = 1;
+INSERT INTO `user` (`id`, `username`, `password`, `email`, `birthder`, `level`, `uid`, `isok`, `memory`, `groupid`) VALUES
+(1, 'admin', 'admin', 'admin', '2019-06-12', 2, 'admin', 1, 1024, 1);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `usergroup`
+--
+
+CREATE TABLE `usergroup` (
+ `id` int(255) NOT NULL,
+ `userid` int(255) DEFAULT NULL,
+ `groupid` int(255) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- 转存表中的数据 `usergroup`
+--
+
+INSERT INTO `usergroup` (`id`, `userid`, `groupid`) VALUES
+(1, 1, 1);
+
+--
+-- Indexes for dumped tables
+--
+
+--
+-- Indexes for table `code`
+--
+ALTER TABLE `code`
+ ADD PRIMARY KEY (`id`);
+
+--
+-- Indexes for table `config`
+--
+ALTER TABLE `config`
+ ADD PRIMARY KEY (`id`) USING BTREE;
+
+--
+-- Indexes for table `emailconfig`
+--
+ALTER TABLE `emailconfig`
+ ADD PRIMARY KEY (`id`) USING BTREE;
+
+--
+-- Indexes for table `group`
+--
+ALTER TABLE `group`
+ ADD PRIMARY KEY (`id`);
+
+--
+-- Indexes for table `imgdata`
+--
+ALTER TABLE `imgdata`
+ ADD PRIMARY KEY (`id`) USING BTREE;
+
+--
+-- Indexes for table `imgreview`
+--
+ALTER TABLE `imgreview`
+ ADD PRIMARY KEY (`id`) USING BTREE;
+
+--
+-- Indexes for table `keys`
+--
+ALTER TABLE `keys`
+ ADD PRIMARY KEY (`id`) USING BTREE;
+
+--
+-- Indexes for table `sysconfig`
+--
+ALTER TABLE `sysconfig`
+ ADD PRIMARY KEY (`id`);
+
+--
+-- Indexes for table `uploadconfig`
+--
+ALTER TABLE `uploadconfig`
+ ADD PRIMARY KEY (`id`) USING BTREE;
+
+--
+-- Indexes for table `user`
+--
+ALTER TABLE `user`
+ ADD PRIMARY KEY (`id`) USING BTREE;
+
+--
+-- Indexes for table `usergroup`
+--
+ALTER TABLE `usergroup`
+ ADD PRIMARY KEY (`id`);
+
+--
+-- 在导出的表使用AUTO_INCREMENT
+--
+
+--
+-- 使用表AUTO_INCREMENT `code`
+--
+ALTER TABLE `code`
+ MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
+
+--
+-- 使用表AUTO_INCREMENT `config`
+--
+ALTER TABLE `config`
+ MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
+
+--
+-- 使用表AUTO_INCREMENT `emailconfig`
+--
+ALTER TABLE `emailconfig`
+ MODIFY `id` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
+
+--
+-- 使用表AUTO_INCREMENT `group`
+--
+ALTER TABLE `group`
+ MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
+
+--
+-- 使用表AUTO_INCREMENT `imgdata`
+--
+ALTER TABLE `imgdata`
+ MODIFY `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=30;
+
+--
+-- 使用表AUTO_INCREMENT `imgreview`
+--
+ALTER TABLE `imgreview`
+ MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
+
+--
+-- 使用表AUTO_INCREMENT `keys`
+--
+ALTER TABLE `keys`
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
+
+--
+-- 使用表AUTO_INCREMENT `sysconfig`
+--
+ALTER TABLE `sysconfig`
+ MODIFY `id` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
+
+--
+-- 使用表AUTO_INCREMENT `uploadconfig`
+--
+ALTER TABLE `uploadconfig`
+ MODIFY `id` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
+
+--
+-- 使用表AUTO_INCREMENT `user`
+--
+ALTER TABLE `user`
+ MODIFY `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=14;
+
+--
+-- 使用表AUTO_INCREMENT `usergroup`
+--
+ALTER TABLE `usergroup`
+ MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
+COMMIT;
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/src/main/java/cn/hellohao/TbedApplication.java b/src/main/java/cn/hellohao/TbedApplication.java
index da6c758..0ca8af2 100644
--- a/src/main/java/cn/hellohao/TbedApplication.java
+++ b/src/main/java/cn/hellohao/TbedApplication.java
@@ -1,22 +1,41 @@
package cn.hellohao;
import javax.servlet.MultipartConfigElement;
+import javax.servlet.http.HttpServletRequest;
+import cn.hellohao.utils.Print;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import java.net.InetAddress;
+import java.util.Scanner;
@SpringBootApplication
@Configuration
+@EnableTransactionManagement(proxyTargetClass = true)
public class TbedApplication {
- public static void main(String[] args) {
- SpringApplication.run(TbedApplication.class, args);
+public static void main(String[] args) {
+ SpringApplication.run(TbedApplication.class, args);
+
+ Scanner scanner = new Scanner(System.in);
+// Print.Normal("请输入密钥:");
+// String in = scanner.nextLine();
+// if(in.equals("111")){
+// Print.Normal("正确,进入");
+// }else{
+// Print.warning("错误,退出");
+// }
+
+
}
-
/**
* 文件上传配置
*
@@ -30,11 +49,6 @@ public class TbedApplication {
/// 总上传数据大小
factory.setMaxRequestSize("102400KB");
return factory.createMultipartConfig();
-
-
-
-
-
}
}
diff --git a/src/main/java/cn/hellohao/controller/AdminController.java b/src/main/java/cn/hellohao/controller/AdminController.java
index f459a48..b919813 100644
--- a/src/main/java/cn/hellohao/controller/AdminController.java
+++ b/src/main/java/cn/hellohao/controller/AdminController.java
@@ -4,7 +4,10 @@ import cn.hellohao.pojo.*;
import cn.hellohao.pojo.vo.PageResultBean;
import cn.hellohao.service.*;
import cn.hellohao.service.impl.ImgServiceImpl;
+import cn.hellohao.service.impl.UserServiceImpl;
+import cn.hellohao.utils.GetCurrentSource;
import cn.hellohao.utils.LocUpdateImg;
+import cn.hellohao.utils.Print;
import cn.hellohao.utils.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -35,16 +38,24 @@ public class AdminController {
@Autowired
private UserService userService;
@Autowired
+ private UserServiceImpl userServiceImpl;
+ @Autowired
private ImgreviewService imgreviewService;
@Autowired
private ConfigService configService;
@Autowired
private UploadConfigService uploadConfigService;
+ @Autowired
+ private CodeService codeService;
+
@RequestMapping(value = "/goadmin")
public String goadmin1(HttpSession session, Model model, HttpServletRequest request) {
User user = (User) session.getAttribute("user");
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
+ Integer usermemory = imgService.getusermemory(user.getId());
+ if(usermemory==null){usermemory=0;}
+ User u = userService.getUsers(user.getEmail());
if(user!=null){
if (user.getLevel() == 1) {
model.addAttribute("level", "普通用户");
@@ -56,32 +67,33 @@ public class AdminController {
model.addAttribute("levels", user.getLevel());
model.addAttribute("username", user.getUsername());
model.addAttribute("api", uploadConfig.getApi());
+
+ model.addAttribute("memory",u.getMemory());//单位M
+ if(usermemory==null){
+ model.addAttribute("usermemory", 0);//单位M
+ }else{
+ float d = (float) (Math.round((usermemory/1024.0F) * 100.0) / 100.0);
+ //Print.Normal();
+ model.addAttribute("usermemory", d);//单位M
+ }
return "admin/index";
}else{
return "redirect:/";
}
}
- // 进入后台页面
@RequestMapping(value = "/admin")
public String goadmin(HttpSession session, Model model) {
- Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
- Keys key = keysService.selectKeys(config.getSourcekey());
+ Config config = configService.getSourceype();
User u = (User) session.getAttribute("user");
- Imgreview imgreview = imgreviewService.selectByPrimaryKey(1);
model.addAttribute("username", u.getUsername());
model.addAttribute("level", u.getLevel());
model.addAttribute("email", u.getEmail());
model.addAttribute("loginid", 100);
- //Boolean b = StringUtils.doNull(key);//判断对象是否有空值
-// if(b){
-// model.addAttribute("source", key.getStorageType());
-// }else{
-// model.addAttribute("source", 456);
-// }
+
return "admin/table";
}
- // 进入后台页面
+
@RequestMapping(value = "/tosurvey")
public String admin2(HttpSession session, Model model) {
User u = (User) session.getAttribute("user");
@@ -94,24 +106,25 @@ public class AdminController {
model.addAttribute("jdk", jdk);
return "admin/survey";
}
- //获取本站概况
+
@RequestMapping(value = "/getwebconfig")
@ResponseBody
public String getwebconfig(HttpSession session) {
JSONObject jsonObject = new JSONObject();
- Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
+ Config config = configService.getSourceype();
User u = (User) session.getAttribute("user");
+ Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
Imgreview imgreview = imgreviewService.selectByPrimaryKey(1);
- jsonObject.put("usercount", imgService.countimg(u.getId()));//这个是根据用户id查询他的图片数
- jsonObject.put("counts", imgService.counts(null) );//总数
+ jsonObject.put("usercount", imgService.countimg(u.getId()));
+ jsonObject.put("counts", imgService.counts(null) );
jsonObject.put("getusertotal", userService.getUserTotal() );
jsonObject.put("imgreviewcount", imgreview.getCount());
- Keys key= keysService.selectKeys(config.getSourcekey());//然后根据类型再查询key
+ Keys key= keysService.selectKeys(Sourcekey);
Boolean b =false;
- if(config.getSourcekey()==5){
+ if(Sourcekey==5){
b =true;
}else{
- b = StringUtils.doNull(config.getSourcekey(),key);//判断对象是否有空值
+ b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
}
if(b){
jsonObject.put("source", key.getStorageType());
@@ -169,7 +182,7 @@ public class AdminController {
PageHelper.startPage(pageNum, pageSize);
List users = null;
if (u.getLevel() > 1) { //根据用户等级查询管理员查询所有的信息
- users = userService.getuserlist();// 这是我们的sql
+ users = userService.getuserlist(u);// 这是我们的sql
// 使用pageInfo包装查询
PageInfo rolePageInfo = new PageInfo<>(users);//
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
@@ -183,14 +196,16 @@ public class AdminController {
@RequestMapping(value = "/selectusertable2")
@ResponseBody
public Map selectByFy12(HttpSession session, @RequestParam(required = false, defaultValue = "1") int page,
- @RequestParam(required = false) int limit) {
+ @RequestParam(required = false) int limit,String username) {
User u = (User) session.getAttribute("user");
// 使用Pagehelper传入当前页数和页面显示条数会自动为我们的select语句加上limit查询
// 从他的下一条sql开始分页
PageHelper.startPage(page, limit);
List users = null;
if (u.getLevel() > 1) { //根据用户等级查询管理员查询所有的信息
- users = userService.getuserlist();// 这是我们的sql
+ User user = new User();
+ user.setUsername(username);
+ users = userService.getuserlist(user);// 这是我们的sql
// 使用pageInfo包装查询
PageInfo rolePageInfo = new PageInfo<>(users);//
Map map = new HashMap();
@@ -211,12 +226,12 @@ public class AdminController {
User u = (User) session.getAttribute("user");
Images images = imgService.selectByPrimaryKey(id);
Keys key = keysService.selectKeys(sourcekey);
- Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
+ Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
Boolean b =false;
- if(config.getSourcekey()==5){
+ if(Sourcekey==5){
b =true;
}else{
- b = StringUtils.doNull(config.getSourcekey(),key);//判断对象是否有空值
+ b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
}
if(b){
ImgServiceImpl de = new ImgServiceImpl();
@@ -262,15 +277,15 @@ public class AdminController {
Integer v = 0;
ImgServiceImpl de = new ImgServiceImpl();
User u = (User) session.getAttribute("user");
- Config config = configService.getSourceype();
+ Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
for (int i = 0; i < ids.length; i++) {
Images images = imgService.selectByPrimaryKey(ids[i]);
Keys key = keysService.selectKeys(images.getSource());
Boolean b =false;
- if(config.getSourcekey()==5){
+ if(Sourcekey==5){
b =true;
}else{
- b = StringUtils.doNull(config.getSourcekey(),key);//判断对象是否有空值
+ b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
}
if(b){
if (key.getStorageType() == 1) {
@@ -311,8 +326,7 @@ public class AdminController {
public String tosetuser(HttpSession session, Model model, HttpServletRequest request) {
User u = (User) session.getAttribute("user");
//key信息
- model.addAttribute("username", u.getUsername());
- model.addAttribute("level", u.getLevel());
+ model.addAttribute("user", u);
return "admin/setuser";
}
@@ -320,11 +334,18 @@ public class AdminController {
@PostMapping("/change")
@ResponseBody
public String change(HttpSession session, User user) {
- //Integer count = userService.checkUsername(user.getUsername());//查询用户名是否重复
User u = (User) session.getAttribute("user");
- user.setEmail(u.getEmail());
+ //user.setEmail(u.getEmail());
+ user.setUid(u.getUid());
JSONArray jsonArray = new JSONArray();
- Integer ret = userService.change(user);
+ Integer ret =0;
+ if(u.getLevel()==1){
+ user.setUsername(null);
+ user.setEmail(null);
+ ret = userService.change(user);
+ }else{
+ ret = userService.change(user);
+ }
jsonArray.add(ret);
if (u.getEmail() != null && u.getPassword() != null) {
session.removeAttribute("user");
@@ -346,6 +367,40 @@ public class AdminController {
return "admin/api";
}
+
+ @PostMapping(value = "/kuorong")
+ @ResponseBody
+ public String kuorong(HttpSession session, String codestring) {
+ User u = (User) session.getAttribute("user");
+ JSONObject jsonObject = new JSONObject();
+ User u1 = userService.getUsers(u.getEmail());
+ Integer ret =0;
+ Integer sizes = 0;
+ if(u!=null){
+ //List code = codeService.selectCode(codestring);
+ Code c = codeService.selectCodekey(codestring);
+ Print.warning(c);
+ if(c!=null) {
+ User user = new User();
+ sizes = c.getValue()+u1.getMemory();
+ user.setMemory(c.getValue()+u1.getMemory());
+ user.setId(u.getId());
+ ret = userServiceImpl.usersetmemory(user,codestring);
+ if(ret>0){ ret = 1; }
+ }else{
+ //扩容码不存在
+ ret=-1;
+ }
+ }else{
+ //登录过期
+ session.invalidate();
+ }
+ jsonObject.put("sizes",sizes);
+ jsonObject.put("ret",ret);
+ return jsonObject.toString();
+ }
+
+
@GetMapping(value = "/images/{id}")
@ResponseBody
public Images selectByFy(@PathVariable("id") Integer id) {
diff --git a/src/main/java/cn/hellohao/controller/AdminRootController.java b/src/main/java/cn/hellohao/controller/AdminRootController.java
index 7e997f9..3f0e0dc 100644
--- a/src/main/java/cn/hellohao/controller/AdminRootController.java
+++ b/src/main/java/cn/hellohao/controller/AdminRootController.java
@@ -2,15 +2,18 @@ package cn.hellohao.controller;
import cn.hellohao.pojo.*;
import cn.hellohao.service.*;
+import cn.hellohao.utils.GetCurrentSource;
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;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
@@ -31,6 +34,15 @@ public class AdminRootController {
private UploadConfigService uploadConfigService;
@Autowired
private NoticeService noticeService;
+ @Autowired
+ private SysConfigService sysConfigService;
+ @Autowired
+ private GroupService groupService;
+ //@Autowired
+ //private UserGroupService userGroupService;
+
+ @Value("${systemupdate}")
+ private String systemupdate;
//返回对象存储界面
@RequestMapping(value = "/touser")
@@ -41,23 +53,23 @@ public class AdminRootController {
//返回对象存储界面
@RequestMapping(value = "tostorage")
public String tostorage(HttpSession session, Model model, HttpServletRequest request) {
- Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
- Keys key= keysService.selectKeys(config.getSourcekey());//然后根据类型再查询key
- Boolean b = StringUtils.doNull(config.getSourcekey(),key);//判断对象是否有空值
+ User u = (User) session.getAttribute("user");
+ Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
+ Keys key= keysService.selectKeys(Sourcekey);//然后根据类型再查询key
+ Boolean b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
Integer StorageType = 0;
- if(config.getSourcekey()!=5){
+ if(Sourcekey!=5){
if(b){
//key信息
model.addAttribute("AccessKey", key.getAccessKey());
model.addAttribute("AccessSecret", key.getAccessSecret());
-
model.addAttribute("Endpoint", key.getEndpoint());
model.addAttribute("Bucketname", key.getBucketname());
model.addAttribute("RequestAddress", key.getRequestAddress());
- model.addAttribute("StorageType", config.getSourcekey());
+ model.addAttribute("StorageType", Sourcekey);
}
//如果是4就是七牛
- if(config.getSourcekey()==4){
+ if(Sourcekey==4){
model.addAttribute("Endpoint2", key.getEndpoint());
}else{
model.addAttribute("Endpoint2", 0);
@@ -71,7 +83,7 @@ public class AdminRootController {
return "admin/storageconfig";
}
- //根据下拉框选的存储源查询对应的key
+
@PostMapping("/getkey")
@ResponseBody
public String getkey(Integer storageType) {
@@ -80,14 +92,15 @@ public class AdminRootController {
jsonArray.add(key);
return jsonArray.toString();
}
- //获取当前使用的对象存储
+
@PostMapping("/getkeyourceype")
@ResponseBody
- public Integer getkeyourceype() {
- Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
+ public Integer getkeyourceype(HttpSession session) {
+ User u = (User) session.getAttribute("user");
+ Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
Integer ret = 0;
- if(config.getSourcekey()!=null){
- ret = config.getSourcekey();
+ if(Sourcekey!=null){
+ ret = Sourcekey;
}
return ret;
}
@@ -118,9 +131,9 @@ public class AdminRootController {
jsonArray.add("-1");
}else{
Integer ret = userService.deleuser(id);
+ //userGroupService.deleusergroup(id);
jsonArray.add(ret);
}
-
return jsonArray.toString();
}
@@ -132,7 +145,7 @@ public class AdminRootController {
return "admin/emailconfig";
}
- //修改邮箱验证
+
@PostMapping("/updateemail")
@ResponseBody
public Integer updateemail(HttpSession session,String emails, String emailkey, String emailurl, String port, String emailname, Integer using ) {
@@ -146,32 +159,28 @@ public class AdminRootController {
Integer ret = emailConfigService.updateemail(emailConfig);
return ret;
}
- //跳转系统配置页面
+
@RequestMapping(value = "/towebconfig")
- public String towebconfig(Model model) {
+ public String towebconfig(HttpSession session,Model model) {
Config config = configService.getSourceype();
+ User u = (User) session.getAttribute("user");
+ Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
UploadConfig updateConfig = uploadConfigService.getUpdateConfig();
+ SysConfig sysConfig = sysConfigService.getstate();
model.addAttribute("config",config);
model.addAttribute("updateConfig",updateConfig);
+ model.addAttribute("sysconfig",sysConfig);
+ model.addAttribute("group",Sourcekey);
return "admin/webconfig";
}
//修改站点配置
@PostMapping("/updateconfig")
@ResponseBody
- public Integer updateconfig(String webname,String explain, String logos,
- String footed, String links, String notice,String baidu,
- String domain,String background1,String background2 ) {
- Config config = new Config();
- config.setWebname(webname);
- config.setExplain(explain);
- config.setLogos(logos);
- config.setFooted(footed);
- config.setLinks(links);
- config.setNotice(notice);
- config.setBaidu(baidu);
- config.setDomain(domain);
- config.setBackground1(background1);
- config.setBackground2(background2);
+// public Integer updateconfig(String webname,String explain, String video,
+// Integer backtype, String links, String notice,String baidu,
+// String domain,String background1,String background2 ) {
+ public Integer updateconfig(Config config ) {
+
Integer ret = configService.setSourceype(config);
return ret;
}
@@ -183,12 +192,61 @@ public class AdminRootController {
return ret;
}
+ //修改用户激活状态
+ @PostMapping("/setisok")
+ @ResponseBody
+ public String setisok(HttpSession session, User user) {
+ Integer ret = userService.setisok(user);
+ JSONArray jsonArray = new JSONArray();
+ jsonArray.add(ret);
+ return jsonArray.toString();
+ }
+ //修改资料
+ @PostMapping("/setmemory")
+ @ResponseBody
+ public String setmemory(HttpSession session, User user) {
+ Integer ret = userService.setmemory(user);
+ JSONArray jsonArray = new JSONArray();
+ 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(value = "/modifyuser")
+ public String modifyuser(Model model,String uid,Integer id) {
+ User user = userService.getUsersMail(uid);
+ model.addAttribute("memory",user.getMemory());
+ model.addAttribute("groupid",user.getGroupid());
+ model.addAttribute("uid",uid);
+ model.addAttribute("id",id);
+ return "admin/modifyuser";
+ }
+
+ @PostMapping("/settstoragetype")
+ @ResponseBody
+ public Integer settstoragetype(Integer storagetype) {
+ Config config = new Config();
+ config.setSourcekey(storagetype);
+ Integer val = configService.setSourceype(config);
+ return val;
+ }
+
+
//关于系统
@RequestMapping("/about")
public String about(HttpSession session,Model model ) {
//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/ClientController.java b/src/main/java/cn/hellohao/controller/ClientController.java
index bae29e4..93ad32c 100644
--- a/src/main/java/cn/hellohao/controller/ClientController.java
+++ b/src/main/java/cn/hellohao/controller/ClientController.java
@@ -47,6 +47,8 @@ public class ClientController {
private COSImageupload cosImageupload;
@Autowired
private FTPImageupload ftpImageupload;
+ @Autowired
+ private DomainService domainService;
@Value("${systemupdate}")
private String systemupdate;
@@ -65,7 +67,8 @@ public class ClientController {
if (user.getIsok() == 1) {
User u = userService.getUsers(email);
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
- Keys key = keysService.selectKeys(config.getSourcekey());
+ Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
+ Keys key = keysService.selectKeys(Sourcekey);
if (key.getStorageType() != 0 && key.getStorageType() != null) {
if (key.getStorageType() == 1) {
nOSImageupload.Initialize(key);//实例化网易
@@ -85,10 +88,10 @@ public class ClientController {
}
Print.Normal("客户端:初始化上传。");
Boolean b = false;
- if (config.getSourcekey() == 5) {
+ if (Sourcekey == 5) {
b = true;
} else {
- b = StringUtils.doNull(config.getSourcekey(), key);//判断对象是否有空值
+ b = StringUtils.doNull(Sourcekey, key);//判断对象是否有空值
}
if (b) {
long stime = System.currentTimeMillis();
diff --git a/src/main/java/cn/hellohao/controller/CodeController.java b/src/main/java/cn/hellohao/controller/CodeController.java
new file mode 100644
index 0000000..8c4ac3e
--- /dev/null
+++ b/src/main/java/cn/hellohao/controller/CodeController.java
@@ -0,0 +1,103 @@
+package cn.hellohao.controller;
+
+import cn.hellohao.pojo.Code;
+import cn.hellohao.pojo.Config;
+import cn.hellohao.pojo.User;
+import cn.hellohao.service.CodeService;
+import cn.hellohao.service.KeysService;
+import cn.hellohao.service.UserService;
+import cn.hellohao.service.impl.ImgServiceImpl;
+import cn.hutool.crypto.SecureUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpSession;
+import java.util.*;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019-08-11 14:25
+ */
+@Controller
+@RequestMapping("/admin/root")
+public class CodeController {
+ @Autowired
+ private CodeService codeService;
+
+
+ //返回code界面
+ @RequestMapping(value = "/tocode")
+ public String tocode() {
+
+ return "admin/code";
+ }
+
+ //获取code列表
+ @RequestMapping(value = "/selectcodelist")
+ @ResponseBody
+ public Map selectcodel(HttpSession session, @RequestParam(required = false, defaultValue = "1") int page,
+ @RequestParam(required = false) int limit) {
+ User u = (User) session.getAttribute("user");
+ // 使用Pagehelper传入当前页数和页面显示条数会自动为我们的select语句加上limit查询
+ // 从他的下一条sql开始分页
+ PageHelper.startPage(page, limit);
+ List codes = null;
+ if (u.getLevel() > 1) { //根据用户等级查询管理员查询所有的信息
+ codes = codeService.selectCode(null);
+ // 使用pageInfo包装查询
+ PageInfo rolePageInfo = new PageInfo<>(codes);//
+ Map map = new HashMap();
+ map.put("code", 0);
+ map.put("msg", "");
+ map.put("count", rolePageInfo.getTotal());
+ map.put("data", rolePageInfo.getList());
+ return map;
+ } else {
+ return null;
+ }
+ }
+
+ @RequestMapping("/deletecodes")
+ @ResponseBody
+ public Integer deletecodes(HttpSession session, @RequestParam("arr[]") String[] arr){
+ //JSONObject jsonObject = new JSONObject();
+ Integer v = 0;
+ User u = (User) session.getAttribute("user");
+ for (int i = 0; i < arr.length; i++) {
+ v = codeService.deleteCode(arr[i]);
+ }
+ return v;
+ }
+ @RequestMapping("/deletecode")
+ @ResponseBody
+ public Integer deletecode(String code){
+ Integer v = codeService.deleteCode(code);
+ return v;
+ }
+ @RequestMapping("/addcode")
+ @ResponseBody
+ public Integer addcode(Integer value,Integer counts){
+ Integer val = 0;
+ Code code = new Code();
+ for (int i= 0;i getgrouplist(HttpSession session, @RequestParam(required = false, defaultValue = "1") int page,
+ @RequestParam(required = false) int limit) {
+ User u = (User) session.getAttribute("user");
+ // 使用Pagehelper传入当前页数和页面显示条数会自动为我们的select语句加上limit查询
+ // 从他的下一条sql开始分页
+ PageHelper.startPage(page, limit);
+ List group = null;
+ if (u.getLevel() > 1) { //根据用户等级查询管理员查询所有的信息
+ group = groupService.grouplist();
+ // 使用pageInfo包装查询
+ PageInfo rolePageInfo = new PageInfo<>(group);//
+ Map map = new HashMap();
+ map.put("code", 0);
+ map.put("msg", "");
+ map.put("count", rolePageInfo.getTotal());
+ map.put("data", rolePageInfo.getList());
+ return map;
+ } else {
+ return null;
+ }
+ }
+
+ @RequestMapping(value = "/addisgroup")
+ @ResponseBody
+ public Integer addisgroup(Group group) {
+ boolean b =false;
+ if(group.getKeyid()==5){
+ b =true;
+ }else{
+ Keys key = keysService.selectKeys(group.getKeyid());
+ b = StringUtils.doNull(group.getKeyid(),key);
+ }
+ Integer ret = 0;
+ if(b){
+ ret = groupService.addgroup(group);
+ }else{
+ ret = -1;//该存储源key配置不完整
+ }
+ return ret;
+ }
+ @RequestMapping(value = "/delegroup")
+ @ResponseBody
+ public Integer delegroup(Integer id) {
+ Integer ret = -1;
+ if(id!=1){
+ ret = groupService.delegroup(id);
+ }
+ return ret;
+ }
+
+ @PostMapping("/getgrouplist")
+ @ResponseBody
+ public String getgrouplist() {
+ List li = groupService.grouplist();
+ JSONArray jsonArray = new JSONArray();
+ for (Group group : li) {
+ jsonArray.add(group);
+ }
+ return jsonArray.toString();
+ }
+
+ @PostMapping("/updateuser")
+ @ResponseBody
+ public Integer updateuser(User user) {
+// UserGroup userGroup = new UserGroup();
+// userGroup.setUserid(user.getId());
+// userGroup.setGroupid(user.getGroupid());
+ //userGroupService.updateusergroup(userGroup);
+ Integer ret = userService.change(user);
+ return ret;
+ }
+
+ @PostMapping("/updategroup")
+ @ResponseBody
+ public Integer updategroup(Group group) {
+ Integer ret = groupService.setgroup(group);
+// if(ret>0){
+// groupService.setgroup(group);
+// }
+ return ret;
+ }
+
+ @RequestMapping("/modifygroup")
+ public String modifygroup(Model model, Integer id) {
+ Group group = groupService.idgrouplist(id);
+ model.addAttribute("group",group);
+ return "admin/setgroup";
+ }
+
+
+
+}
diff --git a/src/main/java/cn/hellohao/controller/UpdateImgController.java b/src/main/java/cn/hellohao/controller/UpdateImgController.java
index 3412e2b..5435242 100644
--- a/src/main/java/cn/hellohao/controller/UpdateImgController.java
+++ b/src/main/java/cn/hellohao/controller/UpdateImgController.java
@@ -12,6 +12,7 @@ import cn.hellohao.service.*;
import cn.hellohao.service.impl.*;
import cn.hellohao.utils.IPPortUtil;
import cn.hellohao.utils.*;
+import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONArray;
@@ -45,79 +48,88 @@ public class UpdateImgController {
private COSImageupload cosImageupload;
@Autowired
private FTPImageupload ftpImageupload;
+ @Autowired
+ private ImgService imgService;
+
@RequestMapping({"/", "/index"})
public String indexImg(Model model, HttpSession httpSession) {
- Print.Normal("欢迎使用Hellohao图床源码。者也许是最好用的java图床项目。");
- Print.Normal("当前项目路径:"+System.getProperty("user.dir"));
- Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
- UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
- Integer filesizetourists = 0;
- Integer filesizeuser = 0;
- Integer imgcounttourists = 0;
- Integer imgcountuser = 0;
- if(uploadConfig.getFilesizetourists()!=null){filesizetourists = uploadConfig.getFilesizetourists();}
- if(uploadConfig.getFilesizeuser()!=null){filesizeuser = uploadConfig.getFilesizeuser();}
- if(uploadConfig.getImgcounttourists()!=null){imgcounttourists = uploadConfig.getImgcounttourists();}
- if(uploadConfig.getImgcountuser()!=null){imgcountuser = uploadConfig.getImgcountuser();}
- //Boolean b =false;
- Keys key = null;
- if(config.getSourcekey()!=0 && config.getSourcekey()!=5){
- key= keysService.selectKeys(config.getSourcekey());//然后根据类型再查询key
- //b = StringUtils.doNull(key);//判断对象是否有空值
- if(key.getStorageType()!=0 && key.getStorageType()!=null){
- int ret =0;
- if(key.getStorageType()==1){
- ret =nOSImageupload.Initialize(key);//实例化网易
- }else if (key.getStorageType()==2){
- ret =OSSImageupload.Initialize(key);
- }else if(key.getStorageType()==3){
- ret = USSImageupload.Initialize(key);
- }else if(key.getStorageType()==4){
- ret = KODOImageupload.Initialize(key);
- }else if(key.getStorageType()==6){
- ret = COSImageupload.Initialize(key);
- }else if(key.getStorageType()==7){
- ret = FTPImageupload.Initialize(key);
+ //boolean b = VerificationDomain.verification();
+ boolean b = true;
+ if(b){
+ Print.Normal("欢迎使用Hellohao图床源码。者也许是最好用的java图床项目。");
+ Print.Normal("当前项目路径:"+System.getProperty("user.dir"));
+ Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
+ UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
+ User u = (User) httpSession.getAttribute("user");
+ String email = (String) httpSession.getAttribute("email");
+ Integer filesizetourists = 0;
+ Integer filesizeuser = 0;
+ Integer imgcounttourists = 0;
+ Integer imgcountuser = 0;
+ if(uploadConfig.getFilesizetourists()!=null){filesizetourists = uploadConfig.getFilesizetourists();}
+ if(uploadConfig.getFilesizeuser()!=null){filesizeuser = uploadConfig.getFilesizeuser();}
+ if(uploadConfig.getImgcounttourists()!=null){imgcounttourists = uploadConfig.getImgcounttourists();}
+ if(uploadConfig.getImgcountuser()!=null){imgcountuser = uploadConfig.getImgcountuser();}
+ //Boolean b =false;
+ Keys key = null;
+ Integer Sourcekey = GetCurrentSource.GetSource(u==null?null:u.getId());
+ if(Sourcekey!=0 && Sourcekey!=5){
+ key= keysService.selectKeys(Sourcekey);//然后根据类型再查询key
+ //b = StringUtils.doNull(key);//判断对象是否有空值
+ if(key.getStorageType()!=0 && key.getStorageType()!=null){
+ int ret =0;
+ if(key.getStorageType()==1){
+ ret =nOSImageupload.Initialize(key);//实例化网易
+ }else if (key.getStorageType()==2){
+ ret =OSSImageupload.Initialize(key);
+ }else if(key.getStorageType()==3){
+ ret = USSImageupload.Initialize(key);
+ }else if(key.getStorageType()==4){
+ ret = KODOImageupload.Initialize(key);
+ }else if(key.getStorageType()==6){
+ ret = COSImageupload.Initialize(key);
+ }else if(key.getStorageType()==7){
+ ret = FTPImageupload.Initialize(key);
+ }
+ else{
+ Print.Normal("为获取到存储参数,或者使用存储源是本地的。");
+ }
+ if(ret<1){model.addAttribute("error", "当前存储源参数配置不完整,请联系管理员配置存储源。");}
+ else{model.addAttribute("error", 1);}
}
- else{
- Print.Normal("为获取到存储参数,或者使用存储源是本地的。");
- }
- if(ret<1){model.addAttribute("error", "当前存储源参数配置不完整,请联系管理员配置存储源。");}
- else{model.addAttribute("error", 1);}
}
- }
-
- User u = (User) httpSession.getAttribute("user");
- String email = (String) httpSession.getAttribute("email");
- if (email != null) {
- //登陆成功
- Integer ret = userService.login(u.getEmail(), u.getPassword());
- if (ret > 0) {
- User user = userService.getUsers(u.getEmail());
- model.addAttribute("username", user.getUsername());
- model.addAttribute("level", user.getLevel());
- model.addAttribute("loginid", 100);
- model.addAttribute("imgcount", imgcountuser);
- model.addAttribute("filesize", filesizeuser*1024*1024);
+ if (email != null) {
+ //登陆成功
+ Integer ret = userService.login(u.getEmail(), u.getPassword());
+ if (ret > 0) {
+ User user = userService.getUsers(u.getEmail());
+ model.addAttribute("username", user.getUsername());
+ model.addAttribute("level", user.getLevel());
+ model.addAttribute("loginid", 100);
+ model.addAttribute("imgcount", imgcountuser);
+ model.addAttribute("filesize", filesizeuser*1024*1024);
+ } else {
+ model.addAttribute("loginid", -1);
+ model.addAttribute("imgcount", imgcounttourists);
+ }
} else {
- model.addAttribute("loginid", -1);
+ model.addAttribute("loginid", -2);
model.addAttribute("imgcount", imgcounttourists);
+ model.addAttribute("filesize", filesizetourists*1024*1024);
}
- } else {
- model.addAttribute("loginid", -2);
- model.addAttribute("imgcount", imgcounttourists);
- model.addAttribute("filesize", filesizetourists*1024*1024);
+ model.addAttribute("suffix", uploadConfig.getSuffix());
+ model.addAttribute("config", config);
+ model.addAttribute("uploadConfig", uploadConfig);
+ Integer isupdate = 1;
+ if(uploadConfig.getIsupdate()!=1){
+ isupdate = (u == null) ? 0: 1;//如果u等于null那么isupdate就等于0,否则等于1
+ }
+ model.addAttribute("ykxz", isupdate);
+ }else{
+ return "index";
}
- model.addAttribute("suffix", uploadConfig.getSuffix());
- model.addAttribute("config", config);
- model.addAttribute("uploadConfig", uploadConfig);
- Integer isupdate = 1;
- if(uploadConfig.getIsupdate()!=1){
- isupdate = (u == null) ? 0: 1;//如果u等于null那么isupdate就等于0,否则等于1
- }
- model.addAttribute("ykxz", isupdate);
return "index";
}
@@ -126,20 +138,40 @@ public class UpdateImgController {
@ResponseBody
public String upimg( HttpSession session
, @RequestParam(value = "file", required = false) MultipartFile[] file) throws Exception {
-
+ JSONArray jsonArray = new JSONArray();
+ JSONObject jsonObject = new JSONObject();
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
User u = (User) session.getAttribute("user");
- JSONArray jsonArray = new JSONArray();
- JSONObject jsonObject = new JSONObject();
- Keys key = keysService.selectKeys(config.getSourcekey());
+ Integer usermemory =0;
+ Integer memory =0;
+ Integer Sourcekey=0;
+ //User tmpuser = userService.getUsers(u.getEmail());
+ //GetCurrentSource getCurrentSource = new GetCurrentSource();
+ if(u==null){
+ Sourcekey = GetCurrentSource.GetSource(null);
+ memory = uploadConfig.getVisitormemory();
+ usermemory= imgService.getusermemory(0);
+ if(usermemory==null){usermemory = 0;}
+ }else{
+ Sourcekey = GetCurrentSource.GetSource(u.getId());
+ memory = userService.getUsers(u.getEmail()).getMemory();
+ usermemory= imgService.getusermemory(u.getId());
+ if(usermemory==null){usermemory = 0;}
+ }
+ Keys key = keysService.selectKeys(Sourcekey);//config.getSourcekey()
Boolean b =false;
- if(config.getSourcekey()==5){
+ if(Sourcekey==5){
b =true;
}else{
- b = StringUtils.doNull(config.getSourcekey(),key);//判断对象是否有空值
+ b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
}
if(b){
+ int tmp = usermemory/1024;
+ if(memory==-1){//证明未做限制
+ tmp = -2;
+ }
+ if(tmp0){
+// UserGroup userGroup = new UserGroup();
+// User user1 = userService.getUsersMail(uid);
+// userGroup.setUserid(user1.getId());
+// userGroup.setGroupid(1);
+// userGroupService.addusergroup(userGroup);
+ }
+ jsonObject.put("ret",ret);
+ jsonObject.put("zctype",type);
+ } else {
+ jsonObject.put("ret",-2);
}
- Integer ret = userService.register(user);
- jsonObject.put("ret",ret);
- jsonObject.put("zctype",type);
- } else {
- jsonObject.put("ret",-2);
+ }else{
+ jsonObject.put("ret",-3); //管理员关闭的注册
}
return jsonObject.toString();
}
@@ -97,8 +116,10 @@ public class UserController {
httpSession.setAttribute("email", user.getEmail());
httpSession.setAttribute("pass", user.getPassword());
jsonArray.add(1);
- } else {
+ } else if(ret==-1){
jsonArray.add(-1);
+ }else {
+ jsonArray.add(-2);
}
} else {
jsonArray.add(0);
@@ -116,10 +137,13 @@ public class UserController {
if (user.getEmail() != null && user.getPassword() != null) {
session.removeAttribute(user.getEmail());
session.removeAttribute(user.getPassword());
- //刷新view
- session.invalidate();
- jsonObject.put("exit", 1);
+ session.removeAttribute("user");
+
}
+ //刷新view
+ session.invalidate();
+ jsonObject.put("exit", 1);
+
return jsonObject.toString();
}
@@ -127,7 +151,6 @@ public class UserController {
@RequestMapping(value = "/activation.do", method = RequestMethod.GET)
public String activation(Model model, HttpServletRequest request, HttpSession session, String activation, String username) {
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
- System.out.println("域名:"+config.getDomain());
Integer ret = 0;
User user = userService.getUsersMail(activation);
model.addAttribute("config", config);
@@ -138,11 +161,10 @@ public class UserController {
return "isok";
} else {
- //return "redirect:/index.do";
- return "isok";
+ return "redirect:/index";
+ //return "isok";
}
}
-
}
diff --git a/src/main/java/cn/hellohao/dao/CodeMapper.java b/src/main/java/cn/hellohao/dao/CodeMapper.java
new file mode 100644
index 0000000..38773ff
--- /dev/null
+++ b/src/main/java/cn/hellohao/dao/CodeMapper.java
@@ -0,0 +1,21 @@
+package cn.hellohao.dao;
+
+import cn.hellohao.pojo.Code;
+import cn.hellohao.pojo.Keys;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface CodeMapper {
+ //查询扩容码
+ List selectCode(@Param("code") String code);
+ Code selectCodekey(@Param("code") String code);
+ //Integer selectCodekey(@Param("value") String value);
+ //添加
+ Integer addCode(Code code);
+ //删除扩容码
+ Integer deleteCode(@Param("code") String code);
+
+}
diff --git a/src/main/java/cn/hellohao/dao/DomainMapper.java b/src/main/java/cn/hellohao/dao/DomainMapper.java
new file mode 100644
index 0000000..d86b2bb
--- /dev/null
+++ b/src/main/java/cn/hellohao/dao/DomainMapper.java
@@ -0,0 +1,16 @@
+package cn.hellohao.dao;
+
+import cn.hellohao.pojo.Domain;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/21 9:46
+ */
+@Mapper
+public interface DomainMapper {
+ Integer getDomain(@Param("domain") String domain);
+
+}
diff --git a/src/main/java/cn/hellohao/dao/GroupMapper.java b/src/main/java/cn/hellohao/dao/GroupMapper.java
new file mode 100644
index 0000000..be373bd
--- /dev/null
+++ b/src/main/java/cn/hellohao/dao/GroupMapper.java
@@ -0,0 +1,21 @@
+package cn.hellohao.dao;
+
+import cn.hellohao.pojo.Group;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/19 16:11
+ */
+@Mapper
+public interface GroupMapper {
+ List grouplist();
+ Group idgrouplist(@Param("id") Integer id);
+ Integer addgroup(Group group);
+ Integer delegroup(@Param("id") Integer id);
+ Integer setgroup(Group group);
+}
diff --git a/src/main/java/cn/hellohao/dao/ImgMapper.java b/src/main/java/cn/hellohao/dao/ImgMapper.java
index f14faeb..4c7051d 100644
--- a/src/main/java/cn/hellohao/dao/ImgMapper.java
+++ b/src/main/java/cn/hellohao/dao/ImgMapper.java
@@ -26,4 +26,6 @@ public interface ImgMapper {
Integer deleall(@Param("id") Integer id);
List gettimeimg(@Param("time") String time);
+
+ Integer getusermemory(@Param("userid") Integer userid);
}
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..f5129e1
--- /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 Hellohao
+ * @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/dao/UserGroupMapper.java b/src/main/java/cn/hellohao/dao/UserGroupMapper.java
new file mode 100644
index 0000000..d80dc2f
--- /dev/null
+++ b/src/main/java/cn/hellohao/dao/UserGroupMapper.java
@@ -0,0 +1,23 @@
+package cn.hellohao.dao;
+
+import cn.hellohao.pojo.UserGroup;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/20 13:45
+ */
+@Mapper
+public interface UserGroupMapper {
+ UserGroup useridgetusergroup(@Param("userid") Integer userid);
+ UserGroup idgetusergroup(@Param("id") Integer id);
+ Integer addusergroup(UserGroup userGroup);
+ Integer updateusergroup(UserGroup userGroup);
+ Integer updateusergroupdefault(@Param("groupid") Integer groupid);
+ Integer deleusergroup(@Param("userid") Integer userid);
+
+
+
+}
diff --git a/src/main/java/cn/hellohao/dao/UserMapper.java b/src/main/java/cn/hellohao/dao/UserMapper.java
index 2779e03..0d4fb1a 100644
--- a/src/main/java/cn/hellohao/dao/UserMapper.java
+++ b/src/main/java/cn/hellohao/dao/UserMapper.java
@@ -30,7 +30,7 @@ public interface UserMapper {
Integer getUserTotal();
- List getuserlist();
+ List getuserlist(User user);
//刪除用戶
Integer deleuser(@Param("id") Integer id);
@@ -44,4 +44,10 @@ public interface UserMapper {
User getUsersMail(@Param("uid") String uid);
+ Integer setisok (User user);
+ Integer setmemory(User user);
+ User getUsersid(@Param("id") Integer id);
+
+ List getuserlistforgroupid(@Param("groupid") Integer groupid);
+
}
diff --git a/src/main/java/cn/hellohao/exception/CodeException.java b/src/main/java/cn/hellohao/exception/CodeException.java
new file mode 100644
index 0000000..e8f49df
--- /dev/null
+++ b/src/main/java/cn/hellohao/exception/CodeException.java
@@ -0,0 +1,28 @@
+package cn.hellohao.exception;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/14 10:19
+ */
+public class CodeException extends RuntimeException {
+
+ public CodeException() {
+ }
+
+ public CodeException(String message) {
+ super(message);
+ }
+
+ public CodeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CodeException(Throwable cause) {
+ super(cause);
+ }
+
+ public CodeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/src/main/java/cn/hellohao/exception/LoginException.java b/src/main/java/cn/hellohao/exception/LoginException.java
index 343c705..ecfe147 100644
--- a/src/main/java/cn/hellohao/exception/LoginException.java
+++ b/src/main/java/cn/hellohao/exception/LoginException.java
@@ -1,7 +1,7 @@
package cn.hellohao.exception;
/**
- * @author Tiansh
+ * @author Hellohao
* @version 1.0
* @date 2019/8/7 9:02
*/
diff --git a/src/main/java/cn/hellohao/interceptor/InterceptorConfig.java b/src/main/java/cn/hellohao/interceptor/InterceptorConfig.java
index 12bab4b..8fc4cac 100644
--- a/src/main/java/cn/hellohao/interceptor/InterceptorConfig.java
+++ b/src/main/java/cn/hellohao/interceptor/InterceptorConfig.java
@@ -7,8 +7,11 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import cn.hellohao.pojo.User;
+import cn.hellohao.utils.Print;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
@@ -22,33 +25,28 @@ public class InterceptorConfig implements HandlerInterceptor {
*/
//这个方法是在访问接口之前执行的,我们只需要在这里写验证登陆状态的业务逻辑,就可以在用户调用指定接口之前验证登陆状态了
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
- //设置不缓存
-// response.setHeader("Cache-Control","no-cache");
-// response.setHeader("Pragma","no-cache");
-// response.setDateHeader("Expires",0);
- //每一个项目对于登陆的实现逻辑都有所区别,我这里使用最简单的Session提取User来验证登陆。
- HttpSession session = request.getSession();
- //这里的User是登陆时放入session的
- User user = (User) session.getAttribute("user");
- String email = null;
- Integer level = 0;
- if (user != null) {
- email = user.getEmail();
- level = user.getLevel();
- }
- // String email = (String) session.getAttribute("email");
- //如果session中没有user,表示没登陆
- if (email == null) {
- //这个方法返回false表示忽略当前请求,如果一个用户调用了需要登陆才能使用的接口,如果他没有登陆这里会直接忽略掉
- //当然你可以利用response给用户返回一些提示信息,告诉他没登陆
- System.out.println("没有登录权限");
- request.getRequestDispatcher("/err").forward(request, response);
- return false;
- } else {
+ HttpSession session = request.getSession();
+ //这里的User是登陆时放入session的
+ User user = (User) session.getAttribute("user");
+ String email = null;
+ Integer level = 0;
+ if (user != null) {
+ email = user.getEmail();
+ level = user.getLevel();
+ }
+ // String email = (String) session.getAttribute("email");
+ //如果session中没有user,表示没登陆
+ if (email == null) {
+ //这个方法返回false表示忽略当前请求,如果一个用户调用了需要登陆才能使用的接口,如果他没有登陆这里会直接忽略掉
+ //当然你可以利用response给用户返回一些提示信息,告诉他没登陆
+ System.out.println("没有登录权限");
+ request.getRequestDispatcher("/err").forward(request, response);
+ return false;
+ } else {
- //System.out.println("进入成功");
- return true; //如果session里有user,表示该用户已经登陆,放行,用户即可继续调用自己需要的接口
- }
+ //System.out.println("进入成功");
+ return true; //如果session里有user,表示该用户已经登陆,放行,用户即可继续调用自己需要的接口
+ }
}
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable ModelAndView modelAndView) throws Exception {
diff --git a/src/main/java/cn/hellohao/interceptor/WebAppConfig.java b/src/main/java/cn/hellohao/interceptor/WebAppConfig.java
index 0f7c91f..94893a4 100644
--- a/src/main/java/cn/hellohao/interceptor/WebAppConfig.java
+++ b/src/main/java/cn/hellohao/interceptor/WebAppConfig.java
@@ -34,6 +34,8 @@ public class WebAppConfig implements WebMvcConfigurer {
registry.addInterceptor(interceptorConfig).addPathPatterns("/admin/**");
registry.addInterceptor(interceptorConfigTwo).addPathPatterns("/admin/root/**");
+
+
}
}
diff --git a/src/main/java/cn/hellohao/pojo/Code.java b/src/main/java/cn/hellohao/pojo/Code.java
new file mode 100644
index 0000000..9b7af71
--- /dev/null
+++ b/src/main/java/cn/hellohao/pojo/Code.java
@@ -0,0 +1,45 @@
+package cn.hellohao.pojo;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019-08-11 14:09
+ */
+public class Code {
+ private Integer id;
+ private Integer value;
+ private String code;
+
+ public Code() {
+ }
+
+ public Code(Integer id, Integer value, String code) {
+ this.id = id;
+ this.value = value;
+ this.code = code;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+
+ public void setValue(Integer value) {
+ this.value = value;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+}
diff --git a/src/main/java/cn/hellohao/pojo/Config.java b/src/main/java/cn/hellohao/pojo/Config.java
index 182a777..11cb9c1 100644
--- a/src/main/java/cn/hellohao/pojo/Config.java
+++ b/src/main/java/cn/hellohao/pojo/Config.java
@@ -6,8 +6,8 @@ public class Config {
private Integer emails;
private String webname;
private String explain;
- private String logos;
- private String footed;
+ private String video;
+ private Integer backtype;
private String links;
private String notice;
private String baidu;
@@ -20,14 +20,14 @@ public class Config {
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 video, Integer backtype, String links, String notice, String baidu, String domain, String background1, String background2, String sett) {
this.id = id;
this.sourcekey = sourcekey;
this.emails = emails;
this.webname = webname;
this.explain = explain;
- this.logos = logos;
- this.footed = footed;
+ this.video = video;
+ this.backtype = backtype;
this.links = links;
this.notice = notice;
this.baidu = baidu;
@@ -77,20 +77,20 @@ public class Config {
this.explain = explain;
}
- public String getLogos() {
- return logos;
+ public String getVideo() {
+ return video;
}
- public void setLogos(String logos) {
- this.logos = logos;
+ public void setVideo(String video) {
+ this.video = video;
}
- public String getFooted() {
- return footed;
+ public Integer getBacktype() {
+ return backtype;
}
- public void setFooted(String footed) {
- this.footed = footed;
+ public void setBacktype(Integer backtype) {
+ this.backtype = backtype;
}
public String getLinks() {
diff --git a/src/main/java/cn/hellohao/pojo/Domain.java b/src/main/java/cn/hellohao/pojo/Domain.java
new file mode 100644
index 0000000..a60f153
--- /dev/null
+++ b/src/main/java/cn/hellohao/pojo/Domain.java
@@ -0,0 +1,45 @@
+package cn.hellohao.pojo;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/21 9:43
+ */
+public class Domain {
+ private Integer id;
+ private String domain;
+ private String code;
+
+ public Domain() {
+ }
+
+ public Domain(Integer id, String domain, String code) {
+ this.id = id;
+ this.domain = domain;
+ this.code = code;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+}
diff --git a/src/main/java/cn/hellohao/pojo/Group.java b/src/main/java/cn/hellohao/pojo/Group.java
new file mode 100644
index 0000000..7b7de7f
--- /dev/null
+++ b/src/main/java/cn/hellohao/pojo/Group.java
@@ -0,0 +1,45 @@
+package cn.hellohao.pojo;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/19 15:59
+ */
+public class Group {
+ private Integer id;
+ private String groupname;
+ private Integer keyid;
+
+ public Group() {
+ }
+
+ public Group(Integer id, String groupname, Integer keyid) {
+ this.id = id;
+ this.groupname = groupname;
+ this.keyid = keyid;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getGroupname() {
+ return groupname;
+ }
+
+ public void setGroupname(String groupname) {
+ this.groupname = groupname;
+ }
+
+ public Integer getKeyid() {
+ return keyid;
+ }
+
+ public void setKeyid(Integer keyid) {
+ this.keyid = keyid;
+ }
+}
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..454aaa2
--- /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 Integer register;
+
+ public SysConfig() {
+ }
+
+ public SysConfig(Integer id, Integer register) {
+ this.id = id;
+ this.register = register;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getRegister() {
+ return register;
+ }
+
+ public void setRegister(Integer register) {
+ this.register = register;
+ }
+}
diff --git a/src/main/java/cn/hellohao/pojo/UploadConfig.java b/src/main/java/cn/hellohao/pojo/UploadConfig.java
index f76773c..db3bc0a 100644
--- a/src/main/java/cn/hellohao/pojo/UploadConfig.java
+++ b/src/main/java/cn/hellohao/pojo/UploadConfig.java
@@ -9,11 +9,13 @@ public class UploadConfig {
private Integer urltype;
private Integer isupdate;
private Integer api;
+ private Integer visitormemory;
+ private Integer usermemory;
public UploadConfig() {
}
- public UploadConfig(String suffix, Integer filesizetourists, Integer filesizeuser, Integer imgcounttourists, Integer imgcountuser, Integer urltype, Integer isupdate, Integer api) {
+ public UploadConfig(String suffix, Integer filesizetourists, Integer filesizeuser, Integer imgcounttourists, Integer imgcountuser, Integer urltype, Integer isupdate, Integer api, Integer visitormemory, Integer usermemory) {
this.suffix = suffix;
this.filesizetourists = filesizetourists;
this.filesizeuser = filesizeuser;
@@ -22,6 +24,8 @@ public class UploadConfig {
this.urltype = urltype;
this.isupdate = isupdate;
this.api = api;
+ this.visitormemory = visitormemory;
+ this.usermemory = usermemory;
}
public String getSuffix() {
@@ -87,4 +91,20 @@ public class UploadConfig {
public void setApi(Integer api) {
this.api = api;
}
+
+ public Integer getVisitormemory() {
+ return visitormemory;
+ }
+
+ public void setVisitormemory(Integer visitormemory) {
+ this.visitormemory = visitormemory;
+ }
+
+ public Integer getUsermemory() {
+ return usermemory;
+ }
+
+ public void setUsermemory(Integer usermemory) {
+ this.usermemory = usermemory;
+ }
}
diff --git a/src/main/java/cn/hellohao/pojo/User.java b/src/main/java/cn/hellohao/pojo/User.java
index 410d72b..afa502a 100644
--- a/src/main/java/cn/hellohao/pojo/User.java
+++ b/src/main/java/cn/hellohao/pojo/User.java
@@ -20,13 +20,15 @@ public class User {
private Integer level;
private String uid;
private Integer isok;
+ private Integer memory;
+ private Integer groupid;
public User() {
super();
}
- public User(Integer id, String username, String password, String email, String birthder, Integer level, String uid, Integer isok) {
+ public User(Integer id, String username, String password, String email, String birthder, Integer level, String uid, Integer isok, Integer memory, Integer groupid) {
this.id = id;
this.username = username;
this.password = password;
@@ -35,6 +37,8 @@ public class User {
this.level = level;
this.uid = uid;
this.isok = isok;
+ this.memory = memory;
+ this.groupid = groupid;
}
public Integer getId() {
@@ -100,4 +104,20 @@ public class User {
public void setIsok(Integer isok) {
this.isok = isok;
}
+
+ public Integer getMemory() {
+ return memory;
+ }
+
+ public void setMemory(Integer memory) {
+ this.memory = memory;
+ }
+
+ public Integer getGroupid() {
+ return groupid;
+ }
+
+ public void setGroupid(Integer groupid) {
+ this.groupid = groupid;
+ }
}
diff --git a/src/main/java/cn/hellohao/pojo/UserGroup.java b/src/main/java/cn/hellohao/pojo/UserGroup.java
new file mode 100644
index 0000000..ff6807c
--- /dev/null
+++ b/src/main/java/cn/hellohao/pojo/UserGroup.java
@@ -0,0 +1,45 @@
+package cn.hellohao.pojo;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/19 16:01
+ */
+public class UserGroup {
+ private Integer id;
+ private Integer userid;
+ private Integer groupid;
+
+ public UserGroup() {
+ }
+
+ public UserGroup(Integer id, Integer userid, Integer groupid) {
+ this.id = id;
+ this.userid = userid;
+ this.groupid = groupid;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getUserid() {
+ return userid;
+ }
+
+ public void setUserid(Integer userid) {
+ this.userid = userid;
+ }
+
+ public Integer getGroupid() {
+ return groupid;
+ }
+
+ public void setGroupid(Integer groupid) {
+ this.groupid = groupid;
+ }
+}
diff --git a/src/main/java/cn/hellohao/service/CodeService.java b/src/main/java/cn/hellohao/service/CodeService.java
new file mode 100644
index 0000000..8bdb83a
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/CodeService.java
@@ -0,0 +1,24 @@
+package cn.hellohao.service;
+
+import cn.hellohao.pojo.Code;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019-08-11 14:20
+ */
+@Service
+public interface CodeService {
+ //查询扩容码
+ List selectCode(String value);
+ Code selectCodekey(String code);
+ //添加
+ Integer addCode(Code code);
+ //删除扩容码
+ Integer deleteCode(String code);
+
+}
diff --git a/src/main/java/cn/hellohao/service/DomainService.java b/src/main/java/cn/hellohao/service/DomainService.java
new file mode 100644
index 0000000..0decf77
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/DomainService.java
@@ -0,0 +1,14 @@
+package cn.hellohao.service;
+
+import cn.hellohao.pojo.Domain;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/21 9:50
+ */
+@Service
+public interface DomainService {
+ Integer getDomain(String domain);
+}
diff --git a/src/main/java/cn/hellohao/service/GroupService.java b/src/main/java/cn/hellohao/service/GroupService.java
new file mode 100644
index 0000000..3f48c67
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/GroupService.java
@@ -0,0 +1,20 @@
+package cn.hellohao.service;
+
+import cn.hellohao.pojo.Group;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/19 16:29
+ */
+@Service
+public interface GroupService {
+ List grouplist();
+ Group idgrouplist(Integer id);
+ Integer addgroup(Group group);
+ Integer delegroup(Integer id);
+ Integer setgroup(Group group);
+}
diff --git a/src/main/java/cn/hellohao/service/ImgService.java b/src/main/java/cn/hellohao/service/ImgService.java
index d02bbac..227e6f2 100644
--- a/src/main/java/cn/hellohao/service/ImgService.java
+++ b/src/main/java/cn/hellohao/service/ImgService.java
@@ -25,4 +25,6 @@ public interface ImgService {
Integer deleall(Integer id);
List gettimeimg(String time);
+
+ Integer getusermemory(Integer userid);
}
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..6966b0e
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/SysConfigService.java
@@ -0,0 +1,15 @@
+package cn.hellohao.service;
+
+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/UserGroupService.java b/src/main/java/cn/hellohao/service/UserGroupService.java
new file mode 100644
index 0000000..7b47962
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/UserGroupService.java
@@ -0,0 +1,19 @@
+package cn.hellohao.service;
+
+import cn.hellohao.pojo.UserGroup;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/20 14:12
+ */
+@Service
+public interface UserGroupService {
+ UserGroup useridgetusergroup(Integer userid);
+ UserGroup idgetusergroup(Integer id);
+ Integer addusergroup(UserGroup userGroup);
+ Integer updateusergroup(UserGroup userGroup);
+ Integer updateusergroupdefault(Integer groupid);
+ Integer deleusergroup(Integer userid);
+}
diff --git a/src/main/java/cn/hellohao/service/UserService.java b/src/main/java/cn/hellohao/service/UserService.java
index 54419cc..afd17f9 100644
--- a/src/main/java/cn/hellohao/service/UserService.java
+++ b/src/main/java/cn/hellohao/service/UserService.java
@@ -2,6 +2,7 @@ package cn.hellohao.service;
import cn.hellohao.pojo.Images;
import cn.hellohao.pojo.User;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -26,7 +27,7 @@ public interface UserService {
Integer getUserTotal();
- List getuserlist();
+ List getuserlist(User user);
Integer deleuser(Integer id);
@@ -38,4 +39,8 @@ public interface UserService {
Integer uiduser(String uid);
User getUsersMail(String uid);
+ Integer setisok (User user);
+ Integer setmemory(User user);
+ User getUsersid(Integer id);
+ List getuserlistforgroupid(Integer groupid);
}
diff --git a/src/main/java/cn/hellohao/service/impl/CodeServiceImpl.java b/src/main/java/cn/hellohao/service/impl/CodeServiceImpl.java
new file mode 100644
index 0000000..10c455e
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/impl/CodeServiceImpl.java
@@ -0,0 +1,42 @@
+package cn.hellohao.service.impl;
+
+import cn.hellohao.dao.CodeMapper;
+import cn.hellohao.pojo.Code;
+import cn.hellohao.service.CodeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019-08-11 14:21
+ */
+@Service
+public class CodeServiceImpl implements CodeService {
+
+ @Autowired
+ private CodeMapper codeMapper;
+
+
+ @Override
+ public List selectCode(String value) {
+ return codeMapper.selectCode(value);
+ }
+
+ @Override
+ public Code selectCodekey(String code) {
+ return codeMapper.selectCodekey(code);
+ }
+
+ @Override
+ public Integer addCode(Code code) {
+ return codeMapper.addCode(code);
+ }
+
+ @Override
+ public Integer deleteCode(String code) {
+ return codeMapper.deleteCode(code);
+ }
+}
diff --git a/src/main/java/cn/hellohao/service/impl/DomainServiceImpl.java b/src/main/java/cn/hellohao/service/impl/DomainServiceImpl.java
new file mode 100644
index 0000000..02be1cd
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/impl/DomainServiceImpl.java
@@ -0,0 +1,23 @@
+package cn.hellohao.service.impl;
+
+import cn.hellohao.dao.DomainMapper;
+import cn.hellohao.pojo.Domain;
+import cn.hellohao.service.DomainService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/21 9:51
+ */
+@Service
+public class DomainServiceImpl implements DomainService {
+ @Autowired
+ private DomainMapper domainMapper;
+
+ @Override
+ public Integer getDomain(String domain) {
+ return domainMapper.getDomain(domain);
+ }
+}
diff --git a/src/main/java/cn/hellohao/service/impl/GroupServiceImpl.java b/src/main/java/cn/hellohao/service/impl/GroupServiceImpl.java
new file mode 100644
index 0000000..29441ea
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/impl/GroupServiceImpl.java
@@ -0,0 +1,67 @@
+package cn.hellohao.service.impl;
+
+import cn.hellohao.dao.GroupMapper;
+import cn.hellohao.dao.UserMapper;
+import cn.hellohao.exception.CodeException;
+import cn.hellohao.pojo.Group;
+import cn.hellohao.pojo.User;
+import cn.hellohao.service.GroupService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/19 16:30
+ */
+@Service
+public class GroupServiceImpl implements GroupService {
+ @Autowired
+ private GroupMapper groupMapper;
+ @Autowired
+ private UserMapper userMapper;
+
+ @Override
+ public List grouplist() {
+ return groupMapper.grouplist();
+ }
+
+ @Override
+ public Group idgrouplist(Integer id) {
+ return groupMapper.idgrouplist(id);
+ }
+
+ @Override
+ public Integer addgroup(Group group) {
+ return groupMapper.addgroup(group);
+ }
+
+ @Override
+ @Transactional//默认遇到throw new RuntimeException(“…”);会回滚
+ public Integer delegroup(Integer id) {
+ Integer ret = 0;
+ ret = groupMapper.delegroup(id);
+ if(ret>0){
+ //userGroupMapper.updateusergroupdefault(id);
+ List userList = userMapper.getuserlistforgroupid(id);
+ for (User user : userList) {
+ User u = new User();
+ u.setGroupid(1);
+ u.setUid(user.getUid());
+ userMapper.change(u);
+ }
+
+ }else{
+ throw new CodeException("用户之没有设置成功。");
+ }
+ return ret;
+ }
+
+ @Override
+ public Integer setgroup(Group group) {
+ return groupMapper.setgroup(group);
+ }
+}
diff --git a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java
index 4b5f421..c4f751d 100644
--- a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java
+++ b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java
@@ -206,4 +206,9 @@ public class ImgServiceImpl implements ImgService {
public List gettimeimg(String time) {
return imgMapper.gettimeimg(time);
}
+
+ @Override
+ public Integer getusermemory(Integer userid) {
+ return imgMapper.getusermemory(userid);
+ }
}
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/java/cn/hellohao/service/impl/UserGroupServiceImpl.java b/src/main/java/cn/hellohao/service/impl/UserGroupServiceImpl.java
new file mode 100644
index 0000000..bfca4a6
--- /dev/null
+++ b/src/main/java/cn/hellohao/service/impl/UserGroupServiceImpl.java
@@ -0,0 +1,48 @@
+package cn.hellohao.service.impl;
+
+import cn.hellohao.dao.UserGroupMapper;
+import cn.hellohao.pojo.UserGroup;
+import cn.hellohao.service.UserGroupService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/20 14:13
+ */
+@Service
+public class UserGroupServiceImpl implements UserGroupService {
+ @Autowired
+ private UserGroupMapper userGroupMapper;
+
+ @Override
+ public UserGroup useridgetusergroup(Integer userid) {
+ return userGroupMapper.useridgetusergroup(userid);
+ }
+
+ @Override
+ public UserGroup idgetusergroup(Integer id) {
+ return userGroupMapper.idgetusergroup(id);
+ }
+
+ @Override
+ public Integer addusergroup(UserGroup userGroup) {
+ return userGroupMapper.addusergroup(userGroup);
+ }
+
+ @Override
+ public Integer updateusergroup(UserGroup userGroup) {
+ return userGroupMapper.updateusergroup(userGroup);
+ }
+
+ @Override
+ public Integer updateusergroupdefault(Integer groupid) {
+ return userGroupMapper.updateusergroupdefault(groupid);
+ }
+
+ @Override
+ public Integer deleusergroup(Integer userid) {
+ return userGroupMapper.deleusergroup(userid);
+ }
+}
diff --git a/src/main/java/cn/hellohao/service/impl/UserServiceImpl.java b/src/main/java/cn/hellohao/service/impl/UserServiceImpl.java
index 7ba858e..1bbb3b1 100644
--- a/src/main/java/cn/hellohao/service/impl/UserServiceImpl.java
+++ b/src/main/java/cn/hellohao/service/impl/UserServiceImpl.java
@@ -1,11 +1,15 @@
package cn.hellohao.service.impl;
+import cn.hellohao.dao.CodeMapper;
+import cn.hellohao.exception.CodeException;
+import cn.hellohao.utils.Print;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hellohao.dao.UserMapper;
import cn.hellohao.pojo.Images;
import cn.hellohao.pojo.User;
import cn.hellohao.service.UserService;
+import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@@ -14,6 +18,8 @@ public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
+ @Autowired
+ private CodeMapper codeMapper;
@Override
public Integer register(User user) {
@@ -74,8 +80,8 @@ public class UserServiceImpl implements UserService {
}
@Override
- public List getuserlist() {
- return userMapper.getuserlist();
+ public List getuserlist(User user) {
+ return userMapper.getuserlist(user);
}
@Override
@@ -87,4 +93,36 @@ public class UserServiceImpl implements UserService {
public User getUsersMail(String uid) {
return userMapper.getUsersMail(uid);
}
+
+ @Override
+ public Integer setisok(User user) {
+ return userMapper.setisok(user);
+ }
+
+ @Override
+ public Integer setmemory(User user) {
+ return userMapper.setmemory(user);
+ }
+
+ @Override
+ public User getUsersid(Integer id) {
+ return userMapper.getUsersid(id);
+ }
+
+ @Override
+ public List getuserlistforgroupid(Integer groupid) {
+ return userMapper.getuserlistforgroupid(groupid);
+ }
+
+ @Transactional//默认遇到throw new RuntimeException(“…”);会回滚
+ public Integer usersetmemory(User user,String codestring) {
+ Integer ret = userMapper.setmemory(user);
+ if(ret<=0){
+ Print.warning("用户空间没有设置成功。回滚");
+ throw new CodeException("用户之没有设置成功。");
+ }else{
+ ret = codeMapper.deleteCode(codestring);
+ }
+ return ret;
+ }
}
diff --git a/src/main/java/cn/hellohao/test/FTP.java b/src/main/java/cn/hellohao/test/FTP.java
index fee07f3..903a519 100644
--- a/src/main/java/cn/hellohao/test/FTP.java
+++ b/src/main/java/cn/hellohao/test/FTP.java
@@ -7,7 +7,7 @@ import org.apache.commons.net.ftp.FTPReply;
import java.io.FileInputStream;
/**
- * @author Tiansh
+ * @author Hellohao
* @version 1.0
* @date 2019/7/29 17:38
* https://blog.csdn.net/WatsonYee/article/details/82389769
diff --git a/src/main/java/cn/hellohao/test/test1.java b/src/main/java/cn/hellohao/test/test1.java
index 7e4a428..63cf554 100644
--- a/src/main/java/cn/hellohao/test/test1.java
+++ b/src/main/java/cn/hellohao/test/test1.java
@@ -1,21 +1,93 @@
package cn.hellohao.test;
-import cn.hellohao.utils.Print;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.extra.ftp.Ftp;
-import java.io.File;
-import java.io.IOException;
+import cn.hellohao.utils.Print;
+import cn.hutool.crypto.SecureUtil;
+import org.apache.commons.codec.binary.Base64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import java.security.SecureRandom;
+import java.util.Date;
public class test1 {
- public static void main(String[] args) {
-
-
- String str = "hellohao.cn:888";
- int flag = str.indexOf(":");
- System.out.println(flag);
+// private static final String KEY = "myMw6qPt&3AD";
+ private static final String KEY = "myMw6qPt&3GHSE";
+ public static void main(String[] args) throws Exception {
+ java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
+ String times = format1.format(new Date());
+ //待加密字段
+ String source = times+"201908111340402000";
+ //加密
+ String result = enCryptAndEncode(source);
+ Print.warning(result);
+ //解密
+ String source_2 = deCryptAndDecode(result);
+ Print.warning(source_2);
+ System.out.println("判断是否相等:"+source.equals(source_2));
+ System.out.println(SecureUtil.md5("200"));
+ //System.out.println(SecureUtil.sha256("201908111340402000"));
}
+
+
+ public static String enCryptAndEncode(String content) {
+ try {
+ byte[] sourceBytes = enCryptAndEncode(content, KEY);
+ return Base64.encodeBase64URLSafeString(sourceBytes);
+ } catch (Exception e) {
+ return content;
+ }
+ }
+
+ /**
+ * 加密函数
+ *
+ * @param content 加密的内容
+ * @param strKey 密钥
+ * @return 返回二进制字符数组
+ * @throws Exception
+ */
+ public static byte[] enCryptAndEncode(String content, String strKey) throws Exception {
+
+ KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
+ keyGenerator.init(128, new SecureRandom(strKey.getBytes()));
+
+ SecretKey desKey = keyGenerator.generateKey();
+ Cipher cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.ENCRYPT_MODE, desKey);
+ return cipher.doFinal(content.getBytes("UTF-8"));
+ }
+
+ public static String deCryptAndDecode(String content) throws Exception {
+ byte[] targetBytes = Base64.decodeBase64(content);
+ return deCryptAndDecode(targetBytes, KEY);
+ }
+
+
+ /**
+ * 解密函数
+ *
+ * @param src 加密过的二进制字符数组
+ * @param strKey 密钥
+ * @return
+ * @throws Exception
+ */
+ public static String deCryptAndDecode(byte[] src, String strKey) throws Exception {
+ KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
+ keyGenerator.init(128, new SecureRandom(strKey.getBytes()));
+
+ SecretKey desKey = keyGenerator.generateKey();
+ Cipher cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.DECRYPT_MODE, desKey);
+ byte[] cByte = cipher.doFinal(src);
+ return new String(cByte, "UTF-8");
+ }
+
+
}
diff --git a/src/main/java/cn/hellohao/utils/AfterServiceStarted.java b/src/main/java/cn/hellohao/utils/AfterServiceStarted.java
new file mode 100644
index 0000000..0a8e237
--- /dev/null
+++ b/src/main/java/cn/hellohao/utils/AfterServiceStarted.java
@@ -0,0 +1,28 @@
+package cn.hellohao.utils;
+
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.stereotype.Component;
+
+import java.util.Scanner;
+
+@Component
+public class AfterServiceStarted implements ApplicationRunner {
+
+ /**
+ * 会在服务启动完成后立即执行
+ */
+ @Override
+ public void run(ApplicationArguments args) throws Exception {
+ Print.Normal("================================================");
+ Print.Normal("|| Hellohao-Pro图床启动成功 ||");
+ Print.Normal("|| 作者博客:Http://www.hellohao.cn ||");
+ Print.Normal("|| 也许这将是最好用的图床 ||");
+ Print.Normal("=================================================");
+ //getLinuxLocalIp();
+
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/hellohao/utils/GetCurrentSource.java b/src/main/java/cn/hellohao/utils/GetCurrentSource.java
new file mode 100644
index 0000000..cab4d0d
--- /dev/null
+++ b/src/main/java/cn/hellohao/utils/GetCurrentSource.java
@@ -0,0 +1,56 @@
+package cn.hellohao.utils;
+
+import cn.hellohao.dao.UserMapper;
+import cn.hellohao.pojo.Group;
+import cn.hellohao.pojo.User;
+import cn.hellohao.pojo.UserGroup;
+import cn.hellohao.service.GroupService;
+import cn.hellohao.service.UserGroupService;
+import cn.hellohao.service.impl.GroupServiceImpl;
+import cn.hellohao.service.impl.UserGroupServiceImpl;
+import cn.hellohao.service.impl.UserServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/20 14:10
+ */
+@Component
+public class GetCurrentSource {
+ @Autowired
+ private GroupServiceImpl groupServiceImpl;
+ @Autowired
+ private UserGroupServiceImpl userGroupServiceImpl;
+ @Autowired
+ private UserServiceImpl userServiceImpl;
+
+ private static GroupServiceImpl groupService;
+ private static UserGroupServiceImpl userGroupService;
+ private static UserServiceImpl userService;
+
+ @PostConstruct
+ public void init() {
+ groupService =groupServiceImpl;
+ userGroupService = userGroupServiceImpl;
+ userService = userServiceImpl;
+ }
+
+
+ public static Integer GetSource(Integer userid){
+ Integer ret = 0;
+ if(userid==null){
+ Group group = groupService.idgrouplist(1);
+ ret = group.getKeyid();
+ }else{
+ //UserGroup userGroup = userGroupService.useridgetusergroup(userid);
+ User user = userService.getUsersid(userid);
+ Group group = groupService.idgrouplist(user.getGroupid());
+ ret = group.getKeyid();
+ }
+ return ret;
+ }
+}
diff --git a/src/main/java/cn/hellohao/utils/LocUpdateImg.java b/src/main/java/cn/hellohao/utils/LocUpdateImg.java
index b08f827..1a71b20 100644
--- a/src/main/java/cn/hellohao/utils/LocUpdateImg.java
+++ b/src/main/java/cn/hellohao/utils/LocUpdateImg.java
@@ -2,10 +2,9 @@ package cn.hellohao.utils;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
-import com.google.gson.Gson;
import org.springframework.web.multipart.MultipartFile;
-import java.io.File;
-import java.io.IOException;
+
+import java.io.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -37,7 +36,19 @@ public class LocUpdateImg {
dest.getParentFile().mkdirs();
}
try {
- entry.getValue().transferTo(dest);
+
+ MultipartFile multipartFile = entry.getValue();
+
+ FileInputStream fileInputStream = (FileInputStream) multipartFile.getInputStream();
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(dest));
+ byte[] bs = new byte[1024];
+ int len;
+ while ((len = fileInputStream.read(bs)) != -1) {
+ bos.write(bs, 0, len);
+ }
+ bos.flush();
+ bos.close();
+
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(username + "/" + uuid+times + "." + entry.getKey());
diff --git a/src/main/java/cn/hellohao/utils/SendEmail.java b/src/main/java/cn/hellohao/utils/SendEmail.java
index 435909a..9961d61 100644
--- a/src/main/java/cn/hellohao/utils/SendEmail.java
+++ b/src/main/java/cn/hellohao/utils/SendEmail.java
@@ -13,11 +13,12 @@ public class SendEmail {
public static MimeMessage Emails(EmailConfig emailConfig) {
Properties p = new Properties();
+ p.setProperty("mail.smtp.auth", "true");
p.setProperty("mail.smtp.host", emailConfig.getEmailurl());
p.setProperty("mail.smtp.port", emailConfig.getPort());
p.setProperty("mail.smtp.socketFactory.port", emailConfig.getPort());
- p.setProperty("mail.smtp.auth", "true");
- p.setProperty("mail.smtp.socketFactory.class", "SSL_FACTORY");
+ p.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+ //p.setProperty("mail.smtp.socketFactory.class", "SSL_FACTORY");
Session session = Session.getInstance(p, new Authenticator() {
// 设置认证账户信息
diff --git a/src/main/java/cn/hellohao/utils/StringUtils.java b/src/main/java/cn/hellohao/utils/StringUtils.java
index 74166fa..ce981b4 100644
--- a/src/main/java/cn/hellohao/utils/StringUtils.java
+++ b/src/main/java/cn/hellohao/utils/StringUtils.java
@@ -13,41 +13,100 @@ public class StringUtils {
//网易
if(k.getEndpoint()!=null && k.getAccessSecret()!=null && k.getEndpoint()!=null
&& k.getBucketname()!=null && k.getRequestAddress()!=null ){
- return true;
+ if(!k.getEndpoint().equals("") && !k.getAccessSecret().equals("") && !k.getEndpoint().equals("")
+ && !k.getBucketname().equals("") && !k.getRequestAddress().equals("") ){
+ return true;
+ }
}
}else if(sourcekey==2){
//阿里
if(k.getEndpoint()!=null && k.getAccessSecret()!=null && k.getEndpoint()!=null
&& k.getBucketname()!=null && k.getRequestAddress()!=null ) {
- return true;
+ if(!k.getEndpoint().equals("") && !k.getAccessSecret().equals("") && !k.getEndpoint().equals("")
+ && !k.getBucketname().equals("") && !k.getRequestAddress().equals("") ) {
+ return true;
+ }
}
}else if(sourcekey==3){
//又拍
if(k.getEndpoint()!=null && k.getAccessSecret()!=null
&& k.getBucketname()!=null && k.getRequestAddress()!=null ) {
- return true;
+ if(!k.getEndpoint().equals("") && !k.getAccessSecret().equals("")
+ && !k.getBucketname().equals("") && !k.getRequestAddress().equals("") ) {
+ return true;
+ }
}
-
}else if(sourcekey==4){
//七牛
if (k.getEndpoint() != null && k.getAccessSecret() != null && k.getEndpoint() != null
&& k.getBucketname() != null && k.getRequestAddress() != null) {
- return true;
+ if (!k.getEndpoint().equals("") && !k.getAccessSecret() .equals("") && !k.getEndpoint() .equals("")
+ && !k.getBucketname() .equals("") && !k.getRequestAddress().equals("")) {
+ return true;
+ }
}
}else if(sourcekey==6){
//腾讯
if(k.getEndpoint()!=null && k.getAccessSecret()!=null && k.getEndpoint()!=null
&& k.getBucketname()!=null && k.getRequestAddress()!=null ) {
- return true;
+ if(!k.getEndpoint().equals("") && !k.getAccessSecret().equals("") && !k.getEndpoint().equals("")
+ && !k.getBucketname().equals("") && !k.getRequestAddress().equals("") ) {
+ return true;
+ }
+
}
}else if(sourcekey==7){
//FTP
if(k.getEndpoint()!=null && k.getAccessSecret()!=null && k.getEndpoint()!=null && k.getRequestAddress()!=null ) {
- return true;
+ if(!k.getEndpoint().equals("") && !k.getAccessSecret().equals("") && !k.getEndpoint().equals("") && !k.getRequestAddress().equals("") ) {
+ return true;
+ }
}
}
return false;
}
+
+ /**
+ * 移除 URL 中的第一个 '/'
+ * @return 如 path = '/folder1/file1', 返回 'folder1/file1'
+ */
+ public static String removeFirstSeparator(String path) {
+ if (!"".equals(path) && path.charAt(0) == '/') {
+ path = path.substring(1);
+ }
+ return path;
+ }
+
+ /**
+ * 移除 URL 中的最后一个 '/'
+ * @return 如 path = '/folder1/file1/', 返回 '/folder1/file1'
+ */
+ public static String removeLastSeparator(String path) {
+ if (!"".equals(path) && path.charAt(path.length() - 1) == '/') {
+ path = path.substring(0, path.length() - 1);
+ }
+ return path;
+ }
+
+ /**
+ * 将域名和路径组装成 URL, 主要用来处理分隔符 '/'
+ * @param domain 域名
+ * @param path 路径
+ * @return URL
+ */
+ public static String concatDomainAndPath(String domain, String path) {
+ if (path != null && path.length() > 1 && path.charAt(0) != '/') {
+ path = '/' + path;
+ }
+
+ if (domain.charAt(domain.length() - 1) == '/') {
+ domain = domain.substring(0, domain.length() - 2);
+ }
+
+ return domain + path;
+ }
+
+
}
diff --git a/src/main/java/cn/hellohao/utils/VerificationDomain.java b/src/main/java/cn/hellohao/utils/VerificationDomain.java
new file mode 100644
index 0000000..2cc716c
--- /dev/null
+++ b/src/main/java/cn/hellohao/utils/VerificationDomain.java
@@ -0,0 +1,40 @@
+package cn.hellohao.utils;
+
+import cn.hutool.http.HttpUtil;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/8/21 10:31
+ */
+public class VerificationDomain {
+ // public static ;
+ public static String domain2;
+
+ public static boolean verification(){
+ String domain=null;
+ HttpServletRequest re = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+ // 网络协议
+ String networkProtocol = re.getScheme();
+ // 网络ip
+ String host = re.getServerName();
+ boolean b =false;
+ if(domain2==null){
+ HashMap paramMap = new HashMap<>();
+ paramMap.put("domain",host);
+ domain= HttpUtil.post("http://tc.hellohao.cn/getdomain", paramMap);
+ }else{
+ return domain2.equals(host);
+ }
+ b = Integer.parseInt(domain)>0;
+ if(b==true){
+ domain2=host;
+ }
+ return b;
+ }
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index d0a85cc..297bbdb 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,8 +1,8 @@
#ݿ˺
-spring.datasource.username=root
+spring.datasource.username=picturebed
#ݿtest
spring.datasource.password=root
-#ݿӵַ129.28.173.126
+#ݿӵַ
spring.datasource.url=jdbc:mysql://localhost:3306/picturebed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#˿
server.port=8088
@@ -24,7 +24,7 @@ multipart.maxFileSize=10240KB
multipart.maxRequestSize=10240KB
spring.thymeleaf.mode = LEGACYHTML5
spring.http.multipart.location=/data/upload_tmp
-systemupdate=2019-08-07
+systemupdate=2019-08-25
diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt
new file mode 100644
index 0000000..804bbef
--- /dev/null
+++ b/src/main/resources/banner.txt
@@ -0,0 +1,9 @@
+ _ _ _
+ /\ /\___| | | ___ | |__ __ _ ___
+ / /_/ / _ \ | |/ _ \| '_ \ / _` |/ _ \
+/ __ / __/ | | (_) | | | | (_| | (_) |
+\/ /_/ \___|_|_|\___/|_| |_|\__,_|\___/
+
+ ————————————————————————————————————
+ Hellohao博客:http://www.hellohao.cn
+ ————————————————————————————————————
\ No newline at end of file
diff --git a/src/main/resources/mapper/CodeMapper.xml b/src/main/resources/mapper/CodeMapper.xml
new file mode 100644
index 0000000..5268048
--- /dev/null
+++ b/src/main/resources/mapper/CodeMapper.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+ insert into `code` (id,value,code) values (null,#{value},#{code})
+
+
+
+ delete from code where code=#{code}
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/ConfigMapper.xml b/src/main/resources/mapper/ConfigMapper.xml
index df83b25..c8b388c 100644
--- a/src/main/resources/mapper/ConfigMapper.xml
+++ b/src/main/resources/mapper/ConfigMapper.xml
@@ -21,11 +21,11 @@
`explain` = #{explain},
-
- `logos` = #{logos},
+
+ `video` = #{video},
-
- `footed` = #{footed},
+
+ `backtype` = #{backtype},
`links` = #{links},
diff --git a/src/main/resources/mapper/DomainMapper.xml b/src/main/resources/mapper/DomainMapper.xml
new file mode 100644
index 0000000..ae1dc6c
--- /dev/null
+++ b/src/main/resources/mapper/DomainMapper.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/GroupMapper.xml b/src/main/resources/mapper/GroupMapper.xml
new file mode 100644
index 0000000..dbfe857
--- /dev/null
+++ b/src/main/resources/mapper/GroupMapper.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+ insert into `group` (id,groupname,keyid) values (null,#{groupname},#{keyid})
+
+
+
+ delete from `group` where id=#{id}
+
+
+
+ UPDATE `group` SET groupname=#{groupname},keyid=#{keyid} where id = #{id};
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/ImgMapper.xml b/src/main/resources/mapper/ImgMapper.xml
index 23ed0c7..9c1f2ca 100644
--- a/src/main/resources/mapper/ImgMapper.xml
+++ b/src/main/resources/mapper/ImgMapper.xml
@@ -75,5 +75,9 @@
+
+
\ No newline at end of file
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/mapper/UploadConfigMapper.xml b/src/main/resources/mapper/UploadConfigMapper.xml
index e782400..e2d7a42 100644
--- a/src/main/resources/mapper/UploadConfigMapper.xml
+++ b/src/main/resources/mapper/UploadConfigMapper.xml
@@ -31,7 +31,13 @@
`isupdate` = #{isupdate},
- `api` = #{api}
+ `api` = #{api},
+
+
+ `visitormemory` = #{visitormemory},
+
+
+ `usermemory` = #{usermemory}
diff --git a/src/main/resources/mapper/UserGroupMapper.xml b/src/main/resources/mapper/UserGroupMapper.xml
new file mode 100644
index 0000000..60d925b
--- /dev/null
+++ b/src/main/resources/mapper/UserGroupMapper.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+ insert into `usergroup` (id,userid,groupid) values (null,#{userid},#{groupid})
+
+
+
+ UPDATE `usergroup` SET groupid = #{groupid} where userid = #{userid}
+
+
+
+ UPDATE `usergroup` SET groupid = 1 where groupid = #{groupid}
+
+
+
+ delete from `usergroup` where userid=#{userid}
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml
index c2f32a0..5352329 100644
--- a/src/main/resources/mapper/UserMapper.xml
+++ b/src/main/resources/mapper/UserMapper.xml
@@ -4,8 +4,8 @@
- INSERT INTO user (id, username, PASSWORD, email, birthder, LEVEL,uid,isok)
- VALUES (NULL, #{username}, #{password}, #{email}, #{birthder}, #{level},#{uid},#{isok} )
+ INSERT INTO user (id, username, PASSWORD, email, birthder, LEVEL,uid,isok,memory,groupid)
+ VALUES (NULL, #{username}, #{password}, #{email}, #{birthder}, #{level},#{uid},#{isok},#{memory},#{groupid} )
-
+
UPDATE `user` set `isok`=1 where uid=#{uid}
@@ -42,10 +42,27 @@
birthder,
LEVEL,
uid,
- isok
+ isok,
+ memory,
+ groupid
FROM user
WHERE email = #{email}
+
+
@@ -69,8 +88,27 @@
- UPDATE `user` set `password`=#{password} where email=#{email}
+ UPDATE `user`
+
+
+ `email` = #{email},
+
+
+ `username` = #{username},
+
+
+ `password` = #{password},
+
+
+ `memory` = #{memory},
+
+
+ `groupid` = #{groupid}
+
+
+ where uid=#{uid}
+
@@ -85,6 +123,13 @@
*
FROM
user
+
+ where
+ CONCAT(
+ username,
+ email
+ ) LIKE '%${username}%'
+
order by birthder desc
@@ -93,4 +138,17 @@
DELETE FROM user WHERE id=#{id}
+
+
+ UPDATE `user` set `isok`=#{isok} where id=#{id}
+
+
+
+ UPDATE `user` set `memory`=#{memory} where id=#{id}
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/static/css/intro.css b/src/main/resources/static/css/intro.css
new file mode 100644
index 0000000..d5260df
--- /dev/null
+++ b/src/main/resources/static/css/intro.css
@@ -0,0 +1,42 @@
+
+ body{
+ background-color:gray;
+ }
+ h1{
+ color:rgb(225,223,220);
+ /*margin-top:160px;*/
+ margin-top:18%;
+ font-size:80px;
+ }
+ h3{
+ color:rgb(225,223,220);
+ }
+ img{
+ /*width:30px;*/
+ /*height:30px;*/
+ }
+ video#bgvid {
+ position: fixed; right: 0; bottom: 0;
+ min-width: 100%; min-height: 100%;
+ width: auto; height: auto; z-index: -100;
+ background-size: cover;
+ }
+ .box{
+ width:100%;
+ }
+ .wForm{
+ margin-top: 10px;
+ }
+
+ .wBtn{
+ margin-top: 20px;
+ width: 200px;
+ height: 80px;
+ border-radius: 130px;
+ opacity: 0.9;
+ font-size: 26px;
+ }
+
+
+
+
diff --git a/src/main/resources/static/layui/js/zadmin.js b/src/main/resources/static/layui/js/zadmin.js
index 2c30e02..d9eb5bc 100644
--- a/src/main/resources/static/layui/js/zadmin.js
+++ b/src/main/resources/static/layui/js/zadmin.js
@@ -47,8 +47,10 @@ layui.use(['element', 'layer'], function () {
var elem = $(".layui-layout-admin");
var flag = elem.hasClass("admin-nav-mini");
if (flag) {
- elem.removeClass("admin-nav-mini")
+ $('#leftstate').css('display','block');
+ elem.removeClass("admin-nav-mini");
} else {
+ $('#leftstate').css('display','none');
elem.addClass("admin-nav-mini");
}
},
@@ -253,6 +255,7 @@ layui.use(['element', 'layer'], function () {
if ($(this).hasClass("layui-nav-itemed")) {
flag = true;
}
+
$("div.layui-side-scroll .layui-nav-item").removeClass("layui-nav-itemed").removeClass("layui-this");
if ($(this).has("dl").length) {//如果有子菜单,显示下拉样式
if (flag) {
diff --git a/src/main/resources/static/layui/layui/css/layui.css b/src/main/resources/static/layui/layui/css/layui.css
index 7f28b8b..d260632 100644
--- a/src/main/resources/static/layui/layui/css/layui.css
+++ b/src/main/resources/static/layui/layui/css/layui.css
@@ -2427,12 +2427,12 @@ hr {
.layui-form-checked span,
.layui-form-checked:hover span {
- background-color: #ff0000
+ background-color: #59e17a
}
.layui-form-checked i,
.layui-form-checked:hover i {
- color: #ff0000
+ color: #59e17a
}
.layui-form-item .layui-form-checkbox {
diff --git a/src/main/resources/static/static/bootstrap-3.3.4-dist/js/bootstrap-table-hellohao1.13.1.js b/src/main/resources/static/static/bootstrap-3.3.4-dist/js/bootstrap-table-hellohao1.13.1.js
index dacd197..91987c0 100644
--- a/src/main/resources/static/static/bootstrap-3.3.4-dist/js/bootstrap-table-hellohao1.13.1.js
+++ b/src/main/resources/static/static/bootstrap-3.3.4-dist/js/bootstrap-table-hellohao1.13.1.js
@@ -699,7 +699,7 @@
return 'Search';
},
formatNoMatches: function formatNoMatches() {
- return 'No matching records found';
+ return '没有任何数据';
},
formatPaginationSwitch: function formatPaginationSwitch() {
return 'Hide/Show pagination';
diff --git a/src/main/resources/static/webuploade/js/upload.js b/src/main/resources/static/webuploade/js/upload.js
index 1fa5240..1418bd3 100644
--- a/src/main/resources/static/webuploade/js/upload.js
+++ b/src/main/resources/static/webuploade/js/upload.js
@@ -212,6 +212,11 @@
layer = layui.layer;
layer.msg("未配置存储源,或存储源配置不正确。", {icon: 2});
});
+ }else if(response.imgurls==-5){
+ layui.use('layer', function () {
+ layer = layui.layer;
+ layer.msg("上传失败,可用空间不足", {icon: 2});
+ });
} else{
arr_url += response.imgurls + '\r\n';
arr_markdown += '\r\n';
diff --git a/src/main/resources/templates/admin/about.html b/src/main/resources/templates/admin/about.html
index 77d19c0..a5266ec 100644
--- a/src/main/resources/templates/admin/about.html
+++ b/src/main/resources/templates/admin/about.html
@@ -27,7 +27,7 @@
开发者交流群:32452345342
- 当前系统版本:2019-08-01 检查更新
+
支持一下作者吧:
@@ -47,10 +47,11 @@
})
});
function sysupdate(v) {
+ var dates = $("#dates").html();
$.ajax({
type: "POST",
url: "/admin/root/sysupdate",
- data: {dates: v},
+ data: {dates: dates},
dataType: "json",
success: function (data) {
if (data < 0) {
diff --git a/src/main/resources/templates/admin/addgroup.html b/src/main/resources/templates/admin/addgroup.html
new file mode 100644
index 0000000..28021c3
--- /dev/null
+++ b/src/main/resources/templates/admin/addgroup.html
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+ 增加分发群组
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/admin/code.html b/src/main/resources/templates/admin/code.html
new file mode 100644
index 0000000..3123868
--- /dev/null
+++ b/src/main/resources/templates/admin/code.html
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
+
+ 扩容码管理
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/admin/group.html b/src/main/resources/templates/admin/group.html
new file mode 100644
index 0000000..9b0640c
--- /dev/null
+++ b/src/main/resources/templates/admin/group.html
@@ -0,0 +1,199 @@
+
+
+
+
+
+
+
+
+
+ 分发群组
+
+
+
+
+
+
+
+
+
+
+
+
+
+
注意:默认群组不可删除,游客或者未分配的注册用户都将会存入默认群组的存储源。
+
增加群组选择存储源时,必须保证你的存储源配置项已经填写完整,否则会出错。
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/admin/index.html b/src/main/resources/templates/admin/index.html
index e46398b..41d08a6 100644
--- a/src/main/resources/templates/admin/index.html
+++ b/src/main/resources/templates/admin/index.html
@@ -12,8 +12,14 @@
@@ -24,13 +30,14 @@
- 图床后台管理
+
+ Console
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/templates/admin/modifyuser.html b/src/main/resources/templates/admin/modifyuser.html
new file mode 100644
index 0000000..11dfb64
--- /dev/null
+++ b/src/main/resources/templates/admin/modifyuser.html
@@ -0,0 +1,94 @@
+
+
+