diff --git a/sql/picturebed.sql b/sql/picturebed.sql index 0125012..a1ed495 100644 --- a/sql/picturebed.sql +++ b/sql/picturebed.sql @@ -11,12 +11,24 @@ Target Server Version : 50720 File Encoding : 65001 - Date: 07/11/2019 21:25:39 + Date: 18/03/2020 22:31:29 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; +-- ---------------------------- +-- Table structure for album +-- ---------------------------- +DROP TABLE IF EXISTS `album`; +CREATE TABLE `album` ( + `albumkey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `albumtitle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `createdate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `userid` int(10) NULL DEFAULT NULL +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + -- ---------------------------- -- Table structure for code -- ---------------------------- @@ -50,13 +62,14 @@ CREATE TABLE `config` ( `webms` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `webkeywords` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `webfavicons` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `theme` int(4) NULL DEFAULT 1 COMMENT '主题', 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-cloud.oss-cn-beijing.aliyuncs.com/Pexels.mp4', '1', 'Hellohao开发制作', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://127.0.0.1:8088', '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, NULL, NULL, NULL); +INSERT INTO `config` VALUES (1, 8, 1, 'Hellohao', '网站由JAVA语言编写应用SpringBoot框架开发,前端全部组件由BootStrap/Layui框架编写。由作者个人更新维护,后期会加入更全面的功能供大家使用,如有BUG请与我反馈。', 'https://hellohao-cloud.oss-cn-beijing.aliyuncs.com/Pexels.mp4', '1', 'Hellohao开发制作', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://127.0.0.1:8088', '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, NULL, NULL, NULL, 1); -- ---------------------------- -- Table structure for emailconfig @@ -94,6 +107,15 @@ CREATE TABLE `group` ( -- ---------------------------- INSERT INTO `group` VALUES (1, '默认群组', 5); +-- ---------------------------- +-- Table structure for imgandalbum +-- ---------------------------- +DROP TABLE IF EXISTS `imgandalbum`; +CREATE TABLE `imgandalbum` ( + `imgname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `albumkey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + -- ---------------------------- -- Table structure for imgdata -- ---------------------------- @@ -108,8 +130,11 @@ CREATE TABLE `imgdata` ( `abnormal` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `source` int(2) NULL DEFAULT NULL COMMENT '存储源', `imgtype` int(2) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; + `explains` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `md5key` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + INDEX `index_md5key_url`(`md5key`, `imgurl`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed; -- ---------------------------- -- Table structure for imgreview @@ -150,12 +175,12 @@ CREATE TABLE `keys` ( -- ---------------------------- INSERT INTO `keys` VALUES (1, '', '', '', '', '', 1); INSERT INTO `keys` VALUES (2, '', '', '', '', '', 2); -INSERT INTO `keys` VALUES (3, '', '', '0', '', '', 3); +INSERT INTO `keys` VALUES (3, '1', '1', '0', '1', 'http://127.0.0.1', 3); INSERT INTO `keys` VALUES (4, '', '', '', '', '', 4); INSERT INTO `keys` VALUES (5, '0', '0', '0', '0', '0', 5); INSERT INTO `keys` VALUES (6, '', '', '', '', '', 6); -INSERT INTO `keys` VALUES (7, '', '', '', '', '', 7); -INSERT INTO `keys` VALUES (8, '', '', '', '', '', 8); +INSERT INTO `keys` VALUES (7, '1', '1', '127.0.0.1:21', '', 'http://127.0.0.1', 7); +INSERT INTO `keys` VALUES (8, '111', '222', '0', '333', 'http://127.0.0.1/', 8); INSERT INTO `keys` VALUES (9, '', '', '', '', '', 9); INSERT INTO `keys` VALUES (10, '0', '', '0', '0', '0', 10); @@ -199,13 +224,14 @@ CREATE TABLE `uploadconfig` ( `api` int(2) NOT NULL COMMENT '开启api', `visitormemory` int(10) NULL DEFAULT NULL COMMENT '游客限制大小', `usermemory` int(10) NULL DEFAULT 0 COMMENT '用户默认大小', + `blacklist` 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 uploadconfig -- ---------------------------- -INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 1, 1, 1, 500, 1024); +INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 2, 1, 1, 500, 1024, ''); -- ---------------------------- -- Table structure for user @@ -228,7 +254,7 @@ CREATE TABLE `user` ( -- ---------------------------- -- Records of user -- ---------------------------- -INSERT INTO `user` VALUES (1, 'admin', 'YWRtaW4=', 'admin', '2019-06-12', 2, 'admin', 1, 1024, 1); +INSERT INTO `user` VALUES (1, 'admin', 'YWRtaW4=', 'admin', '2019-06-12', 2, '828812cff63b4e52b7be7911a9a410b2', 1, 1024, 1); -- ---------------------------- -- Table structure for usergroup diff --git a/src/main/java/cn/hellohao/controller/AdminController.java b/src/main/java/cn/hellohao/controller/AdminController.java index b724a92..1ced80d 100644 --- a/src/main/java/cn/hellohao/controller/AdminController.java +++ b/src/main/java/cn/hellohao/controller/AdminController.java @@ -245,7 +245,7 @@ public class AdminController { de.delect(key, images.getImgname()); } else if (key.getStorageType() == 2) { de.delectOSS(key, images.getImgname()); - } else if (key.getStorageType() == 3) { + } else if (key.getStorageType() == 3 || key.getStorageType() == 8) { de.delectUSS(key, images.getImgname()); } else if (key.getStorageType() == 4) { de.delectKODO(key, images.getImgname()); diff --git a/src/main/java/cn/hellohao/controller/AdminRootController.java b/src/main/java/cn/hellohao/controller/AdminRootController.java index 56d46ba..83ad98c 100644 --- a/src/main/java/cn/hellohao/controller/AdminRootController.java +++ b/src/main/java/cn/hellohao/controller/AdminRootController.java @@ -112,7 +112,7 @@ public class AdminRootController { ret =nOSImageupload.Initialize(key);//实例化网易 }else if (key.getStorageType()==2){ ret = OSSImageupload.Initialize(key); - }else if(key.getStorageType()==3){ + }else if(key.getStorageType()==3 || key.getStorageType()==8){ ret = USSImageupload.Initialize(key); }else if(key.getStorageType()==4){ ret = KODOImageupload.Initialize(key); @@ -200,9 +200,14 @@ public class AdminRootController { @PostMapping("/setisok") @ResponseBody public String setisok(HttpSession session, User user) { - Integer ret = userService.setisok(user); JSONArray jsonArray = new JSONArray(); - jsonArray.add(ret); + User u = (User) session.getAttribute("user"); + if(u.getId()==user.getId()){ + jsonArray.add(-2); + }else{ + Integer ret = userService.setisok(user); + jsonArray.add(ret); + } return jsonArray.toString(); } diff --git a/src/main/java/cn/hellohao/controller/ClientController.java b/src/main/java/cn/hellohao/controller/ClientController.java index 3ae71c8..344745b 100644 --- a/src/main/java/cn/hellohao/controller/ClientController.java +++ b/src/main/java/cn/hellohao/controller/ClientController.java @@ -80,7 +80,7 @@ public class ClientController { nOSImageupload.Initialize(key);//实例化网易 } else if (key.getStorageType() == 2) { OSSImageupload.Initialize(key); - } else if (key.getStorageType() == 3) { + } else if (key.getStorageType() == 3 || key.getStorageType()==8) { USSImageupload.Initialize(key); } else if (key.getStorageType() == 4) { KODOImageupload.Initialize(key); @@ -125,7 +125,7 @@ public class ClientController { m = nOSImageupload.clientuploadNOS(map, userpath, uploadConfig); } else if (key.getStorageType() == 2) { m = ossImageupload.clientuploadOSS(map, userpath, uploadConfig); - } else if (key.getStorageType() == 3) { + } else if (key.getStorageType() == 3 || key.getStorageType()==8) { m = ussImageupload.clientuploadUSS(map, userpath, uploadConfig); } else if (key.getStorageType() == 4) { m = kodoImageupload.clientuploadKODO(map, userpath, uploadConfig); @@ -305,7 +305,7 @@ public class ClientController { m = nOSImageupload.Imageupload(null, userpath,map,setday); }else if (key.getStorageType()==2){ m = ossImageupload.ImageuploadOSS(null, userpath,map,setday); - }else if(key.getStorageType()==3){ + }else if(key.getStorageType()==3 || key.getStorageType()==8){ m = ussImageupload.ImageuploadUSS(null, userpath,map,setday); }else if(key.getStorageType()==4){ m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday); @@ -387,7 +387,7 @@ public class ClientController { m = nOSImageupload.Imageupload(null, userpath,map,setday); }else if (key.getStorageType()==2){ m = ossImageupload.ImageuploadOSS(null, userpath,map,setday); - }else if(key.getStorageType()==3){ + }else if(key.getStorageType()==3 || key.getStorageType()==8){ m = ussImageupload.ImageuploadUSS(null, userpath,map,setday); }else if(key.getStorageType()==4){ m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday); diff --git a/src/main/java/cn/hellohao/interceptor/WebAppConfig.java b/src/main/java/cn/hellohao/interceptor/WebAppConfig.java index 23213c2..9c1cf5e 100644 --- a/src/main/java/cn/hellohao/interceptor/WebAppConfig.java +++ b/src/main/java/cn/hellohao/interceptor/WebAppConfig.java @@ -36,7 +36,8 @@ public class WebAppConfig implements WebMvcConfigurer { registry.addInterceptor(interceptorConfigWeb).addPathPatterns("/**") .excludePathPatterns("/static/**","/**/*.css", "/**/*.js", "/**/*.png", "/**/*.jpg", "/**/*.jpeg", "/**/*.gif", "/**/fonts/*", "/**/*.svg", - "/clientupimg/**","/clientupurlimg/**","/clientlogin/**","/notices/**","/systemupdate/**","/getdomain/**","/getNoticeText/**","/getNotice/**"); + "/clientupimg/**","/clientupurlimg/**","/clientlogin/**","/notices/**","/systemupdate/**","/getdomain/**", + "/getNoticeText/**","/getNotice/**","/addalbum/**","/addalbum/**","/SaveForAlbum/**","/TOALBUM*N/**","/TOALBUM*N/**"); registry.addInterceptor(interceptorConfig).addPathPatterns("/admin/**"); registry.addInterceptor(interceptorConfigTwo).addPathPatterns("/admin/root/**"); diff --git a/src/main/java/cn/hellohao/service/impl/FTPImageupload.java b/src/main/java/cn/hellohao/service/impl/FTPImageupload.java index bb94245..ce0253f 100644 --- a/src/main/java/cn/hellohao/service/impl/FTPImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/FTPImageupload.java @@ -112,6 +112,7 @@ public class FTPImageupload { ftp.login(k.getAccessKey(), k.getAccessSecret()); } catch (IOException e) { e.printStackTrace(); + return -1; } //获取服务器返回的状态码 int reply = ftp.getReplyCode(); diff --git a/src/main/java/cn/hellohao/test/Test1.java b/src/main/java/cn/hellohao/test/Test1.java new file mode 100644 index 0000000..1ab5433 --- /dev/null +++ b/src/main/java/cn/hellohao/test/Test1.java @@ -0,0 +1,88 @@ +package cn.hellohao.test; + +import cn.hellohao.utils.ImgUrlUtil; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; + +public class Test1 { + + + + public static void main(String[] args) { + ThreadTest1 t1 = new ThreadTest1(); + ThreadTest1 t2 = new ThreadTest1(); + ThreadTest1 t3 = new ThreadTest1(); + ThreadTest1 t4 = new ThreadTest1(); + ThreadTest1 t5 = new ThreadTest1(); + ThreadTest1 t6 = new ThreadTest1(); + ThreadTest1 t7 = new ThreadTest1(); + ThreadTest1 t8 = new ThreadTest1(); + ThreadTest1 t9 = new ThreadTest1(); + ThreadTest1 t10 = new ThreadTest1(); + //ThreadTest2 t2 = new ThreadTest2(); + + Thread thread1 = new Thread(t1); + Thread thread2 = new Thread(t2); + Thread thread3 = new Thread(t3); + Thread thread4 = new Thread(t4); + Thread thread5 = new Thread(t5); + Thread thread6 = new Thread(t6); + Thread thread7 = new Thread(t7); + Thread thread8 = new Thread(t8); + Thread thread9 = new Thread(t9); + Thread thread10 = new Thread(t10); + thread1.start(); + thread2.start(); + thread3.start(); + thread4.start(); + thread5.start(); + thread6.start(); + thread7.start(); + thread8.start(); + thread9.start(); + thread10.start(); + + } +} + +class ThreadTest1 implements Runnable { + public void run() { + for (int i = 0; i < 999999999; i++) { + long a = 693; + System.out.println("流量刷取情况:" +shuashua()+", 已经执行:"+ i+"次"); + } + } + public static boolean shuashua(){ + String uuid= UUID.randomUUID().toString().replace("-", ""); + boolean bl = false; + try { + bl = ImgUrlUtil.downLoadFromUrl("https://ftp.bmp.ovh/imgs/2020/03/6bf4d7c231e6fab6.jpg", + uuid, "D://hellohaotmp"+ File.separator); + } catch (IOException e) { + e.printStackTrace(); + } + deleteFile("D://hellohaotmp"+ File.separator+uuid); + return bl; + } + public static boolean deleteFile(String pathname){ + boolean result = false; + File file = new File(pathname); + if (file.exists()) { + file.delete(); + result = true; + System.out.println("文件已经被成功删除"); + } + return result; + } + +} + +class ThreadTest2 implements Runnable { + public void run() { + for (int i = 0; i < 20; i++) { + System.out.println("ThreadTest2正在运行==========" + i); + } + } +} \ No newline at end of file diff --git a/src/main/java/cn/hellohao/test/shua.java b/src/main/java/cn/hellohao/test/shua.java new file mode 100644 index 0000000..38202f3 --- /dev/null +++ b/src/main/java/cn/hellohao/test/shua.java @@ -0,0 +1,45 @@ +package cn.hellohao.test; + +import cn.hellohao.utils.ImgUrlUtil; +import cn.hellohao.utils.Print; +import jdk.nashorn.internal.objects.annotations.Where; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; + +/** + * @author Hellohao + * @version 1.0 + * @date 2020-03-11 21:45 + */ +public class shua { + + + public static void main(String[] args) { + + for (int i = 0; i <999999999 ; i++) { + shuashua(); + Print.Normal("已成功执行:"+i+" 次"); + } + + } + + + public static boolean shuashua(){ + String uuid= UUID.randomUUID().toString().replace("-", ""); + boolean bl = false; + try { + bl = ImgUrlUtil.downLoadFromUrl("https://ftp.bmp.ovh/imgs/2020/03/6bf4d7c231e6fab6.jpg", + uuid, "D://hellohaotmp"+ File.separator); + } catch (IOException e) { + e.printStackTrace(); + } + return bl; + } + + public static Long jia(){ + long l = 693; + return l++; + } +} diff --git a/src/main/java/cn/hellohao/utils/GetSource.java b/src/main/java/cn/hellohao/utils/GetSource.java index 76625f1..d4f2c49 100644 --- a/src/main/java/cn/hellohao/utils/GetSource.java +++ b/src/main/java/cn/hellohao/utils/GetSource.java @@ -27,7 +27,7 @@ public class GetSource { m = nosImageupload.Imageupload(fileMap, userpath,filename,setday); }else if (type==2){ m = ossImageupload.ImageuploadOSS(fileMap, userpath,filename,setday); - }else if(type==3){ + }else if(type==3 || type==8){ m = ussImageupload.ImageuploadUSS(fileMap, userpath,filename,setday); }else if(type==4){ m = kodoImageupload.ImageuploadKODO(fileMap, userpath,filename,setday); diff --git a/src/main/java/cn/hellohao/utils/LocUpdateImg.java b/src/main/java/cn/hellohao/utils/LocUpdateImg.java index d8d6814..b086fb2 100644 --- a/src/main/java/cn/hellohao/utils/LocUpdateImg.java +++ b/src/main/java/cn/hellohao/utils/LocUpdateImg.java @@ -28,11 +28,11 @@ public class LocUpdateImg { java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss"); String times = format1.format(new Date()); // 上传文件流。 - System.out.println("待上传的图片:"+username + "/" + uuid+times + "N." + entry.getKey()); + System.out.println("待上传的图片:"+username + File.separator + uuid+times + "N." + entry.getKey()); File dest = new File(filePath + username + File.separator+ uuid+times + "N." + entry.getKey()); File temppath = new File(filePath + username+ File.separator ); if (!dest.getParentFile().exists()) { - temppath.getParentFile().mkdirs(); + dest.getParentFile().mkdirs(); } try { MultipartFile multipartFile = entry.getValue(); @@ -100,7 +100,7 @@ public class LocUpdateImg { String uuid = "TOIMG"+UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位 java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss"); String times = format1.format(new Date()); - System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey()); + System.out.println("待上传的图片:"+username + "/" + uuid+times + "N." + entry.getKey()); ReturnImage returnImage = new ReturnImage(); if(entry.getValue().getSize()/1024<=uploadConfig.getFilesizeuser()*1024){ File dest = new File(filePath + username + File.separator+ uuid+times + "N." + entry.getKey()); diff --git a/src/main/resources/templates/admin/about.html b/src/main/resources/templates/admin/about.html index a00102a..282856b 100644 --- a/src/main/resources/templates/admin/about.html +++ b/src/main/resources/templates/admin/about.html @@ -28,7 +28,7 @@