73 lines
1.8 KiB
PHP
73 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\Teachers;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\Teachers_strength\Teacher as ModelTeachers;
|
|
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 Teachers extends BaseController
|
|
{
|
|
/**
|
|
* 获取教师列表
|
|
*/
|
|
public function getTeachersList(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
$con = [];
|
|
|
|
$con = Tool::getOptionalQuery(['teacher_name', 'LIKE'], ['teacher_position', '='], ['subject_guid', '='],);
|
|
|
|
$query = ModelTeachers::where($con)
|
|
->field([
|
|
'teacher_id',
|
|
'teacher_guid',
|
|
'teacher_name',
|
|
'teacher_position',
|
|
'teacher_img',
|
|
'subject_guid',
|
|
'teacher_intro',
|
|
'teacher_order'
|
|
])
|
|
->order('teacher_update_time', 'desc');
|
|
|
|
|
|
|
|
return msg("获取教师列表成功!", $query);
|
|
}
|
|
|
|
/**
|
|
* 获取教师详情
|
|
*/
|
|
public function getTeachersInfo(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
|
|
$this->validate($params, ['teacher_guid' => 'require']);
|
|
|
|
$find = ModelTeachers::field([
|
|
'teacher_id',
|
|
'teacher_guid',
|
|
'teacher_name',
|
|
'teacher_position',
|
|
'teacher_img',
|
|
'subject_guid',
|
|
'teacher_intro',
|
|
'teacher_order'
|
|
])
|
|
->where('teacher_guid', $params['teacher_guid'])
|
|
->find();
|
|
|
|
return msg(0, '获取教师详情成功!', ['data' => $find]);
|
|
}
|
|
}
|