<?php

namespace app\api\controller\HonoraryAchievement;

use app\BaseController;
use app\common\model\HonoraryAchievement\SchoolLeaders as ModelSchoolLeaders;
use app\Request;
use think\Validate;
use think\exception\ValidateException;
use think\facade\Filesystem;
use app\common\arw\adjfut\src\Excel;
use app\common\arw\adjfut\src\UploadFile;
use think\facade\Db;
use app\common\exception\Tool;
use think\facade\Env;


class SchoolLeaders extends BaseController
{
    /**
     * 获取录取学院领军者列表
     */
    public function getSchoolLeadersList(Request $request): array
    {
        $params = $request->param();
        $con = [];

        // $this->validate($params, [
        //     'school_category_id|录取院校类型id' => 'require',
        // ]);
        // $con = Tool::getOptionalQuery(['b.school_category_id', '=']);

        $query = ModelSchoolLeaders::where($con)
            ->field([
                'a.school_leaders_id',
                'a.school_category_guid',
                'b.school_category_id',
                'b.school_category_name',
                'a.school_leaders_name',
                'a.school_leaders_school',
                'a.school_leaders_img',
                'a.school_leaders_sort'
            ])
            ->alias('a')
            ->leftJoin('school_category b', 'a.school_category_guid = b.school_category_guid')
            ->hidden(['school_category_guid'])
            ->order('a.school_leaders_sort', 'asc')
            ->select();


        return msg(0, "获取录取学院领军者列表成功!", [
            'data' => $query,
            'count' => count($query)
        ]);
    }

}
