You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.2 KiB

4 years ago
<?php
// +----------------------------------------------------------------------
// | Description: 系统配置
// +----------------------------------------------------------------------
// | Author: yykun
// +----------------------------------------------------------------------
namespace app\admin\controller;
use think\Hook;
use think\Request;
class System extends ApiCommon
{
//用于判断权限
public function _initialize()
{
$action = [
3 years ago
'permission' => ['index'],
'allow' => ['']
4 years ago
];
3 years ago
Hook::listen('check_auth', $action);
4 years ago
$request = Request::instance();
3 years ago
$a = strtolower($request->action());
4 years ago
if (!in_array($a, $action['permission'])) {
parent::_initialize();
3 years ago
}
}
4 years ago
//信息列表
public function index()
3 years ago
{
4 years ago
$systemModel = model('System');
$data = $systemModel->getDataList();
return resultArray(['data' => $data]);
}
3 years ago
4 years ago
//编辑保存
3 years ago
public function save()
{
4 years ago
$param = $this->param;
3 years ago
$userInfo = $this->userInfo;
$field_name = '';
$dataInfo = [];
4 years ago
if (isset($param['logo'])) {
3 years ago
$system_id = 2;
$field_name = '企业logo';
$logo = !empty($param['logo']) ? './public/uploads/' . $param['logo'] : '';
$dataInfo = db('admin_system')->where('id', $system_id)->column('name,value');
4 years ago
db('admin_system')->where('name', 'logo')->update(['value' => $logo]);
3 years ago
# 修改记录
SystemActionLog($userInfo['id'], 'admin_system', 'company', 1, 'update', '企业基本信息设置', '', '', '编辑了:' . $field_name);
}
if (isset($param['name'])) {
$system_id = 1;
$field_name = '企业名称';
$dataInfo = db('admin_system')->where('id', $system_id)->column('name,value');
4 years ago
db('admin_system')->where('name', 'name')->update(['value' => $param['name']]);
3 years ago
# 修改记录
SystemActionLog($userInfo['id'], 'admin_system', 'company', 1, 'update', '企业基本信息设置', '', '', '编辑了:' . $field_name);
4 years ago
}
return resultArray(['data' => '操作成功!']);
3 years ago
}
4 years ago
}