<?php

namespace app\api\controller\Enrol;

use app\BaseController;
use app\common\model\Enrol\Classes as ModelClasses;
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 Classes extends BaseController
{
    /**
     * 获取班型列表
     */
    public function getClassesList(Request $request): array
    {
        $params = $request->param();
        $con = [];

        $query = ModelClasses::where($con)
            ->field([
                'classes_id',
                'classes_name',
                'classes_cover',
                'classes_desc',
                'classes_sort'
            ])
            ->order('classes_sort', 'asc');


        return msg("获取班型列表成功!", $query);
    }

    /**
     * 获取班型详情
     */
    public function getClassesInfo(Request $request): array
    {
        $params = $request->param();

        $this->validate($params, ['classes_id' => 'require']);

        $find = ModelClasses::field([
            'classes_id',
            'classes_name',
            'classes_cover',
            'classes_desc',
            'classes_content',
            'classes_sort'
        ])
            ->where('classes_id', $params['classes_id'])
            ->find();

        return msg(0, '获取班型详情成功!', ['data' => $find]);
    }
}
