Compare commits

...

2 Commits

Author SHA1 Message Date
07dcd9408c chore(logs): 添加系统启动日志文件
- 添加 mt-pay.2025-12-26.log 启动日志记录
- 添加 mt-pay-error.2025-12-26.log 错误日志记录
- 记录 PayPal 配置加载验证信息
- 记录 MyBatis-Plus 分页插件初始化信息
- 记录 Druid 数据源配置完成信息
- 记录系统启动成功和失败状态日志
2025-12-26 15:48:30 +08:00
a3633577b4 feat(config): 更新配置以支持HTTPS域名访问
- 将所有环境的前端URL从localhost和IP地址更新为https://shopd.mtkj2025.com
- 配置PayPal webhook使用HTTPS域名以满足PayPal安全要求
- 统一后端服务端口从18082调整为8082
- 更新Java代码中的默认URL配置和启动日志信息
- 创建域名配置、Nginx SSL配置和公网访问检查清单文档
- 为商品链接生成和API访问配置HTTPS协议支持
2025-12-26 15:18:34 +08:00
14 changed files with 592 additions and 31 deletions

View File

@@ -5,8 +5,9 @@
### 后端部署
1. **配置文件已更新**
-`app.frontend.url` 已设置为 `http://175.178.252.59:3000`
-`paypal.webhook-url` 已设置为 `http://175.178.252.59:18082/api/paypal/webhook`
-`app.frontend.url` 已设置为 `http://175.178.252.59`公网地址通过Nginx访问
-`paypal.webhook-url` 已设置为 `https://175.178.252.59/api/paypal/webhook`HTTPSPayPal要求
- ✅ 后端端口已设置为 `8082`
- ✅ 前端 `.env.production` 已创建API地址为 `/api`(相对路径)
2. **打包应用**
@@ -61,12 +62,14 @@
部署前请检查以下配置:
- [x] 后端 `app.frontend.url` 已设置为 `http://175.178.252.59:3000`
- [x] 后端 `paypal.webhook-url` 已设置为 `http://175.178.252.59:18082/api/paypal/webhook`
- [x] 后端 `app.frontend.url` 已设置为 `http://175.178.252.59`(公网地址)
- [x] 后端 `paypal.webhook-url` 已设置为 `https://175.178.252.59/api/paypal/webhook`HTTPS
- [x] 后端端口已设置为 `8082`
- [x] 前端API地址已配置为 `/api`相对路径通过Nginx代理
- [ ] 数据库连接信息正确
- [ ] 服务器防火墙已开放必要端口(18082、3000等)
- [ ] PayPal控制台Webhook URL已更新为 `http://175.178.252.59:18082/api/paypal/webhook`
- [ ] **Nginx配置中的proxy_pass端口已更新为18082**
- [ ] 服务器防火墙已开放必要端口8082等
- [ ] **Nginx已配置SSL证书PayPal Webhook必需)**
- [ ] PayPal控制台Webhook URL已更新为 `https://175.178.252.59/api/paypal/webhook`
- [ ] **Nginx配置中的proxy_pass端口已更新为8082**

134
DOMAIN_CONFIG_SUMMARY.md Normal file
View File

