张延森 5 lat temu
rodzic
commit
be1405007e

+ 1
- 6
foyo-service/pom.xml Wyświetl plik

10
 	</parent>
10
 	</parent>
11
 	<groupId>com.huiju</groupId>
11
 	<groupId>com.huiju</groupId>
12
 	<artifactId>foyo</artifactId>
12
 	<artifactId>foyo</artifactId>
13
-	<version>0.0.1-SNAPSHOT</version>
13
+	<version>v0.1.0</version>
14
 	<name>foyo</name>
14
 	<name>foyo</name>
15
 	<description>Demo project for Spring Boot</description>
15
 	<description>Demo project for Spring Boot</description>
16
 
16
 
51
 			<version>1.2.56</version>
51
 			<version>1.2.56</version>
52
 			<scope>compile</scope>
52
 			<scope>compile</scope>
53
 		</dependency>
53
 		</dependency>
54
-		<dependency>
55
-			<groupId>com.aliyun.oss</groupId>
56
-			<artifactId>aliyun-sdk-oss</artifactId>
57
-			<version>2.8.3</version>
58
-		</dependency>
59
 
54
 
60
 		<dependency>
55
 		<dependency>
61
 			<groupId>com.github.pagehelper</groupId>
56
 			<groupId>com.github.pagehelper</groupId>

+ 19
- 23
foyo-service/src/main/java/com/huiju/foyo/service/impl/ImageServiceimpl.java Wyświetl plik

1
 package com.huiju.foyo.service.impl;
1
 package com.huiju.foyo.service.impl;
2
 
2
 
3
-import com.aliyun.oss.OSSClient;
4
 import com.huiju.foyo.service.ImageServiceI;
3
 import com.huiju.foyo.service.ImageServiceI;
4
+import org.springframework.beans.factory.annotation.Value;
5
 import org.springframework.stereotype.Service;
5
 import org.springframework.stereotype.Service;
6
 import org.springframework.web.multipart.MultipartFile;
6
 import org.springframework.web.multipart.MultipartFile;
7
 
7
 
8
 import java.io.ByteArrayInputStream;
8
 import java.io.ByteArrayInputStream;
9
+import java.io.File;
9
 import java.io.IOException;
10
 import java.io.IOException;
10
 import java.util.Date;
11
 import java.util.Date;
11
 
12
 
17
  */
18
  */
18
 @Service("ImageService")
19
 @Service("ImageService")
19
 public class ImageServiceimpl implements ImageServiceI {
20
 public class ImageServiceimpl implements ImageServiceI {
20
-
21
-    private static String endpoint = "http://oss-cn-shanghai.aliyuncs.com";
22
-    private static String accessKeyId = "LTAIkc75dpkJw8Lb";
23
-    private static String accessKeySecret = "v4bvXCaix6vSDTCFfwSAdqV53iFEQw";
24
-    private static String bucketName = "jingcheng-h5temp";
25
-
21
+    @Value("${assets.images}")
22
+    String imagePath;
23
+    
26
     @Override
24
     @Override
27
     public String getImageUrl(MultipartFile uploadFile) throws IOException {
25
     public String getImageUrl(MultipartFile uploadFile) throws IOException {
28
-
26
+        //保存的文件名
29
         String imgName = System.currentTimeMillis() + ".png";
27
         String imgName = System.currentTimeMillis() + ".png";
30
-        // 创建OSSClient实例
31
-        OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
32
-        // 上传
33
-        long time = System.currentTimeMillis();
34
-
35
-        ossClient.putObject(bucketName, imgName, new ByteArrayInputStream(uploadFile.getBytes()));
36
-
37
-        // 关闭client
38
-        ossClient.shutdown();
39
-        Date expiration = new Date(time + 3600 * 1000 * 24 * 365 * 10);
40
-        String url = ossClient.generatePresignedUrl(bucketName, imgName, expiration).toString();
41
-
42
-        // 截取掉签名
43
-        url = url.substring(0, url.lastIndexOf("&Signature"));
44
-        return url;
28
+        //保存路径
29
+        String path = imagePath + imgName;
30
+        String rebackPath = "uploadimage/" + imgName;
31
+        //生成保存文件
32
+        File troUploadFile = new File(path);
33
+        //将上传文件保存到路径
34
+        try {
35
+            uploadFile.transferTo(troUploadFile);
36
+        } catch (IOException e) {
37
+            e.printStackTrace();
38
+        }
39
+        
40
+        return rebackPath;
45
     }
41
     }
46
 }
42
 }

+ 5
- 0
foyo-service/src/main/resources/application.yml Wyświetl plik

13
   configuration:
13
   configuration:
14
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
14
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
15
   mapper-locations: classpath:mapper/*.xml
15
   mapper-locations: classpath:mapper/*.xml
16
+
16
 server:
17
 server:
17
   port: 8080
18
   port: 8080
19
+
20
+assets:
21
+  images: /opt/www/upload/images/
22
+

+ 1
- 1
vue-element-admin/config/index.js Wyświetl plik

60
      * then assetsPublicPath should be set to "/bar/".
60
      * then assetsPublicPath should be set to "/bar/".
61
      * In most cases please use '/' !!!
61
      * In most cases please use '/' !!!
62
      */
62
      */
63
-    assetsPublicPath: '/',
63
+    assetsPublicPath: './',
64
 
64
 
