<?php
// +----------------------------------------------------------------------
// | onezan-admin 快速开发的管理平台
// +----------------------------------------------------------------------
// | 官方网址：https://www.onezan.cn
// +----------------------------------------------------------------------
// | onezan团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: 543885307@qq.com
// +----------------------------------------------------------------------
namespace Applications\sample\adminapi\controller\settings;

use app\adminapi\controller\BaseAdminController;
use Applications\sample\modules\settings\service\admin\SettingsService;
use think\Request;

/**
 * 示例应用设置
 * Class Settings
 * @package Applications\sample\adminapi\controller\settings
 */
class Settings extends BaseAdminController
{
    /**
     * 获取应用设置
     * @return \think\response\Json
     */
    public function get()
    {
        return json($this->service()->get());
    }

    /**
     * 保存应用设置
     * @param Request $request
     * @return \think\response\Json
     */
    public function save(Request $request)
    {
        return json($this->service()->save($request));
    }

    /**
     * 获取设置服务实例
     * @return SettingsService
     */
    private function service(): SettingsService
    {
        return $this->app->make(SettingsService::class);
    }
}
