增加极验验证开关设置

This commit is contained in:
2025-06-05 16:21:29 +08:00
parent ebffdf180e
commit d4017014f5
3 changed files with 272 additions and 148 deletions
+43 -24
View File
@@ -405,30 +405,49 @@ class YunzerController extends Base
}
# 配置值
public function configvalue()
{
$req = request();
if ($req->isPost()) {
$post = input('post.');
if (empty($post)) {
Log::record('更新配置值', 0, '数据不能为空', '系统配置');
$this->returnCode(1, '数据不能为空');
}
$oConfig = new YzAdminConfig();
$updateAll = $oConfig->updateAll($post);
if (empty($updateAll)) {
Log::record('更新配置值', 0, '更新配置值失败', '系统配置');
$this->returnCode(1, '更新配置值失败');
}
Log::record('更新配置值', 1, '', '系统配置');
$this->returnCode(0);
} else {
$lists = AdminConfig::order('config_sort DESC,config_id')->select();
View::assign([
'lists' => $lists
]);
return View::fetch();
}
}
{
$req = request();
if ($req->isPost()) {
$post = input('post.');
if (empty($post)) {
Log::record('更新配置值', 0, '数据不能为空', '系统配置');
$this->returnCode(1, '数据不能为空');
}
// 获取所有配置项,检查 config_type 为 4 的项
$allConfigs = AdminConfig::order('config_sort DESC,config_id')->select();
foreach ($allConfigs as $config) {
if ($config['config_type'] == 4) {
$checkboxName = $config['config_name'] . '_checkbox';
$configName = $config['config_name'];
if (!isset($post[$checkboxName])) {
// 复选框未选中,手动添加对应的值为 0
$post[$configName] = 0;
} else {
// 复选框选中,确保值为 1
$post[$configName] = 1;
}
// 移除 checkbox 字段
unset($post[$checkboxName]);
}
}
$oConfig = new YzAdminConfig();
$updateAll = $oConfig->updateAll($post);
if (empty($updateAll)) {
Log::record('更新配置值', 0, '更新配置值失败', '系统配置');
$this->returnCode(1, '更新配置值失败');
}
Log::record('更新配置值', 1, '', '系统配置');
$this->returnCode(0);
} else {
$lists = AdminConfig::order('config_sort DESC,config_id')->select();
View::assign([
'lists' => $lists
]);
return View::fetch();
}
}
// 邮件配置