fix: 修复个人中心问题
This commit is contained in:
@@ -14,7 +14,6 @@ import jakarta.annotation.PostConstruct;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -30,7 +29,7 @@ import java.time.LocalDateTime;
|
||||
* @since 2.3.0
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnExpression("'${oss.enabled}' == 'true' and '${oss.type}' == 'aliyun'")
|
||||
@ConditionalOnProperty(value = "oss.type", havingValue = "aliyun")
|
||||
@ConfigurationProperties(prefix = "oss.aliyun")
|
||||
@RequiredArgsConstructor
|
||||
@Data
|
||||
|
||||
@@ -14,7 +14,6 @@ import jakarta.annotation.PostConstruct;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -33,7 +32,7 @@ import java.time.LocalDateTime;
|
||||
* @since 2023/6/2
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnExpression("'${oss.enabled}' == 'true' and '${oss.type}' == 'minio'")
|
||||
@ConditionalOnProperty(value = "oss.enabled", havingValue = "true" )
|
||||
@ConfigurationProperties(prefix = "oss.minio")
|
||||
@RequiredArgsConstructor
|
||||
@Data
|
||||
@@ -69,8 +68,8 @@ public class MinioOssService implements OssService {
|
||||
.endpoint(endpoint)
|
||||
.credentials(accessKey, secretKey)
|
||||
.build();
|
||||
// 创建存储桶
|
||||
createBucketIfAbsent(bucketName);
|
||||
// 创建存储桶(存储桶不存在)
|
||||
// createBucketIfAbsent(bucketName);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +82,9 @@ public class MinioOssService implements OssService {
|
||||
@Override
|
||||
public FileInfo uploadFile(MultipartFile file) {
|
||||
|
||||
// 创建存储桶(存储桶不存在),如果有搭建好的minio服务,建议放在init方法中
|
||||
createBucketIfAbsent(bucketName);
|
||||
|
||||
// 生成文件名(日期文件夹)
|
||||
String suffix = FileUtil.getSuffix(file.getOriginalFilename());
|
||||
String uuid = IdUtil.simpleUUID();
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "oss.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "OSS 开关"
|
||||
},
|
||||
{
|
||||
"name": "oss.type",
|
||||
"type": "java.lang.String",
|
||||
|
||||
@@ -41,6 +41,21 @@ spring:
|
||||
time-to-live: 3600000
|
||||
# 缓存null值,防止缓存穿透
|
||||
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:
|
||||
global-config:
|
||||
db-config:
|
||||
@@ -78,9 +93,10 @@ security:
|
||||
- /ws/**
|
||||
- /ws-app/**
|
||||
|
||||
# 文件存储配置
|
||||
oss:
|
||||
# OSS 类型 (目前支持aliyun、minio)
|
||||
type: minio
|
||||
type: aliyun
|
||||
# MinIO 对象存储服务
|
||||
minio:
|
||||
# 服务Endpoint
|
||||
@@ -104,6 +120,23 @@ oss:
|
||||
# 存储桶名称
|
||||
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:
|
||||
swagger-ui:
|
||||
|
||||
@@ -75,7 +75,8 @@ security:
|
||||
- /api/v1/auth/captcha
|
||||
- /ws/**
|
||||
- /ws-app/**
|
||||
# 文件上传配置
|
||||
|
||||
# 文件存储配置
|
||||
oss:
|
||||
# OSS 类型 (目前支持aliyun、minio)
|
||||
type: minio
|
||||
@@ -102,6 +103,23 @@ oss:
|
||||
# 存储桶名称
|
||||
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:
|
||||
swagger-ui:
|
||||
|
||||
@@ -60,4 +60,3 @@ generator:
|
||||
extension: .vue
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user