| | |
| | | import com.aliyun.oss.OSS; |
| | | import com.aliyun.oss.OSSClientBuilder; |
| | | import com.mzl.flower.config.OssProperties; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.utils.UUIDGenerator; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | // 把上传之后文件路径返回,需手动拼接上传到阿里云的oss路径 |
| | | // https://edu-mys.oss-cn-chengdu.aliyuncs.com/yy.JPG |
| | | String url = bucketName + "." + endPoint + "/" + filename; |
| | | |
| | | return url; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | throw new ValidationException("上传到云服务器发生异常"); |
| | | // return null; |
| | | } |
| | | } |
| | | } |