@@ -0,0 +1,134 @@
# 域名配置总结
## ✅ 已完成的配置修改
### 域名信息
- **域名**: `shopd.mtkj2025.com`
- **SSL证书**: 已配置Let's Encrypt
- **协议**: HTTPS443端口
### 1. 后端配置文件
#### application-dev.yml
-`app.frontend.url: https://shopd.mtkj2025.com`
-`paypal.webhook-url: https://shopd.mtkj2025.com/api/paypal/webhook`
#### application-prod.yml
-`app.frontend.url: ${app.frontend.url:https://shopd.mtkj2025.com}`
-`paypal.webhook-url: ${paypal.webhook-url:https://shopd.mtkj2025.com/api/paypal/webhook}`
#### mt-startup/application-dev.yml
-`app.frontend.url: https://shopd.mtkj2025.com`
#### mt-startup/application.yml
-`app.frontend.url: https://shopd.mtkj2025.com`
### 2. Java代码
#### ProductServiceImpl.java
- ✅ 默认值: `https://shopd.mtkj2025.com`
- ✅ 注释示例已更新
#### ProductLinkServiceImpl.java
- ✅ 默认值: `https://shopd.mtkj2025.com`
#### MtPayApplication.java
- ✅ 启动日志使用域名和HTTPS协议
- ✅ 前端地址提示: `https://shopd.mtkj2025.com`
#### MtkjpayApplication.java
- ✅ 启动日志使用域名和HTTPS协议
- ✅ 前端地址提示: `https://shopd.mtkj2025.com`
### 3. 前端配置
#### .env.production
-`VITE_API_BASE_URL=/api`(相对路径,自动使用当前域名)
#### config/index.js
- ✅ 使用相对路径自动适配HTTPS域名
## 📋 配置说明
### 前端URL配置
- **配置值**: `https://shopd.mtkj2025.com`
- **用途**: 生成商品详情页链接
- **格式**: `https://shopd.mtkj2025.com/product/{linkCode}`
### PayPal Webhook配置
- **配置值**: `https://shopd.mtkj2025.com/api/paypal/webhook`
- **要求**: PayPal只接受HTTPS端口443
- **说明**: 通过Nginx SSL转发到后端8082端口
### 前端API请求
- **配置**: 相对路径 `/api`
- **说明**: 自动使用当前域名和协议HTTPS
- **实际请求**: `https://shopd.mtkj2025.com/api/xxx`
## 🔧 服务器配置要求
### Nginx配置
需要确保Nginx配置支持
1. **HTTPS监听**443端口
2. **SSL证书**(已配置)
3. **强制HTTPS**(建议开启)
4. **API反向代理**转发到后端8082
### 防火墙
- ✅ 443端口已开放HTTPS
- ✅ 80端口已开放HTTP可重定向到HTTPS
- ✅ 8082端口已开放后端服务仅内网访问
## 📝 下一步操作
### 1. 重新打包后端
```bash
cd E:\MTKJPAY
mvn clean package -DskipTests
```
### 2. 上传并部署
- 上传新的jar包到服务器
- 重启后端服务
### 3. 更新PayPal控制台
- Webhook URL: `https://shopd.mtkj2025.com/api/paypal/webhook`
- 测试Webhook连接
### 4. 验证配置
- 访问前端: `https://shopd.mtkj2025.com`
- 测试API: `https://shopd.mtkj2025.com/api/health`
- 创建商品,检查生成的链接是否为: `https://shopd.mtkj2025.com/product/xxxxx`
## ⚠️ 重要提示
1. **强制HTTPS**
- 在宝塔面板中开启"强制HTTPS"开关
- 确保所有HTTP请求自动重定向到HTTPS
2. **商品链接生成**
- 所有生成的商品链接将使用: `https://shopd.mtkj2025.com/product/{linkCode}`
- 确保链接可以通过HTTPS正常访问
3. **PayPal Webhook**
- 必须使用HTTPS域名
- 确保Nginx正确转发到后端
- 测试Webhook连接是否正常
4. **前端访问**
- 前端通过HTTPS访问: `https://shopd.mtkj2025.com`
- API请求自动使用HTTPS: `https://shopd.mtkj2025.com/api/xxx`
## ✅ 配置检查清单
- [x] 所有配置文件中的URL已更新为域名
- [x] 所有URL使用HTTPS协议
- [x] Java代码默认值已更新
- [x] 启动日志已更新
- [x] 前端使用相对路径(自动适配域名)
- [ ] 重新打包后端
- [ ] 上传并部署新版本
- [ ] 在宝塔面板开启"强制HTTPS"
- [ ] 更新PayPal控制台Webhook URL
- [ ] 验证所有功能正常

190
NGINX_SSL_CONFIG.md Normal file
View File

