diff --git a/src/main/java/cn/hellohao/controller/IndexController.java b/src/main/java/cn/hellohao/controller/IndexController.java index 18002ca..c77116f 100644 --- a/src/main/java/cn/hellohao/controller/IndexController.java +++ b/src/main/java/cn/hellohao/controller/IndexController.java @@ -44,7 +44,7 @@ public class IndexController { @Autowired private IRedisService iRedisService; @Autowired private AppClientService appClientService; - public static String version = "20240102"; + public static String version = "20240111"; @RequestMapping(value = "/") public String Welcome(Model model, HttpServletRequest httpServletRequest) { model.addAttribute("name", "服务端程序(开源版)"); diff --git a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java index c67b55c..92be40b 100644 --- a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java +++ b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java @@ -131,10 +131,9 @@ public class ImgServiceImpl implements ImgService { if(sysConfig.getCheckduplicate().equals("1")){ //查重 Images img = new Images(); - img.setUserid(user.getId()); + img.setUserid(user==null?0:user.getId()); img.setMd5key(images.getMd5key()); List list = imgMapper.selectImgUrlByMD5(img); - jsonObject.put("url", list.get(0).getImgurl()); if (list.size() > 0) { jsonObject.put("url", list.get(0).getImgurl()); jsonObject.put("name", flilename); diff --git a/src/main/java/cn/hellohao/service/impl/UploadServicel.java b/src/main/java/cn/hellohao/service/impl/UploadServicel.java index e86425a..4d4d4e5 100644 --- a/src/main/java/cn/hellohao/service/impl/UploadServicel.java +++ b/src/main/java/cn/hellohao/service/impl/UploadServicel.java @@ -129,6 +129,11 @@ public class UploadServicel { } } } + // 判断路径格式 处理一下,去掉最前面的/ + String RootPath = key.getRootPath().replace(" ", ""); + if (!RootPath.equals("/")) { + updatePath = RootPath.substring(1) + "/" + updatePath; + } // 先存数据库 Images imgObj = new Images(); String imgnameEd = null; @@ -176,6 +181,7 @@ public class UploadServicel { } long stime = System.currentTimeMillis(); + System.out.println("上传前地址:"+updatePath); ReturnImage returnImage = getSource.storageSource(key.getStorageType(), map, updatePath, key.getId()); if (returnImage.getCode().equals("200")) { long etime = System.currentTimeMillis(); @@ -215,7 +221,6 @@ public class UploadServicel { String md5 = jsonObj.getString("md5"); String classifications = jsonObj.getString("classifications"); Integer day = jsonObj.getInteger("day"); - String source = jsonObj.getString("source"); String imgIdentifier = jsonObj.getString("imgIdentifier"); JSONArray jsonArray = new JSONArray(); classifications = classifications==null?"":classifications;