mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
:fire:修复部分情况不能部署成功问题
This commit is contained in:
@@ -39,12 +39,10 @@
|
||||
[Core版](https://hellohao.cn):开源版的基础上增加`Backblaze(B2)` 并且可`同个对象存储商家`可开多个存储源(可添加至90+存储源)
|
||||
|
||||
|
||||
### 更新日志 `20240130`
|
||||
### 更新日志 `20240319`
|
||||
|
||||
- 修复存储源设置不能设置请求域名问题
|
||||
- 优化上传逻辑,减少性能消耗
|
||||
- 修复多个上传文件时的已知BUG
|
||||
- 优化页面部分提示
|
||||
- 修复部分部署场景部署不成功的问题
|
||||
- 提高系统稳定性
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ import org.springframework.util.unit.DataSize;
|
||||
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
import javax.sql.DataSource;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@SpringBootApplication
|
||||
|
||||
@@ -211,9 +211,9 @@ public class FirstRun implements InitializingBean {
|
||||
try {
|
||||
File f = new File(filePath);
|
||||
if (f.exists()) {
|
||||
System.out.print("文件存在");
|
||||
logger.info("文件存在");
|
||||
} else {
|
||||
System.out.print("文件不存在");
|
||||
logger.info("文件不存在,准备创建");
|
||||
// f.createNewFile();// 不存在则创建
|
||||
FileUtil.createTempFile(f);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package cn.hellohao.utils;
|
||||
|
||||
import cn.hellohao.service.impl.S3Imageupload;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
|
||||
final class RunSqlScript {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(RunSqlScript.class);
|
||||
public static String DBDRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
public static String DBURL ;
|
||||
//现在使用的是mysql数据库,是直接连接的,所以此处必须有用户名和密码
|
||||
@@ -21,7 +25,7 @@ final class RunSqlScript {
|
||||
try {
|
||||
Class.forName(DBDRIVER);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("RunSqlScript[29]", e);
|
||||
}
|
||||
//2、连接数据库
|
||||
//通过连接管理器连接数据库
|
||||
@@ -29,14 +33,14 @@ final class RunSqlScript {
|
||||
//在连接的时候直接输入用户名和密码才可以连接
|
||||
conn = DriverManager.getConnection(DBURL,USERNAME,PASSWORD);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("RunSqlScript[36]", e);
|
||||
}
|
||||
//3、向数据库中插入一条数据
|
||||
//String sql = "select count(*) from information_schema.columns where table_name = 'config' and column_name = 'id'";
|
||||
try {
|
||||
stmt = conn.createStatement();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("RunSqlScript[43]", e);
|
||||
}
|
||||
//4、执行语句
|
||||
try {
|
||||
@@ -46,7 +50,7 @@ final class RunSqlScript {
|
||||
count = resultSet.getInt(1);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("RunSqlScript[53]", e);
|
||||
return -1;
|
||||
}
|
||||
//5、关闭操作
|
||||
@@ -54,7 +58,7 @@ final class RunSqlScript {
|
||||
stmt.close();
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("RunSqlScript[61]", e);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -71,8 +75,7 @@ final class RunSqlScript {
|
||||
try {
|
||||
Class.forName(DBDRIVER);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
Print.Normal("SqlHelper.java - ClassNotFoundException");
|
||||
logger.error("RunSqlScript[78]", e);
|
||||
}
|
||||
//2、连接数据库
|
||||
//通过连接管理器连接数据库
|
||||
@@ -80,23 +83,21 @@ final class RunSqlScript {
|
||||
//在连接的时候直接输入用户名和密码才可以连接
|
||||
conn = DriverManager.getConnection(DBURL,USERNAME,PASSWORD);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
Print.Normal("SqlHelper.java - SQLException1");
|
||||
logger.error("RunSqlScript[86]", e);
|
||||
}
|
||||
try {
|
||||
stmt = conn.createStatement();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
Print.Normal("SqlHelper.java - SQLException2");
|
||||
logger.error("RunSqlScript[91]", e);
|
||||
}
|
||||
//4、执行语句
|
||||
try {
|
||||
count = stmt.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
if(e.getMessage().contains("Duplicate key name") && e.getMessage().contains("index_md5key_url")){
|
||||
Print.Normal("Database index already exists, skip this step.");
|
||||
logger.info("Database index already exists, skip this step.");
|
||||
}else{
|
||||
e.printStackTrace();
|
||||
logger.error("RunSqlScript[100]", e);
|
||||
}
|
||||
}
|
||||
//5、关闭操作
|
||||
@@ -104,7 +105,7 @@ final class RunSqlScript {
|
||||
stmt.close();
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
Print.Normal("SqlHelper.java - SQLException4");
|
||||
logger.error("RunSqlScript[108]", e);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ server.port=10088
|
||||
#前端域名需要带协议头http(s)://
|
||||
CROS_ALLOWED_ORIGINS=${HELLOHAO_WEB_HOST:http://127.0.0.1:8080}
|
||||
#数据库账号
|
||||
spring.datasource.username=${MYSQL_NAME:root}
|
||||
spring.datasource.username=${MYSQL_USERNAME:root}
|
||||
#数据库密码test
|
||||
spring.datasource.password=${MYSQL_PASS:root}
|
||||
#数据库链接地址
|
||||
|
||||
Reference in New Issue
Block a user