This commit is contained in:
mkm 2024-01-15 17:32:31 +08:00
parent 068fb364fe
commit 485a607820
2 changed files with 12 additions and 9 deletions

View File

@ -136,7 +136,7 @@ class TaskStages extends CommonModel
if ($endTime > $createTime) {
$timeDifference = abs($endTime - $createTime);
// 计算天数
$days = $timeDifference / 86400;
$days = bcdiv($timeDifference,86400,2);
$task['timeout']=$days.'天';
}

View File

@ -588,23 +588,26 @@ class Project extends BasicApi
}
$data=[];
foreach($select as $k=>$v){
$find=Db::name('positioning')->where(['member_code'=>$v['member_code']])->whereDay('date')->order('date desc')->field('positioning,date,end_date')->find();
$find=Db::name('positioning')->where(['member_code'=>$v['member_code']])->whereTime('date','today')->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'=>'',
'end_date'=>$find['end_date']??'',
];
if($v['end_date']){
$endTime = strtotime($v['end']);
$createTime = strtotime($v['end_date']);
if($find &&$find['end_date']){
$createTime = strtotime($find['date']);
$endTime = strtotime($find['end_date']);
if ($endTime > $createTime) {
$timeDifference = abs($endTime - $createTime);
// 计算天数
$days = $timeDifference / 60;
$data[$k]['end_date']=$days.'分钟';
$days = bcdiv($timeDifference,60,2);
if($days>1){
$data[$k]['stop_time']=$days.'分钟';
}else{
$data[$k]['stop_time']=$days.'秒';
}
}
}