From 5970cfeda37125a38d91e6caf936c1d7dbd16554 Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Mon, 19 May 2025 18:39:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ResourceSharing):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=86=E4=BA=AB=E6=8E=A5=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E6=97=B6=E9=97=B4=E5=A4=84=E7=90=86=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 shared_at_arr 参数名改为 shared_at_str,以更准确地反映其为字符串类型 - 添加逻辑将 shared_at_str 解析为开始和结束时间,格式化为 YYYY-MM-DD HH:MM:SS - 优化了共享时间的处理,确保查询结果包含完整的开始和结束日期 --- .../app/api/controller/apiController/ResourceSharing.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/niucloud/app/api/controller/apiController/ResourceSharing.php b/niucloud/app/api/controller/apiController/ResourceSharing.php index 97aecf2f..cb3e3992 100644 --- a/niucloud/app/api/controller/apiController/ResourceSharing.php +++ b/niucloud/app/api/controller/apiController/ResourceSharing.php @@ -31,8 +31,13 @@ class ResourceSharing extends BaseApiService $page = $request->param('page','1');// $limit = $request->param('limit','10');// $shared_by = $request->param('shared_by','');//共享人ID - $shared_at_arr = $request->param('shared_at_arr',[]);//共享时间|[开始时间(Y-m-d),结束时间(Y-m-d)] - + $shared_at_str = $request->param('shared_at_str','');//共享时间|[开始时间(Y-m-d),结束时间(Y-m-d)] + $shared_at_arr = []; + if(!empty($shared_at_str)){ + $shared_at_arr = explode(' ~ ',$shared_at_str); + $shared_at_arr[0] = "{$shared_at_arr[0]} 00:00:00"; + $shared_at_arr[1] = "{$shared_at_arr[1]} 23:59:59"; + } $where = [ 'shared_by'=>$shared_by,