This commit is contained in:
mkm 2024-01-15 17:22:30 +08:00
parent 028a06bf13
commit 068fb364fe

View File

@ -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);