request->get(); $cateList = CategoryService::getOptions(); $res = [ ['text' => '全部', 'key' => 0] ]; foreach ($cateList as $key => $val) { $res[] = ['text' => $val, 'key' => $key]; } $this->success('', $res); } catch (\Exception $e) { if ($e instanceof HttpResponseException) { throw $e; } $this->error($e->getMessage()); } } }