65
     /**
65
     /**
66
      * Source Maps
66
      * Source Maps

+ 1
- 1
vue-element-admin/config/prod.env.js Wyświetl plik

1
 module.exports = {
1
 module.exports = {
2
   NODE_ENV: '"production"',
2
   NODE_ENV: '"production"',
3
   ENV_CONFIG: '"prod"',
3
   ENV_CONFIG: '"prod"',
4
-  BASE_API: '"https://api-prod"'
4
+  BASE_API: '"/api/admin/"'
5
 }
5
 }

+ 2
- 1
vue-element-admin/src/views/carousel/edit.vue Wyświetl plik

12
           :action= "uploadImgUrl"
12
           :action= "uploadImgUrl"
13
           :show-file-list="false"
13
           :show-file-list="false"
14
           :on-success="handleAvatarSuccess"
14
           :on-success="handleAvatarSuccess"
15
+          :with-credentials="true"
15
           class="avatar-uploader"
16
           class="avatar-uploader"
16
           name="uploadFiles">
17
           name="uploadFiles">
17
           <img v-if="imageUrl" :src="imageUrl" class="avatar">
18
           <img v-if="imageUrl" :src="imageUrl" class="avatar">
83
         sort: '',
84
         sort: '',
84
         imageUrl: ''
85
         imageUrl: ''
85
       },
86
       },
86
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
87
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
87
       dialogStatus: '',
88
       dialogStatus: '',
88
       downloadLoading: false,
89
       downloadLoading: false,
89
       formLabelWidth: '120px',
90
       formLabelWidth: '120px',

+ 1
- 1
vue-element-admin/src/views/case/CoverMovement.vue Wyświetl plik

78
         labelList: [],
78
         labelList: [],
79
         type: 'movement'
79
         type: 'movement'
80
       },
80
       },
81
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
81
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
82
       dialogStatus: '',
82
       dialogStatus: '',
83
       downloadLoading: false,
83
       downloadLoading: false,
84
       formLabelWidth: '120px',
84
       formLabelWidth: '120px',

+ 1
- 1
vue-element-admin/src/views/case/add.vue Wyświetl plik

131
         content: '',
131
         content: '',
132
         type: 'case'
132
         type: 'case'
133
       },
133
       },
134
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
134
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
135
       dialogStatus: '',
135
       dialogStatus: '',
136
       downloadLoading: false,
136
       downloadLoading: false,
137
       formLabelWidth: '120px',
137
       formLabelWidth: '120px',

+ 2
- 1
vue-element-admin/src/views/case/cover.vue Wyświetl plik

6
           :action= "uploadImgUrl"
6
           :action= "uploadImgUrl"
7
           :show-file-list="false"
7
           :show-file-list="false"
8
           :on-success="handleAvatarSuccess"
8
           :on-success="handleAvatarSuccess"
9
+          :with-credentials="true"
9
           class="avatar-uploader"
10
           class="avatar-uploader"
10
           name="uploadFiles">
11
           name="uploadFiles">
11
           <img v-if="imageUrl" :src="imageUrl" class="avatar">
12
           <img v-if="imageUrl" :src="imageUrl" class="avatar">
78
         labelList: [],
79
         labelList: [],
79
         type: 'case'
80
         type: 'case'
80
       },
81
       },
81
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
82
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
82
       dialogStatus: '',
83
       dialogStatus: '',
83
       downloadLoading: false,
84
       downloadLoading: false,
84
       formLabelWidth: '120px',
85
       formLabelWidth: '120px',

+ 1
- 1
vue-element-admin/src/views/case/edit.vue Wyświetl plik

131
         content: '',
131
         content: '',
132
         type: 'case'
132
         type: 'case'
133
       },
133
       },
134
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
134
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
135
       dialogStatus: '',
135
       dialogStatus: '',
136
       downloadLoading: false,
136
       downloadLoading: false,
137
       formLabelWidth: '120px',
137
       formLabelWidth: '120px',

+ 1
- 1
vue-element-admin/src/views/case/servicecase/add.vue Wyświetl plik

101
         serviceImageUrl: '',
101
         serviceImageUrl: '',
102
         labelList: []
102
         labelList: []
103
       },
103
       },
104
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
104
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
105
       dialogStatus: '',
105
       dialogStatus: '',
106
       downloadLoading: false,
106
       downloadLoading: false,
107
       formLabelWidth: '120px',
107
       formLabelWidth: '120px',

+ 1
- 1
vue-element-admin/src/views/company/edit.vue Wyświetl plik

75
         sort: '',
75
         sort: '',
76
         companyImg: ''
76
         companyImg: ''
77
       },
77
       },
78
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
78
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
79
       dialogStatus: '',
79
       dialogStatus: '',
80
       downloadLoading: false,
80
       downloadLoading: false,
81
       formLabelWidth: '120px',
81
       formLabelWidth: '120px',

+ 1
- 1
vue-element-admin/src/views/partner/add.vue Wyświetl plik

83
         sort: '',
83
         sort: '',
84
         logoImg: ''
84
         logoImg: ''
85
       },
85
       },
86
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
86
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
87
       dialogStatus: '',
87
       dialogStatus: '',
88
       downloadLoading: false,
88
       downloadLoading: false,
89
       formLabelWidth: '120px',
89
       formLabelWidth: '120px',

+ 1
- 1
vue-element-admin/src/views/service/edit.vue Wyświetl plik

103
         serviceImageUrl: '',
103
         serviceImageUrl: '',
104
         labelList: []
104
         labelList: []
105
       },
105
       },
106
-      uploadImgUrl: process.env.BASE_API + '/uploadimage',
106
+      uploadImgUrl: process.env.BASE_API + 'uploadimage',
107
       dialogStatus: '',
107
       dialogStatus: '',
108
       downloadLoading: false,
108
       downloadLoading: false,
109
       formLabelWidth: '120px',
109
       formLabelWidth: '120px',