3 changed files with 104 additions and 1 deletions
@ -0,0 +1,36 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\api\controller\apiController; |
|||
|
|||
use app\Request; |
|||
use app\service\api\apiService\CourseService; |
|||
use core\base\BaseApiService; |
|||
|
|||
|
|||
/** |
|||
* 客户资源相关接口 |
|||
* Class Personnel |
|||
* @package app\api\controller\apiController |
|||
*/ |
|||
class Course extends BaseApiService |
|||
{ |
|||
|
|||
//客户资源-修改记录列表 |
|||
public function courseList(Request $request){ |
|||
$id = $this->member_id; |
|||
$data = $this->request->params([ |
|||
["schedule_date",0] |
|||
]); |
|||
return success((new CourseService())->list($id,$data)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
<?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; |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue