Files
BlackFruit-UI/plugins/addon/theme_configurator/controller/ThemeController.php
yiqiu 43b8aff355
All checks were successful
continuous-integration/drone/push Build is passing
完善合作伙伴模块移除:清理控制器中的 partner 字段
- 从后台 ThemeController 的 save 方法中移除 partner 字段
- 从前台 ThemeController 的 config 方法中移除 partner 字段
- 确保数据保存和读取接口不再处理 partner 相关数据

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 17:40:55 +08:00

70 lines
2.0 KiB
PHP

<?php
namespace addon\theme_configurator\controller;
use addon\theme_configurator\model\ThemeConfigModel;
use app\event\controller\PluginAdminBaseController;
use think\Response;
/**
* 后台主题配置控制器
*
* 注意:结构尽量与官方示例插件保持一致,避免因基类或构造方式不一致导致 500。
*/
class ThemeController extends PluginAdminBaseController
{
/**
* 获取配置
*/
public function config(): Response
{
$model = new ThemeConfigModel();
$config = $model->getConfig();
return json([
'status' => 200,
'msg' => lang_plugins('theme_configurator_success'),
'data' => $config,
]);
}
/**
* 保存配置
*/
public function save(): Response
{
// 兼容 application/json 与表单提交两种方式获取参数
$param = $this->request->param();
if (empty($param)) {
$raw = $this->request->getContent();
if ($raw) {
$json = json_decode($raw, true);
if (is_array($json)) {
$param = $json;
}
}
}
// 与前端 payload 结构保持一致,只取需要的字段入库
$payload = [
'seo' => $param['seo'] ?? [],
'header_nav' => $param['header_nav'] ?? [],
'footer_nav' => $param['footer_nav'] ?? [],
'site_config' => $param['site_config'] ?? [],
'friendly_link' => $param['friendly_link'] ?? [],
'banner' => $param['banner'] ?? [],
'side' => $param['side'] ?? [],
'feedback_type' => $param['feedback_type'] ?? [],
'honor' => $param['honor'] ?? [],
];
$model = new ThemeConfigModel();
$config = $model->saveConfig($payload);
return json([
'status' => 200,
'msg' => lang_plugins('theme_configurator_save_success'),
'data' => $config,
]);
}
}