Files
sentos/app/controller/system/Dict.php
2022-05-24 16:10:50 +08:00

127 lines
3.0 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\system;
use app\controller\Base;
use app\services\system\DictionaryService;
/**
* @title 字典功能
*/
class Dict extends Base{
/**
* @title 字典分类数据
*
* @return void
*/
public function category(DictionaryService $dic){
$list = $dic->getTree($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加字典分类
*
* @return void
*/
public function addcate(DictionaryService $dic){
try {
$data = $dic->addcate($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改字典分类
*
* @return void
*/
public function editcate(DictionaryService $dic){
try {
$data = $dic->editcate($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
public function delcate(DictionaryService $dic){
$dic->deleteCategory($this->request);
return $this->data;
}
/**
* @title 字典列表
*
* @return void
*/
public function lists(DictionaryService $dic){
$list = $dic->getDictionary($this->request);
$this->data['data'] = $list;
return $this->data;
}
/**
* @title 添加字典
*
* @return void
*/
public function add(DictionaryService $dic){
try {
$data = $dic->createDic($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 修改字典
*
* @return void
*/
public function edit(DictionaryService $dic){
try {
$data = $dic->updateDic($this->request);
$this->data['code'] = 1;
$this->data['data'] = $data;
} catch (\Exception $e) {
$this->data['code'] = 0;
$this->data['message'] = $e->getMessage();
}
return $this->data;
}
/**
* @title 删除字典
*
* @param DictionaryService $dic
* @return void
*/
public function delete(DictionaryService $dic){
$dic->deleteDic($this->request);
return $this->data;
}
/**
* @title 字典明细
*
* @return void
*/
public function detail(DictionaryService $dic){
$list = $dic->getDictionaryDetail($this->request);
$this->data['data'] = $list;
return $this->data;
}
}