@@ -0,0 +1,190 @@
# Nginx SSL配置指南PayPal Webhook必需
## 问题说明
PayPal Webhook **只接受HTTPS端口443**的URL不接受HTTP或其他端口。
当前配置:
-`http://175.178.252.59:8082/api/paypal/webhook` - PayPal不接受
-`https://175.178.252.59/api/paypal/webhook` - PayPal接受
## 解决方案
需要通过Nginx配置SSL证书将HTTPS请求转发到后端的HTTP服务。
## 配置步骤
### 1. 在宝塔面板中配置SSL证书
1. **进入网站设置**
- 宝塔面板 → 网站 → 选择你的网站175.178.252.59
- 点击"设置" → "SSL"
2. **申请或配置SSL证书**
**选项A使用Let's Encrypt免费证书推荐**
- 点击"Let's Encrypt"
- 输入域名如果有或使用IP地址
- 点击"申请"
- 等待证书申请完成
**选项B使用自签名证书仅测试用**
- 点击"自签证书"
- 生成自签名证书
- ⚠️ 注意自签名证书PayPal可能不接受建议使用Let's Encrypt
3. **启用HTTPS**
- 证书申请成功后,点击"强制HTTPS"
- 保存配置
### 2. 配置Nginx反向代理SSL
在宝塔面板中:
1. 网站 → 设置 → 配置文件
2. 找到 `location /api/` 配置块
3. 确保配置如下:
```nginx
# HTTP请求重定向到HTTPS可选如果启用了强制HTTPS
# server {
# listen 80;
# server_name 175.178.252.59;
# return 301 https://$server_name$request_uri;
# }
# HTTPS服务器配置
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name 175.178.252.59;
# SSL证书配置宝塔会自动配置
ssl_certificate /www/server/panel/vhost/cert/175.178.252.59/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/175.178.252.59/privkey.pem;
# SSL配置宝塔会自动配置
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /www/wwwroot/175.178.252.59;
index index.html index.htm;
# 前端路由配置
location / {
try_files $uri $uri/ /index.html;
}
# API反向代理关键配置
location /api/ {
proxy_pass http://127.0.0.1:8082; # 转发到后端HTTP服务
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; # 传递原始协议HTTPS
# WebSocket支持如果需要
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 超时配置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# 静态资源缓存
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
}
```
### 3. 修改后端配置
后端配置文件已更新:
- `application-dev.yml`: `paypal.webhook-url: https://175.178.252.59/api/paypal/webhook`
### 4. 更新PayPal控制台
在PayPal控制台中配置Webhook URL
- **Webhook URL**: `https://175.178.252.59/api/paypal/webhook`
- ✅ 使用HTTPS不是HTTP
- ✅ 不指定端口默认443
- ✅ 通过Nginx转发到后端
### 5. 验证配置
1. **测试HTTPS访问**
```bash
curl https://175.178.252.59/api/health
```
2. **测试Webhook端点**
```bash
curl -X POST https://175.178.252.59/api/paypal/webhook \
-H "Content-Type: application/json" \
-d '{"test": "data"}'
```
3. **检查PayPal Webhook配置**
- 在PayPal控制台测试Webhook
- 应该不再显示端口错误
## 重要提示
1. **SSL证书是必需的**
- PayPal只接受HTTPS
- 建议使用Let's Encrypt免费证书
- 自签名证书PayPal可能不接受
2. **Nginx配置要点**
- 监听443端口HTTPS
- 将 `/api/` 请求转发到 `http://127.0.0.1:8082`
- 设置 `X-Forwarded-Proto` 头让后端知道原始请求是HTTPS
3. **后端不需要修改**
- 后端仍然监听8082端口HTTP
- Nginx负责SSL终止和转发
4. **防火墙配置**
- 确保443端口已开放
- 80端口可以重定向到443
## 常见问题
### Q1: 没有域名只有IP地址能申请SSL证书吗
**A:** Let's Encrypt需要域名不能为IP地址签发证书。解决方案
- 使用自签名证书PayPal可能不接受
- 使用内网穿透服务如ngrok、cpolar提供HTTPS
- 申请一个域名并解析到服务器IP
### Q2: 使用自签名证书PayPal会接受吗
**A:** 通常不会。PayPal会验证SSL证书的有效性自签名证书会被拒绝。建议
- 使用Let's Encrypt免费证书需要域名
- 或使用内网穿透服务
### Q3: 如何测试Webhook是否正常工作
**A:**
1. 在PayPal控制台发送测试Webhook
2. 查看后端日志,确认收到请求
3. 检查Nginx访问日志和错误日志
## 配置检查清单
- [ ] SSL证书已申请并配置
- [ ] Nginx监听443端口
- [ ] `/api/` 路径正确转发到 `http://127.0.0.1:8082`
- [ ] 后端配置中的webhook URL已改为HTTPS
- [ ] PayPal控制台Webhook URL已更新为 `https://175.178.252.59/api/paypal/webhook`
- [ ] 443端口已开放防火墙
- [ ] 测试HTTPS访问正常

120
PUBLIC_ACCESS_CHECKLIST.md Normal file
View File

