feat(config): 更新配置以支持HTTPS域名访问

- 将所有环境的前端URL从localhost和IP地址更新为https://shopd.mtkj2025.com
- 配置PayPal webhook使用HTTPS域名以满足PayPal安全要求
- 统一后端服务端口从18082调整为8082
- 更新Java代码中的默认URL配置和启动日志信息
- 创建域名配置、Nginx SSL配置和公网访问检查清单文档
- 为商品链接生成和API访问配置HTTPS协议支持
This commit is contained in:
2025-12-26 15:18:34 +08:00
parent bbf235362c
commit a3633577b4
12 changed files with 484 additions and 31 deletions

View File

@@ -32,8 +32,10 @@ public class MtPayApplication {
String contextPath = env.getProperty("server.servlet.context-path", "");
String activeProfiles = String.join(",", env.getActiveProfiles());
// 构建完整的访问地址
String baseUrl = "http://localhost:" + serverPort + contextPath;
// 构建完整的访问地址(使用域名)
String serverHost = env.getProperty("app.server.host", "shopd.mtkj2025.com");
String protocol = env.getProperty("app.server.protocol", "https");
String baseUrl = protocol + "://" + serverHost + ":" + serverPort + contextPath;
String apiUrl = baseUrl + "/api";
String druidUrl = baseUrl + "/druid";
@@ -71,7 +73,7 @@ public class MtPayApplication {
log.info("""
📌 提示:
- 前端代理地址: http://localhost:3000
- 前端地址: https://shopd.mtkj2025.com
- 后端API地址: {}
- 图片上传接口: {}/product/upload/image
- 商品管理接口: {}/product

View File

@@ -25,7 +25,7 @@ public class ProductLinkServiceImpl implements ProductLinkService {
@Autowired
private MtProductLinkMapper productLinkMapper;
@Value("${app.frontend.url:http://localhost:3000}")
@Value("${app.frontend.url:https://shopd.mtkj2025.com}")
private String frontendUrl;
private static final int DEFAULT_EXPIRE_DAYS = 90;

View File

@@ -63,7 +63,7 @@ public class ProductServiceImpl implements ProductService {
@Autowired
private BaiduTranslatorUtils baiduTranslatorUtils;
@Value("${server.port:18082}")
@Value("${server.port:8082}")
private String serverPort;
@Value("${server.servlet.context-path:}")
@@ -72,7 +72,7 @@ public class ProductServiceImpl implements ProductService {
/**
* 前端访问地址用于生成商品详情页URL
*/
@Value("${app.frontend.url:http://localhost:3000}")
@Value("${app.frontend.url:https://shopd.mtkj2025.com}")
private String frontendUrl;
/**
@@ -858,7 +858,7 @@ public class ProductServiceImpl implements ProductService {
/**
* 从完整URL中提取链接码
* 支持两种输入:
* 1. 完整URLhttp://localhost:3000/product/2563c74bd94c4a4b95abccf697a6c756
* 1. 完整URLhttps://shopd.mtkj2025.com/product/2563c74bd94c4a4b95abccf697a6c756
* 2. 链接码2563c74bd94c4a4b95abccf697a6c756
*
* @param input 用户输入的URL或链接码

View File

@@ -63,7 +63,7 @@ spring:
# 服务器配置(所有环境通用)
server:
port: 18082
port: 8082
servlet:
context-path: /
# 文件上传配置
@@ -78,8 +78,9 @@ server:
# 应用配置(所有环境通用)
app:
# 前端访问地址用于生成商品详情页URL等
# 注意已配置SSL证书使用HTTPS和域名
frontend:
url: http://175.178.252.59:3000
url: https://shopd.mtkj2025.com
# 阿里云OSS相关配置所有环境通用
aliyun:
@@ -111,9 +112,10 @@ paypal:
mode: sandbox
# 是否启用PayPal支付
enabled: true
# Webhook URL服务器公网地址
# 注意:需要在PayPal控制台配置此URL
webhook-url: http://175.178.252.59:18082/api/paypal/webhook
# Webhook URL服务器公网地址必须使用HTTPS端口443
# 注意PayPal只接受HTTPS端口443的Webhook URL
# 已配置SSL证书使用域名访问
webhook-url: https://shopd.mtkj2025.com/api/paypal/webhook
# Webhook ID从PayPal控制台获取用于验证Webhook签名
webhook-id: 0SX6117212808615P

View File

@@ -62,7 +62,7 @@ spring:
# 服务器配置
server:
port: ${server.port:18082}
port: ${server.port:8082}
servlet:
context-path: /
multipart:
@@ -72,9 +72,9 @@ server:
# 应用配置
app:
# 前端访问地址
# 前端访问地址已配置SSL证书使用HTTPS和域名
frontend:
url: ${app.frontend.url:http://175.178.252.59:3000}
url: ${app.frontend.url:https://shopd.mtkj2025.com}
# PingPong支付配置生产环境
pingpong:
@@ -99,8 +99,8 @@ paypal:
mode: sandbox
# 是否启用PayPal支付
enabled: true
# Webhook URL部署时请修改为服务器的公网地址
webhook-url: ${paypal.webhook-url:https://your-domain.com/api/paypal/webhook}
# Webhook URL已配置SSL证书使用HTTPS和域名
webhook-url: ${paypal.webhook-url:https://shopd.mtkj2025.com/api/paypal/webhook}
# Webhook ID从PayPal控制台获取
webhook-id: ${paypal.webhook-id:}