From e2e723eb52cc164e6230952bfd2049d911af592a Mon Sep 17 00:00:00 2001
From: hello-hao <923453645@qq.com>
Date: Fri, 29 Dec 2023 17:28:08 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E5=BC=BA=E5=88=B6?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=8C=E4=BC=98=E5=8C=96=E4=B8=83=E7=89=9B?=
=?UTF-8?q?=E4=BA=91=E5=AF=B9=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
.../java/cn/hellohao/auth/token/JWTUtil.java | 3 +-
.../hellohao/controller/AdminController.java | 3 +-
.../hellohao/controller/IndexController.java | 7 ++-
.../service/impl/KODOImageupload.java | 49 +++++--------------
.../cn/hellohao/service/impl/deleImages.java | 43 ++++++++++------
6 files changed, 49 insertions(+), 58 deletions(-)
diff --git a/pom.xml b/pom.xml
index ad5d0f0..31ecdc5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -196,7 +196,7 @@
com.qiniu
qiniu-java-sdk
- 7.2.22
+ 7.14.0
com.qcloud
diff --git a/src/main/java/cn/hellohao/auth/token/JWTUtil.java b/src/main/java/cn/hellohao/auth/token/JWTUtil.java
index 7c6b254..9596873 100644
--- a/src/main/java/cn/hellohao/auth/token/JWTUtil.java
+++ b/src/main/java/cn/hellohao/auth/token/JWTUtil.java
@@ -8,7 +8,6 @@ import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.TokenExpiredException;
import com.auth0.jwt.interfaces.DecodedJWT;
-import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -24,7 +23,7 @@ public class JWTUtil {
public static String createToken(User user){
Calendar calendar = Calendar.getInstance();
- calendar.add(Calendar.SECOND,604800 );//单位秒,604800 为7天
+ calendar.add(Calendar.SECOND,2592000 );//单位秒
Algorithm algorithm = Algorithm.HMAC256(SECRET);
String token = JWT.create()
.withClaim("email", user.getEmail())
diff --git a/src/main/java/cn/hellohao/controller/AdminController.java b/src/main/java/cn/hellohao/controller/AdminController.java
index 63317f3..a29f5a4 100644
--- a/src/main/java/cn/hellohao/controller/AdminController.java
+++ b/src/main/java/cn/hellohao/controller/AdminController.java
@@ -467,6 +467,7 @@ public class AdminController {
JSONObject jsonObj = JSONObject.parseObject(data);
String images = jsonObj.getString("images");
String uuid = jsonObj.getString("uuid");
+ Boolean forceDel = jsonObj.getBoolean("forceDel")==null?false:jsonObj.getBoolean("forceDel");
if (images == null) {
msg.setCode("404");
msg.setInfo("为获取到图像信息");
@@ -499,7 +500,7 @@ public class AdminController {
if (imgIds.size() == 0) {
msg.setCode("110404");
} else {
- deleimages.dele(uuid, imgIds.stream().toArray(Long[]::new));
+ deleimages.dele(forceDel,uuid, imgIds.stream().toArray(Long[]::new));
msg.setCode("200");
}
return msg;
diff --git a/src/main/java/cn/hellohao/controller/IndexController.java b/src/main/java/cn/hellohao/controller/IndexController.java
index 2d404d8..9923d4d 100644
--- a/src/main/java/cn/hellohao/controller/IndexController.java
+++ b/src/main/java/cn/hellohao/controller/IndexController.java
@@ -44,10 +44,11 @@ public class IndexController {
@Autowired private IRedisService iRedisService;
@Autowired private AppClientService appClientService;
+ public static String version = "20230925";
@RequestMapping(value = "/")
public String Welcome(Model model, HttpServletRequest httpServletRequest) {
model.addAttribute("name", "服务端程序(开源版)");
- model.addAttribute("version", "20230925");
+ model.addAttribute("version", version);
model.addAttribute("ip", GetIPS.getIpAddr(httpServletRequest));
model.addAttribute("links", "https://github.com/Hello-hao/tbed");
return "welcome";
@@ -64,6 +65,7 @@ public class IndexController {
JSONObject jsonObject = new JSONObject();
AppClient appClient = appClientService.getAppClientData("app");
jsonObject.put("webname", cd.getString("webname"));
+ jsonObject.put("version",version);
jsonObject.put("websubtitle", cd.getString("websubtitle"));
jsonObject.put("keywords", cd.getString("keywords"));
jsonObject.put("webms", cd.getString("webms"));
@@ -79,6 +81,7 @@ public class IndexController {
jsonObject.put("clientname", appClient.getAppname());
jsonObject.put("clientlogo", appClient.getApplogo());
jsonObject.put("appupdate", appClient.getAppupdate());
+ jsonObject.put("serverVersion",version);
msg.setData(jsonObject);
return msg;
}
@@ -380,7 +383,7 @@ public class IndexController {
return msg;
}
}
- msg = deleimages.dele(null, image.getId());
+ msg = deleimages.dele(false,null, image.getId());
List Delids = (List) msg.getData();
if (!Delids.contains(image.getId())) {
msg.setCode("500");
diff --git a/src/main/java/cn/hellohao/service/impl/KODOImageupload.java b/src/main/java/cn/hellohao/service/impl/KODOImageupload.java
index 3663314..ff30687 100644
--- a/src/main/java/cn/hellohao/service/impl/KODOImageupload.java
+++ b/src/main/java/cn/hellohao/service/impl/KODOImageupload.java
@@ -5,10 +5,10 @@ import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
-import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
+import com.qiniu.storage.Region;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.storage.model.FileInfo;
@@ -28,18 +28,7 @@ public class KODOImageupload {
public ReturnImage ImageuploadKODO(
Map