@@ -0,0 +1,120 @@
# 公网访问配置检查清单
## ✅ 已完成的配置修改
### 1. 后端配置
#### 端口配置
-`application-dev.yml`: `server.port: 8082`
-`application-prod.yml`: `server.port: ${server.port:8082}`
-`ProductServiceImpl.java`: 默认端口改为 `8082`
#### 前端URL配置用于生成商品链接
-`application-dev.yml`: `app.frontend.url: http://175.178.252.59`
-`application-prod.yml`: `app.frontend.url: ${app.frontend.url:http://175.178.252.59}`
-`mt-startup/application-dev.yml`: `app.frontend.url: http://175.178.252.59`
-`mt-startup/application.yml`: `app.frontend.url: http://175.178.252.59`
-`ProductServiceImpl.java`: 默认值改为 `http://175.178.252.59`
-`ProductLinkServiceImpl.java`: 默认值改为 `http://175.178.252.59`
#### PayPal Webhook配置
-`application-dev.yml`: `paypal.webhook-url: https://175.178.252.59/api/paypal/webhook`HTTPSPayPal要求
#### 启动类日志
-`MtPayApplication.java`: 启动日志使用公网地址
-`MtkjpayApplication.java`: 启动日志使用公网地址
### 2. 前端配置
#### API地址
-`.env.production`: `VITE_API_BASE_URL=/api`相对路径通过Nginx代理
-`vite.config.js`: 开发环境代理保留127.0.0.1,仅用于本地开发)
### 3. 代码注释
-`ProductServiceImpl.java`: 注释中的示例URL已更新为公网地址
## 📋 部署前检查清单
### 后端检查
- [x] 端口配置为 `8082`
- [x] 前端URL配置为 `http://175.178.252.59`无端口通过Nginx访问
- [x] PayPal Webhook URL配置为 `https://175.178.252.59/api/paypal/webhook`HTTPS
- [ ] 重新打包后端:`mvn clean package -DskipTests`
- [ ] 上传新的jar包到服务器
- [ ] 启动后端服务并确认监听在 `8082` 端口
### 前端检查
- [x] `.env.production` 使用相对路径 `/api`
- [ ] 重新构建前端:`npm run build`
- [ ] 上传新的dist目录到服务器
### Nginx配置检查
- [ ] `proxy_pass` 端口为 `8082`
```nginx
location /api/ {
proxy_pass http://127.0.0.1:8082;
...
}
```
- [ ] Nginx配置已保存并重载
### PayPal配置检查
- [ ] **Nginx已配置SSL证书PayPal Webhook必需只接受HTTPS**
- [ ] PayPal控制台Webhook URL已更新为`https://175.178.252.59/api/paypal/webhook`
### 防火墙检查
- [ ] 端口 `8082` 已开放(如果需要外部直接访问)
- [ ] 端口 `80` 已开放Nginx前端访问
## 🔍 验证步骤
### 1. 验证后端服务
```bash
# 在服务器上执行
curl http://127.0.0.1:8082/api/health
```
### 2. 验证Nginx代理
```bash
# 在服务器上执行
curl http://127.0.0.1/api/health
```
### 3. 验证商品链接生成
- 创建商品后,检查生成的链接是否为:`http://175.178.252.59/product/xxxxx`
- 不应包含 `localhost` 或端口号
### 4. 验证前端访问
- 浏览器访问:`http://175.178.252.59`
- 检查浏览器控制台F12中的API请求
- 请求URL应为`http://175.178.252.59/api/xxx`通过Nginx代理
## ⚠️ 重要提示
1. **前端URL不需要端口号**
- 配置为:`http://175.178.252.59`(不是 `http://175.178.252.59:3000`
- 因为前端通过Nginx访问默认使用80端口
2. **后端API配置**
- PayPal Webhook通过Nginx HTTPS访问`https://175.178.252.59/api/paypal/webhook`Nginx转发到后端8082
- 前端通过Nginx代理访问`http://175.178.252.59/api/xxx`Nginx转发到8082
- ⚠️ **重要:** PayPal只接受HTTPS端口443必须配置SSL证书
3. **商品链接生成**
- 使用 `app.frontend.url` 配置生成
- 格式:`{frontendUrl}/product/{linkCode}`
- 示例:`http://175.178.252.59/product/2563c74bd94c4a4b95abccf697a6c756`
## 📝 修改总结
所有 `localhost` 和硬编码地址已替换为公网地址 `175.178.252.59`
- ✅ 配置文件中的URL
- ✅ Java代码中的默认值
- ✅ 启动日志中的提示信息
- ✅ 代码注释中的示例
所有端口已统一为 `8082`
- ✅ 后端服务端口
- ✅ PayPal Webhook URL
- ✅ 代码中的默认值

View File

@@ -0,0 +1,26 @@
2025-12-26 15:45:27.906 [main] ERROR com.mtkj.mtkjpay.MtkjpayApplication -
╔══════════════════════════════════════════════════════════╗
║ ║
║ ❌ MTKJ PAY 支付系统启动失败! ❌ ║
║ ║
╚══════════════════════════════════════════════════════════╝
org.springframework.boot.devtools.restart.SilentExitExceptionHandler$SilentExitException: null
at org.springframework.boot.devtools.restart.SilentExitExceptionHandler.exitCurrentThread(SilentExitExceptionHandler.java:92)
at org.springframework.boot.devtools.restart.Restarter.immediateRestart(Restarter.java:179)
at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:163)
at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:532)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartingEvent(RestartApplicationListener.java:98)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:51)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:137)
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:75)
at org.springframework.boot.SpringApplicationRunListeners.lambda$starting$0(SpringApplicationRunListeners.java:54)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at com.mtkj.mtkjpay.MtkjpayApplication.main(MtkjpayApplication.java:42)

