// +---------------------------------------------------------------------- declare(strict_types=1); namespace addon\iot\controller\backend; use think\facade\View; use ywxapp\controller\BackendBase; use ywxapp\service\AddonService; /** * 服务设置控制器 */ class Setting extends BackendBase { /** * 服务设置页 */ public function setting() { $def = include ADDON_PATH . 'iot' . DIRECTORY_SEPARATOR . 'config.php'; $saved = AddonService::config('iot'); View::assign('def', $def); View::assign('saved', $saved ?: []); return View::fetch('admin/setting'); } /** * 保存设置 */ public function saveSetting() { $data = input('post.'); AddonService::config('iot', $data); $this->result->success('保存成功'); } }