// +---------------------------------------------------------------------- namespace app\controller\admin\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; } public function all(DictionaryService $dic){ $list = $dic->getDictionaryAll($this->request); $this->data['data'] = $list; return $this->data; } }