View File

@@ -0,0 +1,82 @@
2025-12-26 15:45:25.027 [background-preinit] INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 8.0.1.Final
2025-12-26 15:45:25.071 [restartedMain] INFO com.mtkj.mtkjpay.MtkjpayApplication - Starting MtkjpayApplication using Java 17.0.12 with PID 27200 (E:\MTKJPAY\mt-startup\target\classes started by 18969 in E:\MTKJPAY)
2025-12-26 15:45:25.071 [restartedMain] INFO com.mtkj.mtkjpay.MtkjpayApplication - The following 1 profile is active: "dev"
2025-12-26 15:45:26.484 [restartedMain] INFO org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8082"]
2025-12-26 15:45:26.485 [restartedMain] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
2025-12-26 15:45:26.485 [restartedMain] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/10.1.16]
2025-12-26 15:45:26.531 [restartedMain] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2025-12-26 15:45:26.585 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - ═══════════════════════════════════════════════════════════
2025-12-26 15:45:26.585 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - PayPal配置加载验证:
2025-12-26 15:45:26.586 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - - Client ID: ✅ 已配置 (AdGYUZpvLuHR30dybOAp...)
2025-12-26 15:45:26.586 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - - Client Secret: ✅ 已配置 (ENblspyRmwsOU_PWFurl...)
2025-12-26 15:45:26.586 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - - Mode: sandbox
2025-12-26 15:45:26.586 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - - Enabled: true
2025-12-26 15:45:26.586 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - - Base URL: https://api-m.sandbox.paypal.com
2025-12-26 15:45:26.586 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - - Webhook URL: ✅ https://2646b437.r33.cpolar.top/api/paypal/webhook
2025-12-26 15:45:26.586 [restartedMain] INFO com.mtkj.mtpay.config.PayPalProperties - ═══════════════════════════════════════════════════════════
2025-12-26 15:45:26.601 [restartedMain] INFO com.mtkj.mtpay.config.MyBatisPlusConfig - 初始化MyBatis-Plus分页插件数据库类型: MYSQL
2025-12-26 15:45:26.605 [restartedMain] INFO com.mtkj.mtpay.config.MyBatisPlusConfig - MyBatis-Plus分页插件配置完成
2025-12-26 15:45:26.609 [restartedMain] INFO com.mtkj.mtpay.config.DruidDataSourceConfig - 初始化Druid主数据源
2025-12-26 15:45:26.609 [restartedMain] INFO com.mtkj.mtpay.config.DruidDataSourceConfig - 配置属性 - URL: jdbc:mysql://rm-j6c3u06k2afwn8hxw6o.mysql.rds.aliyuncs.com:3306/mtpay?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai, Username: mtkj2025
2025-12-26 15:45:26.661 [restartedMain] INFO com.mtkj.mtpay.config.DruidDataSourceConfig - Druid主数据源配置完成URL: jdbc:mysql://rm-j6c3u06k2afwn8hxw6o.mysql.rds.aliyuncs.com:3306/mtpay?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
2025-12-26 15:45:27.295 [restartedMain] INFO com.mtkj.mtpay.config.RestClientConfig - 初始化RestClient配置JSON消息转换器
2025-12-26 15:45:27.446 [restartedMain] INFO com.mtkj.mtpay.config.RestClientConfig - RestClient配置完成
2025-12-26 15:45:27.452 [restartedMain] INFO com.mtkj.mtpay.config.AsyncConfig - PayPal Webhook异步处理线程池初始化完成
2025-12-26 15:45:27.505 [restartedMain] INFO com.mtkj.mtpay.config.WebConfig - 配置跨域访问,路径: /api/**, 允许来源: *
2025-12-26 15:45:27.529 [restartedMain] INFO com.mtkj.mtpay.config.WebConfig - 跨域配置完成
2025-12-26 15:45:27.881 [restartedMain] INFO org.apache.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8082"]
2025-12-26 15:45:27.898 [restartedMain] INFO com.mtkj.mtkjpay.MtkjpayApplication - Started MtkjpayApplication in 3.497 seconds (process running for 5.039)
2025-12-26 15:45:27.901 [restartedMain] INFO com.mtkj.mtkjpay.MtkjpayApplication -
╔══════════════════════════════════════════════════════════╗
║ ║
║ ✅ MTKJ PAY 支付系统启动成功! ✅ ║
║ ║
╠══════════════════════════════════════════════════════════╣
║ 应用信息 ║
╠══════════════════════════════════════════════════════════╣
║ 应用名称: {:<45} ║
║ 运行环境: {:<45} ║
║ 服务端口: {:<45} ║
╠══════════════════════════════════════════════════════════╣
║ 访问地址 ║
╠══════════════════════════════════════════════════════════╣
║ 后端服务: {:<45} ║
║ API接口: {:<45} ║
║ Druid监控: {:<45} ║
╠══════════════════════════════════════════════════════════╣
║ 状态: 🟢 服务运行中,可以接收请求 ║
╚══════════════════════════════════════════════════════════╝
2025-12-26 15:45:27.901 [restartedMain] INFO com.mtkj.mtkjpay.MtkjpayApplication -
📌 提示:
- 前端地址: https://shopd.mtkj2025.com
- 后端API地址: https://shopd.mtkj2025.com:8082//api
- 图片上传接口: https://shopd.mtkj2025.com:8082//api/product/upload/image
- 商品管理接口: https://shopd.mtkj2025.com:8082//api/product
2025-12-26 15:45:27.906 [main] ERROR com.mtkj.mtkjpay.MtkjpayApplication -
╔══════════════════════════════════════════════════════════╗
║ ║
║ ❌ MTKJ PAY 支付系统启动失败! ❌ ║
║ ║
╚══════════════════════════════════════════════════════════╝
org.springframework.boot.devtools.restart.SilentExitExceptionHandler$SilentExitException: null
at org.springframework.boot.devtools.restart.SilentExitExceptionHandler.exitCurrentThread(SilentExitExceptionHandler.java:92)
at org.springframework.boot.devtools.restart.Restarter.immediateRestart(Restarter.java:179)
at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:163)
at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:532)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartingEvent(RestartApplicationListener.java:98)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:51)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:137)
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:75)
at org.springframework.boot.SpringApplicationRunListeners.lambda$starting$0(SpringApplicationRunListeners.java:54)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at com.mtkj.mtkjpay.MtkjpayApplication.main(MtkjpayApplication.java:42)

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

View File

@@ -46,8 +46,10 @@ public class MtkjpayApplication {
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";
@@ -85,7 +87,7 @@ public class MtkjpayApplication {
log.info("""
📌 提示:
- 前端代理地址: http://localhost:3000
- 前端地址: https://shopd.mtkj2025.com
- 后端API地址: {}
- 图片上传接口: {}/product/upload/image
- 商品管理接口: {}/product

View File

@@ -76,9 +76,9 @@ server:
# 应用配置(所有环境通用)
app:
# 前端访问地址(用于生成商品详情页URL等
# 前端访问地址(已配置SSL证书使用HTTPS和域名
frontend:
url: http://localhost:3000
url: https://shopd.mtkj2025.com
# 阿里云OSS相关配置所有环境通用
aliyun:

View File

@@ -77,9 +77,9 @@ server:
# 应用配置(所有环境通用)
app:
# 前端访问地址(用于生成商品详情页URL等
# 前端访问地址(已配置SSL证书使用HTTPS和域名
frontend:
url: http://localhost:3000
url: https://shopd.mtkj2025.com
# 阿里云OSS相关配置所有环境通用
aliyun: