refactor(config): 重构配置管理并优化翻译功能
- 移除 @Component 注解,改用 @EnableConfigurationProperties 在启动类中启用配置 - 将PingPong支付配置从主配置文件移至开发环境配置文件 - 添加PayPal支付配置和百度翻译配置到开发环境 - 将商品和SKU名称翻译逻辑从查询时移至创建时,提高性能 - 移除运行时翻译方法,改为数据库中存储已翻译内容 - 标记PaymentController为过时,系统已切换到PayPal支付 - 优化pom.xml配置,添加classifier属性
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package com.mtkj.mtkjpay;
|
||||
|
||||
import com.mtkj.mtpay.config.AliyunOSSProperties;
|
||||
import com.mtkj.mtpay.config.BaiduTranslatorConfig;
|
||||
import com.mtkj.mtpay.config.PingPongProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
@@ -16,6 +20,11 @@ import org.springframework.core.env.Environment;
|
||||
com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure.class
|
||||
}
|
||||
)
|
||||
@EnableConfigurationProperties({
|
||||
PingPongProperties.class,
|
||||
BaiduTranslatorConfig.class,
|
||||
AliyunOSSProperties.class
|
||||
})
|
||||
public class MtkjpayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -60,8 +60,65 @@ spring:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
# 服务器配置(所有环境通用)
|
||||
server:
|
||||
port: 8082
|
||||
servlet:
|
||||
context-path: /
|
||||
# 文件上传配置
|
||||
multipart:
|
||||
# 单个文件最大大小(10MB)
|
||||
max-file-size: 10MB
|
||||
# 请求最大大小(50MB,支持多文件上传)
|
||||
max-request-size: 50MB
|
||||
# 文件写入磁盘的阈值(超过此大小会写入临时文件)
|
||||
file-size-threshold: 2MB
|
||||
|
||||
# 应用配置(所有环境通用)
|
||||
app:
|
||||
# 前端访问地址(用于生成商品详情页URL等)
|
||||
frontend:
|
||||
url: http://localhost:3000
|
||||
|
||||
# 阿里云OSS相关配置(所有环境通用)
|
||||
aliyun:
|
||||
oss:
|
||||
accessId: LTAI5tHbwvzWfANvNxju2yN1
|
||||
accessKey: sAQR2swByBgmMOofH97hSJT638aVcJ
|
||||
endpoint: https://oss-cn-hangzhou.aliyuncs.com
|
||||
bucketName: mtkj2025
|
||||
|
||||
# PingPong支付配置(开发环境使用沙箱)
|
||||
pingpong:
|
||||
client-id: your-client-id
|
||||
acc-id: your-acc-id
|
||||
secret: your-secret-key
|
||||
sign-type: MD5
|
||||
gateway: https://sandbox-acquirer-payment.pingpongx.com
|
||||
mode: sandbox
|
||||
enabled: false
|
||||
|
||||
# PayPal支付配置(开发环境使用沙箱)
|
||||
paypal:
|
||||
# PayPal Client ID(API密钥)
|
||||
client-id: AdGYUZpvLuHR30dybOApvM-RNB1pVKtd74SVfh-6TK52xV-1JEBddHVMCWuDdyyHri4DXd4kABBi7Icb
|
||||
# PayPal Client Secret(密钥)
|
||||
client-secret: ENblspyRmwsOU_PWFurlhEYUF5Da6aYKl0pjK4ehm7p3R5aSqvbpaF_YsIIs8v0ty1c9WJu15XP-Fe_1
|
||||
# 环境模式:sandbox(沙箱)或 production(生产)
|
||||
mode: sandbox
|
||||
# 是否启用PayPal支付
|
||||
enabled: true
|
||||
|
||||
# 百度翻译配置
|
||||
baidu:
|
||||
translator:
|
||||
app-id: 20250909002450241
|
||||
securityKey: o08lOpCcarl4Pb0BGdkq
|
||||
transApiHost: https://fanyi-api.baidu.com/api/trans/vip/translate
|
||||
qianfan:
|
||||
app-key: ALTAKUyxxqjXU9YhPNYXj8zFQ2
|
||||
app-secret: 2c43ca701e1641b0a945a3a65125c143
|
||||
app_id: 9ae03450-0036-4c61-93bc-659a95cea443
|
||||
Authorization: Bearer bce-v3/ALTAK-9pcPkK0ZLYIDyDJNtVwji/f32d29d61a86e6e4e8c60d5297a310538b3920a7
|
||||
url: https://qianfan.baidubce.com/v2/app/conversation/runs
|
||||
|
||||
|
||||
@@ -61,17 +61,7 @@ spring:
|
||||
# 逻辑未删除值
|
||||
logic-not-delete-value: 0
|
||||
|
||||
# PingPong支付配置
|
||||
pingpong:
|
||||
client-id: your-client-id
|
||||
acc-id: your-acc-id
|
||||
secret: your-secret-key
|
||||
sign-type: MD5
|
||||
gateway: https://sandbox-acquirer-payment.pingpongx.com
|
||||
mode: sandbox
|
||||
enabled: true
|
||||
|
||||
# 服务器配置
|
||||
# 服务器配置(所有环境通用)
|
||||
server:
|
||||
port: 8082
|
||||
servlet:
|
||||
@@ -85,13 +75,13 @@ server:
|
||||
# 文件写入磁盘的阈值(超过此大小会写入临时文件)
|
||||
file-size-threshold: 2MB
|
||||
|
||||
# 应用配置
|
||||
# 应用配置(所有环境通用)
|
||||
app:
|
||||
# 前端访问地址(用于生成商品详情页URL等)
|
||||
frontend:
|
||||
url: http://localhost:3000
|
||||
|
||||
# 阿里云OSS相关配置
|
||||
# 阿里云OSS相关配置(所有环境通用)
|
||||
aliyun:
|
||||
oss:
|
||||
accessId: LTAI5tHbwvzWfANvNxju2yN1
|
||||
|
||||
Reference in New Issue
Block a user