<?php

namespace app\api\controller\v1;

use app\api\controller\Api;

class Classification {


    public $restMethodList = 'get|post|put|';
    /**
     * @SWG\Get(
     *     path="/index",
     *     tags={"用户信息"},
     *     operationId="read",
     *     summary="Add a new pet to the store",
     *     description="",
     *     consumes={"multipart/form-data"},
     *     produces={"multipart/form-data"},
     *     @SWG\Parameter(
     *         name="id",
     *         description="Pet object that needs to be added to the store",
     *         required=false,
     *          paramType="form",
     *         @SWG\Schema(ref="#/definitions/Pet"),
     *     ),
     *     @SWG\Response(
     *         response=405,
     *         description="Invalid input",
     *     ),
     *     security={{"petstore_auth":{"write:pets", "read:pets"}}}
     * )
     */
    public function index(){


    }

    public function read($id){
        //获取4大分类下的子分类
        $groupModel = model('Classification');
        $list=$groupModel->get_all_class($id);
        $result=new Api();
        if($list){
            return $result->sendSuccess($list,'SUCCESS','200');
        }else{
            return $result->sendSuccess($list,'SUCCESS','200');
        }




    }
    public function case_list($id){
        //获取子分类下的案例列表
        $groupModel = model('Classification');
        $list=$groupModel->get_case_list($id);
        $result=new Api();

        if($list){

//            print_json($list);die;
            return $result->sendSuccess($list,'SUCCESS','200');
        }else{
            return $result->sendSuccess($list,'SUCCESS','200');
        }

    }

    public function case_details($id){

        $groupModel = model('Classification');
        $list=$groupModel->get_case_details($id);
        $result=new Api();
        if($list){
            return $result->sendSuccess($list,'SUCCESS','200');
        }else{
            return $result->sendSuccess($list,'SUCCESS','200');
        }
    }




}