后端基础框架

This commit is contained in:
2026-02-25 09:56:35 +08:00
commit b964b54fc6
146 changed files with 6919 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
sys:
# Your App secret key will be used for securely signing the session cookie
# Make sure you are changing this key for your deployment with a strong key.
# You can generate a strong key using `openssl rand -base64 42`.
# Alternatively you can set it with `SECRET_KEY` environment variable.
secret-key: WrLAa6u2LxhO+rQYQM7id01/FJPZ2GxH3pY/A2IFO6mOA0uaKzUIYWOC
# Console API base URL
console-api-url: http://localhost:8181
console-web-url: http://localhost:5173
# Model Configuration
multimodal-send-image-format: base64
# Files URL
files-url: http://127.0.0.1:5123
# Storage configuration
# use for store upload files, private keys...
# storage type: local, aliyun-oss, tencent-cos
storage-type: local
storage-local-path: D:/dev/ai-writing/storage/
# Aliyun oss Storage configuration
aliyun-oss-bucket-name: your-bucket-name
aliyun-oss-access-key: your-access-key
aliyun-oss-secret-key: your-secret-key
aliyun-oss-endpoint: your-endpoint
aliyun-oss-auth-version: v1
aliyun-oss-region: your-region
# Invite Configuration
invite-expiry-hours: 24
server:
# 应用服务 WEB 访问端口
port: 8282
spring:
### 处理连接池冲突 #####
main:
allow-bean-definition-overriding: true
# 数据源
datasource:
# url: jdbc:kingbase8://172.26.138.234:54321/ai-writing?currentSchema=public
# username: system
# password: 123456
# driver-class-name: com.kingbase8.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://223.83.129.121:33060/oai-writting?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: oai-write
password: rpriBbbPRzBNFDYS
# url: jdbc:mysql://127.0.0.1:3306/ai-writting?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
# username: root
# password: zhangjie
type: com.zaxxer.hikari.HikariDataSource
# 数据库 连接池
hikari:
auto-commit: true
connection-test-query: SELECT 1
validation-timeout: 1000
connection-timeout: 60000
idle-timeout: 600000
max-lifetime: 1200000
maximum-pool-size: 15
minimum-idle: 10
pool-name: HikariCP
data:
redis:
port: 6379
host: localhost
password:
database: 0
lettuce:
pool:
# 连接池最大连接数(使用负值表示没有限制) 默认 8
max-active: 8
# 连接池中的最大空闲连接 默认 8
max-idle: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1
max-wait: -1
# 连接池中的最小空闲连接 默认 0
min-idle: 0
mail:
# default(默认smtp邮箱服务) , aliyun-mail-push (阿里云邮件推送)
type: aliyun-mail-push
ak: LTAI5t9xS8GFTSxwWJmi8BMk
sk: ntjZii2NFteyh4JshILyDf9xZwc79L
host: smtpdm.aliyun.com
port: 465
username: robot@mail.oailab.com
password: OaiMail13579
protocol: smtp
properties:
mail:
smtp:
auth: true
ssl:
enable: true
# Login
jwt:
# Token 有效天数
token-validity-days: 15
# Upload configuration
upload:
upload-file-size-limit: 15
upload-file-batch-limit: 5
upload-image-file-size-limit: 10
+38
View File
@@ -0,0 +1,38 @@
spring:
application:
name: ai-base
profiles:
active: local
servlet:
multipart:
enabled: true
max-file-size: 100MB
max-request-size: 100MB
server:
tomcat:
connection-timeout: 300000
servlet:
session:
timeout: 300000
# mybatis-plus 配置
mybatis-plus:
global-config:
db-config:
# 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2)
logic-delete-field: deleted
# 逻辑已删除值(默认为 1)
logic-delete-value: 1
# 逻辑未删除值(默认为 0)
logic-not-delete-value: 0
configuration:
map-underscore-to-camel-case: true
auto-mapping-behavior: full
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
use-generated-keys: true
mapper-locations: classpath*:mapper/**/*Mapper.xml
type-aliases-package: com.jxyunge.oai.mybatis.entity
+106
View File
@@ -0,0 +1,106 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--日志配置-->
<configuration>
<property name="log.base" value="logs/"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
</encoder>
</appender>
<!-- 按照每天生成错误日志文件 -->
<appender name="ERRORFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<Prudent>true</Prudent>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${log.base}LOG_ERROR-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>5</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印错误日志 -->
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 按照每天生成警告日志文件 -->
<appender name="WARNFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<Prudent>true</Prudent>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${log.base}LOG_WARN-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>5</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印警告日志 -->
<level>WARN</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 按照每天生成INFO日志文件 -->
<appender name="INFOFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<Prudent>true</Prudent>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${log.base}LOG_INFO-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>5</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印INFO日志 -->
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 按照每天生成DEBUG日志文件 -->
<appender name="DEBUGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<Prudent>true</Prudent>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${log.base}LOG_DEBUG-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>5</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印DEBUG日志 -->
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志输出级别 -->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ERRORFILE"/>
<appender-ref ref="WARNFILE"/>
<appender-ref ref="INFOFILE"/>
<appender-ref ref="DEBUGFILE"/>
</root>
</configuration>