From 068fb364fe3dfaa5102f789ee05c1241f40add3c Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 15 Jan 2024 17:22:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/project/controller/Project.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/application/project/controller/Project.php b/application/project/controller/Project.php index 2f591b5..79abb61 100755 --- a/application/project/controller/Project.php +++ b/application/project/controller/Project.php @@ -588,15 +588,26 @@ class Project extends BasicApi } $data=[]; foreach($select as $k=>$v){ - $find=Db::name('positioning')->where(['member_code'=>$v['member_code']])->order('date desc')->field('positioning,date,end_date')->find(); - $data[]=[ + $find=Db::name('positioning')->where(['member_code'=>$v['member_code']])->whereDay('date')->order('date desc')->field('positioning,date,end_date')->find(); + $data[$k]=[ 'name'=>$v['name'], 'avatar'=>$v['avatar'], 'member_code'=>$v['member_code'], 'positioning'=>$find['positioning']??'', 'date'=>$find['date']??'', - 'end_date'=>$find['end_date']??'', + 'end_date'=>'', ]; + if($v['end_date']){ + $endTime = strtotime($v['end']); + $createTime = strtotime($v['end_date']); + if ($endTime > $createTime) { + $timeDifference = abs($endTime - $createTime); + // 计算天数 + $days = $timeDifference / 60; + $data[$k]['end_date']=$days.'分钟'; + } + } + } $this->success('',$data);