fix: 修复个人中心问题
This commit is contained in:
@@ -14,7 +14,6 @@ import jakarta.annotation.PostConstruct;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -30,7 +29,7 @@ import java.time.LocalDateTime;
|
|||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnExpression("'${oss.enabled}' == 'true' and '${oss.type}' == 'aliyun'")
|
@ConditionalOnProperty(value = "oss.type", havingValue = "aliyun")
|
||||||
@ConfigurationProperties(prefix = "oss.aliyun")
|
@ConfigurationProperties(prefix = "oss.aliyun")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import jakarta.annotation.PostConstruct;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -33,7 +32,7 @@ import java.time.LocalDateTime;
|
|||||||
* @since 2023/6/2
|
* @since 2023/6/2
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnExpression("'${oss.enabled}' == 'true' and '${oss.type}' == 'minio'")
|
@ConditionalOnProperty(value = "oss.enabled", havingValue = "true" )
|
||||||
@ConfigurationProperties(prefix = "oss.minio")
|
@ConfigurationProperties(prefix = "oss.minio")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
@@ -69,8 +68,8 @@ public class MinioOssService implements OssService {
|
|||||||
.endpoint(endpoint)
|
.endpoint(endpoint)
|
||||||
.credentials(accessKey, secretKey)
|
.credentials(accessKey, secretKey)
|
||||||
.build();
|
.build();
|
||||||
// 创建存储桶
|
// 创建存储桶(存储桶不存在)
|
||||||
createBucketIfAbsent(bucketName);
|
// createBucketIfAbsent(bucketName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -83,6 +82,9 @@ public class MinioOssService implements OssService {
|
|||||||
@Override
|
@Override
|
||||||
public FileInfo uploadFile(MultipartFile file) {
|
public FileInfo uploadFile(MultipartFile file) {
|
||||||
|
|
||||||
|
// 创建存储桶(存储桶不存在),如果有搭建好的minio服务,建议放在init方法中
|
||||||
|
createBucketIfAbsent(bucketName);
|
||||||
|
|
||||||
// 生成文件名(日期文件夹)
|
// 生成文件名(日期文件夹)
|
||||||
String suffix = FileUtil.getSuffix(file.getOriginalFilename());
|
String suffix = FileUtil.getSuffix(file.getOriginalFilename());
|
||||||
String uuid = IdUtil.simpleUUID();
|
String uuid = IdUtil.simpleUUID();
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
{
|
{
|
||||||
"properties": [
|
"properties": [
|
||||||
{
|
|
||||||
"name": "oss.enabled",
|
|
||||||
"type": "java.lang.Boolean",
|
|
||||||
"description": "OSS 开关"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "oss.type",
|
"name": "oss.type",
|
||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
|
|||||||
@@ -41,6 +41,21 @@ spring:
|
|||||||
time-to-live: 3600000
|
time-to-live: 3600000
|
||||||
# 缓存null值,防止缓存穿透
|
# 缓存null值,防止缓存穿透
|
||||||
cache-null-values: true
|
cache-null-values: true
|
||||||
|
# 邮件配置
|
||||||
|
mail:
|
||||||
|
host: smtp.youlai.tech
|
||||||
|
port: 587
|
||||||
|
username: your-email@example.com
|
||||||
|
password: 123456
|
||||||
|
properties:
|
||||||
|
mail:
|
||||||
|
smtp:
|
||||||
|
auth: true
|
||||||
|
starttls:
|
||||||
|
enable: true
|
||||||
|
# 邮件发送者
|
||||||
|
from: youlaitech@163.com
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
global-config:
|
global-config:
|
||||||
db-config:
|
db-config:
|
||||||
@@ -78,9 +93,10 @@ security:
|
|||||||
- /ws/**
|
- /ws/**
|
||||||
- /ws-app/**
|
- /ws-app/**
|
||||||
|
|
||||||
|
# 文件存储配置
|
||||||
oss:
|
oss:
|
||||||
# OSS 类型 (目前支持aliyun、minio)
|
# OSS 类型 (目前支持aliyun、minio)
|
||||||
type: minio
|
type: aliyun
|
||||||
# MinIO 对象存储服务
|
# MinIO 对象存储服务
|
||||||
minio:
|
minio:
|
||||||
# 服务Endpoint
|
# 服务Endpoint
|
||||||
@@ -104,6 +120,23 @@ oss:
|
|||||||
# 存储桶名称
|
# 存储桶名称
|
||||||
bucket-name: default
|
bucket-name: default
|
||||||
|
|
||||||
|
# 短信配置
|
||||||
|
sms:
|
||||||
|
# 阿里云短信
|
||||||
|
aliyun:
|
||||||
|
accessKeyId: LTAI5tSMgfxxxxxxdiBJLyR
|
||||||
|
accessKeySecret: SoOWRqpjtS7xxxxxxZ2PZiMTJOVC
|
||||||
|
domain: dysmsapi.aliyuncs.com
|
||||||
|
regionId: cn-shanghai
|
||||||
|
signName: 有来技术
|
||||||
|
templateCodes:
|
||||||
|
# 注册(预留)
|
||||||
|
register: SMS_22xxx771
|
||||||
|
# 登录(预留)
|
||||||
|
login: SMS_22xxx772
|
||||||
|
# 修改密码
|
||||||
|
changePassword: SMS_22xxx773
|
||||||
|
|
||||||
# springdoc配置: https://springdoc.org/properties.html
|
# springdoc配置: https://springdoc.org/properties.html
|
||||||
springdoc:
|
springdoc:
|
||||||
swagger-ui:
|
swagger-ui:
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ security:
|
|||||||
- /api/v1/auth/captcha
|
- /api/v1/auth/captcha
|
||||||
- /ws/**
|
- /ws/**
|
||||||
- /ws-app/**
|
- /ws-app/**
|
||||||
# 文件上传配置
|
|
||||||
|
# 文件存储配置
|
||||||
oss:
|
oss:
|
||||||
# OSS 类型 (目前支持aliyun、minio)
|
# OSS 类型 (目前支持aliyun、minio)
|
||||||
type: minio
|
type: minio
|
||||||
@@ -102,6 +103,23 @@ oss:
|
|||||||
# 存储桶名称
|
# 存储桶名称
|
||||||
bucket-name: default
|
bucket-name: default
|
||||||
|
|
||||||
|
# 短信配置
|
||||||
|
sms:
|
||||||
|
# 阿里云短信
|
||||||
|
aliyun:
|
||||||
|
accessKeyId: LTAI5tSMgfxxxxxxdiBJLyR
|
||||||
|
accessKeySecret: SoOWRqpjtS7xxxxxxZ2PZiMTJOVC
|
||||||
|
domain: dysmsapi.aliyuncs.com
|
||||||
|
regionId: cn-shanghai
|
||||||
|
signName: 有来技术
|
||||||
|
templateCodes:
|
||||||
|
# 注册(预留)
|
||||||
|
register: SMS_22xxx771
|
||||||
|
# 登录(预留)
|
||||||
|
login: SMS_22xxx772
|
||||||
|
# 修改密码
|
||||||
|
changePassword: SMS_22xxx773
|
||||||
|
|
||||||
# springdoc配置: https://springdoc.org/properties.html
|
# springdoc配置: https://springdoc.org/properties.html
|
||||||
springdoc:
|
springdoc:
|
||||||
swagger-ui:
|
swagger-ui:
|
||||||
|
|||||||
@@ -60,4 +60,3 @@ generator:
|
|||||||
extension: .vue
|
extension: .vue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user