111
k94314517
2024-02-19 deb3baf0fb04c3a9f5b0d4b5bd9fb3237908d576
server/company/src/main/java/com/doumee/api/common/PublicController.java
@@ -129,6 +129,17 @@
                    String tempFileName =  nowDate + "/" + fileName;
                    String key = folder + tempFileName;// 文件名
                    ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key);
                    int type = 2;
                    if(StringUtils.endsWith(key,".mp4")){
                        type =1;
                    }else if(StringUtils.endsWith(key,".jpg")
                            || StringUtils.endsWith(key,".JPG")
                            || StringUtils.endsWith(key,".png")
                            || StringUtils.endsWith(key,".PNG")
                            || StringUtils.endsWith(key,".jpeg")
                            || StringUtils.endsWith(key,".JPEG")){
                        type =0;
                    }
                    if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) {
                        // 移动成功,返回文件名
                        // sendSuccessMessage(response, resourcePath+key);
@@ -139,6 +150,7 @@
                        fileJSON.put("url", resourcePath + key);
                        fileJSON.put("imgaddr", tempFileName);
                        fileJSON.put("imgname", fileName);
                        fileJSON.put("type", type);
                        fileJSON.put("originname", originname);
                        context.put("data",fileJSON);
                        context.put("message","请求成功");