This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<first-menu>
<menu-item href="/settings/database" code="index">配置模板</menu-item>
<menu-item href="/settings/database/update" code="update">修改模板</menu-item>
<span class="item disabled">|</span>
<menu-item href="/settings/database/clean" code="clean">手动清理</menu-item>
<menu-item href="/settings/database/cleanSetting" code="cleanSetting">自动清理设置</menu-item>
<span class="item disabled">|</span>
<span class="item"><tip-icon content="在这里可以设置API节点可以使用的数据库修改后请重新配置并启动API节点才能生效。"></tip-icon></span>
</first-menu>
<div class="margin"></div>

View File

@@ -0,0 +1,30 @@
{$layout}
{$template "menu"}
<div class="ui message" v-if="isLoading">正在加载中...</div>
<div class="ui message small warning" v-if="tables.length > 0">
<p>请确认数据表用途后再执行相关操作。</p>
</div>
<table class="ui table selectable" v-if="tables.length > 0">
<thead>
<tr>
<th>数据表名<sort-arrow name="orderTable"></sort-arrow></th>
<th>占用空间<sort-arrow name="orderSize"></sort-arrow></th>
<th>用途</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="table in tables">
<td>{{table.name}}</td>
<td>{{table.size}}
<span class="grey small" v-if="table.rows > 0">{{table.rows}}行)</span>
</td>
<td>{{table.comment}}</td>
<td>
<a href="" v-if="table.canDelete" @click.prevent="deleteTable(table.name)">删除</a><span v-if="table.canDelete"> &nbsp;</span>
<a href="" v-if="table.canClean" @click.prevent="truncateTable(table.name)">清空</a>
</td>
</tr>
</table>

View File

@@ -0,0 +1,53 @@
Tea.context(function () {
this.tables = []
this.isLoading = true
this.$delay(function () {
this.reload()
})
this.reload = function () {
this.isLoading = true
this.$post("$")
.params({
orderTable: this.orderTable,
orderSize: this.orderSize
})
.success(function (resp) {
this.tables = resp.data.tables;
})
.done(function () {
this.isLoading = false
})
}
this.deleteTable = function (tableName) {
let that = this
teaweb.confirm("html:确定要删除此数据表吗?<br/>删除后数据不能恢复!", function () {
that.$post(".deleteTable")
.params({
table: tableName
})
.success(function () {
teaweb.success("操作成功", function () {
that.reload()
})
})
})
}
this.truncateTable = function (tableName) {
let that = this
teaweb.confirm("html:确定要清空此数据表吗?<br/>清空后数据不能恢复!", function () {
that.$post(".truncateTable")
.params({
table: tableName
})
.success(function () {
teaweb.success("操作成功", function () {
that.reload()
})
})
})
}
})

View File

@@ -0,0 +1,189 @@
{$layout}
{$template "menu"}
<form class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<h4 style="margin-top: 0">网站访问日志</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="serverAccessLogCleanDays" v-model="config.serverAccessLog.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment">天数包括当天。如果填0表示不自动清理。此设置也会同时作用于日志数据库。</p>
</td>
</tr>
</table>
<div>
<a href=""><more-options-indicator>更多设置</more-options-indicator></a>
<div class="margin"></div>
</div>
<div v-show="moreOptionsVisible">
<div class="ui divider"></div>
<h4 style="margin-top: 0">网站带宽统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="serverBandwidthStatCleanDays" v-model="config.serverBandwidthStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">用户带宽统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="userBandwidthStatCleanDays" v-model="config.userBandwidthStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">用户套餐带宽统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="userPlanBandwidthStatCleanDays" v-model="config.userPlanBandwidthStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">网站流量统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="serverDailyStatCleanDays" v-model="config.serverDailyStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<div class="ui divider"></div>
<h4 style="margin-top: 0">网站按小时域名统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="serverDomainHourlyStatCleanDays" v-model="config.serverDomainHourlyStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">系统整体按天流量统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="trafficDailyStatCleanDays" v-model="config.trafficDailyStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">系统整体按小时流量统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="trafficHourlyStatCleanDays" v-model="config.trafficHourlyStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">集群按天流量统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="nodeClusterTrafficDailyStatCleanDays" v-model="config.nodeClusterTrafficDailyStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">节点按天流量统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="nodeTrafficDailyStatCleanDays" v-model="config.nodeTrafficDailyStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">节点按小时流量统计</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="nodeTrafficHourlyStatCleanDays" v-model="config.nodeTrafficHourlyStat.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<h4 style="margin-top: 0">缓存任务</h4>
<table class="ui table definition selectable">
<tr>
<td class="title">数据保存天数 *</td>
<td>
<div class="ui input right labeled">
<input type="text" name="httpCacheTaskCleanDays" v-model="config.httpCacheTask.clean.days" style="width:6em" maxlength="6"/>
<span class="ui label"></span>
</div>
<p class="comment"><pro-warning-label></pro-warning-label></p>
</td>
</tr>
</table>
<div class="margin"></div>
</div>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,34 @@
{$layout}
{$template "menu"}
<p class="ui message error" v-if="error.length > 0">{{error}}</p>
<div v-if="error.length == 0 && dbConfig != null">
<table class="ui table selectable definition">
<tr>
<td class="title">主机地址</td>
<td>{{dbConfig.host}}</td>
</tr>
<tr>
<td>数据库端口</td>
<td>{{dbConfig.port}}</td>
</tr>
<tr>
<td>数据库名称</td>
<td>{{dbConfig.database}}</td>
</tr>
<tr>
<td>用户名</td>
<td>
<span v-if="dbConfig.username.length > 0">{{dbConfig.username}}</span>
<span v-else class="disabled">不使用用户名。</span>
</td>
</tr>
<tr>
<td>密码</td>
<td>
<span v-if="dbConfig.password.length > 0">{{dbConfig.password}}</span>
<span v-else class="disabled">不使用密码。</span>
</td>
</tr>
</table>
</div>

View File

@@ -0,0 +1,44 @@
{$layout}
{$template "menu"}
<div class="ui message small warning">
<p>这里只能修改配置模板文件里的配置信息,并不能直接修改数据库自身的用户名、密码等信息。</p>
</div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<table class="ui table selectable definition">
<tr>
<td class="title">主机地址 *</td>
<td>
<input type="text" name="host" v-model="dbConfig.host" maxlength="100"/>
</td>
</tr>
<tr>
<td>数据库端口 *</td>
<td>
<input type="text" name="port" style="width:6em" v-model="dbConfig.port" maxlength="5"/>
</td>
</tr>
<tr>
<td>数据库名称 *</td>
<td>
<input type="text" name="database" maxlength="100" v-model="dbConfig.database"/>
</td>
</tr>
<tr>
<td>用户名 *</td>
<td>
<input type="text" name="username" maxlength="100" v-model="dbConfig.username"/>
<p class="comment">用来连接数据库的用户名。</p>
</td>
</tr>
<tr>
<td>密码</td>
<td>
<input type="password" name="password" maxlength="100" v-model="dbConfig.password"/>
<p class="comment">用来连接数据库的密码。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifySuccess("保存成功", "/settings/database")
})