<?php
|
|
namespace app\operations\controller\plus\work;
|
|
use app\operations\controller\Controller;
|
use app\operations\model\plus\work\Setting as SettingModel;
|
|
/**
|
* 企业微信设置控制器
|
*/
|
class Setting extends Controller
|
{
|
/**
|
* 基础设置
|
*/
|
public function index()
|
{
|
if ($this->request->isGet()) {
|
return $this->fetchData();
|
}
|
$model = new SettingModel;
|
$data = $this->request->param();
|
$arr = [
|
'background' => $data['background'],
|
];
|
if ($model->edit('basic', $arr)) {
|
return $this->renderSuccess('操作成功');
|
}
|
return $this->renderError($model->getError() ?: '操作失败');
|
}
|
|
/**
|
* 获取基础配置
|
*/
|
public function fetchData()
|
{
|
$vars = SettingModel::getItem('basic');
|
return $this->renderSuccess('', compact('vars'));
|
}
|
|
}
|