diff --git a/README.md b/README.md
index 1154c8f..b73906f 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
-# Hellohao图床 - 全新响应式UI
+# Hellohao图床 - 强大的图像托管服务程序



-> 这是一个基于多家对象存储源的SpringBoot开源图床项目。
-> 本项目使用 Spring Boot 搭建, 针对用户更方便的管理自己的图片管理拓展功能, 支持对接`本地`、`网易`,`阿里`,`又拍`,`七牛`、`腾讯`、`FTP`等多家对象存储.
+> 这是一个基于多家对象存储源的SpringBoot开源图片托管程序。
+> 本项目使用 Spring Boot 搭建, 针对用户更方便的管理自己的图片管理拓展功能, 支持对接`本地`、`网易`,`阿里`,`又拍`,`七牛`、`腾讯`、`FTP`、`u-file`,`B2`等多家对象存储.
> 后台对用户管理。
> 支持配置多家存储源。
> 用户注册邮箱验证,以及后台配置邮箱服务器。
@@ -13,9 +13,11 @@
## 主要功能支持:
+- 多主题支持:炫酷壁纸、简约蓝白
- 支持 图片拖拽、截图软件直接(Ctrl+V)和图片URL地址上传。
-- 支持对接本地、网易、阿里、又拍、七牛、腾讯、FTP等各大对象存储平台。
+- 支持对接本地、网易、阿里、又拍、七牛、腾讯、FTP、u-file、B2等各大对象存储平台。
- 支持图片定期暂存(到期自动删除)
+- 支持画廊分享模式(用户可把自己当前上传的图片以图片集的形式批量分享给好友)
- 支持上传者IP记录,并可配置IP黑名单操作
- 支持链接生成二维码。
- 支持开启/关闭API接口。
@@ -25,129 +27,36 @@
- 邮箱注册激活。
- 站点样式设置和上传规则配置等。
-主站地址: [http://tc.hellohao.cn/](http://tc.hellohao.cn/)
+主站地址: [http://tbed.hellohao.cn/](http://tbed.hellohao.cn/)
-体验地址(用户名/密码均为admin):[http://129.28.173.126:8088/](http://129.28.173.126:8088/)
+文档地址: [http://tbed.hellohao.cn/doc](http://tbed.hellohao.cn/doc)
-文档地址: [http://doc.wwery.com/](http://doc.wwery.com/)
-
-编译包下载: [https://github.com/Hello-hao/Tbed/releases/](https://github.com/Hello-hao/Tbed/releases/)
-
-捐赠列表:[http://doc.wwery.com/#/reward?id=捐赠者名单](http://doc.wwery.com/#/reward?id=捐赠者名单)
+开源版编译包下载(内部版请前往主站获取): [https://github.com/Hello-hao/Tbed/releases/](https://github.com/Hello-hao/Tbed/releases/)
全套部署视频教程:[https://www.bilibili.com/video/av79137056/](https://www.bilibili.com/video/av79137056/)
## 系统预览
-
-
-
+




-## 更新日志
-
-**2019-11-18**
-
-√ 增加上传者ip记录
-
-√ 增加临时期限照片显示。
-
-√ 加固系统安全性验证,防止一些非法操作。
-
-√ 优化后台上传图片算法。
-
-#### 修复
-
-修复上传时总是提示非法调用问题
-修复系统部署的严重BUG
-修复上传者IP地址显示准确问题
-修复注册用户BUG
-
-#### 注意:
-
-- 如果你的图床已经在使用了。直接执行 `patch.sql` 补丁sql即可,不用清空之前的数据。
-- 如果你是2019年09月份之前的版本,或者第一次安装本程序需要执行 `picturebed.sql` 完成sql文件
-
-
## 运行环境
- JDK 1.8
-- MySQL
+- MySQL5.5+
-## 一:项目编译
-(如果你的目的是为了部署自己的图床项目,可以下滑直接用编译包按照部署教程,直接可以部署。)
+## 部署
-### 下载项目
-
-```git
-git clone https://github.com/Hello-hao/Tbed.git
-```
-
-### 导入项目
-
-使用自己的 Intellij IDEA 或者 Eclipse 均可.
-
-### 导入数据库
-
-创建数据库`picturebed`, 字符集选择 `utf8`, 排序规则选择 `utf8_general_ci`.
-导入picturebed.sql
-
-### 配置文件
+### 修改配置文件
打开 `application.properties` 修改 `MySQL` 和 `服务器端口` 等连接信息.
-```properties
-#数据库账号
-spring.datasource.username=root
-#数据库密码
-spring.datasource.password=root
-#数据库链接地址
-spring.datasource.url=jdbc:mysql://localhost:3306/picturebed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-#端口
-server.port=8088
-#鉴黄周期表达式 下方表达式为每天七点半执行
-#不懂请勿乱修改。具体可以参考官方文档http://doc.wwery.com
-Expression=0 30 04 * * ?
-
-
-#下边的配置项不需要修改。
-mybatis.configuration.map-underscore-to-camel-case=true
-mybatis.mapper-locations=classpath:mapper/*.xml
-logging.level.cn.hellohao.dao=debug
-spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
-spring.jackson.time-zone=GMT+8
-spring.datasource.driver-class-name=com.mysql.jdbc.Driver
-spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
-spring.thymeleaf.cache=false
-multipart.maxFileSize=10240KB
-multipart.maxRequestSize=10240KB
-spring.thymeleaf.mode = LEGACYHTML5
-spring.http.multipart.location=/data/upload_tmp
-
-```
-
-### 启动项目
-
-在完成了上述步骤后,找到 TbedApplication 启动类, 启动即可.
-
-初始用户名:admin
-初始邮箱:admin
-初始密码`admin`
-
-启动后访问地址为:http://localhost:8088 , `8088`就是你配置`server.port=8088`的端口.
-
-
-
-## 二:编译包直接部署
-
-> **项目搭建部署教程:** [**http://www.hellohao.cn/?p=201**](http://www.hellohao.cn/?p=201 "点击查看搭建文档")
-
### 部署
前提是你的服务器必须要有`JDK1.8`环境,和`mysql`数据库。
@@ -157,8 +66,6 @@ spring.http.multipart.location=/data/upload_tmp
yum install java-1.8*
```
-如果你是宝塔环境,也可以在应用商店安装一个`Tomcat8`因该是自带JDK1.8环境。
-
把`Tbed.jar`和`application.properties`放到服务器你想存放的目录比如`/home`,注意这两个文件必须要在同一目录下不能分开。
依次运行如下命令:
@@ -168,23 +75,32 @@ cd /home
java -jar Tbed.jar
```
-然后访问`http://服务器IP:8088/`即可。
+
+### 启动项目
+
+启动后访问地址为:http://localhost:8088 , `8088`就是你配置`server.port=8088`的端口.
+
+初始用户名:admin
+初始邮箱:admin
+初始密码`admin`
+
+
注意:上边的`/home`是你的jar包和application.properties文件放的目录。
项目运行起来不要关闭xshell窗口,否则项目将不能访问。可以使用一些后台命令把项目锁定后台。如`nohup`或`screen`,推荐使用`screen`
### PC客户端
-
-
-如果你想让自己的图床拥有自己的客户端,可以加下方群,联系群主帮你对接(前提是你使用的是Hellohao图床程序搭建的网站。)
+作者精力不够,工作繁忙,暂停更新
### 声明
-本程序免费提供给个人用户使用,未经允许不得作为盈利商业使用,如果你想商用,请先与我们联系,分享你的利益。
+本程序免费提供给个人用户使用,未经允许不得作为盈利商业使用,如果你想商用或程序定制,请先与我们联系,分享你的利益。
+源码仅供感兴趣的开发者做开发逻辑参考,不得在未经开发者同意的情况下以他人名义修改并发布使用编译包。
+如果你想个人修改并使用我的源码,请保留原作者的版权,并开源你修改过的源码。
### 反馈交流
- **如果你遇到BUG可以去我的博客反馈**
+**如果你遇到BUG可以去我的博客反馈**
Hellohao博客: [http://www.hellohao.cn/](http://www.hellohao.cn/)
欢迎加入Hellohao开发者交流群,群聊号码:**864800972**
@@ -193,4 +109,5 @@ Hellohao博客: [http://www.hellohao.cn/](http://www.hellohao.cn/)
**如果你也支持Hellohao图床,可以请我喝杯咖啡。我会持续更新Hellohao图床**
-
+**捐赠地址:** [**http://tbed.hellohao.cn/pay**](http://tbed.hellohao.cn/pay)
+
diff --git a/pom.xml b/pom.xml
index 4a2fe48..e50457b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,6 +16,7 @@
1.8
+ 9.0.30
springboot
@@ -68,6 +69,12 @@
java-sdk
4.1.2
+
+
+ org.apache.commons
+ commons-text
+ 1.8
+
com.qiniu
@@ -100,7 +107,6 @@
4.5.16
-
org.quartz-scheduler
diff --git a/sql/picturebed.sql b/sql/picturebed.sql
index 0125012..42537de 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: 15/03/2021 10:08:10
*/
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
-- ----------------------------
@@ -37,26 +49,27 @@ CREATE TABLE `config` (
`sourcekey` int(4) NULL DEFAULT NULL,
`emails` int(4) NULL DEFAULT NULL COMMENT '邮箱配置',
`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 '首页左下角说明',
- `video` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '视频地址',
+ `explain` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `video` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`backtype` 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 '上传页面背景图',
+ `links` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `notice` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `baidu` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `domain` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `background1` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `background2` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`sett` int(2) NOT NULL COMMENT '首页样式',
- `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,
+ `webms` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `webkeywords` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `webfavicons` varchar(1000) 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, 9, 1, 'Hellohao', '网站由JAVA语言编写应用SpringBoot框架开发,前端全部组件由BootStrap/Layui框架编写。由作者个人更新维护,感谢使用者的支持。', '', '1', '© 2019 Hellohao - All Rights Reserved - Collect from Hellohao博客', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://127.0.0.1:8088', 'https://s1.ax1x.com/2020/05/26/tPM6qU.jpg', '', 1, '', '', '', 1);
-- ----------------------------
-- Table structure for emailconfig
@@ -86,13 +99,24 @@ CREATE TABLE `group` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`groupname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '组名称',
`keyid` int(255) NULL DEFAULT NULL,
+ `usertype` int(255) 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 group
-- ----------------------------
-INSERT INTO `group` VALUES (1, '默认群组', 5);
+INSERT INTO `group` VALUES (1, '默认群组', 5, 0);
+
+-- ----------------------------
+-- 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,
+ `notes` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT ' '
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for imgdata
@@ -108,8 +132,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 = 58 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
-- ----------------------------
-- Table structure for imgreview
@@ -128,7 +155,7 @@ CREATE TABLE `imgreview` (
-- ----------------------------
-- Records of imgreview
-- ----------------------------
-INSERT INTO `imgreview` VALUES (1, NULL, NULL, NULL, 0, 0);
+INSERT INTO `imgreview` VALUES (1, '', '', '', 0, 0);
-- ----------------------------
-- Table structure for keys
@@ -150,13 +177,13 @@ 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 (4, '', '', '', '', '', 4);
+INSERT INTO `keys` VALUES (3, '1', '1', '0', '1', 'http://127.0.0.1', 3);
+INSERT INTO `keys` VALUES (4, '', '', '0', '', '', 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 (9, '', '', '', '', '', 9);
+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, 'test', 'test', '123', 'testimg', 'test', 9);
INSERT INTO `keys` VALUES (10, '0', '', '0', '0', '0', 10);
-- ----------------------------
@@ -199,13 +226,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(4000) 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, 10, 1, 5, 'gif,jpg,jpeg,bmp,png', 1, 0, 1, 500, 1024, '');
-- ----------------------------
-- Table structure for user
@@ -215,7 +243,7 @@ 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 '邮箱',
+ `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`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 '用户唯一标识',
@@ -223,12 +251,12 @@ CREATE TABLE `user` (
`memory` int(10) NULL DEFAULT NULL COMMENT '用户内存大小',
`groupid` int(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- 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, '6dfbc6d4063b484e97955148dbeab429', 1, 1024, 1);
-- ----------------------------
-- Table structure for usergroup
diff --git a/src/main/java/cn/hellohao/TbedApplication.java b/src/main/java/cn/hellohao/TbedApplication.java
index 917c34e..a953294 100644
--- a/src/main/java/cn/hellohao/TbedApplication.java
+++ b/src/main/java/cn/hellohao/TbedApplication.java
@@ -7,6 +7,7 @@ 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.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@@ -19,6 +20,7 @@ import java.util.Scanner;
@SpringBootApplication
@Configuration
+@ServletComponentScan
@EnableTransactionManagement(proxyTargetClass = true)
public class TbedApplication {
@@ -37,6 +39,8 @@ public static void main(String[] args) {
factory.setMaxFileSize("102400KB"); // KB,MB
/// 总上传数据大小
factory.setMaxRequestSize("102400KB");
+ //factory.setLocation("/tmp");
+
return factory.createMultipartConfig();
}
diff --git a/src/main/java/cn/hellohao/controller/AdminController.java b/src/main/java/cn/hellohao/controller/AdminController.java
index 274b115..648a6ce 100644
--- a/src/main/java/cn/hellohao/controller/AdminController.java
+++ b/src/main/java/cn/hellohao/controller/AdminController.java
@@ -3,6 +3,7 @@ package cn.hellohao.controller;
import cn.hellohao.pojo.*;
import cn.hellohao.pojo.vo.PageResultBean;
import cn.hellohao.service.*;
+import cn.hellohao.service.impl.AlbumServiceI;
import cn.hellohao.service.impl.ImgServiceImpl;
import cn.hellohao.service.impl.UserServiceImpl;
import cn.hellohao.utils.*;
@@ -45,10 +46,16 @@ public class AdminController {
private UploadConfigService uploadConfigService;
@Autowired
private CodeService codeService;
-
+ @Autowired
+ private ImgAndAlbumService imgAndAlbumService;
+ @Autowired
+ private AlbumService albumService;
+ @Autowired
+ AlbumServiceI albumServiceI;
@RequestMapping(value = "/goadmin")
public String goadmin1(HttpSession session, Model model, HttpServletRequest request) {
+ Config config = configService.getSourceype();
User user = (User) session.getAttribute("user");
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
Integer usermemory = imgService.getusermemory(user.getId());
@@ -65,7 +72,7 @@ public class AdminController {
model.addAttribute("levels", user.getLevel());
model.addAttribute("username", user.getUsername());
model.addAttribute("api", uploadConfig.getApi());
-
+ model.addAttribute("config", config);
model.addAttribute("memory",u.getMemory());//单位M
if(usermemory==null){
model.addAttribute("usermemory", 0);//单位M
@@ -102,7 +109,6 @@ public class AdminController {
model.addAttribute("sysetmname",sysetmname);
model.addAttribute("isarch", isarch);
model.addAttribute("jdk", jdk);
-
//空间大小
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
Integer usermemory = imgService.getusermemory(u.getId());
@@ -125,7 +131,6 @@ public class AdminController {
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
}
}
@@ -147,8 +152,9 @@ public class AdminController {
if(uploadConfig.getIsupdate()!=1){
jsonObject.put("VisitorUpload", 0);//是否禁用了游客上传
}else{
+ Integer temp = imgService.getusermemory(0);
jsonObject.put("VisitorUpload", uploadConfig.getIsupdate());//是否禁用了游客上传
- jsonObject.put("UsedSize", (imgService.getusermemory(0)/1024));//访客已用大小
+ jsonObject.put("UsedSize", (temp == null ? 0 : temp/1024));//访客已用大小
jsonObject.put("VisitorMemory", uploadConfig.getVisitormemory());//访客共大小
}
return jsonObject.toString();
@@ -177,9 +183,13 @@ public class AdminController {
if (u.getLevel() > 1) {
if (selecttype == 1) {
images = imgService.selectimg(img);
- } else {
+ } else if(selecttype == 2) {
img.setUserid(u.getId());
images = imgService.selectimg(img);
+ }else{
+ img.setUserid(u.getId());
+ img.setSelecttype(3);
+ images = imgService.selectimg(img);
}
} else {
img.setUserid(u.getId());
@@ -189,8 +199,6 @@ public class AdminController {
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
-
-
@RequestMapping(value = "/selectusertable")
@ResponseBody
public Map selectByFy12(HttpSession session, @RequestParam(required = false, defaultValue = "1") int page,
@@ -216,19 +224,12 @@ public class AdminController {
@PostMapping("/deleimg")
@ResponseBody
- public String deleimg(HttpSession session, Integer id, Integer sourcekey) {
+ public String deleimg(HttpSession session, Integer id, Integer sourcekey,String imgname) {
JSONObject jsonObject = new JSONObject();
User u = (User) session.getAttribute("user");
Images images = imgService.selectByPrimaryKey(id);
Keys key = keysService.selectKeys(sourcekey);
Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
- Boolean b =false;
- if(Sourcekey==5){
- b =true;
- }else{
- b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
- }
- if(b){
ImgServiceImpl de = new ImgServiceImpl();
if (key.getStorageType() == 1) {
de.delect(key, images.getImgname());
@@ -244,57 +245,53 @@ public class AdminController {
de.delectCOS(key, images.getImgname());
}else if (key.getStorageType() == 7) {
de.delectFTP(key, images.getImgname());
+ }else if (key.getStorageType() == 8) {
+ de.delectUFile(key, images.getImgname());
}else {
System.err.println("未获取到对象存储参数,删除失败。");
}
Integer ret = imgService.deleimg(id);
+ if(ret>0){ imgAndAlbumService.deleteImgAndAlbum(imgname);}
Integer count = 0;
if (ret > 0) {
jsonObject.put("usercount", imgService.countimg(u.getId()));
jsonObject.put("count", imgService.counts(null));
count = 1;
+ imgAndAlbumService.deleteImgAndAlbum(imgname);//关联表删除关于这张照片的所有记录
} else {
count = 0;
}
jsonObject.put("val", count);
- }else{
- jsonObject.put("val", 0);
- }
return jsonObject.toString();
}
@PostMapping("/deleallimg")
@ResponseBody
- public String deleallimg(HttpSession session, @RequestParam("ids[]") Integer[] ids) {
+ public String deleallimg(HttpSession session, @RequestParam("ids[]") Integer[] ids,@RequestParam("sources[]") Integer[] sources,
+ @RequestParam("imgnames[]") String[] imgnames) {
JSONObject jsonObject = new JSONObject();
Integer v = 0;
ImgServiceImpl de = new ImgServiceImpl();
User u = (User) session.getAttribute("user");
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(Sourcekey==5){
- b =true;
- }else{
- b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
- }
- if(b){
+ Keys key = keysService.selectKeys(sources[i]);
if (key.getStorageType() == 1) {
- de.delect(key, images.getImgname());
+ de.delect(key, imgnames[i]);
} else if (key.getStorageType() == 2) {
- de.delectOSS(key, images.getImgname());
+ de.delectOSS(key, imgnames[i]);
} else if (key.getStorageType() == 3) {
- de.delectUSS(key, images.getImgname());
+ de.delectUSS(key, imgnames[i]);
} else if (key.getStorageType() == 4) {
- de.delectKODO(key, images.getImgname());
+ de.delectKODO(key, imgnames[i]);
} else if (key.getStorageType() == 5) {
- LocUpdateImg.deleteLOCImg(images.getImgname());
+ LocUpdateImg.deleteLOCImg(imgnames[i]);
}else if (key.getStorageType() == 6) {
- de.delectCOS(key, images.getImgname());
+ de.delectCOS(key, imgnames[i]);
}else if (key.getStorageType() == 7) {
- de.delectFTP(key, images.getImgname());
+ de.delectFTP(key, imgnames[i]);
+ }else if (key.getStorageType() == 8) {
+ de.delectUFile(key, imgnames[i]);
}else {
System.err.println("未获取到对象存储参数,删除失败。");
}
@@ -303,10 +300,8 @@ public class AdminController {
v = 0;
} else {
v = 1;
+ imgAndAlbumService.deleteImgAndAlbum(imgnames[i]);//关联表删除关于这张照片的所有记录
}
- }else {
- v = 0;
- }
}
jsonObject.put("val", v);
jsonObject.put("usercount", imgService.countimg(u.getId()));
@@ -344,7 +339,6 @@ public class AdminController {
session.removeAttribute("user");
session.invalidate();
}
- // -1 用户名重复
return jsonArray.toString();
}
//进入api
@@ -359,7 +353,6 @@ public class AdminController {
return "admin/api";
}
-
@PostMapping(value = "/kuorong")
@ResponseBody
public String kuorong(HttpSession session, String codestring) {
@@ -397,4 +390,61 @@ public class AdminController {
}
+ @RequestMapping(value = "/albumlist")
+ public String albumlist(HttpSession session, Model model) {
+ Config config = configService.getSourceype();
+ User u = (User) session.getAttribute("user");
+ model.addAttribute("config", config);
+ model.addAttribute("level", u.getLevel());
+ model.addAttribute("email", u.getEmail());
+ model.addAttribute("loginid", 100);
+
+ return "admin/albumlist";
+ }
+
+ @PostMapping("/getAlbumURLList")
+ @ResponseBody
+ public Map getAlbumURLList (HttpSession session,@RequestParam(required = false, defaultValue = "1") int page,
+ @RequestParam(required = false) int limit,Album album){
+ User u = (User) session.getAttribute("user");
+ PageHelper.startPage(page, limit);
+ List list = null;
+ if (u.getLevel() == 2) {
+ album.setUserid(null);
+ list = albumServiceI.selectAlbumURLList(album);
+ PageInfo rolePageInfo = new PageInfo<>(list);
+ Map map = new HashMap();
+ map.put("code", 0);
+ map.put("msg", "");
+ map.put("count", rolePageInfo.getTotal());
+ map.put("data", rolePageInfo.getList());
+ return map;
+ } else {
+ album.setUserid(u.getId());
+ list = albumServiceI.selectAlbumURLList(album);
+ PageInfo rolePageInfo = new PageInfo<>(list);
+ Map map = new HashMap();
+ map.put("code", 0);
+ map.put("msg", "");
+ map.put("count", rolePageInfo.getTotal());
+ map.put("data", rolePageInfo.getList());
+ return map;
+ }
+ }
+
+ @RequestMapping("/delAlbum")
+ @ResponseBody
+ public Integer delAlbum(String albumkey){
+ Integer ret = albumServiceI.delete(albumkey);
+ return ret;
+ }
+
+ @RequestMapping("/delAlbumAll")
+ @ResponseBody
+ public Integer delAlbumAll( @RequestParam("albumkeyArr[]") String[] albumkeyArr ){
+ Integer ret = albumServiceI.deleteAll(albumkeyArr);
+ return ret;
+ }
+
+
}
diff --git a/src/main/java/cn/hellohao/controller/AdminRootController.java b/src/main/java/cn/hellohao/controller/AdminRootController.java
index 56d46ba..263c5e8 100644
--- a/src/main/java/cn/hellohao/controller/AdminRootController.java
+++ b/src/main/java/cn/hellohao/controller/AdminRootController.java
@@ -8,6 +8,7 @@ import cn.hellohao.utils.Print;
import cn.hellohao.utils.StringUtils;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
+import java.util.List;
@Controller
@RequestMapping("/admin/root")
@@ -55,17 +57,15 @@ public class AdminRootController {
User u = (User) session.getAttribute("user");
Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
Keys key= keysService.selectKeys(Sourcekey);
- Boolean b = StringUtils.doNull(Sourcekey,key);
+ //Boolean b = StringUtils.doNull(Sourcekey,key);
Integer StorageType = 0;
if(Sourcekey!=5){
- if(b){
- 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", Sourcekey);
- }
+ 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", Sourcekey);
if(Sourcekey==4){
model.addAttribute("Endpoint2", key.getEndpoint());
}else{
@@ -107,12 +107,11 @@ public class AdminRootController {
config.setSourcekey(key.getStorageType());
Integer val = configService.setSourceype(config);
Integer ret = -2;
- //修改完初始化
if(key.getStorageType()==1){
- ret =nOSImageupload.Initialize(key);//实例化网易
+ ret =nOSImageupload.Initialize(key);
}else if (key.getStorageType()==2){
ret = OSSImageupload.Initialize(key);
- }else if(key.getStorageType()==3){
+ }else if(key.getStorageType()==3 ){
ret = USSImageupload.Initialize(key);
}else if(key.getStorageType()==4){
ret = KODOImageupload.Initialize(key);
@@ -120,6 +119,8 @@ public class AdminRootController {
ret = COSImageupload.Initialize(key);
}else if(key.getStorageType()==7){
ret = FTPImageupload.Initialize(key);
+ }else if(key.getStorageType()==8){
+ ret = UFileImageupload.Initialize(key);
}
else{
Print.Normal("为获取到存储参数,或者使用存储源是本地的。");
@@ -127,7 +128,6 @@ public class AdminRootController {
if(ret>0){
ret = keysService.updateKey(key);
}
-
//-1 对象存储有参数为空,初始化失败
//0,保存失败
//1 正确
@@ -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();
}
@@ -261,4 +266,40 @@ public class AdminRootController {
return Integer.parseInt( result );
}
+ @PostMapping("/tocheck")
+ @ResponseBody
+ public JSONObject tocheck() {
+ JSONObject jsonObject = new JSONObject();
+ List keylist = keysService.getKeys();
+ for (Keys key : keylist) {
+ if(key.getStorageType()!=0 && key.getStorageType()!=null){
+ int ret =0;
+ if(key.getStorageType()==1){
+ ret =NOSImageupload.Initialize(key);
+ jsonObject.put(key.getStorageType().toString(),ret);
+ }else if (key.getStorageType()==2){
+ ret =OSSImageupload.Initialize(key);
+ jsonObject.put(key.getStorageType().toString(),ret);
+ }else if(key.getStorageType()==3){
+ ret = USSImageupload.Initialize(key);
+ jsonObject.put(key.getStorageType().toString(),ret);
+ }else if(key.getStorageType()==4){
+ ret = KODOImageupload.Initialize(key);
+ jsonObject.put(key.getStorageType().toString(),ret);
+ }else if(key.getStorageType()==6){
+ ret = COSImageupload.Initialize(key);
+ jsonObject.put(key.getStorageType().toString(),ret);
+ }else if(key.getStorageType()==7){
+ ret = FTPImageupload.Initialize(key);
+ jsonObject.put(key.getStorageType().toString(),ret);
+ }else if(key.getStorageType()==8){
+ ret = UFileImageupload.Initialize(key);
+ jsonObject.put(key.getStorageType().toString(),ret);
+ }
+ }
+ }
+ jsonObject.put("5",1);
+ return jsonObject;
+ }
+
}
diff --git a/src/main/java/cn/hellohao/controller/AlbumController.java b/src/main/java/cn/hellohao/controller/AlbumController.java
new file mode 100644
index 0000000..01514cb
--- /dev/null
+++ b/src/main/java/cn/hellohao/controller/AlbumController.java
@@ -0,0 +1,179 @@
+package cn.hellohao.controller;
+
+import cn.hellohao.pojo.*;
+import cn.hellohao.service.*;
+import cn.hellohao.service.impl.AlbumServiceI;
+import cn.hellohao.service.impl.ImgAndAlbumServiceImpl;
+import cn.hellohao.utils.GetCurrentSource;
+import cn.hellohao.utils.Print;
+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.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpSession;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @author Hellohao
+ * @version 1.0
+ * @date 2019/12/17 11:25
+ */
+@Controller
+public class AlbumController {
+ @Autowired
+ AlbumServiceI albumServiceI;
+ @Autowired
+ private ConfigService configService;
+ @Autowired
+ private ImgService imgService;
+ @Autowired
+ ImgAndAlbumService imgAndAlbumService;
+ @Autowired
+ private UploadConfigService uploadConfigService;
+
+ @RequestMapping("/addalbum")
+ public String addalbum(HttpSession session,Model model) {
+ UploadConfig updateConfig = uploadConfigService.getUpdateConfig();
+ User u = (User) session.getAttribute("user");
+ Integer sourcekey = 0;
+ if (u == null) {
+ sourcekey = GetCurrentSource.GetSource(null);
+ } else {
+ sourcekey = GetCurrentSource.GetSource(u.getId());
+ }
+ model.addAttribute("urltype",updateConfig.getUrltype());
+ model.addAttribute("sourcekey",sourcekey);
+ return "album/addalbum";
+ }
+
+ @PostMapping("/SaveForAlbum")
+ @ResponseBody
+ public Msg SaveForAlbum(HttpSession session,@RequestParam("imgarr[]") String[] imgarr, @RequestParam("aboutarr[]") String[] aboutarr,
+ String albumtitle, String password){
+ Msg msg = new Msg();
+ User u = (User) session.getAttribute("user");
+ String uuid = "TOALBUM"+ UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5)+"N";
+ Integer ret =0;
+ Integer temp = 0;
+ Integer temp2 = 0;
+ SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
+ for (int i = 0; i < imgarr.length; i++) {
+ Album album = new Album();
+ ImgAndAlbum imgAndAlbum = new ImgAndAlbum();
+ album.setAlbumtitle(albumtitle);
+ album.setCreatedate(df.format(new Date()));
+ album.setPassword(password);
+ album.setAlbumkey(uuid);
+ if(u==null){
+ album.setUserid(0);
+ }else{
+ album.setUserid(u.getId());
+ }
+ String imgurl = "";
+ Integer sourcekey = 0;
+ UploadConfig updateConfig = uploadConfigService.getUpdateConfig();
+ if(updateConfig.getUrltype()==2){
+ imgurl = imgarr[i];
+ }else{
+ if (u == null) {
+ //sourcekey = GetCurrentSource.GetSource(null);
+ imgurl="tourist/"+imgarr[i];
+ } else {
+ //sourcekey = GetCurrentSource.GetSource(u.getId());
+ imgurl=u.getUsername()+"/"+imgarr[i];
+ }
+ }
+
+ imgAndAlbum.setImgname(imgarr[i]);
+ imgAndAlbum.setAlbumkey(uuid);
+ imgAndAlbum.setNotes(aboutarr[i]);
+ if(temp==0){
+ temp2 = albumServiceI.addAlbum(album);
+ temp = 1;
+ }
+ if(temp2>0){
+ ret = albumServiceI.addAlbumForImgAndAlbumMapper(imgAndAlbum);
+ }
+ }
+ if(ret>0){
+ msg.setCode("200");
+ msg.setInfo("成功创建画廊链接:");
+ msg.setData(configService.getSourceype().getDomain()+"/"+uuid);
+ }else{
+ msg.setCode("500");
+ msg.setInfo("创建画廊链接失败:");
+ }
+ return msg;
+ }
+
+ @RequestMapping("/TOALBUM{key}N")
+ public String selectByFy(@PathVariable("key") String key, Model model) {
+ Album album = new Album();
+ album.setAlbumkey("TOALBUM"+key+"N");
+ Album a = albumServiceI.selectAlbum(album);
+ Config config = configService.getSourceype();
+ model.addAttribute("webname",config.getWebname());
+ model.addAttribute("domain",config.getDomain());
+ model.addAttribute("ico",config.getWebfavicons());
+ if(a!=null){
+ model.addAttribute("obj",a);
+ model.addAttribute("album",1);
+ if(a.getPassword()!=null && !a.getPassword().equals("")){
+ model.addAttribute("passType","1");
+ }else{
+ model.addAttribute("passType","0");
+ }
+ }else{
+ model.addAttribute("album",0);
+ }
+ return "album/album_new";
+ }
+
+ @PostMapping("/getAlbumList")
+ @ResponseBody
+ public Msg getAlbumList(String albumkey,String password){
+ Msg msg = new Msg();
+ Album album = new Album();
+ album.setAlbumkey(albumkey);
+ Album a = albumServiceI.selectAlbum(album);
+ if(a==null){
+ msg.setCode("404");
+ msg.setInfo("画廊地址不存在");
+ return msg;
+ }
+ Config config = configService.getSourceype();
+ JSONObject jsonObject = new JSONObject();
+ if(a!=null){
+ if(a.getPassword()==null){
+ List imagesList = imgAndAlbumService.selectImgForAlbumkey(albumkey);
+ msg.setCode("200");
+ jsonObject.put("imagesList",imagesList);
+ }else{
+ if(a.getPassword().equals(password)){
+ List imagesList = imgAndAlbumService.selectImgForAlbumkey(albumkey);
+ msg.setCode("200");
+ jsonObject.put("imagesList",imagesList);
+ }else{
+ msg.setCode("403");
+ msg.setInfo("画廊密码错误");
+ }
+ }
+ jsonObject.put("titlename",a.getAlbumtitle());
+ }
+ jsonObject.put("webname",config.getWebname());
+ msg.setData(jsonObject);
+ return msg;
+ }
+
+
+ @RequestMapping("/addalbum_new")
+ public String addalbum2() {
+ return "album/album_new";
+ }
+
+}
diff --git a/src/main/java/cn/hellohao/controller/ClientController.java b/src/main/java/cn/hellohao/controller/ClientController.java
index ad93090..370b908 100644
--- a/src/main/java/cn/hellohao/controller/ClientController.java
+++ b/src/main/java/cn/hellohao/controller/ClientController.java
@@ -4,6 +4,7 @@ import cn.hellohao.pojo.*;
import cn.hellohao.service.*;
import cn.hellohao.service.impl.*;
import cn.hellohao.utils.*;
+import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,7 +14,11 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import java.io.FileInputStream;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -47,7 +52,7 @@ public class ClientController {
@Autowired
private FTPImageupload ftpImageupload;
@Autowired
- private DomainService domainService;
+ private UFileImageupload uFileImageupload;
@Autowired
private ImgService imgService;
@@ -64,15 +69,13 @@ public class ClientController {
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
if (uploadConfig.getApi() == 1) {
if (email != null && pass != null) {
- Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()));
+ Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()),null);
if (ret > 0) {
User user = userService.getUsers(email);
if (user.getIsok() == 1) {
User u = userService.getUsers(email);
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
-
Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
-
Keys key = keysService.selectKeys(Sourcekey);
if (key.getStorageType() != 0 && key.getStorageType() != null) {
if (key.getStorageType() == 1) {
@@ -87,133 +90,129 @@ public class ClientController {
COSImageupload.Initialize(key);
} else if (key.getStorageType() == 7) {
FTPImageupload.Initialize(key);
- } else {
+ } else if(key.getStorageType()==8){
+ UFileImageupload.Initialize(key);
+ }else {
System.err.println("客户端:未获取到对象存储参数,初始化失败。");
}
}
Print.Normal("客户端:初始化上传。");
- Boolean b = false;
- if (Sourcekey == 5) {
- b = true;
+ long stime = System.currentTimeMillis();
+ String userpath = "tourist";
+ if (uploadConfig.getUrltype() == 2) {
+ java.text.DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
+ userpath = dateFormat.format(new Date());
} else {
- b = StringUtils.doNull(Sourcekey, key);//判断对象是否有空值
+ if (u != null) {
+ userpath = u.getUsername();
+ }
}
- if (b) {
- long stime = System.currentTimeMillis();
- String userpath = "tourist";
- if (uploadConfig.getUrltype() == 2) {
- java.text.DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
- userpath = dateFormat.format(new Date());
- } else {
- if (u != null) {
- userpath = u.getUsername();
- }
+ Map map = new HashMap<>();
+ for (MultipartFile multipartFile : file) {
+ //获取文件名
+ String fileName = multipartFile.getOriginalFilename();
+ String lastname = fileName.substring(fileName.lastIndexOf(".") + 1);//获取文件后缀
+ if (!multipartFile.isEmpty()) { //判断文件是否为空
+ map.put(lastname, multipartFile);
}
- Map map = new HashMap<>();
- for (MultipartFile multipartFile : file) {
- //获取文件名
- String fileName = multipartFile.getOriginalFilename();
- String lastname = fileName.substring(fileName.lastIndexOf(".") + 1);//获取文件后缀
- if (!multipartFile.isEmpty()) { //判断文件是否为空
- map.put(lastname, multipartFile);
+ }
+ Map m = null;
+ Map m2 = null;
+ if (key.getStorageType() == 1) {
+ m = nOSImageupload.clientuploadNOS(map, userpath, uploadConfig);
+ } else if (key.getStorageType() == 2) {
+ m = ossImageupload.clientuploadOSS(map, userpath, uploadConfig);
+ } else if (key.getStorageType() == 3) {
+ m = ussImageupload.clientuploadUSS(map, userpath, uploadConfig);
+ } else if (key.getStorageType() == 4) {
+ m = kodoImageupload.clientuploadKODO(map, userpath, uploadConfig);
+ } else if (key.getStorageType() == 5) {
+ m2 = LocUpdateImg.clientLocUpdateImg(map, userpath, uploadConfig);
+ } else if (key.getStorageType() == 6) {
+ m = cosImageupload.clientuploadCOS(map, userpath, uploadConfig);
+ } else if (key.getStorageType() == 7) {
+ m = ftpImageupload.clientuploadFTP(map, userpath, uploadConfig);
+ } else if (key.getStorageType() == 8) {
+ m = uFileImageupload.clientuploadUSS(map, userpath, uploadConfig);
+ } else {
+ System.err.println("未获取到对象存储参数,上传失败。");
+ }
+ Images img = new Images();
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+ String times = df.format(new Date());
+ System.out.println("上传图片的时间是:" + times);
+ if (key.getStorageType() == 5) {
+ for (Map.Entry entry : m2.entrySet()) {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("Imgname", entry.getKey().getImgname());
+ if (key.getStorageType() == 5) {
+ if (config.getDomain() != null) {
+ jsonObject.put("Imgurl", config.getDomain() + "/" + entry.getKey().getImgurl());
+ img.setImgurl(config.getDomain() + "/" + entry.getKey().getImgurl());//图片链接
+ } else {
+ jsonObject.put("Imgurl", config.getDomain() + "/" + entry.getKey().getImgurl());
+ img.setImgurl("http://" + IPPortUtil.getLocalIP() + ":" + IPPortUtil.getLocalPort() + "/" + entry.getKey().getImgurl());//图片链接
+ }
+ } else {
+ jsonObject.put("Imgname", entry.getKey().getImgurl());
+ img.setImgurl(entry.getKey().getImgurl());//图片链接
}
- }
- Map m = null;
- Map m2 = null;
- if (key.getStorageType() == 1) {
- m = nOSImageupload.clientuploadNOS(map, userpath, uploadConfig);
- } else if (key.getStorageType() == 2) {
- m = ossImageupload.clientuploadOSS(map, userpath, uploadConfig);
- } else if (key.getStorageType() == 3) {
- m = ussImageupload.clientuploadUSS(map, userpath, uploadConfig);
- } else if (key.getStorageType() == 4) {
- m = kodoImageupload.clientuploadKODO(map, userpath, uploadConfig);
- } else if (key.getStorageType() == 5) {
- m2 = LocUpdateImg.clientuploadFTP(map, userpath, uploadConfig);
- } else if (key.getStorageType() == 6) {
- m = cosImageupload.clientuploadCOS(map, userpath, uploadConfig);
- } else if (key.getStorageType() == 7) {
- m = ftpImageupload.clientuploadFTP(map, userpath, uploadConfig);
- } else {
- System.err.println("未获取到对象存储参数,上传失败。");
- }
- Images img = new Images();
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
- String times = df.format(new Date());
- System.out.println("上传图片的时间是:" + times);
- if (key.getStorageType() == 5) {
- for (Map.Entry entry : m2.entrySet()) {
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("Imgname", entry.getKey().getImgname());
- if (key.getStorageType() == 5) {
- if (config.getDomain() != null) {
- jsonObject.put("Imgurl", config.getDomain() + "/links/" + entry.getKey().getImgurl());
- img.setImgurl(config.getDomain() + "/links/" + entry.getKey().getImgurl());//图片链接
- } else {
- jsonObject.put("Imgurl", config.getDomain() + "/links/" + entry.getKey().getImgurl());
- img.setImgurl("http://" + IPPortUtil.getLocalIP() + ":" + IPPortUtil.getLocalPort() + "/links/" + entry.getKey().getImgurl());//图片链接
- }
- } else {
- jsonObject.put("Imgname", entry.getKey().getImgurl());
- img.setImgurl(entry.getKey().getImgurl());//图片链接
- }
- img.setUpdatetime(times);
- img.setSource(key.getStorageType());
- if (u == null) {
- img.setUserid(0);//用户id
- } else {
- img.setUserid(u.getId());//用户id
- }
- img.setSizes((entry.getValue()));
- img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
- img.setAbnormal(userip);
- img.setImgtype(0);
- //-1证明超出大小,
- if (entry.getValue() != -1) {
- userService.insertimg(img);
- }
- long etime = System.currentTimeMillis();
- System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
- jsonArray.add(jsonObject);
+ img.setUpdatetime(times);
+ img.setSource(key.getStorageType());
+ if (u == null) {
+ img.setUserid(0);//用户id
+ } else {
+ img.setUserid(u.getId());//用户id
}
- } else {
- for (Map.Entry entry : m.entrySet()) {
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("Imgname", entry.getKey().getImgname());
- if (key.getStorageType() == 5) {
- if (config.getDomain() != null) {
- jsonObject.put("Imgurl", config.getDomain() + "/links/" + entry.getKey().getImgurl());
- img.setImgurl(config.getDomain() + "/links/" + entry.getKey().getImgurl());//图片链接
- } else {
- jsonObject.put("Imgurl", config.getDomain() + "/links/" + entry.getKey().getImgurl());
- img.setImgurl("http://" + IPPortUtil.getLocalIP() + ":" + IPPortUtil.getLocalPort() + "/links/" + entry.getKey().getImgurl());//图片链接
- }
- } else {
- jsonObject.put("Imgurl", entry.getKey().getImgurl());
- img.setImgurl(entry.getKey().getImgurl());//图片链接
- }
- img.setUpdatetime(times);
- img.setSource(key.getStorageType());
- if (u == null) {
- img.setUserid(0);//用户id
- } else {
- img.setUserid(u.getId());//用户id
- }
- img.setSizes((entry.getValue())/1024);
- img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
- img.setAbnormal(userip);
- img.setImgtype(0);
- //-1证明超出大小,
- if (entry.getValue() != -1) {
- userService.insertimg(img);
- }
- long etime = System.currentTimeMillis();
- System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
- jsonArray.add(jsonObject);
+ img.setSizes((entry.getValue()));
+ img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
+ img.setAbnormal(userip);
+ img.setImgtype(0);
+ //-1证明超出大小,
+ if (entry.getValue() != -1) {
+ userService.insertimg(img);
}
+ long etime = System.currentTimeMillis();
+ System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
+ jsonArray.add(jsonObject);
}
- resultBean = ResultBean.success(jsonArray);
- } else {resultBean = ResultBean.error(-1, "服务器内部错误,请联系管理员");}
+ } else {
+ for (Map.Entry entry : m.entrySet()) {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("Imgname", entry.getKey().getImgname());
+ if (key.getStorageType() == 5) {
+ if (config.getDomain() != null) {
+ jsonObject.put("Imgurl", config.getDomain() + "/" + entry.getKey().getImgurl());
+ img.setImgurl(config.getDomain() + "/" + entry.getKey().getImgurl());//图片链接
+ } else {
+ jsonObject.put("Imgurl", config.getDomain() + "/" + entry.getKey().getImgurl());
+ img.setImgurl("http://" + IPPortUtil.getLocalIP() + ":" + IPPortUtil.getLocalPort() + "/" + entry.getKey().getImgurl());//图片链接
+ }
+ } else {
+ jsonObject.put("Imgurl", entry.getKey().getImgurl());
+ img.setImgurl(entry.getKey().getImgurl());//图片链接
+ }
+ img.setUpdatetime(times);
+ img.setSource(key.getStorageType());
+ if (u == null) {
+ img.setUserid(0);//用户id
+ } else {
+ img.setUserid(u.getId());//用户id
+ }
+ img.setSizes((entry.getValue())/1024);
+ img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
+ img.setAbnormal(userip);
+ img.setImgtype(0);
+ //-1证明超出大小,
+ if (entry.getValue() != -1) {
+ userService.insertimg(img);
+ }
+ long etime = System.currentTimeMillis();
+ System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
+ jsonArray.add(jsonObject);
+ }
+ }
+ resultBean = ResultBean.success(jsonArray);
}
} else {resultBean = ResultBean.error(-2, "此用户信息不正确。");}
} else {resultBean = ResultBean.error(-3, "邮箱密码为空");}
@@ -232,7 +231,7 @@ public class ClientController {
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
if (uploadConfig.getApi() == 1) {
if (email != null && pass != null) {
- Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()));
+ Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()),null);
if (ret > 0) {
User u = userService.getUsers(email);
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
@@ -262,11 +261,6 @@ public class ClientController {
Integer youke = uploadConfig.getFilesizetourists();
Integer yonghu = uploadConfig.getFilesizeuser();
String uuid= UUID.randomUUID().toString().replace("-", "");
- Boolean bo =false;
- if(Sourcekey==5){
- bo =true;
- }else{bo = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
- }
// //容量判断
if(u==null){
memory = uploadConfig.getVisitormemory();
@@ -278,191 +272,186 @@ public class ClientController {
if(usermemory==null){usermemory = 0;}
}
Print.warning("上传地址是:"+request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
- if(bo){
- if(usermemory/10240 && imgsize<=(yonghu*1024*1024)){
- try{
- boolean bl =ImgUrlUtil.downLoadFromUrl(imgurl,
- uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
- if(bl==true){
- FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
- byte[] b = new byte[3];
- is.read(b, 0, b.length);
- String xxx = ImgUrlUtil.bytesToHexString(b);
- xxx = xxx.toUpperCase();
- String ooo = TypeDict.checkType(xxx);
- if(is!=null){
- is.close();
+ if(usermemory/10240 && imgsize<=(yonghu*1024*1024)){
+ try{
+ boolean bl =ImgUrlUtil.downLoadFromUrl(imgurl,
+ uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
+ if(bl==true){
+ FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ byte[] b = new byte[3];
+ is.read(b, 0, b.length);
+ String xxx = ImgUrlUtil.bytesToHexString(b);
+ xxx = xxx.toUpperCase();
+ String ooo = TypeDict.checkType(xxx);
+ if(is!=null){
+ is.close();
+ }
+ if(!ooo.equals("0000")){
+ Map map = new HashMap<>();
+ map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ Map m = null;
+ if(key.getStorageType()==1){
+ m = nOSImageupload.Imageupload(null, userpath,map,setday);
+ }else if (key.getStorageType()==2){
+ m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
+ }else if(key.getStorageType()==3 ){
+ m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
+ }else if(key.getStorageType()==4){
+ m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
+ }else if(key.getStorageType()==5){
+ m = LocUpdateImg.ImageuploadLOC(null,userpath,map,setday);
+ }else if(key.getStorageType()==6){
+ m = cosImageupload.ImageuploadCOS(null,userpath,map,setday);
+ }else if(key.getStorageType()==7){
+ m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
+ }else if(key.getStorageType()==8){
+ m = uFileImageupload.ImageuploadUSS(null, userpath,map,setday);
}
- if(!ooo.equals("0000")){
- Map map = new HashMap<>();
- map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
- Map m = null;
- if(key.getStorageType()==1){
- m = nOSImageupload.Imageupload(null, userpath,map,setday);
- }else if (key.getStorageType()==2){
- m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
- }else if(key.getStorageType()==3){
- m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
- }else if(key.getStorageType()==4){
- m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
- }else if(key.getStorageType()==5){
- m = LocUpdateImg.ImageuploadLOC(null,userpath,map,setday);
- }else if(key.getStorageType()==6){
- m = cosImageupload.ImageuploadCOS(null,userpath,map,setday);
- }else if(key.getStorageType()==7){
- m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
- }
- else{
- System.err.println("未获取到对象存储参数,上传失败。");
- }
- Images img = new Images();
- SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
- String times = df.format(new Date());
- System.out.println("上传图片的时间是:"+times);
- for (Map.Entry entry : m.entrySet()) {
- if(key.getStorageType()==5){
- if(config.getDomain()!=null){
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
- }else{
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
- }
+ else{
+ System.err.println("未获取到对象存储参数,上传失败。");
+ }
+ Images img = new Images();
+ SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
+ String times = df.format(new Date());
+ System.out.println("上传图片的时间是:"+times);
+ for (Map.Entry entry : m.entrySet()) {
+ if(key.getStorageType()==5){
+ if(config.getDomain()!=null){
+ jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
+ img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
- jsonArray.add(entry.getKey().getImgurl());
- img.setImgurl(entry.getKey().getImgurl());
+ jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
+ img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
- img.setUpdatetime(times);
- img.setSource(key.getStorageType());
- if (u == null) {
- img.setUserid(0);
- } else {
- img.setUserid(u.getId());
- }
- img.setSizes((entry.getValue()));
- img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
- img.setAbnormal(userip);
- img.setImgtype(0);
- userService.insertimg(img);
- long etime = System.currentTimeMillis();
- System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
+ }else{
+ jsonArray.add(entry.getKey().getImgurl());
+ img.setImgurl(entry.getKey().getImgurl());
+ }
+ img.setUpdatetime(times);
+ img.setSource(key.getStorageType());
+ if (u == null) {
+ img.setUserid(0);
+ } else {
+ img.setUserid(u.getId());
}
- resultBean = ResultBean.success(jsonArray);
- }else{
- resultBean = ResultBean.error(-3,"文件类型不符合要求");
+ img.setSizes((entry.getValue()));
+ img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
+ img.setAbnormal(userip);
+ img.setImgtype(0);
+ userService.insertimg(img);
+ long etime = System.currentTimeMillis();
+ System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
+ resultBean = ResultBean.success(jsonArray);
+ }else{
+ resultBean = ResultBean.error(-3,"文件类型不符合要求");
}
- }catch (Exception e) {
- // TODO: handle exception
- Print.warning(e.toString());
- resultBean = ResultBean.error(-4,"该文件不支持上传");
}
- }else{
- resultBean = ResultBean.error(-2,"文件过大");
+ }catch (Exception e) {
+ // TODO: handle exception
+ Print.warning(e.toString());
+ resultBean = ResultBean.error(-4,"该文件不支持上传");
}
}else{
- if(imgsize>0 && imgsize<=(youke*1024*1024)){
- try{
- boolean bl = ImgUrlUtil.downLoadFromUrl(imgurl,
- uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
- if(bl==true){
- FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
- byte[] b = new byte[3];
- is.read(b, 0, b.length);
- String xxx = ImgUrlUtil.bytesToHexString(b);
- xxx = xxx.toUpperCase();
- String ooo = TypeDict.checkType(xxx);
- if(is!=null){
- is.close();
- }
- if(!xxx.equals("0000")){
- Map map = new HashMap<>();
- map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
- Map m = null;
- if(key.getStorageType()==1){
- m = nOSImageupload.Imageupload(null, userpath,map,setday);
- }else if (key.getStorageType()==2){
- m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
- }else if(key.getStorageType()==3){
- m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
- }else if(key.getStorageType()==4){
- m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
- }else if(key.getStorageType()==5){
- m =LocUpdateImg.ImageuploadLOC(null,userpath, map,setday);
- }else if(key.getStorageType()==6){
- m =cosImageupload.ImageuploadCOS(null,userpath, map,setday);
- }else if(key.getStorageType()==7){
- m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
- }
- else{
- System.err.println("未获取到对象存储参数,上传失败。");
- }
- Images img = new Images();
- SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
- String times = df.format(new Date());
- System.out.println("上传图片的时间是:"+times);
- for (Map.Entry entry : m.entrySet()) {
- if(key.getStorageType()==5){
- if(config.getDomain()!=null){
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
- }else{
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
- }
- }else{
- jsonArray.add(entry.getKey().getImgurl());
- img.setImgurl(entry.getKey().getImgurl());//图片链接
- }
- img.setUpdatetime(times);
- img.setSource(key.getStorageType());
- if (u == null) {
- img.setUserid(0);//用户id
- } else {
- img.setUserid(u.getId());//用户id
- }
- img.setSizes((entry.getValue()));
- img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
- img.setAbnormal(userip);
- img.setImgtype(0);
- userService.insertimg(img);
- long etime = System.currentTimeMillis();
- System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
- }
- resultBean = ResultBean.success(jsonArray);
- }else{
- resultBean = ResultBean.error(-3,"文件类型不符合要求");
- }
- }
- }catch (Exception e) {
- // TODO: handle exception
- Print.warning(e.toString());
- resultBean = ResultBean.error(-4,"文件类型不符合要求");
- }
- }else{
- resultBean = ResultBean.error(-2,"图片太大或不存在");
- }
+ resultBean = ResultBean.error(-2,"文件过大");
}
}else{
- resultBean = ResultBean.error(-5,"可用空间不足");
+ if(imgsize>0 && imgsize<=(youke*1024*1024)){
+ try{
+ boolean bl = ImgUrlUtil.downLoadFromUrl(imgurl,
+ uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
+ if(bl==true){
+ FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ byte[] b = new byte[3];
+ is.read(b, 0, b.length);
+ String xxx = ImgUrlUtil.bytesToHexString(b);
+ xxx = xxx.toUpperCase();
+ String ooo = TypeDict.checkType(xxx);
+ if(is!=null){
+ is.close();
+ }
+ if(!xxx.equals("0000")){
+ Map map = new HashMap<>();
+ map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ Map m = null;
+ if(key.getStorageType()==1){
+ m = nOSImageupload.Imageupload(null, userpath,map,setday);
+ }else if (key.getStorageType()==2){
+ m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
+ }else if(key.getStorageType()==3 ){
+ m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
+ }else if(key.getStorageType()==4){
+ m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
+ }else if(key.getStorageType()==5){
+ m =LocUpdateImg.ImageuploadLOC(null,userpath, map,setday);
+ }else if(key.getStorageType()==6){
+ m =cosImageupload.ImageuploadCOS(null,userpath, map,setday);
+ }else if(key.getStorageType()==7){
+ m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
+ }else if(key.getStorageType()==8){
+ m = uFileImageupload.ImageuploadUSS(null, userpath,map,setday);
+ }
+ else{
+ System.err.println("未获取到对象存储参数,上传失败。");
+ }
+ Images img = new Images();
+ SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
+ String times = df.format(new Date());
+ System.out.println("上传图片的时间是:"+times);
+ for (Map.Entry entry : m.entrySet()) {
+ if(key.getStorageType()==5){
+ if(config.getDomain()!=null){
+ jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
+ img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
+ }else{
+ jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
+ img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
+ }
+ }else{
+ jsonArray.add(entry.getKey().getImgurl());
+ img.setImgurl(entry.getKey().getImgurl());//图片链接
+ }
+ img.setUpdatetime(times);
+ img.setSource(key.getStorageType());
+ if (u == null) {
+ img.setUserid(0);//用户id
+ } else {
+ img.setUserid(u.getId());//用户id
+ }
+ img.setSizes((entry.getValue()));
+ img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
+ img.setAbnormal(userip);
+ img.setImgtype(0);
+ userService.insertimg(img);
+ long etime = System.currentTimeMillis();
+ System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
+ }
+ resultBean = ResultBean.success(jsonArray);
+ }else{
+ resultBean = ResultBean.error(-3,"文件类型不符合要求");
+ }
+ }
+ }catch (Exception e) {
+ // TODO: handle exception
+ Print.warning(e.toString());
+ resultBean = ResultBean.error(-4,"文件类型不符合要求");
+ }
+ }else{
+ resultBean = ResultBean.error(-2,"图片太大或不存在");
+ }
}
}else{
- resultBean = ResultBean.error(-1,"未配置存储源");
+ resultBean = ResultBean.error(-5,"可用空间不足");
}
+
}else {resultBean = ResultBean.error(-2, "此用户信息不正确。");}
}else {resultBean = ResultBean.error(-3, "邮箱或密码为空");}
}else{resultBean = ResultBean.error(-4, "管理员关闭了API接口");}
Print.Normal(resultBean.toString());
return resultBean;
-/**
- * 错误返回值含义:
- * -1 存储源key未配置
- * -2 目标图片太大或者不存在
- * -3 文件类型不符合要求
- * */
}
@RequestMapping("/clientlogin")
@@ -470,7 +459,7 @@ Print.Normal(resultBean.toString());
public String login( HttpSession httpSession, String email, String password) {
JSONArray jsonArray = new JSONArray();
String basepass = Base64Encryption.encryptBASE64(password.getBytes());
- Integer ret = userService.login(email, basepass);
+ Integer ret = userService.login(email, basepass,null);
if (ret > 0) {
User user = userService.getUsers(email);
if (user.getIsok() == 1) {
@@ -489,21 +478,39 @@ Print.Normal(resultBean.toString());
@GetMapping (value = "/notices")
@ResponseBody
public String notices() throws Exception {
- return "-1";//-1就是没有公告,客户端不显示
- }
- //主端接口
- @PostMapping("/systemupdate")
- @ResponseBody
- public String sysupdate(String dates) {
- Integer i=dates.compareTo(systemupdate);//小于0则需要更新
- return i.toString();
- }
- //主端接口
- @PostMapping("/getdomain")
- @ResponseBody
- public String getdomain(String domain) {
- Integer count = domainService.getDomain(domain);
- return count.toString();
+ return "-1";
}
+ @GetMapping("/getNotice")
+ @ResponseBody
+ public Msg getNotice() {
+ Msg msg = new Msg();
+ String url = "http://tc.hellohao.cn/getNoticeText";
+ try {
+ URL u = new URL("http://tc.hellohao.cn/getNoticeText");
+ HttpURLConnection uConnection = (HttpURLConnection) u.openConnection();
+ uConnection.connect();
+ System.out.println(uConnection.getResponseCode());
+ if(uConnection.getResponseCode()==200){
+ if(TestUrl.testUrlWithTimeOut(url,2000)){
+ String urls =url;
+ msg.setData(HttpUtil.get(urls));
+ }else{
+ msg.setData("暂无公告");
+ }
+ }else{
+ msg.setData("暂无公告");
+ }
+ uConnection.disconnect();
+ } catch (Exception e) {
+ //e.printStackTrace();
+ Print.warning("connect failed");
+ msg.setData("暂无公告");
+ }
+ return msg;
+ }
+
+
+
+
}
diff --git a/src/main/java/cn/hellohao/controller/ExceptionHandling.java b/src/main/java/cn/hellohao/controller/ExceptionHandling.java
index 1f7c515..8e0188b 100644
--- a/src/main/java/cn/hellohao/controller/ExceptionHandling.java
+++ b/src/main/java/cn/hellohao/controller/ExceptionHandling.java
@@ -2,8 +2,10 @@ package cn.hellohao.controller;
import cn.hellohao.exception.StorageSourceInitException;
import cn.hellohao.utils.Print;
+import org.springframework.ui.Model;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;
@@ -50,6 +52,20 @@ public class ExceptionHandling {
return e.getMessage();
}
+ @ExceptionHandler
+ public String test3(HttpRequestMethodNotSupportedException e,Model model){
+
+ ModelAndView modelAndView = new ModelAndView("/index");
+ Print.Normal("URL访问类型不正确:"+ e.getMessage());
+ //e.printStackTrace();
+ modelAndView.addObject("error","URL访问类型不正确。");
+ model.addAttribute("error","URL访问类型不正确。");
+ //返回错误信息,并显示给用户
+ //return e.getMessage();
+ return "exception";
+ }
+
+
// @ExceptionHandler
// public String methodArgumentNotValid(BindException e) {
diff --git a/src/main/java/cn/hellohao/controller/GroupController.java b/src/main/java/cn/hellohao/controller/GroupController.java
index 512607d..a679790 100644
--- a/src/main/java/cn/hellohao/controller/GroupController.java
+++ b/src/main/java/cn/hellohao/controller/GroupController.java
@@ -72,19 +72,19 @@ public class GroupController {
@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);
- }
+ //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){
+ //if(b){
ret = groupService.addgroup(group);
- }else{
- ret = -1;
- }
+ //}else{
+ // ret = -1;
+ //}
return ret;
}
@RequestMapping(value = "/delegroup")
diff --git a/src/main/java/cn/hellohao/controller/UpdateImgController.java b/src/main/java/cn/hellohao/controller/UpdateImgController.java
index 23daff4..8695d48 100644
--- a/src/main/java/cn/hellohao/controller/UpdateImgController.java
+++ b/src/main/java/cn/hellohao/controller/UpdateImgController.java
@@ -4,22 +4,29 @@ import cn.hellohao.pojo.*;
import cn.hellohao.service.*;
import cn.hellohao.service.impl.*;
import cn.hellohao.utils.*;
+import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.text.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpRequest;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.view.RedirectView;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.ImageWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import java.io.FileInputStream;
-import java.io.IOException;
+import java.awt.image.BufferedImage;
+import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -32,8 +39,6 @@ public class UpdateImgController {
@Autowired
private KeysService keysService;
@Autowired
- private OSSImageupload ossImageupload;
- @Autowired
private ConfigService configService;
@Autowired
private UploadConfigService uploadConfigService;
@@ -47,9 +52,13 @@ public class UpdateImgController {
private FTPImageupload ftpImageupload;
@Autowired
private ImgService imgService;
+ @Autowired
+ private UploadServicel uploadServicel;
private String[] iparr;
+ public static String vu;
+
@RequestMapping({"/", "/index"})
public String indexImg(Model model, HttpSession httpSession, HttpServletRequest request, HttpServletResponse response) {
Print.Normal("当前项目路径:"+System.getProperty("user.dir"));
@@ -66,7 +75,7 @@ public class UpdateImgController {
if(uploadConfig.getImgcounttourists()!=null){imgcounttourists = uploadConfig.getImgcounttourists();}
if(uploadConfig.getImgcountuser()!=null){imgcountuser = uploadConfig.getImgcountuser();}
if (email != null) {
- Integer ret = userService.login(u.getEmail(), u.getPassword());
+ Integer ret = userService.login(u.getEmail(), u.getPassword(),null);
if (ret > 0) {
User user = userService.getUsers(u.getEmail());
model.addAttribute("username", user.getUsername());
@@ -91,115 +100,22 @@ public class UpdateImgController {
isupdate = (u == null) ? 0: 1;
}
model.addAttribute("VisitorUpload", isupdate);
- return "index";
+ vu = IdUtil.simpleUUID();
+ model.addAttribute("vu",vu);
+ if(config.getTheme()==1){
+ return "index";
+ }else{
+ return "index-Minimalism";
+ }
}
@RequestMapping(value = "/upimg")
@ResponseBody
- public String upimg( HttpSession session,HttpServletRequest request
+ public Msg upimg( HttpSession session,HttpServletRequest request
, @RequestParam(value = "file", required = false) MultipartFile multipartFile,Integer setday,String upurlk) throws Exception {
- String userip = GetIPS.getIpAddr(request);
- Print.Normal("上传者ip:"+userip);
- java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
- JSONArray jsonArray = new JSONArray();
- JSONObject jsonObject = new JSONObject();
- Config config = configService.getSourceype();
- UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
- User u = (User) session.getAttribute("user");
- Integer usermemory =0;
- Integer memory =0;
- Integer sourcekey=0;
- Integer maxsize = 0;
- String userpath = "tourist";
- Boolean b =false;
- if(uploadConfig.getBlacklist()!=null){
- iparr = uploadConfig.getBlacklist().split(";");
- for (String s : iparr) {
- if(s.equals(userip)){
- jsonObject.put("imgurls",911);
- return jsonObject.toString();
- }
- }
- }
- if(Integer.parseInt(Base64Encryption.decryptBASE64(upurlk))!=yzupdate()){
- jsonObject.put("imgurls",403);
- return jsonObject.toString();
- }
- if(u==null){
- sourcekey = GetCurrentSource.GetSource(null);
- memory = uploadConfig.getVisitormemory();
- maxsize = uploadConfig.getFilesizetourists();
- usermemory= imgService.getusermemory(0);
- if(usermemory==null){usermemory = 0;}
- }else{
- userpath = u.getUsername();
- sourcekey = GetCurrentSource.GetSource(u.getId());
- memory = userService.getUsers(u.getEmail()).getMemory();
- maxsize = uploadConfig.getFilesizeuser();
- usermemory= imgService.getusermemory(u.getId());
- if(usermemory==null){usermemory = 0;}
- }
- if(uploadConfig.getUrltype()==2){
- userpath = dateFormat.format(new Date());
- }
- Keys key = keysService.selectKeys(sourcekey);
- if(sourcekey==5){b =true;}
- else{b = StringUtils.doNull(sourcekey,key);}
- if(!b){
- jsonObject.put("imgurls",-1);
- return jsonObject.toString();
- }
- int tmp =(memory==-1? -2:(usermemory/1024));
- if(tmp>=memory){
- jsonObject.put("imgurls",-5);
- return jsonObject.toString();
- }
- long stime = System.currentTimeMillis();
- Map map = new HashMap<>();
- Print.Normal("文件大小:"+multipartFile.getSize());
- if(multipartFile.getSize()>maxsize*1024*1024){
- jsonObject.put("imgurls",-6);
- return jsonObject.toString();
- }
- String fileName = multipartFile.getOriginalFilename();
- String lastname = fileName.substring(fileName.lastIndexOf(".") + 1);
- if (!multipartFile.isEmpty()) {
- map.put(lastname, multipartFile);
- }
- Map m = null;
- m = GetSource.storageSource(key.getStorageType(),map, userpath,null,setday);
- Images img = new Images();
- SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
- Print.Normal("上传图片的时间是:"+df.format(new Date()));
- for (Map.Entry entry : m.entrySet()) {
- if(key.getStorageType()==5){
- if(config.getDomain()!=null){
- jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
- jsonObject.put("imgnames",entry.getKey().getImgname());
- img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- }else{
- jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
- jsonObject.put("imgnames",entry.getKey().getImgname());
- img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
- }
- }else{
- jsonObject.put("imgurls",entry.getKey().getImgurl());
- jsonObject.put("imgnames",entry.getKey().getImgname());
- img.setImgurl(entry.getKey().getImgurl());
- }
- jsonArray.add(jsonObject);
- img.setUpdatetime(df.format(new Date()));
- img.setSource(key.getStorageType());
- img.setUserid(u == null?0:u.getId());
- img.setSizes((entry.getValue()) / 1024);
- img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
- img.setImgtype(setday>0?1:0);
- img.setAbnormal(userip);
- userService.insertimg(img);
- long etime = System.currentTimeMillis();
- Print.Normal("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
- }
- return jsonObject.toString();
+ Msg msg = new Msg();
+ msg = uploadServicel.uploadForLoc(session,request,multipartFile,setday,upurlk,iparr);
+ return msg;
}
//根据网络图片url上传
@@ -239,7 +155,8 @@ public class UpdateImgController {
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
userpath = dateFormat.format(new Date());
}
- if(Integer.parseInt(Base64Encryption.decryptBASE64(upurlk))!=yzupdate()){
+ //if(Integer.parseInt(Base64Encryption.decryptBASE64(upurlk))!=yzupdate()){
+ if (!upurlk.equals(UpdateImgController.vu)) {
jsonArray.add(-403);
return jsonArray.toString();
}
@@ -248,12 +165,12 @@ public class UpdateImgController {
Integer youke = uploadConfig.getFilesizetourists();
Integer yonghu = uploadConfig.getFilesizeuser();
String uuid= UUID.randomUUID().toString().replace("-", "");
- Boolean bo =false;
- bo = Sourcekey==5?true:StringUtils.doNull(Sourcekey,key);
- if(!bo){
- jsonArray.add(-1);
- return jsonArray.toString();
- }
+ //Boolean bo =false;
+ //bo = Sourcekey==5?true:StringUtils.doNull(Sourcekey,key);
+// if(!bo){
+// jsonArray.add(-1);
+// return jsonArray.toString();
+// }
Print.warning("上传地址是:"+request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(usermemory/1024>=memory) {
@@ -268,9 +185,9 @@ public class UpdateImgController {
}
try{
boolean bl =ImgUrlUtil.downLoadFromUrl(imgurl,
- uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
+ uuid, request.getSession().getServletContext().getRealPath("/")+File.separator+"hellohaotmp"+File.separator);
if(bl==true){
- FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+File.separator+"hellohaotmp"+File.separator+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
@@ -281,7 +198,7 @@ public class UpdateImgController {
return jsonArray.toString();
}
Map map = new HashMap<>();
- map.put(TypeDict.checkType(xxx), request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ map.put(TypeDict.checkType(xxx), request.getSession().getServletContext().getRealPath("/")+"hellohaotmp"+ File.separator+uuid);
Map m = null;
m = GetSource.storageSource(key.getStorageType(), null, userpath,map,setday);
Images img = new Images();
@@ -291,11 +208,11 @@ public class UpdateImgController {
for (Map.Entry entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
+ jsonArray.add(config.getDomain()+"/"+entry.getKey().getImgurl());
+ img.setImgurl(config.getDomain()+"/"+entry.getKey().getImgurl());//图片链接
}else{
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
+ jsonArray.add(config.getDomain()+"/"+entry.getKey().getImgurl());
+ img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
@@ -305,7 +222,8 @@ public class UpdateImgController {
img.setSource(key.getStorageType());
img.setUserid(u == null?0:u.getId());
img.setSizes((entry.getValue()));
- img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
+ //img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
+ img.setImgname(entry.getKey().getImgurl());
img.setAbnormal(userip);
if(setday>0){img.setImgtype(1);}
else{img.setImgtype(0);}
@@ -326,9 +244,9 @@ public class UpdateImgController {
}
try{
boolean bl = ImgUrlUtil.downLoadFromUrl(imgurl,
- uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
+ uuid, request.getSession().getServletContext().getRealPath("/")+"hellohaotmp"+File.separator);
if(bl==true){
- FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"hellohaotmp"+File.separator+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
@@ -339,7 +257,7 @@ public class UpdateImgController {
return jsonArray.toString();
}
Map map = new HashMap<>();
- map.put(TypeDict.checkType(xxx), request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
+ map.put(TypeDict.checkType(xxx), request.getSession().getServletContext().getRealPath("/")+File.separator+"hellohaotmp"+File.separator+uuid);
Map m = null;
m = GetSource.storageSource(key.getStorageType(), null, userpath,map,setday);
Images img = new Images();
@@ -349,11 +267,11 @@ public class UpdateImgController {
for (Map.Entry entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());
+ jsonArray.add(config.getDomain()+"/"+entry.getKey().getImgurl());
+ img.setImgurl(config.getDomain()+"/"+entry.getKey().getImgurl());
}else{
- jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
- img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
+ jsonArray.add(config.getDomain()+"/"+entry.getKey().getImgurl());
+ img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
@@ -419,6 +337,128 @@ public class UpdateImgController {
}
+ @RequestMapping("/{key1}/TOIMG{key2}N.{key3}")
+ public ResponseEntity