fix: 修复个人中心问题

This commit is contained in:
ray
2024-08-19 00:50:59 +08:00
parent fd3f889f56
commit dfccc03f48
6 changed files with 60 additions and 14 deletions

View File

@@ -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

View File

@@ -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();

View File

@@ -1,10 +1,5 @@
{
"properties": [
{
"name": "oss.enabled",
"type": "java.lang.Boolean",
"description": "OSS 开关"
},
{
"name": "oss.type",
"type": "java.lang.String",

View File

@@ -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:

View File

@@ -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:

View File

@@ -60,4 +60,3 @@ generator:
extension: .vue