<?php namespace app\controller\api\v1; use support\Request; use App\Utils\ApiResponse; use App\model\Mechanism; use hg\apidoc\annotation as Apidoc; /** * @Apidoc\Title("养老机构控制器") */ class MechanismController { protected $noNeedLogin = ['get_mechanism_list','get_mechanism_details']; /** * @Apidoc\Title("1.0 获取所有养老机构") * @Apidoc\Url("api/v1/mechanism/get_mechanism_list") * @Apidoc\Method("POST") */ public function get_mechanism_list(Request $request) { $res = Mechanism::all(); return ApiResponse::success(200, $res); } /** * @Apidoc\Title("1.0 获取养老机构详细信息") * @Apidoc\Url("api/v1/mechanism/get_mechanism_details") * @Apidoc\Param("id", type="int",require=true, desc="养老机构id",default="1") * @Apidoc\Method("POST") */ public function get_mechanism_details(Request $request) { $data = $request->post(); $res = Mechanism::where('id', $data['id'])->first(); return ApiResponse::success(200, $res); } }