<?php

namespace app\api\controller\HonoraryAchievement;

use app\BaseController;
use app\common\model\HonoraryAchievement\JointAchievement as ModelJointAchievement;
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 JointAchievement extends BaseController
{
    /**
     * 获取联考成绩列表
     */
    public function getJointAchievementList(Request $request): array
    {
        $params = $request->param();
        $con = [];

        $query = ModelJointAchievement::where($con)
            ->field([
                'joint_achievement_id',
                'joint_achievement_title',
                'joint_achievement_cover',
                'joint_achievement_sort',
            ])
            ->order('joint_achievement_sort', 'asc');

        return msg("获取联考成绩列表成功!",$query);
    }

    /**
     * 获取联考成绩详情
     */
    public function getJointAchievementInfo(Request $request): array
    {
        $params = $request->param();

        $this->validate($params, ['joint_achievement_id|联考成绩id' => 'require']);

        $find = ModelJointAchievement::field([
            'joint_achievement_id',
            'joint_achievement_title',
            'joint_achievement_cover',
            'joint_achievement_sort',
            'joint_achievement_content',
            'joint_achievement_create_time',
        ])
            ->where('joint_achievement_id', $params['joint_achievement_id'])
            ->find();

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