From b29fe7b2d33da23b8e6706ee9f321b481c000af3 Mon Sep 17 00:00:00 2001
From: "1213317725@qq.com" <1213317725@qq.com>
Date: Mon, 30 Jun 2025 15:47:52 +0800
Subject: [PATCH] 1
---
.../api/controller/apiController/ClassApi.php | 46 +-
niucloud/app/api/controller/member/Member.php | 36 ++
niucloud/app/api/route/member.php | 14 +
.../service/api/apiService/jlClassService.php | 9 +-
.../app/service/api/member/MemberService.php | 154 ++++++
uniapp/pages/coach/my/due_soon.vue | 518 ++++++++----------
uniapp/pages/coach/my/index.vue | 9 +-
.../pages/coach/my/schooling_statistics.vue | 2 +-
uniapp/pages/coach/student/student_list.vue | 129 ++---
9 files changed, 524 insertions(+), 393 deletions(-)
diff --git a/niucloud/app/api/controller/apiController/ClassApi.php b/niucloud/app/api/controller/apiController/ClassApi.php
index d8c22f2a..c1ae82c1 100644
--- a/niucloud/app/api/controller/apiController/ClassApi.php
+++ b/niucloud/app/api/controller/apiController/ClassApi.php
@@ -111,32 +111,40 @@ class ClassApi extends BaseApiService
public function addJlPublishJob(Request $request)
{
$id = $this->member_id;
+// $data = $this->request->params([
+// ["class_id",0],
+// ["classes_id_name",''],
+// ["description",''],
+// ["content_type",''],
+// ["course_id",0],
+// ["course_id_name",''],
+// ["student_id",''],
+// ["students_ids_name",''],
+// ["type",''],
+// ["personnel_id",$id],
+// ]);
+// if (isset($data['student_id'])) {
+// if (is_string($data['student_id']) && strpos($data['student_id'], ',') !== false) {
+// $studentIds = explode(',', $data['student_id']);
+// $studentIds = array_map('trim', $studentIds);
+// } elseif (is_array($data['student_id'])) {
+// $studentIds = $data['student_id'];
+// } else {
+// $studentIds = [(string)$data['student_id']];
+// }
+// $studentIds = array_map('intval', $studentIds);
+// } else {
+// $studentIds = [];
+// }
+// $data['student_id'] = $studentIds;
+
$data = $this->request->params([
["class_id",0],
- ["classes_id_name",''],
["description",''],
- ["content_type",''],
["course_id",0],
- ["course_id_name",''],
["student_id",''],
- ["students_ids_name",''],
- ["type",''],
["personnel_id",$id],
]);
- if (isset($data['student_id'])) {
- if (is_string($data['student_id']) && strpos($data['student_id'], ',') !== false) {
- $studentIds = explode(',', $data['student_id']);
- $studentIds = array_map('trim', $studentIds);
- } elseif (is_array($data['student_id'])) {
- $studentIds = $data['student_id'];
- } else {
- $studentIds = [(string)$data['student_id']];
- }
- $studentIds = array_map('intval', $studentIds);
- } else {
- $studentIds = [];
- }
- $data['student_id'] = $studentIds;
return success('操作成功', (new jlClassService())->addPublishJob($data));
}
//获取我的页面统计个数
diff --git a/niucloud/app/api/controller/member/Member.php b/niucloud/app/api/controller/member/Member.php
index 953aae5b..c70e37aa 100644
--- a/niucloud/app/api/controller/member/Member.php
+++ b/niucloud/app/api/controller/member/Member.php
@@ -147,4 +147,40 @@ class Member extends BaseApiController
}
+ public function get_assignments_list(){
+ return success(( new MemberService() )->get_assignments_list());
+ }
+
+
+ public function assignments_info(){
+ $data = $this->request->params([
+ [ 'id', '' ]
+ ]);
+ return success(( new MemberService() )->assignments_info($data));
+ }
+
+ public function service_detail(){
+ $data = $this->request->params([
+ [ 'id', '' ]
+ ]);
+ return success(( new MemberService() )->service_detail($data));
+ }
+
+ public function service_list(){
+ return success(( new MemberService() )->service_list());
+ }
+
+ //教练下全部学员
+ public function student_list(){
+ $data = $this->request->params([
+ [ 'type', 'all' ]
+ ]);
+ return success(( new MemberService() )->student_list($data));
+ }
+
+ public function sktj(){
+ return success(( new MemberService() )->sktj());
+ }
+
+
}
diff --git a/niucloud/app/api/route/member.php b/niucloud/app/api/route/member.php
index 540220a7..04cfd875 100644
--- a/niucloud/app/api/route/member.php
+++ b/niucloud/app/api/route/member.php
@@ -108,6 +108,20 @@ Route::group('member', function () {
Route::get('jl_index', 'member.Member/jl_index');
+ Route::get('get_assignments_list', 'member.Member/get_assignments_list');
+
+ Route::get('assignments_info', 'member.Member/assignments_info');
+
+ Route::get('service/detail', 'member.Member/service_detail');
+
+ Route::get('service/list', 'member.Member/service_list');
+
+ //教练下全部学员
+ Route::get('student_list', 'member.Member/student_list');
+
+ Route::get('sktj', 'member.Member/sktj');
+
+
})->middleware(ApiChannel::class)
->middleware(ApiPersonnelCheckToken::class, true)
->middleware(ApiLog::class);
diff --git a/niucloud/app/service/api/apiService/jlClassService.php b/niucloud/app/service/api/apiService/jlClassService.php
index e1565f72..ad0cb712 100644
--- a/niucloud/app/service/api/apiService/jlClassService.php
+++ b/niucloud/app/service/api/apiService/jlClassService.php
@@ -149,10 +149,11 @@ class jlClassService extends BaseApiService
public function addPublishJob($data)
{
$Assignment = new Assignment();
- foreach ($data['student_id'] as $v) {
- $data['student_id'] = $v;
- $Assignment->create($data);
- }
+// foreach ($data['student_id'] as $v) {
+// $data['student_id'] = $v;
+// $Assignment->create($data);
+// }
+ $Assignment->create($data);
return true;
}
diff --git a/niucloud/app/service/api/member/MemberService.php b/niucloud/app/service/api/member/MemberService.php
index 10421563..018e5906 100644
--- a/niucloud/app/service/api/member/MemberService.php
+++ b/niucloud/app/service/api/member/MemberService.php
@@ -12,12 +12,15 @@
namespace app\service\api\member;
use app\model\assignment\Assignment;
+use app\model\attendance\Attendance;
use app\model\campus\Campus;
+use app\model\class_resources_rel\ClassResourcesRel;
use app\model\communication_records\CommunicationRecords;
use app\model\course_schedule\CourseSchedule;
use app\model\member\Member;
use app\model\person_course_schedule\PersonCourseSchedule;
use app\model\service_logs\ServiceLogs;
+use app\model\student_courses\StudentCourses;
use app\service\core\member\CoreMemberService;
use core\base\BaseApiService;
use core\exception\ApiException;
@@ -243,4 +246,155 @@ class MemberService extends BaseApiService
return ['course_list' => $course_list,'task_list' => $task_list,'service_list' => $service_list];
}
+
+
+ public function get_assignments_list(){
+ $Assignment = new Assignment();
+ $search_model = $Assignment
+ ->alias("a")
+ ->join(['school_class' => 'b'],"a.class_id = b.id","left")
+ ->join(['school_course' => 'c'],"a.course_id = c.id","left")
+ ->field("a.id,a.create_time,b.class_name,c.course_name,a.status")
+ ->where([
+ 'a.personnel_id' => $this->member_id
+ ])->order("a.create_time desc");
+
+ $list = $this->pageQuery($search_model, function ($item){
+
+ });
+
+ return $list;
+ }
+
+
+
+ public function assignments_info($data){
+ $Assignment = new Assignment();
+
+ $info = $Assignment
+ ->alias("a")
+ ->join(['school_personnel' => 'b'],'a.personnel_id = b.id','left')
+ ->where(['a.id' => $data['id']])
+ ->field("a.*,b.name as coach_name,b.head_img as coach_pic")
+ ->find();
+ return $info ? $info->toArray() : [];
+ }
+
+ public function service_detail($data){
+ $service_logs = new ServiceLogs();
+ $info = $service_logs->alias("a")
+ ->join(['school_customer_resources' => 'b'],'a.resource_id = b.id',"left")
+ ->join(['school_course' => 'c'],'a.course_id = c.id',"left")
+ ->join(['school_service' => 'd'],'a.service_id = d.id',"left")
+ ->join(['school_personnel' => 'e'],'a.staff_id = e.id',"left")
+ ->join(['school_campus' => 'f'],'b.campus = f.id',"left")
+ ->where(['a.id' => $data['id']])
+ ->field("
+ a.id,b.name as resource_id,c.course_name as course_id,d.service_name as service_id,a.service_remark,a.status,
+ e.name as staff_id,a.score,a.feedback,a.feedback_time,a.created_at,a.updated_at,f.campus_name as campus,
+ b.source_channel,b.source
+ ")
+ ->find();
+
+ $info['source'] = get_dict_value('source',$info['source']);
+ $info['channel'] = get_dict_value('SourceChannel',$info['source_channel']);
+
+ return $info ? $info->toArray() : [];
+ }
+
+
+ public function service_list(){
+ $service_logs = new ServiceLogs();
+ $search_model = $service_logs
+ ->alias("a")
+ ->join(['school_service' => 'd'],'a.service_id = d.id',"left")
+ ->where([
+ 'a.staff_id' => $this->member_id
+ ])
+ ->field("a.*,d.service_name,d.description")
+ ->order("a.created_at desc");
+
+ $list = $this->pageQuery($search_model, function ($item){
+
+ });
+
+ return $list;
+ }
+
+ //教练下全部学员
+ 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')]];
+ }
+ $student_courses = new StudentCourses();
+ $list = $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
+ ")
+ ->select();
+
+ return $list ? $list->toArray() : [];
+ }
+
+ public function sktj(){
+ $course_schedule = new CourseSchedule();
+ $student_courses = new StudentCourses();
+ $class_resources_rel = new ClassResourcesRel();
+ $attendance = new Attendance();
+ $year = date('Y');
+ $currentMonth = date('n');
+ $results = [];
+
+ for ($m = $currentMonth; $m >= 1; $m--) {
+ $start = date("Y-m-01", strtotime("$year-$m"));
+ $end = date("Y-m-t", strtotime("$year-$m"));
+
+ $count = $course_schedule
+ ->where("coach_id = {$this->member_id} OR education_id = {$this->member_id} OR find_in_set('{$this->member_id}', assistant_ids) ")
+ ->where('course_date', 'between', [$start, $end])
+ ->count();
+
+
+ $list = $student_courses
+ ->where("main_coach_id = {$this->member_id} OR education_id = {$this->member_id} OR find_in_set('{$this->member_id}', assistant_ids) ")
+ ->where('start_date', 'between', [$start, $end])
+ ->select();
+
+ $yfzxy = count($list);
+ $class_id = [];
+ foreach($list as $k=>$v){
+ $class_id[] = $class_resources_rel->where(['resource_id' => $v['resource_id']])->value("class_id");
+ }
+
+ $class_id = array_unique($class_id);
+
+ $dk_count = $attendance->where(['staff_id' => $this->member_id])->where('attendance_date', 'between', [$start, $end])->count();
+
+
+ if ($count > 0) {
+ $rate = round($dk_count / $count * 100, 2); // 保留两位小数
+ } else {
+ $rate = 0;
+ }
+
+
+ $results[] = ['month_date' => "$year-$m",'ysks' => $count,'yfzxy' => $yfzxy,'zsbj' => count($class_id),'ydkl' => $rate];
+
+
+ }
+
+ return $results;
+ }
+
}
diff --git a/uniapp/pages/coach/my/due_soon.vue b/uniapp/pages/coach/my/due_soon.vue
index 4b4a5afd..730e84c7 100644
--- a/uniapp/pages/coach/my/due_soon.vue
+++ b/uniapp/pages/coach/my/due_soon.vue
@@ -1,323 +1,235 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
- 即将到期
-
-
-
- 黄明明
- 课程截止时间:2020.05:25
-
-
-
-
- 24
- 已上课时
-
-
- 24
- 剩余课时
-
-
-
-
-
-
-
-
- 即将到期
-
-
-
- 黄明明
- 课程截止时间:2020.05:25
-
-
-
-
- 24
- 已上课时
-
-
- 24
- 剩余课时
-
-
-
-
-
-
-
-
- 即将到期
-
-
-
- 黄明明
- 课程截止时间:2020.05:25
-
-
-
-
- 24
- 已上课时
-
-
- 24
- 剩余课时
-
-
-
-
-
-
-
-
- 即将到期
-
-
-
- 黄明明
- 课程截止时间:2020.05:25
-
-
-
-
- 24
- 已上课时
-
-
- 24
- 剩余课时
-
-
-
-
-
-
-
-
- 即将到期
-
-
-
- 黄明明
- 课程截止时间:2020.05:25
-
-
-
-
- 24
- 已上课时
-
-
- 24
- 剩余课时
-
-
-
-
-
-
-
-
-
-
-
-
- 黄明明
- 课程截止时间:2020.05:25
-
-
-
-
- 24
- 已上课时
-
-
- 24
- 剩余课时
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 即将到期
+
+
+
+ {{item.name}}
+ 课程截止时间:{{item.end_date}}
+
+
+
+
+ {{
+ (item.use_total_hours + item.use_gift_hours)
+ }}节
+ 已上课时
+
+
+ {{
+ (item.total_hours + item.gift_hours) - (item.use_total_hours + item.use_gift_hours)
+ }}节
+ 剩余课时
+
+
+
+
+
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/uniapp/pages/coach/my/index.vue b/uniapp/pages/coach/my/index.vue
index 106b6089..ee51bf68 100644
--- a/uniapp/pages/coach/my/index.vue
+++ b/uniapp/pages/coach/my/index.vue
@@ -56,10 +56,10 @@
-
+
即将到期
@@ -128,13 +128,14 @@ export default {
}
},
onLoad() {
+
},
onShow() {
+
this.init();
},
methods: {
async init(){
- this.getMemberInfo()
this.getStatistics()
},
@@ -162,6 +163,8 @@ export default {
return
}
this.statisticsInfo = res.data
+
+ this.getMemberInfo()
},
//打开到课率统计
diff --git a/uniapp/pages/coach/my/schooling_statistics.vue b/uniapp/pages/coach/my/schooling_statistics.vue
index 9072f4c2..60a75d6f 100644
--- a/uniapp/pages/coach/my/schooling_statistics.vue
+++ b/uniapp/pages/coach/my/schooling_statistics.vue
@@ -10,7 +10,7 @@
- 34
+ {{v.ysks}}
月授课数/节
diff --git a/uniapp/pages/coach/student/student_list.vue b/uniapp/pages/coach/student/student_list.vue
index b4b2c667..e59dcaf3 100644
--- a/uniapp/pages/coach/student/student_list.vue
+++ b/uniapp/pages/coach/student/student_list.vue
@@ -19,11 +19,13 @@
剩余课程:
- {{item.remainingCourses}}节
+ {{
+ (item.total_hours + item.gift_hours) - (item.use_total_hours + item.use_gift_hours)
+ }}节
到期时间:
- {{item.expiryDate}}
+ {{item.end_date}}
@@ -38,6 +40,7 @@