<?php

namespace app\api\controller\Enrol;

use app\BaseController;
use app\common\model\Enrol\EnrolIntro as ModelEnrolIntro;
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 EnrolIntro extends BaseController
{
    /**
     * 获取招生简介列表
     */
    public function getEnrolIntroList(Request $request): array
    {
        $params = $request->param();
        $con = [];

        $query = ModelEnrolIntro::where($con)
            ->field([
                'enrol_intro_id',
                'enrol_intro_title',
                'enrol_intro_cover',
                'enrol_intro_sort',
            ])
            ->order('enrol_intro_sort', 'asc');

        return msg("获取招生简介列表成功!", $query);
    }

    /**
     * 获取招生简介详情
     */
    public function getEnrolIntroInfo(Request $request): array
    {
        $params = $request->param();

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

        $find = ModelEnrolIntro::field([
            'enrol_intro_id',
            'enrol_intro_title',
            'enrol_intro_create_time',
            'enrol_intro_cover',
            'enrol_intro_content',
            'enrol_intro_sort',
        ])
            ->where('enrol_intro_id', $params['enrol_intro_id'])
            ->find();

        return msg(0, '获取招生简介详情成功!', ['data' => $find]);
    }
}
