<?php

namespace app\adminapi\controller\settings\index;

use app\adminapi\controller\BaseAdminController;

class Login extends BaseAdminController
{
    public function getConfig()
    {
        return show(1,'',[
            'bg_type' => \app\common\service\ConfigService::get('login', 'bg_type','image'),
            'bg_src' => \app\common\service\ConfigService::get('login', 'bg_src',''),
            'bg_scroll' => \app\common\service\ConfigService::get('login', 'bg_scroll','1'),
        ]);
    }

    public function setConfig()
    {
        $params = $this->request->post();

        if (isset($params['bg_type'])) {
            \app\common\service\ConfigService::set('login', 'bg_type', $params['bg_type']);
        }

        if (isset($params['bg_src'])) {
            \app\common\service\ConfigService::set('login', 'bg_src', $params['bg_src']);
        }

        if (isset($params['bg_scroll'])) {
            \app\common\service\ConfigService::set('login', 'bg_scroll', $params['bg_scroll']);
        }

        return $this->success('设置成功');
    }
}