diff --git a/source/application/api/controller/library/Pass.php b/source/application/api/controller/library/Pass.php index 6e20e3f..6e5cb30 100644 --- a/source/application/api/controller/library/Pass.php +++ b/source/application/api/controller/library/Pass.php @@ -106,9 +106,9 @@ class Pass extends Controller # 查看该组是否存在上一条数据 $lastHoursWhere = ['hour_time' => $last_hour, 'group_id' => $val['group_id']]; $lastHours = $dm->find('bt_library_hours',$lastHoursWhere,'*','id DESC'); - if ($lastHours) { - $incount = $val['today_incount'] - $lastHours['target_today_incount']; - $outcount = $val['today_outcount'] - $lastHours['target_today_outcount']; + if ($lastHours && $hour != '00:00') { + $incount = (int)($val['today_incount'] - $lastHours['target_today_incount']); + $outcount = (int)($val['today_outcount'] - $lastHours['target_today_outcount']); $incount = $incount > 0 ? $incount : 0; $outcount = $outcount > 0 ? $outcount : 0; } @@ -178,8 +178,8 @@ class Pass extends Controller $update = [ 'incount' => $incount, 'outcount' => $outcount, - 'last_incount' => $incount, - 'last_outcount' => $outcount, + 'last_incount' => $value['incount'], + 'last_outcount' => $value['outcount'], 'update_time' => date("Y-m-d H:i:s",time()) ]; $dm->update('bt_library_data',$update,['id' => $query['id']]);