dictionaryService = $dictionaryService; } public function index() { $dictionaries = $this->dictionaryService->getAll(); return response()->json([ 'code' => 200, 'message' => 'success', 'data' => $dictionaries ]); } public function getByCode(Request $request) { $code = $request->input('code'); $items = $this->dictionaryService->getItemsByCode($code); return response()->json([ 'code' => 200, 'message' => 'success', 'data' => [ 'code' => $code, 'items' => $items, ] ]); } public function show(int $id) { $dictionary = $this->dictionaryService->getById($id); if (!$dictionary) { return response()->json([ 'code' => 404, 'message' => '字典不存在', 'data' => null ], 404); } return response()->json([ 'code' => 200, 'message' => 'success', 'data' => $dictionary ]); } }