Use the gin framework

This commit is contained in:
2025-10-26 14:48:02 +08:00
parent 9e0eb1497b
commit d844403505
29 changed files with 1612 additions and 1858 deletions

View File

@@ -278,7 +278,7 @@
url: '/admin/api/apis/apps',
type: 'GET',
success: function (res) {
if (res.success && res.data) {
if (res.code === 0 && res.data) {
var filterSelect = $('select[name="app_uuid"]').eq(0);
// 清空现有选项(保留默认选项)
filterSelect.find('option:not(:first)').remove();
@@ -303,7 +303,7 @@
url: '/admin/api/apis/types',
type: 'GET',
success: function (res) {
if (res.success && res.data) {
if (res.code === 0 && res.data) {
var typeSelect = $('select[name="api_type"]').eq(0);
// 清空现有选项(保留默认选项)
typeSelect.find('option:not(:first)').remove();
@@ -453,7 +453,7 @@
contentType: 'application/json',
data: JSON.stringify({ side: side, algorithm: algorithm }),
success: function (res) {
if (res.success && res.data) {
if (res.code === 0 && res.data) {
if (algorithm === 1) { // RC4
$('[name="' + prefix + '_private_key"]').val(res.data.private_key || '');
} else if (algorithm === 4) { // 易加密
@@ -464,7 +464,7 @@
}
layer.msg('已自动生成' + (side === 'submit' ? '提交' : '返回') + '密钥', { icon: 1, time: 1500 });
} else {
layer.msg(res.message || '自动生成密钥失败', { icon: 2 });
layer.msg(res.msg || '自动生成密钥失败', { icon: 2 });
}
},
error: function () {
@@ -498,7 +498,7 @@
contentType: 'application/json',
data: JSON.stringify({ side: 'submit', algorithm: algo }),
success: function (res) {
if (res.success && res.data) {
if (res.code === 0 && res.data) {
if (algo === 1) { // RC4
$('[name="submit_private_key"]').val(res.data.private_key || '');
} else if (algo === 4) { // 易加密
@@ -508,7 +508,7 @@
$('[name="submit_private_key"]').val(res.data.private_key || '');
}
} else {
layer.msg(res.message || '生成失败', { icon: 2 });
layer.msg(res.msg || '生成失败', { icon: 2 });
}
},
error: function () { layer.msg('生成失败', { icon: 2 }); }
@@ -528,7 +528,7 @@
contentType: 'application/json',
data: JSON.stringify({ side: 'return', algorithm: algo }),
success: function (res) {
if (res.success && res.data) {
if (res.code === 0 && res.data) {
if (algo === 1) { // RC4
$('[name="return_private_key"]').val(res.data.private_key || '');
} else if (algo === 4) { // 易加密
@@ -538,7 +538,7 @@
$('[name="return_private_key"]').val(res.data.private_key || '');
}
} else {
layer.msg(res.message || '生成失败', { icon: 2 });
layer.msg(res.msg || '生成失败', { icon: 2 });
}
},
error: function () { layer.msg('生成失败', { icon: 2 }); }
@@ -602,12 +602,12 @@
contentType: 'application/json',
data: JSON.stringify(formData),
success: function (res) {
if (res.success) {
if (res.code === 0) {
layer.msg('接口更新成功', { icon: 1 });
layer.close(index);
apisTable.reload();
} else {
layer.msg(res.message || '更新失败', { icon: 2 });
layer.msg(res.msg || '更新失败', { icon: 2 });
}
},
error: function () {

View File

@@ -761,15 +761,17 @@
$.ajax({
url: '/admin/api/apps/get_multi_config?uuid=' + obj.data.uuid,
type: 'GET',
success: function (config) {
// 填充表单数据
$('input[name="login_type"][value="' + config.login_type + '"]').prop('checked', true);
$('input[name="multi_open_scope"][value="' + config.multi_open_scope + '"]').prop('checked', true);
$('input[name="clean_interval"]').val(config.clean_interval);
$('input[name="check_interval"]').val(config.check_interval);
$('input[name="multi_open_count"]').val(config.multi_open_count);
success: function (res) {
if (res.code === 0 && res.data) {
var config = res.data;
// 填充表单数据
$('input[name="login_type"][value="' + config.login_type + '"]').prop('checked', true);
$('input[name="multi_open_scope"][value="' + config.multi_open_scope + '"]').prop('checked', true);
$('input[name="clean_interval"]').val(config.clean_interval);
$('input[name="check_interval"]').val(config.check_interval);
$('input[name="multi_open_count"]').val(config.multi_open_count);
// 打开静态弹窗
// 打开静态弹窗
var multiConfigIndex = layer.open({
type: 1,
title: '多开配置 - ' + obj.data.name,
@@ -815,7 +817,7 @@
contentType: 'application/json',
data: JSON.stringify(formData),
success: function (res) {
if (res.message) {
if (res.code === 0) {
layer.msg('多开配置更新成功', { icon: 1 });
layer.close(index);
table.reload('appsTable');
@@ -836,6 +838,9 @@
form.render();
}
});
} else {
layer.msg(res.msg || '获取多开配置失败', { icon: 2 });
}
},
error: function () {
layer.msg('获取多开配置失败,请稍后重试', { icon: 2 });
@@ -884,9 +889,11 @@
$.ajax({
url: '/admin/api/apps/get_bind_config?uuid=' + obj.data.uuid,
type: 'GET',
success: function (config) {
// 填充表单数据
$('#bindConfigModal input[name="machine_verify"][value="' + config.machine_verify + '"]').prop('checked', true);
success: function (res) {
if (res.code === 0 && res.data) {
var config = res.data;
// 填充表单数据
$('#bindConfigModal input[name="machine_verify"][value="' + config.machine_verify + '"]').prop('checked', true);
$('#bindConfigModal input[name="machine_rebind_enabled"][value="' + config.machine_rebind_enabled + '"]').prop('checked', true);
$('#bindConfigModal input[name="machine_rebind_limit"][value="' + config.machine_rebind_limit + '"]').prop('checked', true);
$('#bindConfigModal input[name="machine_free_count"]').val(config.machine_free_count);
@@ -977,6 +984,9 @@
form.render();
}
});
} else {
layer.msg(res.msg || '获取绑定设置失败', { icon: 2 });
}
},
error: function () {
layer.msg('获取绑定设置失败,请稍后重试', { icon: 2 });
@@ -987,9 +997,11 @@
$.ajax({
url: '/admin/api/apps/get_register_config?uuid=' + obj.data.uuid,
type: 'GET',
success: function (config) {
// 填充表单数据
$('#registerConfigModal input[name="register_enabled"][value="' + config.register_enabled + '"]').prop('checked', true);
success: function (res) {
if (res.code === 0 && res.data) {
var config = res.data;
// 填充表单数据
$('#registerConfigModal input[name="register_enabled"][value="' + config.register_enabled + '"]').prop('checked', true);
$('#registerConfigModal input[name="register_limit_enabled"][value="' + config.register_limit_enabled + '"]').prop('checked', true);
$('#registerConfigModal input[name="register_limit_time"][value="' + config.register_limit_time + '"]').prop('checked', true);
$('#registerConfigModal input[name="register_count"]').val(config.register_count);
@@ -1074,6 +1086,9 @@
form.render();
}
});
} else {
layer.msg(res.msg || '获取注册设置失败', { icon: 2 });
}
},
error: function () {
layer.msg('获取注册设置失败,请稍后重试', { icon: 2 });

View File

@@ -1,4 +1,4 @@
{{ define "variables" }}
{{ define "variables.html" }}
<section>
<h2>变量管理</h2>
<div class="layui-btn-container" style="margin:12px 0">

Submodule web/template/layui-theme-dark deleted from a89e6787f4