新增数据库初始化脚本,创建外链表和用户表,更新主程序以支持数据库连接和关闭,添加外链信息的API接口。
This commit is contained in:
@ -263,7 +263,7 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">有效期</label>
|
||||
<input type="date" class="form-control" name="access_token" required>
|
||||
<input type="date" class="form-control" name="expiry_date" required>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -357,18 +357,16 @@
|
||||
//添加保存外链事件
|
||||
$('#saveExlink').on('click', function() {
|
||||
// 获取表单数据
|
||||
// 确保正确获取表单元素
|
||||
const exlinkForm = document.querySelector('#addExlinkModal form');
|
||||
if (!exlinkForm) {
|
||||
showMessage('找不到元素', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData(exlinkForm);
|
||||
const formValues = Object.fromEntries(formData.entries());
|
||||
const formData = new FormData(document.querySelector('#addExlinkModal form'));
|
||||
const formValues = {
|
||||
disk_type: formData.get('disk_type'),
|
||||
account_id: formData.get('account_id'),
|
||||
remaining_count: formData.get('remaining_count'),
|
||||
expiry_date: formData.get('expiry_date')
|
||||
};
|
||||
|
||||
// 检查表单是否填写完整
|
||||
if (!formValues.account_id || !formValues.remaining_count || !formValues.access_token) {
|
||||
if (!formValues.disk_type || !formValues.remaining_count || !formValues.account_id || !formValues.expiry_date) {
|
||||
showMessage('请填写所有必填字段!', 'error');
|
||||
return; // 停止提交
|
||||
}
|
||||
@ -382,11 +380,11 @@
|
||||
console.log('准备提交的数据:', submitData);
|
||||
// 发送数据到服务器
|
||||
$.ajax({
|
||||
url: '/login',
|
||||
url: '/admin/exlink',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
token: "test"
|
||||
data: formValues
|
||||
}),
|
||||
success: function(data) {
|
||||
if (data.status) {
|
||||
|
Reference in New Issue
Block a user