From ff2f68505f5684875c351f20bb17a35121b250be Mon Sep 17 00:00:00 2001 From: zeyan <258785420@qq.com> Date: Tue, 8 Jul 2025 09:09:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- niucloud/app/adminapi/route/service_logs.php | 14 + niucloud/app/api/controller/member/Member.php | 8 +- .../app/service/api/member/MemberService.php | 95 ++++- uniapp/pages.json | 12 +- uniapp/pages/coach/my/index.vue | 2 +- uniapp/pages/coach/my/service_list.vue | 291 +++++++------ uniapp/pages/coach/my/teaching_management.vue | 91 +++- uniapp/pages/coach/student/info.vue | 398 +++++++++--------- uniapp/pages/coach/student/student_list.vue | 30 +- uniapp/pages/market/clue/clue_info.vue | 7 + 10 files changed, 596 insertions(+), 352 deletions(-) diff --git a/niucloud/app/adminapi/route/service_logs.php b/niucloud/app/adminapi/route/service_logs.php index e4d15e1e..790e956f 100644 --- a/niucloud/app/adminapi/route/service_logs.php +++ b/niucloud/app/adminapi/route/service_logs.php @@ -23,6 +23,20 @@ Route::group('service_logs', function () { Route::get('service_logs', 'service_logs.ServiceLogs/lists'); + // 服务记录分发管理 + Route::group('distribution', function () { + // 手动执行分发任务 + Route::post('execute', 'service_logs.ServiceLogsDistribution/executeDistribution'); + // 获取分发统计信息 + Route::get('stats', 'service_logs.ServiceLogsDistribution/getDistributionStats'); + // 获取待分发的服务记录列表 + Route::get('pending', 'service_logs.ServiceLogsDistribution/getPendingDistributionList'); + // 重置分发状态 + Route::post('reset', 'service_logs.ServiceLogsDistribution/resetDistributionStatus'); + // 获取教务和教练人员列表 + Route::get('staff', 'service_logs.ServiceLogsDistribution/getStaffList'); + }); + })->middleware([ AdminCheckToken::class, AdminCheckRole::class, diff --git a/niucloud/app/api/controller/member/Member.php b/niucloud/app/api/controller/member/Member.php index 0443e39f..c0a029f1 100644 --- a/niucloud/app/api/controller/member/Member.php +++ b/niucloud/app/api/controller/member/Member.php @@ -184,7 +184,13 @@ class Member extends BaseApiController //教练下全部学员 public function student_list(){ $data = $this->request->params([ - [ 'type', 'all' ] + [ 'type', 'all' ], + [ 'name', '' ], + [ 'phone', '' ], + [ 'lessonCount', '' ], + [ 'leaveCount', '' ], + [ 'courseId', '' ], + [ 'classId', '' ], ]); return success(( new MemberService() )->student_list($data)); } diff --git a/niucloud/app/service/api/member/MemberService.php b/niucloud/app/service/api/member/MemberService.php index b72e70e3..dc0f6420 100644 --- a/niucloud/app/service/api/member/MemberService.php +++ b/niucloud/app/service/api/member/MemberService.php @@ -376,27 +376,100 @@ class MemberService extends BaseApiService //教练下全部学员 public function student_list($data) { - $where = []; - if($data['type'] == "daoqi"){ - $where[] = ['a.end_date', 'between', [date('Y-m-d', strtotime('-6 days')), date('Y-m-d')]]; - } + // 添加调试日志 + Log::debug('MemberService/student_list - 接收参数: ' . json_encode($data)); + + // 创建查询构建器 $student_courses = new StudentCourses(); - $list = $student_courses + $query = $student_courses ->alias("a") ->join(['school_student' => 'b'],"a.student_id = b.id","left") ->join(['school_campus' => 'c'],'b.campus_id = c.id',"left") ->join(['school_customer_resources' => 'e'],'e.id = b.user_id',"left") ->join(['school_member' => 'f'],'f.member_id = e.member_id',"left") ->join(['school_resource_sharing' => 'g'],'g.resource_id = e.id',"left") - ->where($where) - ->where("a.main_coach_id = {$this->member_id} OR a.education_id = {$this->member_id} OR find_in_set('{$this->member_id}', a.assistant_ids) ") - ->field(" - b.id,b.name,c.campus_name as campus, - a.total_hours,a.gift_hours,a.use_total_hours,a.use_gift_hours,a.end_date,f.headimg as avatar,g.id as resource_sharing_id + ->where("a.main_coach_id = {$this->member_id} OR a.education_id = {$this->member_id} OR find_in_set('{$this->member_id}', a.assistant_ids) "); + + // 基础条件:到期时间筛选 + if(isset($data['type']) && $data['type'] == "daoqi"){ + $query->where('a.end_date', 'between', [date('Y-m-d', strtotime('-6 days')), date('Y-m-d')]); + } + + // 处理课时数量查询 (gift_hours + total_hours - use_total_hours - use_gift_hours = lessonCount) + if (!empty($data['lessonCount'])) { + $query->whereRaw("(a.gift_hours + a.total_hours - a.use_total_hours - a.use_gift_hours) = {$data['lessonCount']}"); + } + + // 处理课程ID查询 + if (!empty($data['courseId'])) { + $query->where('a.course_id', '=', $data['courseId']); + } + + // 处理姓名查询(模糊匹配) + if (!empty($data['name'])) { + Log::debug('MemberService/student_list - 添加姓名查询条件: ' . $data['name']); + $namePattern = '%' . $data['name'] . '%'; + Log::debug('MemberService/student_list - 姓名匹配模式: ' . $namePattern); + $query->where('e.name', 'like', $namePattern); + } + + // 处理手机号查询(模糊匹配) + if (!empty($data['phone'])) { + Log::debug('MemberService/student_list - 添加手机号查询条件: ' . $data['phone']); + $phonePattern = '%' . $data['phone'] . '%'; + Log::debug('MemberService/student_list - 手机号匹配模式: ' . $phonePattern); + $query->where('e.phone_number', 'like', $phonePattern); + } + + // 处理请假次数查询 + if (!empty($data['leaveCount'])) { + $person_course_schedule = new PersonCourseSchedule(); + $leave_resource_ids = $person_course_schedule + ->field('resources_id') + ->where(['status' => 2]) // 请假状态 + ->group('resources_id') + ->having("COUNT(*) = {$data['leaveCount']}") + ->column('resources_id'); + + if (empty($leave_resource_ids)) { + // 如果没有满足请假次数的资源,返回空结果 + Log::debug('MemberService/student_list - 没有满足请假次数的资源,返回空结果'); + return []; + } + + $query->where('e.id', 'in', $leave_resource_ids); + } + + // 处理班级ID查询 + if (!empty($data['classId'])) { + $class_resources_rel = new ClassResourcesRel(); + $class_resource_ids = $class_resources_rel + ->where(['class_id' => $data['classId']]) + ->column('resource_id'); + + if (empty($class_resource_ids)) { + // 如果班级下没有资源,返回空结果 + Log::debug('MemberService/student_list - 班级下没有资源,返回空结果'); + return []; + } + + $query->where('e.id', 'in', $class_resource_ids); + } + + // 记录生成的SQL(仅用于调试) + Log::debug('MemberService/student_list - SQL: ' . $query->buildSql()); + + $list = $query->field(" + b.id,e.name,c.campus_name as campus, + a.total_hours,a.gift_hours,a.use_total_hours,a.use_gift_hours,a.end_date,f.headimg as avatar,g.id as resource_sharing_id, + e.phone_number ") ->select(); - return $list ? $list->toArray() : []; + $result = $list ? $list->toArray() : []; + Log::debug('MemberService/student_list - 查询结果数量: ' . count($result)); + + return $result; } public function sktj(){ diff --git a/uniapp/pages.json b/uniapp/pages.json index 47d5fc32..a2b2baa6 100644 --- a/uniapp/pages.json +++ b/uniapp/pages.json @@ -438,7 +438,7 @@ "navigationBarTitleText": "修改密码", "navigationStyle": "default", "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" + "navigationBarTextStyle": "white" } }, { @@ -446,8 +446,8 @@ "style": { "navigationBarTitleText": "教研管理列表", "navigationStyle": "default", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" + "navigationBarBackgroundColor": "#171717", + "navigationBarTextStyle": "white" } }, { @@ -456,7 +456,7 @@ "navigationBarTitleText": "文章详情", "navigationStyle": "default", "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" + "navigationBarTextStyle": "white" } }, { @@ -465,7 +465,7 @@ "navigationBarTitleText": "考试", "navigationStyle": "default", "navigationBarBackgroundColor": "#171717", - "navigationBarTextStyle": "black" + "navigationBarTextStyle": "white" } }, { @@ -664,7 +664,7 @@ "style": { "navigationBarTitleText": "服务列表", "navigationBarBackgroundColor": "#29d3b4", - "navigationBarTextStyle": "black" + "navigationBarTextStyle": "white" } }, { diff --git a/uniapp/pages/coach/my/index.vue b/uniapp/pages/coach/my/index.vue index ff84af07..87ca1351 100644 --- a/uniapp/pages/coach/my/index.vue +++ b/uniapp/pages/coach/my/index.vue @@ -228,7 +228,7 @@ //打开服务详情 openServiceDetail() { this.$navigateTo({ - url: '/pages/coach/my/service_detail' + url: '/pages/coach/my/service_list' }) }, diff --git a/uniapp/pages/coach/my/service_list.vue b/uniapp/pages/coach/my/service_list.vue index a76b6eaf..2eb2f362 100644 --- a/uniapp/pages/coach/my/service_list.vue +++ b/uniapp/pages/coach/my/service_list.vue @@ -1,6 +1,6 @@