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)