- {{ '参与者ID' }}:{{ node.participant_id }}
+ {{ '参与者' }}:{{ node.name }}
{{ '顺序' }}:{{ node.sequence }}
diff --git a/admin/src/app/views/service_logs/service_logs.vue b/admin/src/app/views/service_logs/service_logs.vue
new file mode 100644
index 00000000..72cad48a
--- /dev/null
+++ b/admin/src/app/views/service_logs/service_logs.vue
@@ -0,0 +1,165 @@
+
+
+
+
+ {{ pageName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{
+ t('search')
+ }}
+ {{
+ t('reset')
+ }}
+
+
+
+
+
+
+
+ {{
+ !studentCourseUsageTable.loading ? t('emptyData') : ''
+ }}
+
+
+
+
+
+
+
+
+
+
+
+ 是
+ 否
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/src/app/views/student_course_usage/student_course_usage.vue b/admin/src/app/views/student_course_usage/student_course_usage.vue
index 98cbf43d..7bec15fc 100644
--- a/admin/src/app/views/student_course_usage/student_course_usage.vue
+++ b/admin/src/app/views/student_course_usage/student_course_usage.vue
@@ -3,9 +3,6 @@
{{ pageName }}
-
- {{ t('addStudentCourseUsage') }}
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
{{
@@ -58,41 +58,23 @@
!studentCourseUsageTable.loading ? t('emptyData') : ''
}}
-
-
-
-
-
-
-
-
- {{
- t('edit')
- }}
- {{
- t('delete')
- }}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
service->getList($where, (int)$page, (int)$limit);
-
+
return success($data);
}
@@ -72,12 +72,12 @@ class Process extends BaseAdminController
if (empty($id)) {
return fail('参数错误');
}
-
+
$info = $this->service->getInfo((int)$id);
if (empty($info)) {
return fail('审批流程不存在');
}
-
+
return success($info);
}
@@ -88,19 +88,19 @@ class Process extends BaseAdminController
{
$data = Request::only(['process_name', 'remarks']);
$config_id = input('config_id', 0);
-
+
// 验证参数
if (empty($data['process_name'])) {
return fail('流程名称不能为空');
}
-
+
if (empty($config_id)) {
return fail('请选择审批流配置');
}
-
+
// 设置申请人ID
$data['applicant_id'] = $this->request->uid();
-
+
try {
$process_id = $this->service->create($data, $config_id);
return success(['id' => $process_id]);
@@ -117,15 +117,15 @@ class Process extends BaseAdminController
$process_id = input('process_id', 0);
$status = input('status', '');
$remarks = input('remarks', '');
-
+
if (empty($process_id)) {
return fail('参数错误');
}
-
+
if (empty($status) || !in_array($status, ['approved', 'rejected'])) {
return fail('请选择审批结果');
}
-
+
try {
$result = $this->service->approve((int)$process_id, $this->request->uid(), $status, $remarks);
return success($result);
@@ -140,11 +140,11 @@ class Process extends BaseAdminController
public function cancel()
{
$process_id = input('process_id', 0);
-
+
if (empty($process_id)) {
return fail('参数错误');
}
-
+
try {
$result = $this->service->cancel($process_id, $this->request->uid());
return success($result);
@@ -152,4 +152,4 @@ class Process extends BaseAdminController
return fail($e->getMessage());
}
}
-}
\ No newline at end of file
+}
diff --git a/niucloud/app/adminapi/controller/service_logs/ServiceLogs.php b/niucloud/app/adminapi/controller/service_logs/ServiceLogs.php
new file mode 100644
index 00000000..f420285b
--- /dev/null
+++ b/niucloud/app/adminapi/controller/service_logs/ServiceLogs.php
@@ -0,0 +1,39 @@
+request->params([
+ ["name",""],
+ ["score",""]
+ ]);
+ return success((new ServiceLogsService())->getPage($data));
+ }
+
+}
diff --git a/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php b/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php
index c9005c68..0ccad9ac 100644
--- a/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php
+++ b/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php
@@ -28,9 +28,9 @@ class StudentCourseUsage extends BaseAdminController
*/
public function lists(){
$data = $this->request->params([
- ["student_course_id",""],
- ["used_hours",""],
- ["usage_date",""]
+ ["emergency_contact",""],
+ ["student_name",""],
+ ["contact_phone",""]
]);
return success((new StudentCourseUsageService())->getPage($data));
}
@@ -87,5 +87,5 @@ class StudentCourseUsage extends BaseAdminController
return success('DELETE_SUCCESS');
}
-
+
}
diff --git a/niucloud/app/adminapi/route/service_logs.php b/niucloud/app/adminapi/route/service_logs.php
new file mode 100644
index 00000000..e4d15e1e
--- /dev/null
+++ b/niucloud/app/adminapi/route/service_logs.php
@@ -0,0 +1,31 @@
+middleware([
+ AdminCheckToken::class,
+ AdminCheckRole::class,
+ AdminLog::class
+]);
+// USER_CODE_END -- service
diff --git a/niucloud/app/model/service_logs/ServiceLogs.php b/niucloud/app/model/service_logs/ServiceLogs.php
new file mode 100644
index 00000000..b0d2aafa
--- /dev/null
+++ b/niucloud/app/model/service_logs/ServiceLogs.php
@@ -0,0 +1,44 @@
+pageQuery($search_model, function ($item, $key) {
$item = $this->makeUp($item);
+
+ $sixSpeed = new SixSpeed();
+ $data = $sixSpeed->where(['resource_id' => $item['id']])->findOrEmpty()->toArray();
+ $item['six'] = $data;
});
}
diff --git a/niucloud/app/service/admin/service_logs/ServiceLogsService.php b/niucloud/app/service/admin/service_logs/ServiceLogsService.php
new file mode 100644
index 00000000..447f66fb
--- /dev/null
+++ b/niucloud/app/service/admin/service_logs/ServiceLogsService.php
@@ -0,0 +1,60 @@
+model = new ServiceLogs();
+ }
+
+ /**
+ * 获取学员课时消费记录列表
+ * @return array
+ */
+ public function getPage(array $data = [])
+ {
+ $where = [];
+ if($data['name']){
+ $where[] = ['b.name','like','%'.$data['name'].'%'];
+ }
+
+ if($data['score']){
+ $where[] = ['a.score','=',$data['score']];
+ }
+
+ $search_model = $this->model
+ ->alias("a")
+ ->join(['school_customer_resources' => 'b'],'a.resource_id = b.id','left')
+ ->join(['school_personnel' => 'c'],'a.staff_id = c.id','left')
+ ->join(['school_service' => 'd'],'a.service_id = d.id','left')
+ ->where($where)
+ ->field("a.*,b.name,c.name as staff_name,d.service_name,d.customer_confirmation")
+ ->order("a.id desc");
+ $list = $this->pageQuery($search_model);
+ return $list;
+ }
+
+
+}
diff --git a/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php b/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php
index 82435bbe..b4d7fc7d 100644
--- a/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php
+++ b/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php
@@ -31,15 +31,31 @@ class StudentCourseUsageService extends BaseAdminService
/**
* 获取学员课时消费记录列表
- * @param array $where
* @return array
*/
- public function getPage(array $where = [])
+ public function getPage(array $data = [])
{
- $field = 'id,student_course_id,used_hours,usage_date,created_at,updated_at';
- $order = 'id desc';
-
- $search_model = $this->model->withSearch(["id","student_course_id","used_hours","usage_date"], $where)->field($field)->order($order);
+ $where = [];
+ if($data['emergency_contact']){
+ $where[] = ['c.emergency_contact','like','%'.$data['emergency_contact'].'%'];
+ }
+
+ if($data['student_name']){
+ $where[] = ['c.name','like','%'.$data['student_name'].'%'];
+ }
+
+ if($data['contact_phone']){
+ $where[] = ['c.contact_phone','=',$data['contact_phone']];
+ }
+
+ $search_model = $this->model
+ ->alias("a")
+ ->join(['school_student_courses' => 'b'],'a.student_course_id = b.id','left')
+ ->join(['school_student' => 'c'],'b.student_id = c.id','left')
+ ->join(['school_course' => 'd'],'b.course_id = d.id','left')
+ ->where($where)
+ ->field("a.*,c.name as student_name,c.emergency_contact,d.course_name,b.total_hours,ROUND(b.total_hours - b.use_total_hours) as sy_time,ROUND(b.gift_hours - b.use_gift_hours) as gift_hours")
+ ->order("a.id desc");
$list = $this->pageQuery($search_model);
return $list;
}
@@ -94,6 +110,6 @@ class StudentCourseUsageService extends BaseAdminService
return $res;
}
-
+
}
diff --git a/niucloud/app/service/school_approval/SchoolApprovalProcessService.php b/niucloud/app/service/school_approval/SchoolApprovalProcessService.php
index f79a28d2..68f0e735 100644
--- a/niucloud/app/service/school_approval/SchoolApprovalProcessService.php
+++ b/niucloud/app/service/school_approval/SchoolApprovalProcessService.php
@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace app\service\school_approval;
+use app\model\personnel\Personnel;
use app\model\school_approval\SchoolApprovalConfig;
use app\model\school_approval\SchoolApprovalConfigNode;
use app\model\school_approval\SchoolApprovalParticipants;
@@ -26,25 +27,28 @@ class SchoolApprovalProcessService
*/
public function getList(array $where = [], int $page = 1, int $limit = 10): array
{
- $field = 'id, process_name, applicant_id, application_time, current_approver_id, approval_status, approval_time, remarks, created_at, updated_at';
- $order = 'id desc';
-
+ $field = 'a.*,b.name as applicant_name,c.name as current_approver_name';
+ $order = 'a.id desc';
+
$list = (new SchoolApprovalProcess())
+ ->alias("a")
+ ->join(['school_personnel' => 'b'],'a.applicant_id = b.id','left')
+ ->join(['school_personnel' => 'c'],'a.current_approver_id = c.id','left')
->where($where)
->field($field)
->order($order)
->page($page, $limit)
->select()
->toArray();
-
+
$count = (new SchoolApprovalProcess())->where($where)->count();
-
+
return [
'list' => $list,
'count' => $count
];
}
-
+
/**
* 获取审批流程详情
* @param int $id
@@ -52,14 +56,26 @@ class SchoolApprovalProcessService
*/
public function getInfo(int $id): array
{
- $info = (new SchoolApprovalProcess())->with(['participants'])->where(['id' => $id])->find();
+ $info = (new SchoolApprovalProcess())
+ ->alias("a")
+ ->join(['school_personnel' => 'b'],'a.applicant_id = b.id','left')
+ ->join(['school_personnel' => 'c'],'a.current_approver_id = c.id','left')
+ ->with(['participants'])
+ ->where(['a.id' => $id])
+ ->field('a.*,b.name as applicant_name,c.name as current_approver_name')
+ ->find();
if (empty($info)) {
return [];
}
-
- return $info->toArray();
+ $info = $info->toArray();
+ $Personnel = new Personnel();
+ foreach ($info['participants'] as $key => $value) {
+ $info['participants'][$key]['name'] = $Personnel->where(['id' => $value['participant_id']])->value('name');
+ }
+
+ return $info;
}
-
+
/**
* 创建审批流程
* @param array $data
@@ -76,7 +92,7 @@ class SchoolApprovalProcessService
if (empty($config_info)) {
throw new Exception('审批配置不存在');
}
-
+
// 创建审批流程
$process = [
'process_name' => $data['process_name'],
@@ -86,9 +102,9 @@ class SchoolApprovalProcessService
'approval_status' => SchoolApprovalProcess::STATUS_PENDING,
'remarks' => $data['remarks'] ?? ''
];
-
+
$process_id = (new SchoolApprovalProcess())->insertGetId($process);
-
+
// 创建审批参与人
$participants = [];
foreach ($config_info['nodes'] as $sequence => $node) {
@@ -103,22 +119,22 @@ class SchoolApprovalProcessService
];
}
}
-
+
if (!empty($participants)) {
(new SchoolApprovalParticipants())->insertAll($participants);
-
+
// 更新当前审批人为第一个审批人
$first_participant = (new SchoolApprovalParticipants())
->where(['process_id' => $process_id])
->order('sequence', 'asc')
->find();
-
+
if (!empty($first_participant)) {
(new SchoolApprovalProcess())->where(['id' => $process_id])
->update(['current_approver_id' => $first_participant['participant_id']]);
}
}
-
+
Db::commit();
return $process_id;
} catch (\Exception $e) {
@@ -126,7 +142,7 @@ class SchoolApprovalProcessService
throw new Exception($e->getMessage());
}
}
-
+
/**
* 审批
* @param int $process_id 流程ID
@@ -145,17 +161,17 @@ class SchoolApprovalProcessService
if (empty($process_info)) {
throw new Exception('审批流程不存在');
}
-
+
// 检查是否当前审批人
if ($process_info['current_approver_id'] != $approver_id) {
throw new Exception('您不是当前审批人');
}
-
+
// 检查流程状态
if ($process_info['approval_status'] != SchoolApprovalProcess::STATUS_PENDING) {
throw new Exception('该审批流程已完成');
}
-
+
// 获取当前审批节点
$current_participant = (new SchoolApprovalParticipants())
->where([
@@ -164,18 +180,18 @@ class SchoolApprovalProcessService
'status' => SchoolApprovalParticipants::STATUS_PENDING
])
->find();
-
+
if (empty($current_participant)) {
throw new Exception('审批节点信息错误');
}
-
+
// 更新当前审批人状态
(new SchoolApprovalParticipants())->where(['id' => $current_participant['id']])
->update([
'status' => $status,
'remarks' => $remarks
]);
-
+
// 如果拒绝,直接更新整个流程状态为拒绝
if ($status == SchoolApprovalParticipants::STATUS_REJECTED) {
(new SchoolApprovalProcess())->where(['id' => $process_id])
@@ -184,11 +200,11 @@ class SchoolApprovalProcessService
'approval_time' => time(),
'remarks' => $remarks
]);
-
+
Db::commit();
return true;
}
-
+
// 检查当前节点是否需要会签
$same_sequence_participants = (new SchoolApprovalParticipants())
->where([
@@ -197,14 +213,14 @@ class SchoolApprovalProcessService
'status' => SchoolApprovalParticipants::STATUS_PENDING
])
->select();
-
+
// 如果是会签且还有其他人未审批,则等待
if ($current_participant['sign_type'] == SchoolApprovalParticipants::SIGN_TYPE_AND && !$same_sequence_participants->isEmpty()) {
// 不做任何处理,等待其他人审批
Db::commit();
return true;
}
-
+
// 获取下一个审批节点
$next_participant = (new SchoolApprovalParticipants())
->where([
@@ -213,7 +229,7 @@ class SchoolApprovalProcessService
])
->order('sequence', 'asc')
->find();
-
+
if (empty($next_participant)) {
// 没有下一个审批人,流程结束,标记为已通过
(new SchoolApprovalProcess())->where(['id' => $process_id])
@@ -226,7 +242,7 @@ class SchoolApprovalProcessService
(new SchoolApprovalProcess())->where(['id' => $process_id])
->update(['current_approver_id' => $next_participant['participant_id']]);
}
-
+
Db::commit();
return true;
} catch (\Exception $e) {
@@ -234,7 +250,7 @@ class SchoolApprovalProcessService
throw new Exception($e->getMessage());
}
}
-
+
/**
* 撤销审批流程
* @param int $process_id 流程ID
@@ -251,17 +267,17 @@ class SchoolApprovalProcessService
if (empty($process_info)) {
throw new Exception('审批流程不存在');
}
-
+
// 检查是否申请人
if ($process_info['applicant_id'] != $applicant_id) {
throw new Exception('您不是该流程的申请人');
}
-
+
// 检查流程状态
if ($process_info['approval_status'] != SchoolApprovalProcess::STATUS_PENDING) {
throw new Exception('该审批流程已完成,无法撤销');
}
-
+
// 更新流程状态为已拒绝(撤销)
(new SchoolApprovalProcess())->where(['id' => $process_id])
->update([
@@ -269,7 +285,7 @@ class SchoolApprovalProcessService
'approval_time' => time(),
'remarks' => '申请人撤销'
]);
-
+
// 更新所有待审批节点为已拒绝
(new SchoolApprovalParticipants())->where([
'process_id' => $process_id,
@@ -278,7 +294,7 @@ class SchoolApprovalProcessService
'status' => SchoolApprovalParticipants::STATUS_REJECTED,
'remarks' => '申请人撤销'
]);
-
+
Db::commit();
return true;
} catch (\Exception $e) {
@@ -286,4 +302,4 @@ class SchoolApprovalProcessService
throw new Exception($e->getMessage());
}
}
-}
\ No newline at end of file
+}
From a8cbc26d2363155dea9a45843bad5e3bfd2442e1 Mon Sep 17 00:00:00 2001
From: LLL <15374889135@163.com>
Date: Wed, 4 Jun 2025 19:02:04 +0800
Subject: [PATCH 04/17] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../api/controller/apiController/ClassApi.php | 18 ++--
.../apiController/TeachingResearch.php | 7 +-
niucloud/app/api/route/route.php | 2 +
niucloud/app/model/class_grade/ClassGrade.php | 11 ++
.../class_personnel_rel/ClassPersonnelRel.php | 57 ++++++++++
.../service/api/apiService/jlClassService.php | 102 ++++++++++++++++++
6 files changed, 188 insertions(+), 9 deletions(-)
create mode 100644 niucloud/app/model/class_personnel_rel/ClassPersonnelRel.php
create mode 100644 niucloud/app/service/api/apiService/jlClassService.php
diff --git a/niucloud/app/api/controller/apiController/ClassApi.php b/niucloud/app/api/controller/apiController/ClassApi.php
index 83f4ec5b..0b12e697 100644
--- a/niucloud/app/api/controller/apiController/ClassApi.php
+++ b/niucloud/app/api/controller/apiController/ClassApi.php
@@ -12,7 +12,7 @@
namespace app\api\controller\apiController;
use app\Request;
-use app\service\api\apiService\CourseService;
+use app\service\api\apiService\jlClassService;
use core\base\BaseApiService;
@@ -21,22 +21,24 @@ use core\base\BaseApiService;
* Class Personnel
* @package app\api\controller\apiController
*/
-class ClassSpi extends BaseApiService
+class ClassApi extends BaseApiService
{
//课程列表
public function jlClassList(Request $request){
$id = $this->member_id;
- dd(111);
- return success((new CourseService())->list($id,$data));
+ $data = $this->request->params([
+ ["name",'']
+ ]);
+ return success((new jlClassService())->list($id,$data));
}
- //获取课程详情
- public function courseInfo(Request $request){
+ //课程详情
+ public function jlClassInfo(Request $request){
$data = $this->request->params([
- ["id",0]
+ ["class_id",0]
]);
- return success('SUCCESS',(new CourseService())->info($data['id']));
+ return success('获取成功',(new jlClassService())->info($data['class_id']));
}
}
diff --git a/niucloud/app/api/controller/apiController/TeachingResearch.php b/niucloud/app/api/controller/apiController/TeachingResearch.php
index b202071b..71cd1a5f 100644
--- a/niucloud/app/api/controller/apiController/TeachingResearch.php
+++ b/niucloud/app/api/controller/apiController/TeachingResearch.php
@@ -115,10 +115,15 @@ class TeachingResearch extends BaseApiService
if ($resLessonTeaching['answers_num'] >= $res['number_answers']) {
return fail('已超过答题次数', []);
} else {
+ if (count($userRes['data']['cameus_dept_arr']) > 0) {
+ $campus_id = $userRes['data']['cameus_dept_arr'][0]['campus_id'];
+ } else {
+ $campus_id = 0;
+ }
foreach ($result as &$v){
$v['user_id'] = $userRes['data']['id'];
$v['question_id'] = $v['ids'];
- $v['campus_id'] = 0;
+ $v['campus_id'] = $campus_id;
$v['answer'] = $v['value'];
$resEq = $ExamQuestions->where('id',$v['ids'])->find();
if ($resEq['correct_answer'] == $v['value']){
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index f26b3824..3b72577e 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -294,6 +294,8 @@ Route::group(function () {
Route::get('course/delStudentCourse', 'apiController.course/delStudentCourse');
//班级列表
Route::get('class/jlClassList', 'apiController.classApi/jlClassList');
+ //班级详情
+ Route::get('class/jlClassInfo', 'apiController.classApi/jlClassInfo');
//课程列表
Route::get('course/courseList', 'apiController.course/courseList');
//获取课程详情
diff --git a/niucloud/app/model/class_grade/ClassGrade.php b/niucloud/app/model/class_grade/ClassGrade.php
index acff649b..8e8ce49f 100644
--- a/niucloud/app/model/class_grade/ClassGrade.php
+++ b/niucloud/app/model/class_grade/ClassGrade.php
@@ -13,6 +13,7 @@ namespace app\model\class_grade;
use app\model\campus\Campus;
use app\model\personnel\Personnel;
+use app\model\class_personnel_rel\ClassPersonnelRel;
use core\base\BaseModel;
use think\model\concern\SoftDelete;
use think\model\relation\HasMany;
@@ -229,6 +230,16 @@ class ClassGrade extends BaseModel
return $this->hasOne(Personnel::class, 'id', 'head_coach')->joinType('left')->withField('name,id')->bind(['head_coach_name'=>'name']);
}
+ public function personnelAll(){
+ return $this->hasOne(Personnel::class, 'id', 'head_coach')->joinType('left')->withField('head_img,id')->bind(['head_coach_head_img'=>'head_img']);
+ }
+ public function personnelName(){
+ return $this->hasOne(Personnel::class, 'id', 'head_coach')->joinType('left')->withField('name,id')->bind(['head_coach_name'=>'name']);
+ }
+
+ public function classPersonnelRel(){
+ return $this->hasMany(ClassPersonnelRel::class, 'class_id', 'id');
+ }
}
diff --git a/niucloud/app/model/class_personnel_rel/ClassPersonnelRel.php b/niucloud/app/model/class_personnel_rel/ClassPersonnelRel.php
new file mode 100644
index 00000000..7644993d
--- /dev/null
+++ b/niucloud/app/model/class_personnel_rel/ClassPersonnelRel.php
@@ -0,0 +1,57 @@
+hasOne(Student::class, 'id', 'source_id');
+ }
+
+ public function studentCourses(){
+ return $this->hasOne(StudentCourses::class, 'student_id', 'source_id')->joinType('left')->withField('end_date,student_id')->bind(['end_date'=>'end_date']);
+ }
+
+ public function studentCoursesInfo(){
+ return $this->hasOne(StudentCourses::class, 'student_id', 'source_id');
+ }
+
+
+}
diff --git a/niucloud/app/service/api/apiService/jlClassService.php b/niucloud/app/service/api/apiService/jlClassService.php
new file mode 100644
index 00000000..d3628355
--- /dev/null
+++ b/niucloud/app/service/api/apiService/jlClassService.php
@@ -0,0 +1,102 @@
+model = (new ClassGrade());
+ }
+
+ //列表
+ public function list($id,$data)
+ {
+ $order = 'id desc';
+ $where = [];
+ if ($data['name'] !== '') {
+ $where[] = ['name','like','%'.$data['name'].'%'];
+ }
+ $search_model = $this->model->where('head_coach', $id)->where($where)->order($order)
+ ->with(['classPersonnelRel' => function($query) {
+ $query->with(['student' => function($query) {
+ $query->with(['customerResources' => function($query) {
+ $query->with(['member' => function($query) {
+ $query->select();
+ }]);
+ }]);
+ },'studentCourses']);
+
+ },'personnelAll']);
+ $list = $this->pageQuery($search_model);
+ foreach ($list['data'] as &$v){
+ if (count($v['classPersonnelRel']) > 0) {
+ $now = time();
+ $count = 0;
+ foreach ($v['classPersonnelRel'] as $item) {
+ if (isset($item['end_date'])) {
+ $endTime = strtotime($item['end_date']);
+ if ($endTime > $now && $endTime <= $now + 7 * 86400) {
+ $count++;
+ }
+ }
+ }
+ $v['end_count'] = $count;
+ } else {
+ $v['end_count'] = 0;
+ }
+ }
+ return $list;
+ }
+
+
+ public function info($data)
+ {
+ $search_model = $this->model->where('id', $data)
+ ->with(['classPersonnelRel' => function($query) {
+ $query->with(['student' => function($query) {
+ $query->with(['customerResources' => function($query) {
+ $query->with(['member' => function($query) {
+ $query->select();
+ }]);
+ }]);
+ },'studentCourses','studentCoursesInfo']);
+ },'personnelAll', 'personnelName']);
+ $list = $search_model->find();
+ if (count($list['classPersonnelRel']) > 0) {
+ $now = time();
+ $count = 0;
+ foreach ($list['classPersonnelRel'] as $item) {
+ if (isset($item['end_date'])) {
+ $endTime = strtotime($item['end_date']);
+ if ($endTime > $now && $endTime <= $now + 7 * 86400) {
+ $count++;
+ }
+ }
+ }
+ $v['end_count'] = $count;
+ } else {
+ $v['end_count'] = 0;
+ }
+ return $list;
+ }
+
+}
From 8099ede01359bad92c8bfdbb1142ff276e959e9b Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Wed, 4 Jun 2025 19:49:19 +0800
Subject: [PATCH 05/17] =?UTF-8?q?feat(customer):=20=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E5=B9=B6?=
=?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 CustomerResourcesAuth 控制器中添加 info 方法,用于获取学生详情
- 在路由文件中添加对应的学生详情路由
- 在 CustomerResources 模型中添加与 Member 表的一对一关联
- 在 CustomerResourcesService 服务中实现 getInfo 方法,用于获取客户资源详情
---
.../apiController/CustomerResourcesAuth.php | 14 +++++++++
niucloud/app/api/route/route.php | 7 ++++-
.../customer_resources/CustomerResources.php | 6 ++++
.../apiService/CustomerResourcesService.php | 31 +++++++++++++++++++
4 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php b/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php
index da434e18..daff3e80 100644
--- a/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php
+++ b/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php
@@ -14,6 +14,7 @@ namespace app\api\controller\apiController;
use app\dict\member\MemberLoginTypeDict;
use app\model\member\Member;
use app\Request;
+use app\service\api\apiService\CustomerResourcesService;
use app\service\api\login\LoginService;
use core\base\BaseApiService;
@@ -67,4 +68,17 @@ class customerResourcesAuth extends BaseApiService
return success($res);
}
+ //学生详情
+ public function info(){
+ $member_id = $this->member_id;
+ $where = [
+ 'member_id'=>$member_id
+ ];
+ $res = (new CustomerResourcesService())->getInfo($where);
+ if (!$res['code']) {
+ return fail($res['msg']);
+ }
+ return success($res['data']);
+ }
+
}
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index 8032d2e3..3e296836 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -319,6 +319,7 @@ Route::group(function () {
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓-----学生用户端相关-----↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
//无需token验证的
Route::group(function () {
+ //学生登录
Route::post('customerResourcesAuth/login', 'apiController.CustomerResourcesAuth/login');
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class)
@@ -327,7 +328,11 @@ Route::group(function () {
//需要token验证的
Route::group(function () {
-// Route::get('personnel/info', 'apiController.Personnel/info');
+ //员工端-上传图片
+ Route::post('memberUploadImage', 'upload.Upload/image');
+ //学生详情
+ Route::get('customerResourcesAuth/info', 'apiController.CustomerResourcesAuth/info');
+
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class, true)
diff --git a/niucloud/app/model/customer_resources/CustomerResources.php b/niucloud/app/model/customer_resources/CustomerResources.php
index 218f156d..5dcdfe4e 100644
--- a/niucloud/app/model/customer_resources/CustomerResources.php
+++ b/niucloud/app/model/customer_resources/CustomerResources.php
@@ -162,6 +162,12 @@ class CustomerResources extends BaseModel
return $this->hasMany(ResourceSharing::class, 'resource_id', 'id');
}
+ //一对一关联"用户账号登陆表"
+ public function memberHasOne()
+ {
+ return $this->hasOne(Member::class, 'member_id', 'member_id');
+ }
+
diff --git a/niucloud/app/service/api/apiService/CustomerResourcesService.php b/niucloud/app/service/api/apiService/CustomerResourcesService.php
index 142dec68..b5cd055e 100644
--- a/niucloud/app/service/api/apiService/CustomerResourcesService.php
+++ b/niucloud/app/service/api/apiService/CustomerResourcesService.php
@@ -36,6 +36,37 @@ class CustomerResourcesService extends BaseApiService
parent::__construct();
}
+ //获取客户资源详情
+ public function getInfo(array $where,string $field = '*'){
+ $res = [
+ 'code' => 0,
+ 'msg' => '操作失败',
+ 'data' => []
+ ];
+ $model = new CustomerResources();
+ if(!empty($where['member_id'])){
+ $model = $model->where('member_id', $where['member_id']);
+ }
+ $data = $model->field($field)
+ ->with([
+ 'memberHasOne',
+ 'resourceSharingHasMany'
+ ])
+ ->append([
+ 'gender_name',
+ 'initial_intent_name'
+ ])
+ ->find();
+ if ($data){
+ $data = $data->toArray();
+ $res['code'] = 1;
+ $res['data'] = $data;
+ }else{
+ $res['msg'] = '暂无数据';
+ }
+ return $res;
+ }
+
//获取全部客户资源数据
public function getAll(array $where,string $field = '*')
{
From b062174ab21e6dbb7bbc2f132aff3e3d6d036baf Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 10:59:43 +0800
Subject: [PATCH 06/17] =?UTF-8?q?feat(customer):=20=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=AF=A6=E6=83=85=E4=BF=AE=E6=94=B9=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 CustomerResourcesAuth 控制器的 edit 方法处理学生信息修改请求
- 在路由中添加 customerResourcesAuth/edit 路由
- 新增 CustomerResourcesService服务的 editInfo 方法实现学生信息修改逻辑
- 优化 CommonService 的 compareData 方法,增加 JSON格式返回值
---
.../apiController/CustomerResourcesAuth.php | 35 ++++++++
niucloud/app/api/route/route.php | 2 +
.../service/api/apiService/CommonService.php | 6 ++
.../apiService/CustomerResourcesService.php | 89 +++++++++++++++++++
4 files changed, 132 insertions(+)
diff --git a/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php b/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php
index daff3e80..1fd574ab 100644
--- a/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php
+++ b/niucloud/app/api/controller/apiController/CustomerResourcesAuth.php
@@ -81,4 +81,39 @@ class customerResourcesAuth extends BaseApiService
return success($res['data']);
}
+ //学生详情-修改
+ public function edit(Request $request){
+ $member_id = $this->member_id;
+ $where = [
+ 'member_id'=>$member_id
+ ];
+ $data = [
+ 'headimg' => $request->param('headimg', ''),
+ 'name' => $request->param('name', ''),
+ 'gender' => $request->param('gender', ''),
+ 'age' => $request->param('age', ''),
+ 'phone_number' => $request->param('phone_number', ''),
+ ];
+
+ // 验证必填字段
+ if (empty($data['name'])) {
+ return fail('姓名不能为空');
+ }
+ if (empty($data['gender'])) {
+ return fail('性别不能为空');
+ }
+ if (empty($data['age'])) {
+ return fail('年龄不能为空');
+ }
+ if (empty($data['phone_number'])) {
+ return fail('手机号不能为空');
+ }
+
+ $res = (new CustomerResourcesService())->editInfo($where,$data);
+ if (!$res['code']) {
+ return fail($res['msg']);
+ }
+ return success([]);
+ }
+
}
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index 3e296836..b502522d 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -332,6 +332,8 @@ Route::group(function () {
Route::post('memberUploadImage', 'upload.Upload/image');
//学生详情
Route::get('customerResourcesAuth/info', 'apiController.CustomerResourcesAuth/info');
+ //学生详情-修改
+ Route::post('customerResourcesAuth/edit', 'apiController.CustomerResourcesAuth/edit');
})->middleware(ApiChannel::class)
diff --git a/niucloud/app/service/api/apiService/CommonService.php b/niucloud/app/service/api/apiService/CommonService.php
index 07380753..1f0e82cf 100644
--- a/niucloud/app/service/api/apiService/CommonService.php
+++ b/niucloud/app/service/api/apiService/CommonService.php
@@ -143,12 +143,18 @@ class CommonService extends BaseApiService
}
return [
+ // 返回发生更改的字段名数组
'changed_fields' => $changedFields,
+ // 返回旧数据中的更改字段及其值
'old_values' => $oldChanges,
+ // 返回新数据中的更改字段及其值
'new_values' => $newChanges,
+ // 将 changed_fields 转换为 JSON 格式,保留中文字符
'changed_fields_json' => json_encode($changedFields, JSON_UNESCAPED_UNICODE),
+ // 将 old_changes 转换为 JSON 格式,保留中文字符
'old_values_json' => json_encode($oldChanges, JSON_UNESCAPED_UNICODE),
+ // 将 new_changes 转换为 JSON 格式,保留中文字符
'new_values_json' => json_encode($newChanges, JSON_UNESCAPED_UNICODE)
];
}
diff --git a/niucloud/app/service/api/apiService/CustomerResourcesService.php b/niucloud/app/service/api/apiService/CustomerResourcesService.php
index b5cd055e..ff5e380a 100644
--- a/niucloud/app/service/api/apiService/CustomerResourcesService.php
+++ b/niucloud/app/service/api/apiService/CustomerResourcesService.php
@@ -311,6 +311,95 @@ class CustomerResourcesService extends BaseApiService
}
}
+ //客户资源(学生个人资料)-编辑
+ public function editInfo(array $where, array $data)
+ {
+
+ $res = [
+ 'code' => 0,
+ 'msg' => '操作失败',
+ 'data' => []
+ ];
+
+ if (!$where) {
+ $res['msg'] = '查询条件不能为空';
+ return $res;
+ }
+
+ $customer_resources_data = [
+ 'name' => $data['name'], // 姓名
+ 'gender' => $data['gender'], // 性别(male:男, female:女)
+ 'age' => $data['age'], // 年龄
+ 'phone_number' => $data['phone_number'], // 手机号
+ ];
+
+ $date = date('Y-m-d H:i:s');
+ $customer_resources_data['updated_at'] = $date;
+
+ //开启事物
+ Db::startTrans();
+ try {
+ $customer_resources = CustomerResources::where('member_id', $where['member_id'])->find();
+
+ if ($customer_resources) {
+ $customer_resources = $customer_resources->toArray();
+ }
+ $update_1 = CustomerResources::where('id', $customer_resources['id'])->update($customer_resources_data);//客户资源表
+ if (!$update_1) {
+ Db::rollback();
+ return $res;
+ }
+
+ //更新学生账户登录表
+ $member_data = [
+ 'username'=>$data['phone_number'],
+ 'mobile'=>$data['phone_number'],
+ 'update_time'=>time()
+ ];
+ if(!empty($data['headimg'])){
+ $member_data['headimg'] = $data['headimg'];
+ }
+ $update_member = Member::where('member_id', $where['member_id'])->update($member_data);
+ if(!$update_member){
+ Db::rollback();
+ return $res;
+ }
+
+
+
+ //更近客户资源日志表
+ $compareData = (new CommonService)->compareData($customer_resources, $customer_resources_data);
+ if ($compareData['changed_fields']) {
+ $data = [
+ "customer_resource_id" => $customer_resources['id'],//客户资源的ID
+ "operator_id" => 0,//操作人的ID
+ "campus_id" => 0,//操作人校区的ID|如果这人有2校区就填0
+ "modified_fields" => $compareData['changed_fields_json'],//修改的哪些字段
+ "old_values" => $compareData['old_values_json'],//修改前的值
+ "new_values" => $compareData['new_values_json'],//修改后的值
+ ];
+
+ $id = CustomerResourceChanges::insertGetId($data);
+ if (!$id) {
+ Db::rollback();
+ return $res;
+ }
+ }
+
+
+
+ Db::commit();
+ $res = [
+ 'code' => 1,
+ 'msg' => '操作成功'
+ ];
+ return $res;
+ } catch (\Exception $exception) {
+ Db::rollback();
+ return $res;
+ }
+ }
+
//客户资源-获取客户资源修改记录列表
public function getCustomerResourceChangesEditLog(array $where)
{
From 88d333cc714e1d65f899550d3af334d126471c3d Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 11:00:13 +0800
Subject: [PATCH 07/17] =?UTF-8?q?refactor(niucloud):=20=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=B4=A6=E6=88=B7=E7=99=BB=E5=BD=95=E8=A1=A8?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 移除了多余的空行和注释
- 改进了代码格式,使代码更加清晰易读- 优化了条件判断语句的写法,提高了代码质量
---
.../api/apiService/CustomerResourcesService.php | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/niucloud/app/service/api/apiService/CustomerResourcesService.php b/niucloud/app/service/api/apiService/CustomerResourcesService.php
index ff5e380a..8b0ab131 100644
--- a/niucloud/app/service/api/apiService/CustomerResourcesService.php
+++ b/niucloud/app/service/api/apiService/CustomerResourcesService.php
@@ -352,21 +352,20 @@ class CustomerResourcesService extends BaseApiService
//更新学生账户登录表
$member_data = [
- 'username'=>$data['phone_number'],
- 'mobile'=>$data['phone_number'],
- 'update_time'=>time()
+ 'username' => $data['phone_number'],
+ 'mobile' => $data['phone_number'],
+ 'update_time' => time()
];
- if(!empty($data['headimg'])){
+ if (!empty($data['headimg'])) {
$member_data['headimg'] = $data['headimg'];
}
$update_member = Member::where('member_id', $where['member_id'])->update($member_data);
- if(!$update_member){
+ if (!$update_member) {
Db::rollback();
return $res;
}
-
//更近客户资源日志表
$compareData = (new CommonService)->compareData($customer_resources, $customer_resources_data);
if ($compareData['changed_fields']) {
@@ -386,8 +385,6 @@ class CustomerResourcesService extends BaseApiService
}
}
-
-
Db::commit();
$res = [
'code' => 1,
From 235000c57949346442eada1e78d89545b908607f Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 14:46:33 +0800
Subject: [PATCH 08/17] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E6=8E=A7=E5=88=B6=E5=99=A8=E5=92=8C=E7=94=A8=E6=88=B7?=
=?UTF-8?q?=E5=8F=8D=E9=A6=88=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 Test 控制器,用于测试相关接口- 新增 UserFeedback 控制器,用于处理学生用户反馈
- 更新 Upload 控制器,增加文件扩展名和名称信息
- 在路由中添加用户反馈相关路由
---
.../app/api/controller/apiController/Test.php | 46 ++++++++++++++++
.../controller/apiController/UserFeedback.php | 53 +++++++++++++++++++
niucloud/app/api/controller/upload/Upload.php | 12 ++++-
niucloud/app/api/route/route.php | 4 ++
4 files changed, 114 insertions(+), 1 deletion(-)
create mode 100644 niucloud/app/api/controller/apiController/Test.php
create mode 100644 niucloud/app/api/controller/apiController/UserFeedback.php
diff --git a/niucloud/app/api/controller/apiController/Test.php b/niucloud/app/api/controller/apiController/Test.php
new file mode 100644
index 00000000..93490b91
--- /dev/null
+++ b/niucloud/app/api/controller/apiController/Test.php
@@ -0,0 +1,46 @@
+param('personnel_id', '');//员工人力资源表id(两个参数2选1)
+ $customer_resources_id = $request->param('customer_resources_id', '');//学生资源表id(两个参数2选1)
+ if (empty($personnel_id) && empty($customer_resources_id)) {
+ return fail('缺少参数');
+ }
+
+ $where = [
+ 'personnel_id' => $personnel_id,
+ 'customer_resources_id' => $customer_resources_id,
+ ];
+
+ $res = (new ChatService())->getChatFriendsPage($where);
+
+ return success($res);
+ }
+}
diff --git a/niucloud/app/api/controller/apiController/UserFeedback.php b/niucloud/app/api/controller/apiController/UserFeedback.php
new file mode 100644
index 00000000..8ac04a98
--- /dev/null
+++ b/niucloud/app/api/controller/apiController/UserFeedback.php
@@ -0,0 +1,53 @@
+post('user_id', ''); // 用户ID(对应school_customer_resources表id)
+ $feedback_text = $request->post('feedback_text', ''); // 反馈内容
+ $attachment_url = $request->post('attachment_url', null); // 附件URL(OSS对象存储),允许为空
+
+
+ //验证必填
+ if (empty($user_id) || empty($feedback_text)) {
+ return fail('必填参数不能为空');
+ }
+
+ $data = [
+ 'user_id' => $user_id,
+ 'feedback_text' => $feedback_text,
+ 'attachment_url' => $attachment_url ?? null,
+ ];
+
+ $add = \app\model\user_feedback\UserFeedback::create($data);
+
+ if (!$add) {
+ return fail('添加失败');
+ }
+
+ return success([]);
+ }
+}
diff --git a/niucloud/app/api/controller/upload/Upload.php b/niucloud/app/api/controller/upload/Upload.php
index 1463faaf..b24b7733 100644
--- a/niucloud/app/api/controller/upload/Upload.php
+++ b/niucloud/app/api/controller/upload/Upload.php
@@ -33,7 +33,17 @@ class Upload extends BaseApiController
['file', 'file'],
]);
$upload_service = new UploadService();
- return success($upload_service->image($data['file'],$extraData));
+
+ $res = $upload_service->image($data['file'],$extraData);
+
+ $res['ext'] = ''; // 初始化文件扩展名
+ $res['name'] = ''; // 初始化文件名称
+ if (isset($res['url'])) {
+ $res['ext'] = pathinfo($res['url'], PATHINFO_EXTENSION);
+ $res['name'] = basename($res['url']);
+ }
+
+ return success($res);
}
/**
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index b502522d..ba452b10 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -335,6 +335,10 @@ Route::group(function () {
//学生详情-修改
Route::post('customerResourcesAuth/edit', 'apiController.CustomerResourcesAuth/edit');
+ //学生用户反馈-添加
+ Route::post('userFeedback/add', 'apiController.UserFeedback/add');
+
+
})->middleware(ApiChannel::class)
->middleware(ApiCheckToken::class, true)
From 53fbe28ec680a9e21c5d97be52cb990f442a26ab Mon Sep 17 00:00:00 2001
From: "1213317725@qq.com" <1213317725@qq.com>
Date: Thu, 5 Jun 2025 14:54:23 +0800
Subject: [PATCH 09/17] 1
---
admin/src/app/api/customer_resources.ts | 12 ++
.../customer_resource_changes.vue | 8 +-
.../components/UserProfile.vue | 69 +++++---
.../customer_resources/components/log.vue | 122 ++++++++++++++
.../components/order_table.vue | 118 +++++++++++++
.../components/student_courses.vue | 131 +++++++++++++++
.../customer_resources/CustomerResources.php | 29 ++++
.../app/adminapi/route/customer_resources.php | 5 +
niucloud/app/common.php | 19 +++
.../customer_resources/CustomerResources.php | 1 +
.../CustomerResourcesService.php | 156 ++++++++++++++++++
11 files changed, 650 insertions(+), 20 deletions(-)
create mode 100644 admin/src/app/views/customer_resources/components/log.vue
create mode 100644 admin/src/app/views/customer_resources/components/order_table.vue
create mode 100644 admin/src/app/views/customer_resources/components/student_courses.vue
diff --git a/admin/src/app/api/customer_resources.ts b/admin/src/app/api/customer_resources.ts
index e43e8779..1dae55ba 100644
--- a/admin/src/app/api/customer_resources.ts
+++ b/admin/src/app/api/customer_resources.ts
@@ -76,3 +76,15 @@ export function fpEdit(params: Record) {
export function getWithCoachList(params: Record) {
return request.get('customer_resources/coach_person', { params })
}
+
+export function getLogList(params: Record) {
+ return request.get('customer_resources/log_list', { params })
+}
+
+export function getStudentCoursesList(params: Record) {
+ return request.get('customer_resources/student_courses', { params })
+}
+
+export function getOrderTableList(params: Record) {
+ return request.get('customer_resources/order_table', { params })
+}
diff --git a/admin/src/app/views/customer_resource_changes/customer_resource_changes.vue b/admin/src/app/views/customer_resource_changes/customer_resource_changes.vue
index 2db80a27..8a2c8a4f 100644
--- a/admin/src/app/views/customer_resource_changes/customer_resource_changes.vue
+++ b/admin/src/app/views/customer_resource_changes/customer_resource_changes.vue
@@ -76,6 +76,12 @@ import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
+const props = defineProps({
+ value: Number
+})
+
+console.log(props.value);
+
let customerResourceChangesTable = reactive({
page: 1,
limit: 10,
@@ -83,7 +89,7 @@ let customerResourceChangesTable = reactive({
loading: true,
data: [],
searchParam: {
- customer_resource_id: route.query.id,
+ customer_resource_id: props.value ? props.value : route.query.id,
},
})
diff --git a/admin/src/app/views/customer_resources/components/UserProfile.vue b/admin/src/app/views/customer_resources/components/UserProfile.vue
index 666f903a..a7449c72 100644
--- a/admin/src/app/views/customer_resources/components/UserProfile.vue
+++ b/admin/src/app/views/customer_resources/components/UserProfile.vue
@@ -10,11 +10,14 @@
-
+
-
{{ user.name }}
-
ID: {{ user.id }}
-
电话: {{ user.phone }}
+
{{ user.nickname }}
+
+
ID: U{{ user.member_id }}
+
电话: {{ user.mobile }}
+
住址: {{ user.address }}
+
@@ -25,25 +28,28 @@
-
六要素信息
- 需求购买力:{{ info.purchasePower }}
- 认知理念:{{ info.knowledge }}
- 距离:{{ info.distance }}
+ 需求购买力:{{ info.purchasePower }}
+ 认知理念:{{ info.knowledge }}
+
- 可谈上课时间:{{ info.canTalkDate }}
- 承诺到访时间:{{ info.promisedVisitDate }}
- 实际到访时间:{{ info.actualVisitDate }}
+ 距离:{{ info.distance }}
+ 可谈上课时间:{{ info.canTalkDate }}
+
- 电话后的意向程度:{{ info.phoneIntention }}
- 是否关单:
+ 承诺到访时间:{{ info.promisedVisitDate }}
+ 实际到访时间:{{ info.actualVisitDate }}
+
+
+ 电话后的意向程度:{{ info.phoneIntention }}
+ 是否关单:
{{ info.isClosed ? '是' : '否' }}
@@ -61,22 +67,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/src/app/views/customer_resources/components/order_table.vue b/admin/src/app/views/customer_resources/components/order_table.vue
new file mode 100644
index 00000000..19d9b656
--- /dev/null
+++ b/admin/src/app/views/customer_resources/components/order_table.vue
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+ {{
+ !customerResourceChangesTable.loading ? t('emptyData') : ''
+ }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/src/app/views/customer_resources/components/student_courses.vue b/admin/src/app/views/customer_resources/components/student_courses.vue
new file mode 100644
index 00000000..6c52cda9
--- /dev/null
+++ b/admin/src/app/views/customer_resources/components/student_courses.vue
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+ {{
+ !customerResourceChangesTable.loading ? t('emptyData') : ''
+ }}
+
+
+
+
+
+
+
+
+
+ {{ row.used }}/{{ row.total }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php b/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php
index e67500de..f84b1ebe 100644
--- a/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php
+++ b/niucloud/app/adminapi/controller/customer_resources/CustomerResources.php
@@ -41,6 +41,8 @@ class CustomerResources extends BaseAdminController
return success((new CustomerResourcesService())->getPage($data));
}
+
+
/**
* 客户资源详情
* @param int $id
@@ -196,4 +198,31 @@ class CustomerResources extends BaseAdminController
{
return success((new CustomerResourcesService())->getResourceByCourse($schedule));
}
+
+
+ public function log_list()
+ {
+ $data = $this->request->params([
+ ["customer_resource_id", ""]
+ ]);
+ return success((new CustomerResourcesService())->log_list($data));
+ }
+
+ public function student_courses()
+ {
+ $data = $this->request->params([
+ ["customer_resource_id", ""]
+ ]);
+ return success((new CustomerResourcesService())->student_courses($data));
+ }
+
+ public function order_table()
+ {
+ $data = $this->request->params([
+ ["customer_resource_id", ""]
+ ]);
+ return success((new CustomerResourcesService())->order_table($data));
+ }
+
+
}
diff --git a/niucloud/app/adminapi/route/customer_resources.php b/niucloud/app/adminapi/route/customer_resources.php
index 2be1d5cc..ecdfe098 100644
--- a/niucloud/app/adminapi/route/customer_resources.php
+++ b/niucloud/app/adminapi/route/customer_resources.php
@@ -47,6 +47,11 @@ Route::group('customer_resources', function () {
Route::get('getResourceByCourse/:schedule/students', 'customer_resources.CustomerResources/getResourceByCourse');
+ Route::get('log_list','customer_resources.CustomerResources/log_list');
+
+ Route::get('student_courses','customer_resources.CustomerResources/student_courses');
+
+ Route::get('order_table','customer_resources.CustomerResources/order_table');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
diff --git a/niucloud/app/common.php b/niucloud/app/common.php
index f1d57b3b..b043c134 100644
--- a/niucloud/app/common.php
+++ b/niucloud/app/common.php
@@ -1214,3 +1214,22 @@ function calculateChildHealthScore($age, $gender, $height, $weight) {
// 四舍五入取整
return round($total_score);
}
+
+
+function get_dict_value($key,$value){
+ $dict = new \app\model\dict\Dict();
+ $field = 'id,name,key,dictionary,memo,create_time,update_time';
+
+ $info = $dict->field($field)->where([['key', '=', $key]])->findOrEmpty()->toArray();
+ if($info['dictionary'] == null)
+ {
+ $info['dictionary'] = [];
+ }
+
+ $map = [];
+ foreach ($info['dictionary'] as $item) {
+ $map[$item['value']] = $item['name'];
+ }
+
+ return $map[$value];
+}
diff --git a/niucloud/app/model/customer_resources/CustomerResources.php b/niucloud/app/model/customer_resources/CustomerResources.php
index 218f156d..ce0415e3 100644
--- a/niucloud/app/model/customer_resources/CustomerResources.php
+++ b/niucloud/app/model/customer_resources/CustomerResources.php
@@ -89,6 +89,7 @@ class CustomerResources extends BaseModel
'updated_at' => '更新时间',
'deleted_at' => '逻辑删除时间',
'status' => '客户状态',
+ 'member_label' => '资源标签'
];
public function orderTable()
diff --git a/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php b/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php
index f8569fc2..fa0625cf 100644
--- a/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php
+++ b/niucloud/app/service/admin/customer_resources/CustomerResourcesService.php
@@ -15,6 +15,8 @@ use app\model\campus_person_role\CampusPersonRole;
use app\model\course_schedule\CourseSchedule;
use app\model\customer_resource_changes\CustomerResourceChanges;
use app\model\customer_resources\CustomerResources;
+use app\model\member\Member;
+use app\model\member\MemberLabel;
use app\model\order_table\OrderTable;
use app\model\personnel\Personnel;
use app\model\campus\Campus;
@@ -22,6 +24,7 @@ use app\model\campus\Campus;
use app\model\resource_sharing\ResourceSharing;
use app\model\six_speed\SixSpeed;
use app\model\six_speed_modification_log\SixSpeedModificationLog;
+use app\model\student_courses\StudentCourses;
use app\service\admin\member\MemberLabelService;
use core\base\BaseAdminService;
@@ -99,9 +102,17 @@ class CustomerResourcesService extends BaseAdminService
$sixSpeed = new SixSpeed();
$data = $sixSpeed->where(['resource_id' => $item['id']])->findOrEmpty()->toArray();
$item['six'] = $data;
+
+ $member = new Member();
+
+ $member_info = $member->where(['member_id' => $item['member_id']])->findOrEmpty()->toArray();
+ $item['member_info'] = $member_info;
});
}
+
+
+
/**
* 获取客户资源信息
* @param int $id
@@ -419,4 +430,149 @@ class CustomerResourcesService extends BaseAdminService
return $all;
}
+
+
+
+ public function log_list(array $data = [])
+ {
+ $customer_resource_changes = new CustomerResourceChanges();
+ $where = [];
+ if ($data['customer_resource_id']) {
+ $where[] = ['a.customer_resource_id', '=', $data['customer_resource_id']];
+ }
+
+
+
+ $search_model = $customer_resource_changes
+ ->alias("a")
+ ->join(['school_personnel' => 'b'], 'a.operator_id = b.id', 'left')
+ ->where($where)
+ ->field("a.*,b.name")
+ ->order("a.id asc");
+
+
+ return $this->pageQuery($search_model, function ($item, $key) {
+ $fieldZhArr = CustomerResources::FieldZh;
+ $modified_fields = json_decode($item['modified_fields'], true);
+ $type = [];
+ foreach ($modified_fields as $key => $value) {
+ $type[] = $fieldZhArr[$value];
+ }
+ $item['type'] = implode("
",$type);
+
+ $old_values = json_decode($item['old_values'], true);
+ $new_values = json_decode($item['new_values'], true);
+ $values = [];
+ foreach ($old_values as $key => $value) {
+
+ $old_value = $this->fields($key,$value);
+ $new_value = $this->fields($key,$new_values[$key]);
+
+ $values[] = $old_value.'->'.$new_value;
+ }
+
+ $item['values'] = implode("
",$values);
+
+
+ });
+ }
+
+ public function student_courses(array $data = [])
+ {
+ $studentCourses = new StudentCourses();
+ $where = [];
+ if ($data['customer_resource_id']) {
+ $where[] = ['b.user_id', '=', $data['customer_resource_id']];
+ }
+
+
+
+ $search_model = $studentCourses
+ ->alias("a")
+ ->join(['school_student' => 'b'], 'a.student_id = b.id', 'left')
+ ->join(['school_course' => 'c'], 'a.course_id = c.id', 'left')
+ ->where($where)
+ ->field("a.*,c.course_name")
+ ->order("a.id desc");
+
+
+ return $this->pageQuery($search_model, function ($item, $key) {
+ $item['total'] = $item['total_hours'] + $item['gift_hours'];
+ $item['used'] = $item['use_total_hours'] + $item['use_gift_hours'];
+
+ $now = date('Y-m-d'); // 当前日期
+
+ if ($now < $item['start_date']) {
+ $item['status'] = '未进行';
+ } elseif ($now > $item['end_date']) {
+ $item['status'] = '已结束';
+ } else {
+ $item['status'] = '进行中';
+ }
+
+ });
+ }
+
+
+ public function order_table(array $data = [])
+ {
+ $orderTable = new OrderTable();
+ $where = [];
+ if ($data['customer_resource_id']) {
+ $where[] = ['a.resource_id', '=', $data['customer_resource_id']];
+ }
+
+ $search_model = $orderTable
+ ->alias("a")
+ ->join(['school_course' => 'b'], 'a.course_id = b.id', 'left')
+ ->where($where)
+ ->field("a.*,b.course_name")
+ ->order("a.id desc");
+
+
+ return $this->pageQuery($search_model, function ($item, $key) {
+ $arr = ['cash' => '现金支付','scan_code' => '扫码支付','subscription' => '订阅支付'];
+ $item['type'] = $arr[$item['payment_type']];
+ $item['order_status'] = $item['order_status'] == 'pending' ? '待支付' : '已支付';
+ });
+ }
+
+
+ public function fields($filed,$value){
+ if(!$value){
+ return '空';
+ }
+ $campus = new Campus();
+ $member_label = new MemberLabel();
+ switch ($filed) {
+ case 'initial_intent':
+ return get_dict_value('preliminarycustomerintention',$value);
+ break;
+ case 'source':
+ return get_dict_value('source',$value);
+ break;
+ case 'purchasing_power':
+ return get_dict_value('customer_purchasing_power',$value);
+ break;
+ case 'cognitive_idea':
+ return get_dict_value('cognitive_concept',$value);
+ break;
+ case 'source_channel':
+ return get_dict_value('SourceChannel',$value);
+ break;
+ case 'status':
+ return get_dict_value('kh_status',$value);
+ break;
+ case 'member_label':
+ $label_name = $member_label->where('label_id','in',$value)->column('label_name');
+ return implode("-",$label_name);
+ break;
+ case 'campus':
+ return $campus->where(['id' => $value])->value("campus_name");
+ break;
+ default:
+ return $value;
+ }
+ }
+
}
From 370ce5cbe15f4b16afbb099c1508ac4bf511891a Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 15:40:15 +0800
Subject: [PATCH 10/17] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E5=AD=A6?=
=?UTF-8?q?=E7=94=9F=E7=AB=AF=E7=94=A8=E6=88=B7=E8=81=8A=E5=A4=A9=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增学生端用户聊天的好友关系列表接口- 新增学生端用户聊天的好友关系详情接口
- 新增学生端用户聊天的聊天记录获取接口
- 新增学生端用户聊天的发送聊天内容接口
---
niucloud/app/api/route/route.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index ba452b10..8b5897a4 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -338,6 +338,16 @@ Route::group(function () {
//学生用户反馈-添加
Route::post('userFeedback/add', 'apiController.UserFeedback/add');
+ //学生端-用户聊天-好友关系列表
+ Route::get('xy/chat/getChatFriendsList', 'apiController.Chat/getChatFriendsList');
+ //学生端-用户聊天-好友关系详情
+ Route::get('xy/chat/getChatFriendsInfo', 'apiController.Chat/getChatFriendsInfo');
+ //学生端-用户聊天-获取聊天记录
+ Route::get('xy/chat/getChatMessagesList', 'apiController.Chat/getChatMessagesList');
+ //学生端-用户聊天-发送聊天内容
+ Route::post('xy/chat/sendChatMessages', 'apiController.Chat/sendChatMessages');
+
+
})->middleware(ApiChannel::class)
From 7e801a4dcafdb39af0ea5b3fb140318fbea5c6cf Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 16:06:26 +0800
Subject: [PATCH 11/17] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E4=BD=93?=
=?UTF-8?q?=E6=B5=8B=E6=8A=A5=E5=91=8A=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E5=92=8C=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 PhysicalTest 控制器,提供体测报告相关接口
- 实现 PhysicalTestService 和 TestService 服务类,处理体测报告业务逻辑
- 添加体测报告列表和详情查询功能
---
.../controller/apiController/PhysicalTest.php | 46 +++++++++
.../api/apiService/PhysicalTestService.php | 95 +++++++++++++++++++
.../service/api/apiService/TestService.php | 95 +++++++++++++++++++
3 files changed, 236 insertions(+)
create mode 100644 niucloud/app/api/controller/apiController/PhysicalTest.php
create mode 100644 niucloud/app/service/api/apiService/PhysicalTestService.php
create mode 100644 niucloud/app/service/api/apiService/TestService.php
diff --git a/niucloud/app/api/controller/apiController/PhysicalTest.php b/niucloud/app/api/controller/apiController/PhysicalTest.php
new file mode 100644
index 00000000..340d7423
--- /dev/null
+++ b/niucloud/app/api/controller/apiController/PhysicalTest.php
@@ -0,0 +1,46 @@
+param('personnel_id', '');//员工人力资源表id(两个参数2选1)
+ $customer_resources_id = $request->param('customer_resources_id', '');//学生资源表id(两个参数2选1)
+ if (empty($personnel_id) && empty($customer_resources_id)) {
+ return fail('缺少参数');
+ }
+
+ $where = [
+ 'personnel_id' => $personnel_id,
+ 'customer_resources_id' => $customer_resources_id,
+ ];
+
+ $res = (new ChatService())->getChatFriendsPage($where);
+
+ return success($res);
+ }
+}
diff --git a/niucloud/app/service/api/apiService/PhysicalTestService.php b/niucloud/app/service/api/apiService/PhysicalTestService.php
new file mode 100644
index 00000000..04254c09
--- /dev/null
+++ b/niucloud/app/service/api/apiService/PhysicalTestService.php
@@ -0,0 +1,95 @@
+getPageParam();//获取请求参数中的页码+分页数
+ $page = $page_params['page'];
+ $limit = $page_params['limit'];
+
+ $model = new ChatFriends();
+ //判断用没有员工id
+ if (!empty($where['personnel_id'])) {
+ $model = $model->where('personnel_id', $where['personnel_id']);
+ }
+
+ if (!empty($where['customer_resources_id'])) {
+ $model = $model->where('customer_resources_id', $where['customer_resources_id']);
+ }
+
+ $data = $model
+ ->with([
+ 'personnel',
+ 'customer',
+ ])
+ ->paginate([
+ 'list_rows' => $limit,
+ 'page' => $page,
+ ])->toArray();
+
+ return $data;
+ }
+
+ //查询详情
+ public function getTestInfo(array $where)
+ {
+ $model = new ChatFriends();
+ //判断用没有员工id
+ if (!empty($where['personnel_id'])) {
+ $model = $model->where('personnel_id', $where['personnel_id']);
+ }
+ if (!empty($where['customer_resources_id'])) {
+ $model = $model->where('customer_resources_id', $where['customer_resources_id']);
+ }
+ $data = $model->find();
+
+
+ if ($data) {
+ $data = $data->toArray();
+ $res = [
+ 'code' => 1,
+ 'msg' => '操作成功',
+ 'data' => $data
+ ];
+ return $res;
+ } else {
+ $res = [
+ 'code' => 0,
+ 'msg' => '暂无数据',
+ 'data' => []
+ ];
+ return $res;
+ }
+ }
+}
diff --git a/niucloud/app/service/api/apiService/TestService.php b/niucloud/app/service/api/apiService/TestService.php
new file mode 100644
index 00000000..81629665
--- /dev/null
+++ b/niucloud/app/service/api/apiService/TestService.php
@@ -0,0 +1,95 @@
+getPageParam();//获取请求参数中的页码+分页数
+ $page = $page_params['page'];
+ $limit = $page_params['limit'];
+
+ $model = new ChatFriends();
+ //判断用没有员工id
+ if (!empty($where['personnel_id'])) {
+ $model = $model->where('personnel_id', $where['personnel_id']);
+ }
+
+ if (!empty($where['customer_resources_id'])) {
+ $model = $model->where('customer_resources_id', $where['customer_resources_id']);
+ }
+
+ $data = $model
+ ->with([
+ 'personnel',
+ 'customer',
+ ])
+ ->paginate([
+ 'list_rows' => $limit,
+ 'page' => $page,
+ ])->toArray();
+
+ return $data;
+ }
+
+ //查询详情
+ public function getTestInfo(array $where)
+ {
+ $model = new ChatFriends();
+ //判断用没有员工id
+ if (!empty($where['personnel_id'])) {
+ $model = $model->where('personnel_id', $where['personnel_id']);
+ }
+ if (!empty($where['customer_resources_id'])) {
+ $model = $model->where('customer_resources_id', $where['customer_resources_id']);
+ }
+ $data = $model->find();
+
+
+ if ($data) {
+ $data = $data->toArray();
+ $res = [
+ 'code' => 1,
+ 'msg' => '操作成功',
+ 'data' => $data
+ ];
+ return $res;
+ } else {
+ $res = [
+ 'code' => 0,
+ 'msg' => '暂无数据',
+ 'data' => []
+ ];
+ return $res;
+ }
+ }
+}
From c3aa8befeeaca80ec328b9b9189933745504e4dd Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 17:25:23 +0800
Subject: [PATCH 12/17] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E4=BD=93?=
=?UTF-8?q?=E6=B5=8B=E6=8A=A5=E5=91=8A=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增体测报告列表和详情接口
- 实现体测报告数据的查询和处理
- 添加学生资源一对一关系的方法
- 优化体测报告数据的展示逻辑
---
.../controller/apiController/PhysicalTest.php | 24 +++++++++++---
niucloud/app/api/route/route.php | 5 +++
.../app/model/physical_test/PhysicalTest.php | 7 ++++
.../api/apiService/PhysicalTestService.php | 33 +++++++++++--------
4 files changed, 52 insertions(+), 17 deletions(-)
diff --git a/niucloud/app/api/controller/apiController/PhysicalTest.php b/niucloud/app/api/controller/apiController/PhysicalTest.php
index 340d7423..6f5e8443 100644
--- a/niucloud/app/api/controller/apiController/PhysicalTest.php
+++ b/niucloud/app/api/controller/apiController/PhysicalTest.php
@@ -12,21 +12,37 @@
namespace app\api\controller\apiController;
use app\Request;
-use app\service\api\apiService\CampusService;
use app\service\api\apiService\ChatService;
-use app\service\api\apiService\CommonService;
+use app\service\api\apiService\PhysicalTestService;
use core\base\BaseApiService;
/**
- * 体测报告控制器相关接口
+ * 体测报告-控制器相关接口
* Class Personnel
* @package app\api\controller\apiController
*/
class PhysicalTest extends BaseApiService
{
- //测试控制器Demo
+ //列表
public function index(Request $request)
+ {
+ $resource_id = $request->param('resource_id', '');//学生资源表id
+ if (empty($resource_id)) {
+ return fail('缺少参数');
+ }
+
+ $where = [
+ 'resource_id' => $resource_id,
+ ];
+
+ $res = (new PhysicalTestService())->getList($where);
+
+ return success($res);
+ }
+
+ //详情
+ public function info(Request $request)
{
$personnel_id = $request->param('personnel_id', '');//员工人力资源表id(两个参数2选1)
$customer_resources_id = $request->param('customer_resources_id', '');//学生资源表id(两个参数2选1)
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index 8b5897a4..0a94a83b 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -347,6 +347,11 @@ Route::group(function () {
//学生端-用户聊天-发送聊天内容
Route::post('xy/chat/sendChatMessages', 'apiController.Chat/sendChatMessages');
+ //学生端-体测报告-列表
+ Route::get('xy/physicalTest', 'apiController.PhysicalTest/index');
+ //学生端-体测报告-详情
+ Route::get('xy/physicalTest/info', 'apiController.PhysicalTest/info');
+
diff --git a/niucloud/app/model/physical_test/PhysicalTest.php b/niucloud/app/model/physical_test/PhysicalTest.php
index c81da6ec..61290480 100644
--- a/niucloud/app/model/physical_test/PhysicalTest.php
+++ b/niucloud/app/model/physical_test/PhysicalTest.php
@@ -81,6 +81,13 @@ class PhysicalTest extends BaseModel
return $this->hasOne(CustomerResources::class, 'id', 'resource_id')->joinType('left')->withField('name,id')->bind(['resource_id_name'=>'name']);
}
+ //获取学生资源一对一
+ public function customerResourcesHasOne(){
+ return $this->hasOne(CustomerResources::class, 'id', 'resource_id');
+ }
+
+
+
public function student(){
return $this->hasOne(Student::class, 'id', 'student_id')->joinType('left')->withField('name,id')->bind(['student_id_name'=>'name']);
}
diff --git a/niucloud/app/service/api/apiService/PhysicalTestService.php b/niucloud/app/service/api/apiService/PhysicalTestService.php
index 04254c09..95d201cd 100644
--- a/niucloud/app/service/api/apiService/PhysicalTestService.php
+++ b/niucloud/app/service/api/apiService/PhysicalTestService.php
@@ -14,10 +14,8 @@ namespace app\service\api\apiService;
use app\model\campus\Campus;
use app\model\campus_person_role\CampusPersonRole;
use app\model\chat_friends\ChatFriends;
-use app\model\chat_messages\ChatMessages;
-use app\model\dict\Dict;
+use app\model\physical_test\PhysicalTest;
use core\base\BaseApiService;
-use think\facade\Db;
/**
* 体测报告-控制器服务层
@@ -32,32 +30,41 @@ class PhysicalTestService extends BaseApiService
}
//查询列表
- public function getTestList(array $where)
+ public function getList(array $where,string $field = '*')
{
$page_params = $this->getPageParam();//获取请求参数中的页码+分页数
$page = $page_params['page'];
$limit = $page_params['limit'];
- $model = new ChatFriends();
+ $model = new PhysicalTest();
//判断用没有员工id
- if (!empty($where['personnel_id'])) {
- $model = $model->where('personnel_id', $where['personnel_id']);
- }
-
- if (!empty($where['customer_resources_id'])) {
- $model = $model->where('customer_resources_id', $where['customer_resources_id']);
+ if (!empty($where['resource_id'])) {
+ $model = $model->where('resource_id', $where['resource_id']);
}
$data = $model
+ ->field($field)
+ ->order('id','desc')
+ ->append([
+ 'customerResources'
+ ])
->with([
- 'personnel',
- 'customer',
+ 'customerResourcesHasOne'
])
->paginate([
'list_rows' => $limit,
'page' => $page,
])->toArray();
+
+ foreach ($data['data'] as &$v) {
+ $age = $v['customerResourcesHasOne']['age'];//年龄
+ $gender = $v['customerResourcesHasOne']['gender'] == 'female' ? 2:1 ;//性别( 1:男,2:女)
+ $height = $v['height'];//身高
+ $weight = $v['weight'];//体重
+ $v['calculateChildHealthScore'] = calculateChildHealthScore($age, $gender, $height, $weight);//综合评分
+ }
+
return $data;
}
From 8d5e9224b96d4ccd5080e61a7d865603497d0779 Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 17:30:24 +0800
Subject: [PATCH 13/17] =?UTF-8?q?refactor(PhysicalTest):=20=E9=87=8D?=
=?UTF-8?q?=E6=9E=84=E4=BD=93=E6=B5=8B=E6=8A=A5=E5=91=8A=E8=AF=A6=E6=83=85?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修改接口参数,使用体测报告的 id 替代员工或学生资源 id
- 更新服务层方法,增加字段选择功能
- 优化数据查询,关联查询学生资源信息
- 添加综合评分计算逻辑
---
.../controller/apiController/PhysicalTest.php | 17 +++++-----
.../api/apiService/PhysicalTestService.php | 31 +++++++++++++------
2 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/niucloud/app/api/controller/apiController/PhysicalTest.php b/niucloud/app/api/controller/apiController/PhysicalTest.php
index 6f5e8443..9c7bbe1e 100644
--- a/niucloud/app/api/controller/apiController/PhysicalTest.php
+++ b/niucloud/app/api/controller/apiController/PhysicalTest.php
@@ -44,19 +44,22 @@ class PhysicalTest extends BaseApiService
//详情
public function info(Request $request)
{
- $personnel_id = $request->param('personnel_id', '');//员工人力资源表id(两个参数2选1)
- $customer_resources_id = $request->param('customer_resources_id', '');//学生资源表id(两个参数2选1)
- if (empty($personnel_id) && empty($customer_resources_id)) {
+ $id = $request->param('id', '');//体测报告的id
+
+ if (empty($id)) {
return fail('缺少参数');
}
$where = [
- 'personnel_id' => $personnel_id,
- 'customer_resources_id' => $customer_resources_id,
+ 'id' => $id,
];
- $res = (new ChatService())->getChatFriendsPage($where);
+ $res = (new PhysicalTestService())->getInfo($where);
- return success($res);
+ if(!$res['code']){
+ return fail($res['msg']);
+ }
+
+ return success($res['data']);
}
}
diff --git a/niucloud/app/service/api/apiService/PhysicalTestService.php b/niucloud/app/service/api/apiService/PhysicalTestService.php
index 95d201cd..08b429a5 100644
--- a/niucloud/app/service/api/apiService/PhysicalTestService.php
+++ b/niucloud/app/service/api/apiService/PhysicalTestService.php
@@ -69,21 +69,34 @@ class PhysicalTestService extends BaseApiService
}
//查询详情
- public function getTestInfo(array $where)
+ public function getInfo(array $where,string $field = '*')
{
- $model = new ChatFriends();
- //判断用没有员工id
- if (!empty($where['personnel_id'])) {
- $model = $model->where('personnel_id', $where['personnel_id']);
- }
- if (!empty($where['customer_resources_id'])) {
- $model = $model->where('customer_resources_id', $where['customer_resources_id']);
+ $model = new PhysicalTest();
+ //判断用没有体测报告id
+ if (!empty($where['id'])) {
+ $model = $model->where('id', $where['id']);
}
- $data = $model->find();
+
+ $data = $model
+ ->field($field)
+ ->append([
+ 'customerResources'
+ ])
+ ->with([
+ 'customerResourcesHasOne'
+ ])
+ ->find();
if ($data) {
$data = $data->toArray();
+
+ $age = $data['customerResourcesHasOne']['age'];//年龄
+ $gender = $data['customerResourcesHasOne']['gender'] == 'female' ? 2 : 1;//性别( 1:男,2:女)
+ $height = $data['height'];//身高
+ $weight = $data['weight'];//体重
+ $data['calculateChildHealthScore'] = calculateChildHealthScore($age, $gender, $height, $weight);//综合评分
+
$res = [
'code' => 1,
'msg' => '操作成功',
From 498f29a710875db3061d4ddd5c52369efd0fa4e1 Mon Sep 17 00:00:00 2001
From: LLL <15374889135@163.com>
Date: Thu, 5 Jun 2025 17:43:06 +0800
Subject: [PATCH 14/17] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../api/controller/apiController/ClassApi.php | 9 ++++
.../api/controller/apiController/Course.php | 6 +++
niucloud/app/api/route/route.php | 6 ++-
niucloud/app/model/course/Course.php | 20 +++++----
.../model/course_schedule/CourseSchedule.php | 12 ++++++
niucloud/app/model/student/Student.php | 1 +
.../service/api/apiService/CourseService.php | 43 +++++++++++++++++--
.../service/api/apiService/jlClassService.php | 18 ++++++++
8 files changed, 102 insertions(+), 13 deletions(-)
diff --git a/niucloud/app/api/controller/apiController/ClassApi.php b/niucloud/app/api/controller/apiController/ClassApi.php
index 0b12e697..93fd2c99 100644
--- a/niucloud/app/api/controller/apiController/ClassApi.php
+++ b/niucloud/app/api/controller/apiController/ClassApi.php
@@ -41,4 +41,13 @@ class ClassApi extends BaseApiService
return success('获取成功',(new jlClassService())->info($data['class_id']));
}
+ //获取学员详情
+ public function jlStudentsInfo(Request $request){
+ $data = $this->request->params([
+ ["students_id",0]
+ ]);
+ return success('获取成功',(new jlClassService())->jlStudentsInfo($data['students_id']));
+ }
+
+
}
diff --git a/niucloud/app/api/controller/apiController/Course.php b/niucloud/app/api/controller/apiController/Course.php
index a4b7a69d..597c7104 100644
--- a/niucloud/app/api/controller/apiController/Course.php
+++ b/niucloud/app/api/controller/apiController/Course.php
@@ -33,6 +33,12 @@ class Course extends BaseApiService
return success((new CourseService())->list($id,$data));
}
+ //班级课程列表
+ public function classCourseList(Request $request){
+ $id = $this->member_id;
+ return success((new CourseService())->classList($id));
+ }
+
//获取课程详情
public function courseInfo(Request $request){
$data = $this->request->params([
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index 3b72577e..a9e7f6b0 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -286,8 +286,10 @@ Route::group(function () {
-
-
+ //获取学员详情
+ Route::get('class/jlStudentsInfo', 'apiController.classApi/jlStudentsInfo');
+ //班级课程列表
+ Route::get('course/classCourseList', 'apiController.course/classCourseList');
//获取添加学员列表
Route::get('course/addStudentList', 'apiController.course/addStudentList');
Route::post('course/addStudent', 'apiController.course/addStudent');
diff --git a/niucloud/app/model/course/Course.php b/niucloud/app/model/course/Course.php
index 2f9fc8d4..36992c8e 100644
--- a/niucloud/app/model/course/Course.php
+++ b/niucloud/app/model/course/Course.php
@@ -12,6 +12,7 @@
namespace app\model\course;
use core\base\BaseModel;
+use app\model\student_courses\StudentCourses;
use think\model\concern\SoftDelete;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
@@ -85,7 +86,7 @@ class Course extends BaseModel
$query->where("course_type", $value);
}
}
-
+
/**
* 搜索器:课程课程时长
* @param $value
@@ -97,7 +98,7 @@ class Course extends BaseModel
$query->where("duration", $value);
}
}
-
+
/**
* 搜索器:课程课时数量
* @param $value
@@ -109,7 +110,7 @@ class Course extends BaseModel
$query->where("session_count", $value);
}
}
-
+
/**
* 搜索器:课程单次逍客数量
* @param $value
@@ -121,7 +122,7 @@ class Course extends BaseModel
$query->where("single_session_count", $value);
}
}
-
+
/**
* 搜索器:课程课程价格
* @param $value
@@ -133,7 +134,7 @@ class Course extends BaseModel
$query->where("price", $value);
}
}
-
+
/**
* 搜索器:课程内部提醒课时
* @param $value
@@ -145,7 +146,7 @@ class Course extends BaseModel
$query->where("internal_reminder", $value);
}
}
-
+
/**
* 搜索器:课程客户提醒课时
* @param $value
@@ -157,7 +158,7 @@ class Course extends BaseModel
$query->where("customer_reminder", $value);
}
}
-
+
/**
* 搜索器:课程课程备注
* @param $value
@@ -171,7 +172,10 @@ class Course extends BaseModel
}
-
+ public function studentCourses()
+ {
+ return $this->hasOne(StudentCourses::class, 'course_id', 'id');
+ }
diff --git a/niucloud/app/model/course_schedule/CourseSchedule.php b/niucloud/app/model/course_schedule/CourseSchedule.php
index ec49b544..943e5c23 100644
--- a/niucloud/app/model/course_schedule/CourseSchedule.php
+++ b/niucloud/app/model/course_schedule/CourseSchedule.php
@@ -14,6 +14,8 @@ namespace app\model\course_schedule;
use app\model\course\Course;
use app\model\personnel\Personnel;
use app\model\venue\Venue;
+use app\model\campus\Campus;
+use app\model\student_courses\StudentCourses;
use core\base\BaseModel;
use think\model\concern\SoftDelete;
use think\model\relation\HasMany;
@@ -102,4 +104,14 @@ class CourseSchedule extends BaseModel
return $this->hasOne(Course::class, 'id', 'course_id');
}
+ public function campus()
+ {
+ return $this->hasOne(Campus::class, 'id', 'campus_id')->joinType('left')->withField('campus_name,id')->bind(['campus_name'=>'campus_name']);
+ }
+
+ public function studentCourses()
+ {
+ return $this->hasOne(StudentCourses::class, 'course_id', 'course_id');
+ }
+
}
diff --git a/niucloud/app/model/student/Student.php b/niucloud/app/model/student/Student.php
index e5d2e31b..4d8d0197 100644
--- a/niucloud/app/model/student/Student.php
+++ b/niucloud/app/model/student/Student.php
@@ -152,4 +152,5 @@ class Student extends BaseModel
return $this->hasOne(ClassGrade::class, 'id', 'class_id');
}
+
}
diff --git a/niucloud/app/service/api/apiService/CourseService.php b/niucloud/app/service/api/apiService/CourseService.php
index ddefbf3b..1484cd5e 100644
--- a/niucloud/app/service/api/apiService/CourseService.php
+++ b/niucloud/app/service/api/apiService/CourseService.php
@@ -50,9 +50,8 @@ class CourseService extends BaseApiService
$query->select();
},'venue' => function($query) {
$query->select();
- }]);
+ },'campus','studentCourses']);
$list = $this->pageQuery($search_model);
- $PersonCourseSchedule = new PersonCourseSchedule();
foreach ($list['data'] as $k => $v) {
$student = Db::name('person_course_schedule')
->alias('pcs')
@@ -93,7 +92,7 @@ class CourseService extends BaseApiService
->alias('sc')
->where('sc.course_id', $list['id'])
->join('school_student_course_usage sscu', 'sc.id = sscu.student_course_id')
- ->field('sc.student_id,sc.end_date')
+ ->field('sc.student_id,sc.end_date,sc.end_date,sc.start_date,sc.course_id')
->select()->toArray();
foreach ($student_courses as &$v){
$student = Db::name('student')
@@ -138,6 +137,44 @@ class CourseService extends BaseApiService
}
+ public function classList($data)
+ {
+ $CourseSchedule = new CourseSchedule();
+ $search_model = $CourseSchedule
+ ->where('coach_id', $data)
+ ->with(['course' => function($query) {
+ $query->with(['studentCourses' => function($query) {
+ $query->select();
+ }]);
+ },'venue' => function($query) {
+ $query->select();
+ },'coach' => function($query) {
+ $query->select();
+ },'campus']);
+ $list = $this->pageQuery($search_model);
+ foreach ($list['data'] as &$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();
+ $v['student'] = $student;
+ }
+ foreach ($list['data'] as &$v) {
+ $student_courses = Db::name('student_courses')
+ ->alias('sc')
+ ->where('sc.course_id', $v['id'])
+ ->join('school_student_course_usage sscu', 'sc.id = sscu.student_course_id')
+ ->field('sc.student_id,sc.end_date,sc.end_date,sc.start_date,sc.course_id')
+ ->select()->toArray();
+ $v['student_courses'] = $student_courses;
+ }
+ return $list;
+ }
+
//获取添加学员列表
public function StudentList($id)
{
diff --git a/niucloud/app/service/api/apiService/jlClassService.php b/niucloud/app/service/api/apiService/jlClassService.php
index d3628355..d02ff63f 100644
--- a/niucloud/app/service/api/apiService/jlClassService.php
+++ b/niucloud/app/service/api/apiService/jlClassService.php
@@ -12,6 +12,7 @@
namespace app\service\api\apiService;
use app\model\class_grade\ClassGrade;
+use app\model\student\Student;
use core\base\BaseApiService;
/**
@@ -99,4 +100,21 @@ class jlClassService extends BaseApiService
return $list;
}
+ public function jlStudentsInfo($data)
+ {
+ $Student = new Student();
+ $res = $Student->where('id',$data)->with(['customerResources' => function($query) {
+ $query->with(['member' => function($query) {
+ $query->select();
+ }]);
+ }]);
+ $res = $res->find();
+
+
+
+
+
+
+ return $res;
+ }
}
From c28fd7d6690bfe6138377f45d9cf0cddf3861d4b Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 5 Jun 2025 17:57:32 +0800
Subject: [PATCH 15/17] =?UTF-8?q?refactor(PhysicalTestService):=E8=B0=83?=
=?UTF-8?q?=E6=95=B4=E5=B9=B4=E9=BE=84=E5=AD=97=E6=AE=B5=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E8=B7=AF=E5=BE=84-=20=E4=BB=8E=20$v['customerResourcesHasOne']?=
=?UTF-8?q?['age']=20=E4=BF=AE=E6=94=B9=E4=B8=BA=20$v['age']=20-=20?=
=?UTF-8?q?=E4=BB=8E=20$data['customerResourcesHasOne']['age']=20=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E4=B8=BA=20$data['age']?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
niucloud/app/service/api/apiService/PhysicalTestService.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/niucloud/app/service/api/apiService/PhysicalTestService.php b/niucloud/app/service/api/apiService/PhysicalTestService.php
index 08b429a5..d72df915 100644
--- a/niucloud/app/service/api/apiService/PhysicalTestService.php
+++ b/niucloud/app/service/api/apiService/PhysicalTestService.php
@@ -58,7 +58,7 @@ class PhysicalTestService extends BaseApiService
foreach ($data['data'] as &$v) {
- $age = $v['customerResourcesHasOne']['age'];//年龄
+ $age = $v['age'];//年龄
$gender = $v['customerResourcesHasOne']['gender'] == 'female' ? 2:1 ;//性别( 1:男,2:女)
$height = $v['height'];//身高
$weight = $v['weight'];//体重
@@ -91,7 +91,7 @@ class PhysicalTestService extends BaseApiService
if ($data) {
$data = $data->toArray();
- $age = $data['customerResourcesHasOne']['age'];//年龄
+ $age = $data['age'];//年龄
$gender = $data['customerResourcesHasOne']['gender'] == 'female' ? 2 : 1;//性别( 1:男,2:女)
$height = $data['height'];//身高
$weight = $data['weight'];//体重
From b9766a2f0e2e735773a164884cdb208661ad61d0 Mon Sep 17 00:00:00 2001
From: LLL <15374889135@163.com>
Date: Fri, 6 Jun 2025 08:46:55 +0800
Subject: [PATCH 16/17] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../api/controller/apiController/ClassApi.php | 61 +++++++++++++++++++
niucloud/app/api/route/route.php | 20 +++---
.../service/api/apiService/jlClassService.php | 38 +++++++++++-
3 files changed, 110 insertions(+), 9 deletions(-)
diff --git a/niucloud/app/api/controller/apiController/ClassApi.php b/niucloud/app/api/controller/apiController/ClassApi.php
index 93fd2c99..24b8d248 100644
--- a/niucloud/app/api/controller/apiController/ClassApi.php
+++ b/niucloud/app/api/controller/apiController/ClassApi.php
@@ -13,6 +13,7 @@ namespace app\api\controller\apiController;
use app\Request;
use app\service\api\apiService\jlClassService;
+use app\service\api\apiService\PhysicalTestService;
use core\base\BaseApiService;
@@ -49,5 +50,65 @@ class ClassApi extends BaseApiService
return success('获取成功',(new jlClassService())->jlStudentsInfo($data['students_id']));
}
+ //体测列表
+ public function PhysicalTestList(Request $request){
+ $data = $this->request->params([
+ ["user_id",0]
+ ]);
+ return success('获取成功',(new jlClassService())->PhysicalTestList($data['user_id']));
+ }
+
+ //体测详情
+ public function PhysicalTestInfo(Request $request)
+ {
+ $id = $request->param('survey_id', '');//体测报告的id
+ if (empty($id)) {
+ return fail('缺少参数');
+ }
+ $where = [
+ 'id' => $id,
+ ];
+ $res = (new PhysicalTestService())->getInfo($where);
+ if(!$res['code']){
+ return fail($res['msg']);
+ }
+ return success($res['data']);
+ }
+
+ //添加作业-获取班级列表
+ public function jlGetClassesList(Request $request)
+ {
+ return success((new jlClassService())->GetClassesList());
+ }
+
+ //添加作业-获取课程列表
+ public function jlGetCoursesList(Request $request)
+ {
+ return success((new jlClassService())->GetCoursesList());
+ }
+
+ //添加作业-学员列表
+ public function jlGetStudentList(Request $request)
+ {
+ return success((new jlClassService())->GetStudentList());
+ }
+
+ //添加作业
+ public function addJlPublishJob(Request $request)
+ {
+ $data = $this->request->params([
+ ["class_id",0],
+ ["classes_id_name",''],
+ ["content_text",''],
+ ["content_type",''],
+ ["course_id",0],
+ ["course_id_name",''],
+ ["student_id",''],
+ ["students_ids_name",''],
+ ["type",''],
+ ]);
+ return success('操作成功', (new jlClassService())->addPublishJob($data));
+ }
+
}
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index cfebd194..1b85f92c 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -278,14 +278,18 @@ Route::group(function () {
-
-
-
-
-
-
-
-
+ //添加作业
+ Route::get('class/jlPublishJob/add', 'apiController.classApi/addJlPublishJob');
+ //添加作业-获取课程列表
+ Route::get('class/jlGetStudentList/list', 'apiController.classApi/jlGetStudentList');
+ //添加作业-获取课程列表
+ Route::get('class/jlGetCoursesList/list', 'apiController.classApi/jlGetCoursesList');
+ //添加作业-获取班级列表
+ Route::get('class/jlGetClasses/list', 'apiController.classApi/jlGetClassesList');
+ //体测报告-列表
+ Route::get('class/physicalTest', 'apiController.classApi/PhysicalTestList');
+ //体测报告-详情
+ Route::get('class/physicalTest/info', 'apiController.classApi/PhysicalTestInfo');
//获取学员详情
Route::get('class/jlStudentsInfo', 'apiController.classApi/jlStudentsInfo');
//班级课程列表
diff --git a/niucloud/app/service/api/apiService/jlClassService.php b/niucloud/app/service/api/apiService/jlClassService.php
index d02ff63f..115420f4 100644
--- a/niucloud/app/service/api/apiService/jlClassService.php
+++ b/niucloud/app/service/api/apiService/jlClassService.php
@@ -13,6 +13,8 @@ namespace app\service\api\apiService;
use app\model\class_grade\ClassGrade;
use app\model\student\Student;
+use app\model\assignment\Assignment;
+use app\model\course\Course;
use core\base\BaseApiService;
/**
@@ -109,12 +111,46 @@ class jlClassService extends BaseApiService
}]);
}]);
$res = $res->find();
+ return $res;
+ }
+ public function PhysicalTestList($data)
+ {
+ $resource_id = $data;
+ $where = [
+ 'resource_id' => $resource_id,
+ ];
+ $physical_test = (new PhysicalTestService())->getList($where);
+ $res['physical_test'] = $physical_test;
+ return $res;
+ }
-
+ public function GetClassesList()
+ {
+ $res = $this->model->where('status',1)->select()->toArray();
+ return $res;
+ }
+ public function GetCoursesList()
+ {
+ $Course = new Course();
+ $res = $Course->select()->toArray();
+ return $res;
+ }
+ public function GetStudentList()
+ {
+ $Student = new Student();
+ $res = $Student->where('status', 1)->select()->toArray();
+ return $res;
+ }
+ public function addPublishJob($data)
+ {
+ $Assignment = new Assignment();
+ $res = $Assignment->create($data);
return $res;
}
+
+
}
From a522c667f8e9be9ccb858128542b954e1937d441 Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Fri, 6 Jun 2025 10:50:28 +0800
Subject: [PATCH 17/17] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E5=AD=A6?=
=?UTF-8?q?=E7=94=9F=E8=AF=BE=E7=A8=8B=E5=AE=89=E6=8E=92=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E5=92=8C=E7=9B=B8=E5=85=B3=E6=9C=8D=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 PersonCourseSchedule 控制器,实现学生课程安排列表接口
- 新增 PersonCourseScheduleService 服务类,提供课程安排查询功能
- 在路由文件中添加学生课程安排相关路由
---
.../apiController/PersonCourseSchedule.php | 42 ++++++++
niucloud/app/api/route/route.php | 5 +
.../PersonCourseScheduleService.php | 98 +++++++++++++++++++
3 files changed, 145 insertions(+)
create mode 100644 niucloud/app/api/controller/apiController/PersonCourseSchedule.php
create mode 100644 niucloud/app/service/api/apiService/PersonCourseScheduleService.php
diff --git a/niucloud/app/api/controller/apiController/PersonCourseSchedule.php b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php
new file mode 100644
index 00000000..df2731ee
--- /dev/null
+++ b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php
@@ -0,0 +1,42 @@
+param('resources_id', '');//客户资源ID
+ if (empty($resources_id)) {
+ return fail('缺少参数');
+ }
+
+ $where = [
+ 'resources_id' => $resources_id,
+ ];
+
+ $res = (new PersonCourseScheduleService())->getList($where);
+
+ return success($res);
+ }
+}
diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php
index 1b85f92c..79593a19 100644
--- a/niucloud/app/api/route/route.php
+++ b/niucloud/app/api/route/route.php
@@ -358,6 +358,11 @@ Route::group(function () {
//学生端-体测报告-详情
Route::get('xy/physicalTest/info', 'apiController.PhysicalTest/info');
+ //学生端-学生课程安排-列表
+ Route::get('xy/personCourseSchedule', 'apiController.PersonCourseSchedule/index');
+ //学生端-学生课程安排-详情
+ Route::get('xy/personCourseSchedule/info', 'apiController.PersonCourseSchedule/info');
+
diff --git a/niucloud/app/service/api/apiService/PersonCourseScheduleService.php b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php
new file mode 100644
index 00000000..8d5d7538
--- /dev/null
+++ b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php
@@ -0,0 +1,98 @@
+getPageParam();//获取请求参数中的页码+分页数
+ $page = $page_params['page'];
+ $limit = $page_params['limit'];
+
+ $model = new PersonCourseSchedule();
+ //判断有没有客户资源id
+ if (!empty($where['resources_id'])) {
+ $model = $model->where('resources_id', $where['resources_id']);
+ }
+ $schedule_id = $model->distinct(true)->column('schedule_id');//课程安排id
+ if(!$schedule_id){
+ return [];
+ }
+
+ $data = CourseSchedule::whereIn('id', $schedule_id)
+ ->order('course_date','desc')
+ ->with([
+ 'venue',//场地
+ 'campus',//校区
+ 'course',//课程
+ ])
+
+ ->paginate([
+ 'list_rows' => $limit,
+ 'page' => $page,
+ ])->toArray();
+
+
+
+ return $data;
+ }
+
+ //查询详情
+ public function getTestInfo(array $where)
+ {
+ $model = new ChatFriends();
+ //判断用没有员工id
+ if (!empty($where['personnel_id'])) {
+ $model = $model->where('personnel_id', $where['personnel_id']);
+ }
+ if (!empty($where['customer_resources_id'])) {
+ $model = $model->where('customer_resources_id', $where['customer_resources_id']);
+ }
+ $data = $model->find();
+
+
+ if ($data) {
+ $data = $data->toArray();
+ $res = [
+ 'code' => 1,
+ 'msg' => '操作成功',
+ 'data' => $data
+ ];
+ return $res;
+ } else {
+ $res = [
+ 'code' => 0,
+ 'msg' => '暂无数据',
+ 'data' => []
+ ];
+ return $res;
+ }
+ }
+}