diff --git a/Tbed.7z b/Tbed.7z
deleted file mode 100644
index cc15e1f..0000000
Binary files a/Tbed.7z and /dev/null differ
diff --git a/sql/picturebed.sql b/sql/picturebed.sql
index 72a4d36..f385e42 100644
--- a/sql/picturebed.sql
+++ b/sql/picturebed.sql
@@ -1,17 +1,17 @@
/*
Navicat Premium Data Transfer
- Source Server : Hellohao
+ Source Server : localhost
Source Server Type : MySQL
- Source Server Version : 50562
- Source Host : 129.28.173.126:3306
+ Source Server Version : 50720
+ Source Host : localhost:3306
Source Schema : picturebed
Target Server Type : MySQL
- Target Server Version : 50562
+ Target Server Version : 50720
File Encoding : 65001
- Date: 29/08/2019 13:50:42
+ Date: 08/10/2019 18:01:43
*/
SET NAMES utf8mb4;
@@ -26,7 +26,7 @@ CREATE TABLE `code` (
`value` int(20) NOT NULL,
`code` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for config
@@ -53,7 +53,7 @@ CREATE TABLE `config` (
-- ----------------------------
-- Records of config
-- ----------------------------
-INSERT INTO `config` VALUES (1, 1, 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);
+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);
-- ----------------------------
-- Table structure for emailconfig
@@ -84,7 +84,7 @@ CREATE TABLE `group` (
`groupname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '组名称',
`keyid` int(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of group
@@ -105,7 +105,7 @@ CREATE TABLE `imgdata` (
`abnormal` int(2) NULL DEFAULT NULL COMMENT '异常',
`source` int(2) NULL DEFAULT NULL COMMENT '存储源',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 60 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for imgreview
@@ -144,9 +144,9 @@ CREATE TABLE `keys` (
-- ----------------------------
-- Records of keys
-- ----------------------------
-INSERT INTO `keys` VALUES (1, '547046ec6495457783f040df098a8ce3', '255b334a4d174e95a3d9e5938f1966ab', 'https://nos-eastchina1.126.net', 'hellohao', 'https://hellohao.nos-eastchina1.126.net', 1);
+INSERT INTO `keys` VALUES (1, '', '', '', '', '', 1);
INSERT INTO `keys` VALUES (2, '', '', '', '', '', 2);
-INSERT INTO `keys` VALUES (3, '', '', '', '', '', 3);
+INSERT INTO `keys` VALUES (3, '', '', '0', '', '', 3);
INSERT INTO `keys` VALUES (4, '', '', '', '', '', 4);
INSERT INTO `keys` VALUES (5, '0', '0', '0', '0', '0', 5);
INSERT INTO `keys` VALUES (6, '', '', '', '', '', 6);
@@ -201,7 +201,7 @@ CREATE TABLE `uploadconfig` (
-- ----------------------------
-- Records of uploadconfig
-- ----------------------------
-INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 1, 1, 0, 500, 1024);
+INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 1, 1, 1, 500, 1024);
-- ----------------------------
-- Table structure for user
@@ -219,7 +219,7 @@ 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 = 15 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of user
@@ -235,7 +235,7 @@ CREATE TABLE `usergroup` (
`userid` int(255) NULL DEFAULT NULL,
`groupid` int(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of usergroup
diff --git a/src/main/java/cn/hellohao/controller/AdminController.java b/src/main/java/cn/hellohao/controller/AdminController.java
index 4edd30f..b4c4823 100644
--- a/src/main/java/cn/hellohao/controller/AdminController.java
+++ b/src/main/java/cn/hellohao/controller/AdminController.java
@@ -99,9 +99,37 @@ public class AdminController {
String isarch = System.getProperty("os.arch");
String jdk = System.getProperty("java.version");
model.addAttribute("username", u.getUsername());
+ model.addAttribute("levels", u.getLevel());
model.addAttribute("sysetmname",sysetmname);
model.addAttribute("isarch", isarch);
model.addAttribute("jdk", jdk);
+
+ //空间大小
+ UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
+ Integer usermemory = imgService.getusermemory(u.getId());
+ if(usermemory==null){usermemory=0;}
+ User user = userService.getUsers(u.getEmail());
+ if(u!=null){
+ if (u.getLevel() == 1) {
+ model.addAttribute("level", "普通用户");
+ } else if (u.getLevel() == 2) {
+ model.addAttribute("level", "管理员");
+ } else {
+ model.addAttribute("level", "未 知");
+ }
+ model.addAttribute("levels", u.getLevel());
+ model.addAttribute("username", u.getUsername());
+ model.addAttribute("api", uploadConfig.getApi());
+
+ model.addAttribute("memory",user.getMemory());//单位M
+ if(usermemory==null){
+ model.addAttribute("usermemory", 0);//单位M
+ }else{
+ float d = (float) (Math.round((usermemory/1024.0F) * 100.0) / 100.0);
+ //Print.Normal();
+ model.addAttribute("usermemory", d);//单位M
+ }
+ }
return "admin/survey";
}
@@ -170,49 +198,21 @@ public class AdminController {
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
+
//获取用户信息列表
@RequestMapping(value = "/selectusertable")
@ResponseBody
- public PageResultBean selectByFy1(HttpSession session, Integer pageNum, Integer pageSize) {
- User u = (User) session.getAttribute("user");
- // 使用Pagehelper传入当前页数和页面显示条数会自动为我们的select语句加上limit查询
- // 从他的下一条sql开始分页
- PageHelper.startPage(pageNum, pageSize);
- List users = null;
- if (u.getLevel() > 1) { //根据用户等级查询管理员查询所有的信息
- users = userService.getuserlist(u);// 这是我们的sql
- // 使用pageInfo包装查询
- PageInfo rolePageInfo = new PageInfo<>(users);//
- return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
- } else {
- return null;
- }
- }
-
-
- //获取用户信息列表
- @RequestMapping(value = "/selectusertable2")
- @ResponseBody
public Map selectByFy12(HttpSession session, @RequestParam(required = false, defaultValue = "1") int page,
@RequestParam(required = false) int limit,String username) {
User u = (User) session.getAttribute("user");
- // 使用Pagehelper传入当前页数和页面显示条数会自动为我们的select语句加上limit查询
- // 从他的下一条sql开始分页
PageHelper.startPage(page, limit);
List users = null;
- List users2 = new ArrayList<>();
if (u.getLevel() > 1) { //根据用户等级查询管理员查询所有的信息
User user = new User();
user.setUsername(username);
users = userService.getuserlist(user);// 这是我们的sql
- for (User user1 : users) {
- User uu = new User();
- uu = user1;
- uu.setPassword(Base64Encryption.decryptBASE64(user1.getPassword()));
- users2.add(uu);
- }
// 使用pageInfo包装查询
- PageInfo rolePageInfo = new PageInfo<>(users2);//
+ PageInfo rolePageInfo = new PageInfo<>(users);//
Map map = new HashMap();
map.put("code", 0);
map.put("msg", "");
diff --git a/src/main/java/cn/hellohao/controller/ClientController.java b/src/main/java/cn/hellohao/controller/ClientController.java
index 0e8ed22..7d44cd6 100644
--- a/src/main/java/cn/hellohao/controller/ClientController.java
+++ b/src/main/java/cn/hellohao/controller/ClientController.java
@@ -196,7 +196,7 @@ public class ClientController {
} else {
img.setUserid(u.getId());//用户id
}
- img.setSizes((entry.getValue()));
+ img.setSizes((entry.getValue())/1024);
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
//-1证明超出大小,
diff --git a/src/main/java/cn/hellohao/controller/UpdateImgController.java b/src/main/java/cn/hellohao/controller/UpdateImgController.java
index 0775399..3b0c4e8 100644
--- a/src/main/java/cn/hellohao/controller/UpdateImgController.java
+++ b/src/main/java/cn/hellohao/controller/UpdateImgController.java
@@ -111,7 +111,7 @@ public class UpdateImgController {
@RequestMapping(value = "/upimg")
@ResponseBody
public String upimg( HttpSession session
- , @RequestParam(value = "file", required = false) MultipartFile[] file) throws Exception {
+ , @RequestParam(value = "file", required = false) MultipartFile[] file,Integer setday) throws Exception {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
Config config = configService.getSourceype();
@@ -156,6 +156,7 @@ public class UpdateImgController {
}
Map map = new HashMap<>();
for (MultipartFile multipartFile : file) {
+
// 获取ImageReader对象的迭代器
//获取文件名
String fileName = multipartFile.getOriginalFilename();
@@ -168,19 +169,19 @@ public class UpdateImgController {
}
Map m = null;
if(key.getStorageType()==1){
- m = nOSImageupload.Imageupload(map, userpath,null);
+ m = nOSImageupload.Imageupload(map, userpath,null,setday);
}else if (key.getStorageType()==2){
- m = ossImageupload.ImageuploadOSS(map, userpath,null);
+ m = ossImageupload.ImageuploadOSS(map, userpath,null,setday);
}else if(key.getStorageType()==3){
- m = ussImageupload.ImageuploadUSS(map, userpath,null);
+ m = ussImageupload.ImageuploadUSS(map, userpath,null,setday);
}else if(key.getStorageType()==4){
- m = kodoImageupload.ImageuploadKODO(map, userpath,null);
+ m = kodoImageupload.ImageuploadKODO(map, userpath,null,setday);
}else if(key.getStorageType()==5){
- m = LocUpdateImg.ImageuploadLOC(map, userpath,null);
+ m = LocUpdateImg.ImageuploadLOC(map, userpath,null,setday);
}else if(key.getStorageType()==6){
- m = cosImageupload.ImageuploadCOS(map, userpath,null);
+ m = cosImageupload.ImageuploadCOS(map, userpath,null,setday);
}else if(key.getStorageType()==7){
- m = ftpImageupload.ImageuploadFTP(map, userpath,null);
+ m = ftpImageupload.ImageuploadFTP(map, userpath,null,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
@@ -218,6 +219,7 @@ public class UpdateImgController {
img.setAbnormal(0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
+
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
}else{
@@ -244,7 +246,7 @@ public class UpdateImgController {
//根据网络图片url上传
@PostMapping(value = "/upurlimg")
@ResponseBody
- public String upurlimg(HttpSession session, String imgurl, HttpServletRequest request) throws Exception {
+ public String upurlimg(HttpSession session, String imgurl, HttpServletRequest request,Integer setday) throws Exception {
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
User u = (User) session.getAttribute("user");
@@ -263,8 +265,6 @@ public class UpdateImgController {
usermemory= imgService.getusermemory(u.getId());
if(usermemory==null){usermemory = 0;}
}
-
-
//Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
String userpath = "tourist";
if(uploadConfig.getUrltype()==2){
@@ -325,19 +325,19 @@ public class UpdateImgController {
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map m = null;
if(key.getStorageType()==1){
- m = nOSImageupload.Imageupload(null, userpath,map);
+ m = nOSImageupload.Imageupload(null, userpath,map,setday);
}else if (key.getStorageType()==2){
- m = ossImageupload.ImageuploadOSS(null, userpath,map);
+ m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
}else if(key.getStorageType()==3){
- m = ussImageupload.ImageuploadUSS(null, userpath,map);
+ m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
}else if(key.getStorageType()==4){
- m = kodoImageupload.ImageuploadKODO(null, userpath,map);
+ m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
}else if(key.getStorageType()==5){
- m = LocUpdateImg.ImageuploadLOC(null,userpath,map);
+ m = LocUpdateImg.ImageuploadLOC(null,userpath,map,setday);
}else if(key.getStorageType()==6){
- m = cosImageupload.ImageuploadCOS(null,userpath,map);
+ m = cosImageupload.ImageuploadCOS(null,userpath,map,setday);
}else if(key.getStorageType()==7){
- m = ftpImageupload.ImageuploadFTP(null,userpath,map);
+ m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
@@ -409,19 +409,19 @@ public class UpdateImgController {
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map m = null;
if(key.getStorageType()==1){
- m = nOSImageupload.Imageupload(null, userpath,map);
+ m = nOSImageupload.Imageupload(null, userpath,map,setday);
}else if (key.getStorageType()==2){
- m = ossImageupload.ImageuploadOSS(null, userpath,map);
+ m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
}else if(key.getStorageType()==3){
- m = ussImageupload.ImageuploadUSS(null, userpath,map);
+ m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
}else if(key.getStorageType()==4){
- m = kodoImageupload.ImageuploadKODO(null, userpath,map);
+ m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
}else if(key.getStorageType()==5){
- m =LocUpdateImg.ImageuploadLOC(null,userpath, map);
+ m =LocUpdateImg.ImageuploadLOC(null,userpath, map,setday);
}else if(key.getStorageType()==6){
- m =cosImageupload.ImageuploadCOS(null,userpath, map);
+ m =cosImageupload.ImageuploadCOS(null,userpath, map,setday);
}else if(key.getStorageType()==7){
- m = ftpImageupload.ImageuploadFTP(null,userpath,map);
+ m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
@@ -477,7 +477,6 @@ public class UpdateImgController {
}else{
jsonArray.add(-1);
}
-
return jsonArray.toString();
/**
* 错误返回值含义:
@@ -515,7 +514,6 @@ public class UpdateImgController {
return jsonObject.toString();
}
-
@RequestMapping("/err")
public String err() {
return "err";
diff --git a/src/main/java/cn/hellohao/quartz/FirstJob.java b/src/main/java/cn/hellohao/quartz/FirstJob.java
new file mode 100644
index 0000000..cccd063
--- /dev/null
+++ b/src/main/java/cn/hellohao/quartz/FirstJob.java
@@ -0,0 +1,20 @@
+package cn.hellohao.quartz;
+
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.stereotype.Component;
+
+
+@EnableScheduling
+@Component
+public class FirstJob{
+
+ public void task(){
+ //System.out.println("任务1执行....");
+ TempImgTask tempImgTask = new TempImgTask();
+ try {
+ tempImgTask.start();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/cn/hellohao/quartz/QuartzConfigration.java b/src/main/java/cn/hellohao/quartz/QuartzConfigration.java
index 5f77d4a..6c609bb 100644
--- a/src/main/java/cn/hellohao/quartz/QuartzConfigration.java
+++ b/src/main/java/cn/hellohao/quartz/QuartzConfigration.java
@@ -1,5 +1,9 @@
package cn.hellohao.quartz;
+import cn.hellohao.quartz.FirstJob;
+import cn.hellohao.quartz.SecondJob;
+import cn.hellohao.quartz.SpringUtil;
+import org.quartz.JobDetail;
import org.quartz.Trigger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@@ -7,9 +11,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import org.springframework.scheduling.quartz.SimpleTriggerFactoryBean;
-/*
-* 由于springboot是无xml配置,所以此处我们采用bean注解的方式实现quartz的配置*/
@Configuration
public class QuartzConfigration {
@@ -17,78 +20,69 @@ public class QuartzConfigration {
@Value("${Expression}")
private String Expression;
- @Bean(name = "jobDetail")
- public MethodInvokingJobDetailFactoryBean detailFactoryBean(SchedulerTask task) {
- // ScheduleTask为需要执行的任务
+
+
+ // 配置触发器1
+ @Bean(name = "firstTrigger")
+ public SimpleTriggerFactoryBean firstTrigger(JobDetail firstJobDetail) {
+ SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean();
+ trigger.setJobDetail(firstJobDetail);
+ // 设置任务启动延迟
+ trigger.setStartDelay(0);
+ // 每5秒执行一次
+ trigger.setRepeatInterval(3600000);//一小时
+ return trigger;
+ }
+
+ // 配置定时任务1
+ @Bean(name = "firstJobDetail")
+ public MethodInvokingJobDetailFactoryBean firstJobDetail() {
+ FirstJob firstJob = (FirstJob) SpringUtil.getBean(FirstJob.class);
MethodInvokingJobDetailFactoryBean jobDetail = new MethodInvokingJobDetailFactoryBean();
- /*
- * 是否并发执行
- * 例如每5s执行一次任务,但是当前任务还没有执行完,就已经过了5s了,
- * 如果此处为true,则下一个任务会bing执行,如果此处为false,则下一个任务会等待上一个任务执行完后,再开始执行
- */
-
- /*
- *
-"0 0 12 * * ?" 每天中午12点触发
-"0 15 10 ? * *" 每天上午10:15触发
-"0 15 10 * * ?" 每天上午10:15触发
-"0 15 10 * * ? *" 每天上午10:15触发
-"0 15 10 * * ? 2005" 2005年的每天上午10:15触发
-"0 * 14 * * ?" 在每天下午2点到下午2:59期间的每1分钟触发
-"0 0/5 14 * * ?" 在每天下午2点到下午2:55期间的每5分钟触发
-"0 0/5 14,18 * * ?" 在每天下午2点到2:55期间和下午6点到6:55期间的每5分钟触发
-"0 0-5 14 * * ?" 在每天下午2点到下午2:05期间的每1分钟触发
-"0 10,44 14 ? 3 WED" 每年三月的星期三的下午2:10和2:44触发
-"0 15 10 ? * MON-FRI" 周一至周五的上午10:15触发
-"0 15 10 15 * ?" 每月15日上午10:15触发
-"0 15 10 L * ?" 每月最后一日的上午10:15触发
-"0 15 10 ? * 6L" 每月的最后一个星期五上午10:15触发
-"0 15 10 ? * 6L 2002-2005" 2002年至2005年的每月的最后一个星期五上午10:15触发
-"0 15 10 ? * 6#3" 每月的第三个星期五上午10:15触发
- * */
- jobDetail.setConcurrent(true);
-
- jobDetail.setName("scheduler");// 设置任务的名字
- jobDetail.setGroup("scheduler_group");// 设置任务的分组,这些属性都可以存储在数据库中,在多任务的时候使用
-
- /*
- * 这两行代码表示执行task对象中的scheduleTest方法。定时执行的逻辑都在scheduleTest。
- */
- jobDetail.setTargetObject(task);
-
- jobDetail.setTargetMethod("start");
+ // 是否并发执行
+ jobDetail.setConcurrent(false);
+ // 为需要执行的实体类对应的对象
+ jobDetail.setTargetObject(firstJob);
+ // 需要执行的方法
+ jobDetail.setTargetMethod("task");
return jobDetail;
}
- @Bean(name = "jobTrigger")
- public CronTriggerFactoryBean cronJobTrigger(MethodInvokingJobDetailFactoryBean jobDetail) {
- CronTriggerFactoryBean tigger = new CronTriggerFactoryBean();
- tigger.setJobDetail(jobDetail.getObject());
- tigger.setCronExpression((Expression));
- //tigger.setCronExpression("0 30 04 * * ?");// 表示每天七点半执行
- //tigger.setCronExpression(("0 0/3 * * * ?"));//每三分钟
- //tigger.setCronExpression("*/5 * * * * ?");//每五秒执行一次
- //tigger.set
- tigger.setName("myTigger");// trigger的name
- return tigger;
-
+ // 配置触发器2
+ @Bean(name = "secondTrigger")
+ public CronTriggerFactoryBean secondTrigger(JobDetail secondJobDetail) {
+ CronTriggerFactoryBean trigger = new CronTriggerFactoryBean();
+ trigger.setJobDetail(secondJobDetail);
+ // cron表达式
+ trigger.setCronExpression(Expression);
+ //trigger.setCronExpression("0 0/1 * * * ?");
+ return trigger;
}
+ // 配置定时任务2
+ @Bean(name = "secondJobDetail")
+ public MethodInvokingJobDetailFactoryBean secondJobDetail() {
+
+ SecondJob secondJob = (SecondJob) SpringUtil.getBean(SecondJob.class);
+ MethodInvokingJobDetailFactoryBean jobDetail = new MethodInvokingJobDetailFactoryBean();
+ // 是否并发执行
+ jobDetail.setConcurrent(false);
+ // 为需要执行的实体类对应的对象
+ jobDetail.setTargetObject(secondJob);
+ // 需要执行的方法
+ jobDetail.setTargetMethod("task");
+ return jobDetail;
+ }
+
+ // 配置Scheduler
@Bean(name = "scheduler")
- public SchedulerFactoryBean schedulerFactory(Trigger cronJobTrigger) {
+ public SchedulerFactoryBean schedulerFactory(Trigger firstTrigger, Trigger secondTrigger) {
SchedulerFactoryBean bean = new SchedulerFactoryBean();
- //设置是否任意一个已定义的Job会覆盖现在的Job。默认为false,即已定义的Job不会覆盖现有的Job。
- bean.setOverwriteExistingJobs(true);
- // 延时启动,应用启动5秒后 ,定时器才开始启动
- bean.setStartupDelay(5);
- // 注册定时触发器
- bean.setTriggers(cronJobTrigger);
+ // 延时启动,应用启动1秒后
+ bean.setStartupDelay(1);
+ // 注册触发器
+ bean.setTriggers(firstTrigger, secondTrigger);
return bean;
}
- //多任务时的Scheduler,动态设置Trigger。一个SchedulerFactoryBean可能会有多个Trigger
- @Bean(name = "multitaskScheduler")
- public SchedulerFactoryBean schedulerFactoryBean(){
- SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
- return schedulerFactoryBean;
- }
+
}
\ No newline at end of file
diff --git a/src/main/java/cn/hellohao/quartz/SchedulerTask.java b/src/main/java/cn/hellohao/quartz/SchedulerTask.java
index 9a9f679..03d94a0 100644
--- a/src/main/java/cn/hellohao/quartz/SchedulerTask.java
+++ b/src/main/java/cn/hellohao/quartz/SchedulerTask.java
@@ -3,19 +3,18 @@ package cn.hellohao.quartz;
import cn.hellohao.pojo.Images;
import cn.hellohao.pojo.Imgreview;
import cn.hellohao.pojo.Keys;
-import cn.hellohao.service.ConfigService;
-import cn.hellohao.service.ImgreviewService;
-import cn.hellohao.service.KeysService;
import cn.hellohao.service.impl.ImgServiceImpl;
+import cn.hellohao.service.impl.ImgreviewServiceImpl;
+import cn.hellohao.service.impl.KeysServiceImpl;
+import cn.hellohao.utils.LocUpdateImg;
import com.alibaba.fastjson.JSON;
import com.baidu.aip.contentcensor.AipContentCensor;
import com.baidu.aip.contentcensor.EImgType;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
+import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -24,83 +23,100 @@ import java.util.List;
单任务执行,并且通过控制器的接口实现时间间隔的动态修改
任务类
* */
-@Configuration
+//@Configuration
+
@Component
-@EnableScheduling
+
public class SchedulerTask {
@Autowired
private ImgServiceImpl imgService;
@Autowired
- private ImgreviewService imgreviewService;
+ private ImgreviewServiceImpl imgreviewService;
@Autowired
- private KeysService keysService;
+ private KeysServiceImpl keysService;
private static AipContentCensor client;
+ private static SchedulerTask schedulerTask;
+
+
+ @PostConstruct
+ public void init() {
+ schedulerTask = this; }
+
+
private static void Initializes(Imgreview imgreview) {
client = new AipContentCensor(imgreview.getAppId(), imgreview.getApiKey(), imgreview.getSecretKey());
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
}
- public void start() throws InterruptedException {
-
- //System.out.println("活动开始!!!"+new Date());
+ public void start(){
//查询鉴黄key
- Imgreview imgreview = imgreviewService.selectByPrimaryKey(1);
- //初始化鉴黄
- SchedulerTask.Initializes(imgreview);
- //计算出昨天的日期
- Date d = new Date();
- SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
- String oldtime = df.format(new Date(d.getTime() - 1 * 24 * 60 * 60 * 1000));
- //服务器获取出这个时间段的值然后遍历
- List imglist= imgService.gettimeimg(oldtime);
- for (Images images : imglist) {
-
- String imgurl = images.getImgurl();
- System.err.println("正在鉴定的图片:" + imgurl);
- JSONObject res = client.antiPorn(imgurl);
- res = client.imageCensorUserDefined(imgurl, EImgType.URL, null);
- System.err.println("返回的鉴黄json:"+res.toString());
- com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray("[" + res.toString() + "]");
- for (Object o : jsonArray) {
- com.alibaba.fastjson.JSONObject jsonObject = (com.alibaba.fastjson.JSONObject) o;
- com.alibaba.fastjson.JSONArray data = jsonObject.getJSONArray("data");
- Integer conclusionType = jsonObject.getInteger("conclusionType");
- if (conclusionType == 2) {
- for (Object datum : data) {
- com.alibaba.fastjson.JSONObject imgdata = (com.alibaba.fastjson.JSONObject) datum;
- if (imgdata.getInteger("type") == 1) {
- //标记图片
- Integer ret = imgService.deleimgname(images.getImgname()); //删除数据库图片信息
- //Imgreview imgreview1 =imgreviewService.selectByPrimaryKey(1);
- Imgreview imgreview1 = new Imgreview();
- imgreview1.setId(1);
- Integer count = imgreview.getCount();
- System.out.println("违法图片总数:" + count);
- imgreview1.setCount(count + 1);
- imgreviewService.updateByPrimaryKeySelective(imgreview1);
- Keys key =null;
- if(images.getSource()==1){
- key = keysService.selectKeys(images.getSource());
- imgService.delect(key, images.getImgname());
- }else if (images.getSource()==2){
- key = keysService.selectKeys(images.getSource());
- imgService.delectOSS(key, images.getImgname());
- }else if(images.getSource()==3){
- //初始化腾讯云
- }else if(images.getSource()==4){
- //初始化七牛云
- }else{
- System.err.println("未获取到对象存储参数,上传失败。");
- }
-
- if (ret == 1) {
- System.err.println("存在色情图片,删除成功。");
- } else {
- System.err.println("存在色情图片,删除失败");
+ Imgreview imgreview = schedulerTask.imgreviewService.selectByPrimaryKey(1);
+ if(imgreview.getUsing()==1){
+ //初始化鉴黄
+ SchedulerTask.Initializes(imgreview);
+ //计算出昨天的日期
+ Date d = new Date();
+ SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
+ String oldtime = df.format(new Date(d.getTime() - 1 * 24 * 60 * 60 * 1000));
+ //服务器获取出这个时间段的值然后遍历
+ List imglist= schedulerTask.imgService.gettimeimg(oldtime);
+ for (Images images : imglist) {
+ String imgurl = images.getImgurl();
+ System.err.println("正在鉴定的图片:" + imgurl);
+ JSONObject res = client.antiPorn(imgurl);
+ res = client.imageCensorUserDefined(imgurl, EImgType.URL, null);
+ System.err.println("返回的鉴黄json:"+res.toString());
+ com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray("[" + res.toString() + "]");
+ for (Object o : jsonArray) {
+ com.alibaba.fastjson.JSONObject jsonObject = (com.alibaba.fastjson.JSONObject) o;
+ com.alibaba.fastjson.JSONArray data = jsonObject.getJSONArray("data");
+ Integer conclusionType = jsonObject.getInteger("conclusionType");
+ if (conclusionType == 2) {
+ for (Object datum : data) {
+ com.alibaba.fastjson.JSONObject imgdata = (com.alibaba.fastjson.JSONObject) datum;
+ if (imgdata.getInteger("type") == 1) {
+ //标记图片
+ Integer ret = schedulerTask.imgService.deleimgname(images.getImgname()); //删除数据库图片信息
+ //Imgreview imgreview1 =imgreviewService.selectByPrimaryKey(1);
+ Imgreview imgreview1 = new Imgreview();
+ imgreview1.setId(1);
+ Integer count = imgreview.getCount();
+ System.out.println("违法图片总数:" + count);
+ imgreview1.setCount(count + 1);
+ schedulerTask.imgreviewService.updateByPrimaryKeySelective(imgreview1);
+ Keys key =null;
+ if(images.getSource()==1){
+ key = keysService.selectKeys(images.getSource());
+ schedulerTask.imgService.delect(key, images.getImgname());
+ }else if (images.getSource()==2){
+ key = keysService.selectKeys(images.getSource());
+ schedulerTask.imgService.delectOSS(key, images.getImgname());
+ }else if(images.getSource()==3){
+ key = keysService.selectKeys(images.getSource());
+ schedulerTask.imgService.delectUSS(key, images.getImgname());
+ }else if(images.getSource()==4){
+ key = keysService.selectKeys(images.getSource());
+ schedulerTask.imgService.delectKODO(key, images.getImgname());
+ }else if(images.getSource()==5){
+ LocUpdateImg.deleteLOCImg(images.getImgname());
+ }else if(images.getSource()==6){
+ key = keysService.selectKeys(images.getSource());
+ schedulerTask.imgService.delectCOS(key, images.getImgname());
+ }else if(images.getSource()==7){
+ key = keysService.selectKeys(images.getSource());
+ schedulerTask.imgService.delectFTP(key, images.getImgname());
+ }else{
+ System.err.println("未获取到对象存储参数,上传失败。");
+ }
+ if (ret == 1) {
+ System.err.println("存在色情图片,删除成功。");
+ } else {
+ System.err.println("存在色情图片,删除失败");
+ }
}
}
}
diff --git a/src/main/java/cn/hellohao/quartz/SecondJob.java b/src/main/java/cn/hellohao/quartz/SecondJob.java
new file mode 100644
index 0000000..9999042
--- /dev/null
+++ b/src/main/java/cn/hellohao/quartz/SecondJob.java
@@ -0,0 +1,16 @@
+package cn.hellohao.quartz;
+
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.stereotype.Component;
+
+
+@EnableScheduling
+@Component
+public class SecondJob{
+
+ public void task() {
+ //System.out.println("任务2执行....");
+ SchedulerTask schedulerTask = new SchedulerTask();
+ schedulerTask.start();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/cn/hellohao/quartz/SpringUtil.java b/src/main/java/cn/hellohao/quartz/SpringUtil.java
new file mode 100644
index 0000000..a2b0797
--- /dev/null
+++ b/src/main/java/cn/hellohao/quartz/SpringUtil.java
@@ -0,0 +1,40 @@
+package cn.hellohao.quartz;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SpringUtil implements ApplicationContextAware {
+
+ private static ApplicationContext applicationContext;
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ if (SpringUtil.applicationContext == null) {
+ SpringUtil.applicationContext = applicationContext;
+ }
+ }
+
+ //获取applicationContext
+ public static ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ //通过name获取 Bean.
+ public static Object getBean(String name) {
+ return getApplicationContext().getBean(name);
+ }
+
+ //通过class获取Bean.
+ public static T getBean(Class clazz) {
+ return getApplicationContext().getBean(clazz);
+ }
+
+ //通过name,以及Clazz返回指定的Bean
+ public static T getBean(String name, Class clazz) {
+ return getApplicationContext().getBean(name, clazz);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/hellohao/quartz/TempImgTask.java b/src/main/java/cn/hellohao/quartz/TempImgTask.java
new file mode 100644
index 0000000..b91d679
--- /dev/null
+++ b/src/main/java/cn/hellohao/quartz/TempImgTask.java
@@ -0,0 +1,146 @@
+package cn.hellohao.quartz;
+
+import cn.hellohao.pojo.Keys;
+import cn.hellohao.service.impl.ImgServiceImpl;
+import cn.hellohao.service.impl.KeysServiceImpl;
+import cn.hellohao.utils.DeleImg;
+import cn.hellohao.utils.LocUpdateImg;
+import cn.hellohao.utils.Print;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.io.*;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/*
+单任务执行,并且通过控制器的接口实现时间间隔的动态修改
+任务类
+* */
+//@Configuration
+
+@Component
+public class TempImgTask {
+
+ @Autowired
+ private ImgServiceImpl imgService;
+ @Autowired
+ private KeysServiceImpl keysService;
+
+ private static TempImgTask tempImgTask;
+
+
+ @PostConstruct
+ public void init() {
+ tempImgTask = this;
+ tempImgTask.imgService = this.imgService;
+ tempImgTask.keysService = this.keysService;
+ }
+
+
+ public void start() throws InterruptedException {
+ List list = new ArrayList<>();
+ File file = new File(File.separator + "HellohaoData"+File.separator+"img.ini");
+ //判断文件是否存在
+ if (file.exists()) {
+ StringBuilder result = new StringBuilder();
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));//构造一个BufferedReader类来读取文件
+ String s = null;
+ while ((s = br.readLine()) != null) {//使用readLine方法,一次读一行
+ result.append(System.lineSeparator() + s);
+ //Print.Normal( s);
+ String str = s;
+ String[] strArr = str.split("\\|");
+ System.out.println(strArr.length); //这里输出3
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Date sd1=new Date();//大时间 当前时间
+ Date sd2=df.parse(strArr[1]);//小时间
+ if(sd1.after(sd2)){//等于false时说明图片时间大于或者等于当前时间
+ Integer ret = tempImgTask.imgService.deleimgname(strArr[0]);//删除库里图片数据
+ Keys key =null;
+ if(Integer.parseInt(strArr[2])==1){
+ key = tempImgTask.keysService.selectKeys(Integer.parseInt(strArr[2]));
+ tempImgTask.imgService.delect(key,strArr[0]);
+ }else if (Integer.parseInt(strArr[2])==2){
+ key = tempImgTask.keysService.selectKeys(Integer.parseInt(strArr[2]));
+ tempImgTask.imgService.delectOSS(key, strArr[0]);
+ }else if(Integer.parseInt(strArr[2])==3){
+ key = tempImgTask.keysService.selectKeys(Integer.parseInt(strArr[2]));
+ tempImgTask.imgService.delectUSS(key, strArr[0]);
+ }else if(Integer.parseInt(strArr[2])==4){
+ key = tempImgTask.keysService.selectKeys(Integer.parseInt(strArr[2]));
+ tempImgTask.imgService.delectKODO(key, strArr[0]);
+ }else if(Integer.parseInt(strArr[2])==5){
+ LocUpdateImg.deleteLOCImg(strArr[0]);
+ }else if(Integer.parseInt(strArr[2])==6){
+ key = tempImgTask.keysService.selectKeys(Integer.parseInt(strArr[2]));
+ tempImgTask.imgService.delectCOS(key,strArr[0]);
+ }else if(Integer.parseInt(strArr[2])==7){
+ key = tempImgTask.keysService.selectKeys(Integer.parseInt(strArr[2]));
+ tempImgTask.imgService.delectFTP(key, strArr[0]);
+ }else{
+ System.err.println("未获取到对象存储参数,上传失败。");
+ }
+ }else{
+ //没有过期的临时图片
+ list.add(s);
+ }
+ }
+ br.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ //return result.toString();
+ textcr(list);
+ } else {
+ //Print.warning("file not exists, 不进行暂存扫描处理");
+ try {
+ file.createNewFile();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ clearInfoForFile(File.separator + "HellohaoData"+File.separator+"img.ini");
+ }
+
+
+ /**
+ * 清空文件内容
+ * @param fileName
+ */
+ public static void clearInfoForFile(String fileName) {
+ //Print.Normal("清空原ini文件");
+ File file =new File(fileName);
+ try {
+ if(!file.exists()) {
+ file.createNewFile();
+ }
+ FileWriter fileWriter =new FileWriter(file);
+ fileWriter.write("");
+ fileWriter.flush();
+ fileWriter.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+
+ //遍历没有过期的list文本,依次插入
+ public static void textcr(List list){
+ clearInfoForFile(File.separator + "HellohaoData"+File.separator+"img.ini");
+ //Print.Normal("开始重新插入没有过期的文本");
+ for (String s : list) {
+ DeleImg.charu(s);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/cn/hellohao/service/impl/COSImageupload.java b/src/main/java/cn/hellohao/service/impl/COSImageupload.java
index b4d877d..7b627e1 100644
--- a/src/main/java/cn/hellohao/service/impl/COSImageupload.java
+++ b/src/main/java/cn/hellohao/service/impl/COSImageupload.java
@@ -3,6 +3,8 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
+import cn.hellohao.utils.DateUtils;
+import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import com.netease.cloud.auth.BasicCredentials;
@@ -33,7 +35,8 @@ public class COSImageupload {
static COSClient cosClient;
static Keys key;
- public Map ImageuploadCOS(Map fileMap, String username,Map fileMap2) throws Exception {
+ public Map ImageuploadCOS(Map fileMap, String username,
+ Map fileMap2,Integer setday) throws Exception {
// 要上传文件的路径
if(fileMap2==null){
File file = null;
@@ -54,6 +57,10 @@ public class COSImageupload {
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + "/" + userkey);
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "6");
+ }
} catch (CosServiceException serverException) {
serverException.printStackTrace();
@@ -81,8 +88,11 @@ public class COSImageupload {
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
ReturnImage returnImage = new ReturnImage();
returnImage.setImgurl(key.getRequestAddress() + "/" + userkey);
-
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "6");
+ }
boolean bb= new File(imgurl).getAbsoluteFile().delete();
Print.Normal("删除情况"+bb);
} catch (Exception e) {
diff --git a/src/main/java/cn/hellohao/service/impl/FTPImageupload.java b/src/main/java/cn/hellohao/service/impl/FTPImageupload.java
index 696f7ae..323a669 100644
--- a/src/main/java/cn/hellohao/service/impl/FTPImageupload.java
+++ b/src/main/java/cn/hellohao/service/impl/FTPImageupload.java
@@ -3,9 +3,7 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
-import cn.hellohao.utils.FTPUtils;
-import cn.hellohao.utils.ImgUrlUtil;
-import cn.hellohao.utils.Print;
+import cn.hellohao.utils.*;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.springframework.stereotype.Service;
@@ -22,7 +20,8 @@ public class FTPImageupload {
static FTPClient ftpClient1 ;
static Keys key;
- public Map ImageuploadFTP(Map fileMap, String username,Map fileMap2) throws Exception {
+ public Map ImageuploadFTP(Map fileMap, String username,
+ Map fileMap2,Integer setday) throws Exception {
String[] host = key.getEndpoint().split("\\:");
String h = host[0];
Integer p = Integer.parseInt(host[1]);
@@ -52,7 +51,10 @@ public class FTPImageupload {
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + File.separator+ userkey);
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
-
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "7");
+ }
ftps.close();
}
@@ -76,6 +78,10 @@ public class FTPImageupload {
returnImage.setImgurl(key.getRequestAddress() + File.separator+ userkey);
Print.Normal("Url上传成功返回地址");
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "7");
+ }
ftps.close();
}
boolean bb= new File(imgurl).getAbsoluteFile().delete();
diff --git a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java
index c4f751d..ada0c54 100644
--- a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java
+++ b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java
@@ -87,8 +87,6 @@ public class ImgServiceImpl implements ImgService {
if (isExist) {
nosClient.deleteObject(tname, fileName);
}
-
-
}
//删除OSS对象存储的图片文件
diff --git a/src/main/java/cn/hellohao/service/impl/KODOImageupload.java b/src/main/java/cn/hellohao/service/impl/KODOImageupload.java
index 0717928..165ea75 100644
--- a/src/main/java/cn/hellohao/service/impl/KODOImageupload.java
+++ b/src/main/java/cn/hellohao/service/impl/KODOImageupload.java
@@ -3,6 +3,8 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
+import cn.hellohao.utils.DateUtils;
+import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.ObjectMetadata;
@@ -30,7 +32,8 @@ public class KODOImageupload {
static UploadManager uploadManager;
static Keys key;
- public Map ImageuploadKODO(Map fileMap, String username, Map fileMap2) throws Exception {
+ public Map ImageuploadKODO(Map fileMap, String username,
+ Map fileMap2,Integer setday) throws Exception {
// 要上传文件的路径
if(fileMap2==null){
File file = null;
@@ -53,7 +56,10 @@ public class KODOImageupload {
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
- //System.out.println(putRet.hash);
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "4");
+ }
} catch (QiniuException ex) {
Response r = ex.response;
System.err.println(r.toString());
@@ -67,7 +73,6 @@ public class KODOImageupload {
return ImgUrl;
}else{
Map ImgUrl = new HashMap<>();
-
for (Map.Entry entry : fileMap2.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
@@ -82,6 +87,10 @@ public class KODOImageupload {
ReturnImage returnImage = new ReturnImage();
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "4");
+ }
new File(imgurl).delete();
} catch (QiniuException ex) {
Response r = ex.response;
diff --git a/src/main/java/cn/hellohao/service/impl/NOSImageupload.java b/src/main/java/cn/hellohao/service/impl/NOSImageupload.java
index 6255236..7bbf366 100644
--- a/src/main/java/cn/hellohao/service/impl/NOSImageupload.java
+++ b/src/main/java/cn/hellohao/service/impl/NOSImageupload.java
@@ -11,6 +11,8 @@ import java.util.UUID;
import cn.hellohao.exception.StorageSourceInitException;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
+import cn.hellohao.utils.DateUtils;
+import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import com.netease.cloud.services.nos.model.ObjectMetadata;
@@ -42,7 +44,8 @@ public class NOSImageupload {
static NosClient nosClient;
static Keys key;
- public Map Imageupload(Map fileMap, String username,Map fileMap2) throws Exception {
+ public Map Imageupload(Map fileMap, String username,
+ Map fileMap2,Integer setday) throws Exception {
// 要上传文件的路径
if(fileMap2==null){
File file = null;
@@ -57,7 +60,10 @@ public class NOSImageupload {
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
-
+ if(setday>0){
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid+times + "." + entry.getKey()+"-"+deleimg+"-"+"1");
+ }
}
return ImgUrl;
}else{
@@ -94,6 +100,10 @@ public class NOSImageupload {
ReturnImage returnImage = new ReturnImage();
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "-" + deleimg + "-" + "1");
+ }
boolean bb= new File(imgurl).getAbsoluteFile().delete();
Print.Normal("删除情况"+bb);
diff --git a/src/main/java/cn/hellohao/service/impl/OSSImageupload.java b/src/main/java/cn/hellohao/service/impl/OSSImageupload.java
index 43081d6..5130230 100644
--- a/src/main/java/cn/hellohao/service/impl/OSSImageupload.java
+++ b/src/main/java/cn/hellohao/service/impl/OSSImageupload.java
@@ -3,6 +3,8 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
+import cn.hellohao.utils.DateUtils;
+import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import com.aliyun.oss.OSSClient;
@@ -22,7 +24,8 @@ public class OSSImageupload {
static OSSClient ossClient;
static Keys key;
- public Map ImageuploadOSS(Map fileMap, String username,Map fileMap2) throws Exception {
+ public Map ImageuploadOSS(Map fileMap, String username,
+ Map fileMap2,Integer setday) throws Exception {
if(fileMap2==null){
File file = null;
Map ImgUrl = new HashMap<>();
@@ -56,7 +59,10 @@ public class OSSImageupload {
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
-
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "2");
+ }
}
//ossClient.shutdown();
return ImgUrl;
@@ -92,6 +98,10 @@ public class OSSImageupload {
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
new File(imgurl).delete();
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "2");
+ }
}
//ossClient.shutdown();
return ImgUrl;
diff --git a/src/main/java/cn/hellohao/service/impl/USSImageupload.java b/src/main/java/cn/hellohao/service/impl/USSImageupload.java
index 93fa2e0..be28e37 100644
--- a/src/main/java/cn/hellohao/service/impl/USSImageupload.java
+++ b/src/main/java/cn/hellohao/service/impl/USSImageupload.java
@@ -3,6 +3,8 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
+import cn.hellohao.utils.DateUtils;
+import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import com.UpYun;
import com.aliyun.oss.OSSClient;
@@ -21,7 +23,8 @@ public class USSImageupload {
static UpYun upyun;
static Keys key;
- public Map ImageuploadUSS(Map fileMap, String username,Map fileMap2) throws Exception {
+ public Map ImageuploadUSS(Map fileMap, String username,
+ Map fileMap2,Integer setday) throws Exception {
if(fileMap2==null){
File file = null;
Map ImgUrl = new HashMap<>();
@@ -43,6 +46,10 @@ public class USSImageupload {
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "3");
+ }
}else{
System.err.println("上传失败");
}
@@ -68,6 +75,11 @@ public class USSImageupload {
ReturnImage returnImage = new ReturnImage();
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "3");
+ }
+
}else{
System.err.println("上传失败");
}
diff --git a/src/main/java/cn/hellohao/test/test1.java b/src/main/java/cn/hellohao/test/test1.java
index de3e24c..99dae87 100644
--- a/src/main/java/cn/hellohao/test/test1.java
+++ b/src/main/java/cn/hellohao/test/test1.java
@@ -17,14 +17,14 @@ import java.util.Date;
public class test1 {
public static void main(String[] args) throws Exception {
- readFile(File.separator + "HellohaoData"+File.separator+"db.db");
- //charu();
+ readFile(File.separator + "HellohaoData"+File.separator+"img.ini");
+ //charu("Hellohao/b3da10930021007.png|");
}
- public static void charu() {
+ public static void charu(String src) {
String filePath =File.separator + "HellohaoData" ;
File file = new File(filePath);
- File file1 = new File(filePath+File.separator+"db.db");
+ File file1 = new File(filePath+File.separator+"img.ini");
if(!file.exists()){
file.mkdirs();
}
@@ -43,7 +43,7 @@ public class test1 {
e.printStackTrace();
}
PrintWriter pw = new PrintWriter(fw);
- pw.println("666666");
+ pw.println(src);//插入每行的内容
pw.flush();
try {
fw.flush();
diff --git a/src/main/java/cn/hellohao/utils/DateUtils.java b/src/main/java/cn/hellohao/utils/DateUtils.java
new file mode 100644
index 0000000..e8226db
--- /dev/null
+++ b/src/main/java/cn/hellohao/utils/DateUtils.java
@@ -0,0 +1,31 @@
+package cn.hellohao.utils;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @author Tiansh
+ * @version 1.0
+ * @date 2019/9/20 16:27
+ */
+public class DateUtils {
+ /**
+ * 当前日期加上天数后的日期
+ * @param num 为增加的天数
+ * @return
+ */
+ public static String plusDay(int num){
+ Date d = new Date();
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String currdate = format.format(d);
+ System.out.println("现在的日期是:" + currdate);
+
+ Calendar ca = Calendar.getInstance();
+ ca.add(Calendar.DATE, num);// num为增加的天数,可以改变的
+ d = ca.getTime();
+ String enddate = format.format(d);
+ System.out.println("增加天数以后的日期:" + enddate);
+ return enddate;
+ }
+}
diff --git a/src/main/java/cn/hellohao/utils/DeleImg.java b/src/main/java/cn/hellohao/utils/DeleImg.java
new file mode 100644
index 0000000..bea6b75
--- /dev/null
+++ b/src/main/java/cn/hellohao/utils/DeleImg.java
@@ -0,0 +1,64 @@
+package cn.hellohao.utils;
+
+
+import java.io.*;
+
+public class DeleImg {
+ public static void main(String[] args) throws Exception {
+ readFile(File.separator + "HellohaoData"+File.separator+"img.ini");
+ //charu();
+ }
+
+ public static void charu(String imgUrlText) {
+ String filePath =File.separator + "HellohaoData" ;
+ File file = new File(filePath);
+ File file1 = new File(filePath+File.separator+"img.ini");
+ if(!file.exists()){
+ file.mkdirs();
+ }
+ if(!file1.exists()){
+ try {
+ file1.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ FileWriter fw = null;
+ try {
+ //如果文件存在,则追加内容;如果文件不存在,则创建文件
+ fw = new FileWriter(file1, true);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ PrintWriter pw = new PrintWriter(fw);
+ pw.println(imgUrlText);
+ pw.flush();
+ try {
+ fw.flush();
+ pw.close();
+ fw.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ // 读取文件内容
+ public static String readFile(String path) {//路径
+ File file = new File(path);
+ StringBuilder result = new StringBuilder();
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));//构造一个BufferedReader类来读取文件
+ String s = null;
+ while ((s = br.readLine()) != null) {//使用readLine方法,一次读一行
+ result.append(System.lineSeparator() + s);
+ Print.Normal( s);
+ }
+ br.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result.toString();
+ }
+
+}
diff --git a/src/main/java/cn/hellohao/utils/LocUpdateImg.java b/src/main/java/cn/hellohao/utils/LocUpdateImg.java
index 92a1a8c..7c4cb4b 100644
--- a/src/main/java/cn/hellohao/utils/LocUpdateImg.java
+++ b/src/main/java/cn/hellohao/utils/LocUpdateImg.java
@@ -19,7 +19,8 @@ public class LocUpdateImg {
- public static Map ImageuploadLOC(Map fileMap, String username, Map fileMap2) throws Exception {
+ public static Map ImageuploadLOC(Map fileMap, String username,
+ Map fileMap2,Integer setday) throws Exception {
String filePath =File.separator + "HellohaoData" + File.separator;
if(fileMap2==null){
File file = null;
@@ -51,6 +52,10 @@ public class LocUpdateImg {
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "5");
+ }
} catch (IOException e) {
e.printStackTrace();
System.err.println("上传失败");
@@ -76,6 +81,10 @@ public class LocUpdateImg {
ReturnImage returnImage = new ReturnImage();
returnImage.setImgurl(username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put( returnImage, ImgUrlUtil.getFileSize2(new File(newfilePath)));
+ if(setday>0) {
+ String deleimg = DateUtils.plusDay(setday);
+ DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "5");
+ }
}
//new File(imgurl).delete();
return ImgUrl;
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 517ea93..ac579a5 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -3,7 +3,7 @@ spring.datasource.username=root
#ݿtest
spring.datasource.password=root
#ݿӵַ
-spring.datasource.url=jdbc:mysql://localhost:3306/picturebed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/picturebed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#˿
server.port=8088
#ڱʽ ·ʽΪÿߵִ
@@ -24,7 +24,7 @@ multipart.maxFileSize=10240KB
multipart.maxRequestSize=10240KB
spring.thymeleaf.mode = LEGACYHTML5
spring.http.multipart.location=/data/upload_tmp
-systemupdate=2019-09-08
+systemupdate=2019-10-08
diff --git a/src/main/resources/db/doc.txt b/src/main/resources/db/doc.txt
new file mode 100644
index 0000000..3ddc008
--- /dev/null
+++ b/src/main/resources/db/doc.txt
@@ -0,0 +1 @@
+存储源删除
\ No newline at end of file
diff --git a/src/main/resources/db/img.ini b/src/main/resources/db/img.ini
new file mode 100644
index 0000000..492d11a
--- /dev/null
+++ b/src/main/resources/db/img.ini
@@ -0,0 +1,3 @@
+aaaaaaaaaaa
+vbbbbbbbbbbbbbb
+cccccccccccc
\ No newline at end of file
diff --git a/src/main/resources/db/test.txt b/src/main/resources/db/test.txt
deleted file mode 100644
index d75b77f..0000000
--- a/src/main/resources/db/test.txt
+++ /dev/null
@@ -1 +0,0 @@
-66666666666666666
\ No newline at end of file
diff --git a/src/main/resources/static/js/base64.min.js b/src/main/resources/static/js/base64.min.js
new file mode 100644
index 0000000..fdb0fae
--- /dev/null
+++ b/src/main/resources/static/js/base64.min.js
@@ -0,0 +1,18 @@
+jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_VERSION="1.1";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw "Cannot decode base64";}
+ return idx;}
+ function _decode_chars(y,x){while(y.length>0){var ch=y[0];if(ch<0x80){y.shift();x.push(String.fromCharCode(ch));}else if((ch&0x80)==0xc0){if(y.length<2)break;ch=y.shift();var ch1=y.shift();x.push(String.fromCharCode(((ch&0x1f)<<6)+(ch1&0x3f)));}else{if(y.length<3)break;ch=y.shift();var ch1=y.shift();var ch2=y.shift();x.push(String.fromCharCode(((ch&0x0f)<<12)+((ch1&0x3f)<<6)+(ch2&0x3f)));}}}
+ function _decode(s){var pads=0,i,b10,imax=s.length,x=[],y=[];s=String(s);if(imax===0){return s;}
+ if(imax%4!==0){throw "Cannot decode base64";}
+ if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2;}
+ imax-=4;}
+ for(i=0;i>16);y.push((b10>>8)&0xff);y.push(b10&0xff);_decode_chars(y,x);}
+ switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);y.push(b10>>16);y.push((b10>>8)&0xff);break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);y.push(b10>>16);break;}
+ _decode_chars(y,x);if(y.length>0)throw "Cannot decode base64";return x.join("");}
+ function _get_chars(ch,y){if(ch<0x80)y.push(ch);else if(ch<0x800){y.push(0xc0+((ch>>6)&0x1f));y.push(0x80+(ch&0x3f));}else{y.push(0xe0+((ch>>12)&0xf));y.push(0x80+((ch>>6)&0x3f));y.push(0x80+(ch&0x3f));}}
+ function _encode(s){if(arguments.length!==1){throw "SyntaxError: exactly one argument required";}
+ s=String(s);if(s.length===0){return s;}
+ var i,b10,y=[],x=[],len=s.length;i=0;while(i=3){var ch1=y.shift();var ch2=y.shift();var ch3=y.shift();b10=(ch1<<16)|(ch2<<8)|ch3;x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&0x3F));x.push(_ALPHA.charAt((b10>>6)&0x3f));x.push(_ALPHA.charAt(b10&0x3f));}
+ i++;}
+ switch(y.length){case 1:var ch=y.shift();b10=ch<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&0x3F)+_PADCHAR+_PADCHAR);break;case 2:var ch1=y.shift();var ch2=y.shift();b10=(ch1<<16)|(ch2<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&0x3F)+_ALPHA.charAt((b10>>6)&0x3f)+_PADCHAR);break;}
+ return x.join("");}
+ return{decode:_decode,encode:_encode,VERSION:_VERSION};}(jQuery));
\ No newline at end of file
diff --git a/src/main/resources/static/webuploade/js/upload.js b/src/main/resources/static/webuploade/js/upload.js
index 1418bd3..d1427a4 100644
--- a/src/main/resources/static/webuploade/js/upload.js
+++ b/src/main/resources/static/webuploade/js/upload.js
@@ -2,6 +2,7 @@
(function( $ ){
// 当domReady的时候开始初始化
+ var d = 0;
$(function() {
var $wrap = $('#uploader'),
@@ -147,11 +148,12 @@
label: '点击选择文件'
},
formData: {
- uid: 123
+ setday:isday
},
dnd: '#wrapper',
paste: '#wrapper',
- swf: 'https://hellohao-cloud.oss-cn-beijing.aliyuncs.com/Uploader.swf',
+ //swf: 'https://hellohao-cloud.oss-cn-beijing.aliyuncs.com/Uploader.swf',
+ swf: '/webuploade/Uploader.sw',
chunked: false,//分片上传
chunkSize: 512 * 1024,
server: '/upimg',
@@ -256,10 +258,10 @@
label: '继续添加'
});
// 添加“添加下一个”模型的按钮,
- /*uploader.addButton({
- id: '#addModel',
- label: '添加下一个'
- });*/
+ // uploader.addButton({
+ // id: '#addModel',
+ // label: '添加下一个'
+ // });
uploader.on('ready', function() {
window.uploader = uploader;
});
@@ -453,9 +455,8 @@
function updateStatus() {
var text = '', stats;
-
if ( state === 'ready' ) {
- text = '选中' + fileCount + '张图片,共' +
+ text = '图片期限 选中' + fileCount + '张图片,共' +
WebUploader.formatSize( fileSize ) + '。';
} else if ( state === 'confirm' ) {
stats = uploader.getStats();
@@ -475,7 +476,12 @@
}
}
- $info.html( text );
+ $info.html( text);
+ if(isday>0){
+ $('#setday').text(isday+'天后销毁');
+ }else{
+ $('#setday').text('图片期限');
+ }
}
function setState( val ) {
diff --git a/src/main/resources/static/webuploade/js/webuploader.js b/src/main/resources/static/webuploade/js/webuploader.js
index a4b7299..a611f9a 100644
--- a/src/main/resources/static/webuploade/js/webuploader.js
+++ b/src/main/resources/static/webuploade/js/webuploader.js
@@ -3193,7 +3193,6 @@ var count2 = 0;
};
$.extend( Transport.prototype, {
-
// 添加Blob, 只能添加一次,最后一次有效。
appendBlob: function( key, blob, filename ) {
var me = this,
@@ -3216,6 +3215,7 @@ var count2 = 0;
// 添加其他字段
append: function( key, value ) {
if ( typeof key === 'object' ) {
+
$.extend( this._formData, key );
} else {
this._formData[ key ] = value;
@@ -3982,6 +3982,7 @@ var count2 = 0;
// 做上传操作。
_doSend: function( block ) {
+
var me = this,
owner = me.owner,
opts = me.options,
diff --git a/src/main/resources/templates/admin/index.html b/src/main/resources/templates/admin/index.html
index 41d08a6..003f663 100644
--- a/src/main/resources/templates/admin/index.html
+++ b/src/main/resources/templates/admin/index.html
@@ -87,7 +87,7 @@
-
- 我的图片
+ 图片列表
diff --git a/src/main/resources/templates/admin/storageconfig.html b/src/main/resources/templates/admin/storageconfig.html
index 160756a..25aa5dd 100644
--- a/src/main/resources/templates/admin/storageconfig.html
+++ b/src/main/resources/templates/admin/storageconfig.html
@@ -149,6 +149,7 @@
$("#c3 label").text('地区代码');
$("#keyusername").text('SecretId');
$("#keypass").text('SecretKey');
+ $("#ysm").text("如:北京地区就写ap-beijing");
}else if(data.value==7){
//$("#c3").css('display','none');
$("#c3-1").css('display','none');
@@ -156,12 +157,16 @@
$("#keyusername").text('FTP账号');
$("#keypass").text('FTP密码');
$("#c3 label").text('FTP地址');
+ $("#c3 label").text('FTP地址');
+ $("#ysm").text('按格式填写如:127.0.0.1:21不需要添加ftp:// 推荐使用21默认端口,修改过得端口先用xftp等客户端工具测试一下能不能链接。');
+
}else{
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
+ $("#ysm").text('需带有http://或https://');
}
}else{
$("#c1").css('display','none');
@@ -171,19 +176,21 @@
$("#c4").css('display','none');
$("#c5").css('display','none');
$("#c6").css('display','block');
- }
- if(data.value==6){
- $("#ysm").text("如:北京地区就写ap-beijing");
- }else{
- $("#ysm").text("需带有http://或https:");
- }
- if(data.value==7){
- $("#c3 label").text('FTP地址');
- $("#ysm").text('按格式填写如:127.0.0.1:21不需要添加ftp:// 推荐使用21默认端口,修改过得端口先用xftp等客户端工具测试一下能不能链接。');
- }else{
$("#c3 label").text('Endpoint');
$("#ysm").text('需带有http://或https://');
}
+ // if(data.value==6){
+ // $("#ysm").text("如:北京地区就写ap-beijing");
+ // }else{
+ // $("#ysm").text("需带有http://或https:");
+ // }
+ // if(data.value==7){
+ // $("#c3 label").text('FTP地址');
+ // $("#ysm").text('按格式填写如:127.0.0.1:21不需要添加ftp:// 推荐使用21默认端口,修改过得端口先用xftp等客户端工具测试一下能不能链接。');
+ // }else{
+ // $("#c3 label").text('Endpoint');
+ // $("#ysm").text('需带有http://或https://');
+ // }
$.ajax({
type: "POST",
url: "/admin/root/getkey",
@@ -260,31 +267,21 @@
$("#c3 label").text('地区代码');
$("#keyusername").text('SecretId');
$("#keypass").text('SecretKey');
+ $("#ysm").text("如:北京地区就写ap-beijing");
}else if(types==7){
- //$("#c3").css('display','none');
$("#c3-1").css('display','none');
$("#c4").css('display','none');
- //$("#c3 label").text('地区代码');
$("#keyusername").text('FTP账号');
$("#keypass").text('FTP密码');
+ $("#c3 label").text('FTP地址');
+ $("#ysm").text('按格式填写如:127.0.0.1:21不需要添加ftp:// 推荐使用21默认端口,修改过得端口先用xftp等客户端工具测试一下能不能链接。');
+
}else{
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
- }
-
- if(types==6){
- $("#ysm").text("如:北京地区就写ap-beijing");
- }else{
- $("#ysm").text("需带有http://或https:");
- }
- if(types==7){
- $("#c3 label").text('FTP地址');
- $("#ysm").text('按格式填写如:127.0.0.1:21不需要添加ftp:// 推荐使用21默认端口,修改过得端口先用xftp等客户端工具测试一下能不能链接。');
- }else{
- $("#c3 label").text('Endpoint');
$("#ysm").text('需带有http://或https://');
}
diff --git a/src/main/resources/templates/admin/survey.html b/src/main/resources/templates/admin/survey.html
index 02136b1..ac9e05c 100644
--- a/src/main/resources/templates/admin/survey.html
+++ b/src/main/resources/templates/admin/survey.html
@@ -14,8 +14,9 @@
-
+
+
diff --git a/src/main/resources/templates/admin/user.html b/src/main/resources/templates/admin/user.html
index bcf11a5..e24ab35 100644
--- a/src/main/resources/templates/admin/user.html
+++ b/src/main/resources/templates/admin/user.html
@@ -31,7 +31,7 @@
-
+