You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.3 KiB
66 lines
2.3 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service\api\apiService;
|
|
|
|
use app\model\course_schedule\CourseSchedule;
|
|
use app\model\person_course_schedule\PersonCourseSchedule;
|
|
use app\model\course\Course;
|
|
use core\base\BaseApiService;
|
|
use think\Model;
|
|
use think\facade\Db;
|
|
|
|
/**
|
|
* 员工服务层
|
|
* Class MemberService
|
|
* @package app\service\api\member
|
|
*/
|
|
class CourseService extends BaseApiService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->model = new Course();
|
|
}
|
|
|
|
//获取教研管理文章列表
|
|
public function list($id,$data)
|
|
{
|
|
$where = [];
|
|
if ($data['schedule_date']) {
|
|
$where[] = ['course_date','=', $data['schedule_date']];
|
|
}
|
|
$CourseSchedule = new CourseSchedule();
|
|
$search_model = $CourseSchedule
|
|
->where('coach_id', $id)
|
|
->where($where)
|
|
->with(['course' => function($query) {
|
|
$query->select();
|
|
},'venue' => function($query) {
|
|
$query->select();
|
|
}]);
|
|
$list = $this->pageQuery($search_model);
|
|
$PersonCourseSchedule = new PersonCourseSchedule();
|
|
foreach ($list['data'] as $k => $v) {
|
|
$student = Db::name('person_course_schedule')
|
|
->alias('pcs')
|
|
->where('pcs.schedule_id', $v['id']) // 建议加上表别名避免冲突
|
|
->join('school_student st', 'pcs.student_id = st.id')
|
|
->join('school_customer_resources cr', 'st.user_id = cr.id')
|
|
->join('school_member sm', 'cr.member_id = sm.member_id')
|
|
->field('st.name, sm.headimg as avatar') // 👈 正确方式取字段
|
|
->select();
|
|
$list['data'][$k]['student'] = $student;
|
|
}
|
|
return $list;
|
|
}
|
|
}
|
|
|
|
|