From 110ba578ff8d24c6f59594b09838eed1915faf4b Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Mon, 31 Jul 2023 15:28:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E6=97=B6=E6=95=B0=E6=8D=AE=20?= =?UTF-8?q?=E5=B0=8F=E4=BA=8E0=E7=AD=89=E4=BA=8E0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/api/controller/library/Pass.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/application/api/controller/library/Pass.php b/source/application/api/controller/library/Pass.php index 77b27b1..50998ac 100644 --- a/source/application/api/controller/library/Pass.php +++ b/source/application/api/controller/library/Pass.php @@ -103,10 +103,12 @@ class Pass extends Controller } else { # 查看该组是否存在上一条数据 $lastHoursWhere = ['hour_time' => $last_hour, 'group_id' => $val['group_id']]; - $lastHours = $dm->find('bt_library_hours',$lastHoursWhere); + $lastHours = $dm->find('bt_library_hours',$lastHoursWhere,'*','id DESC'); if ($lastHours) { $incount = $val['today_incount'] - $lastHours['target_today_incount']; + $incount = $incount > 0 ? $incount : 0; $outcount = $val['today_outcount'] - $lastHours['target_today_outcount']; + $outcount = $outcount > 0 ? $outcount : 0; } # 创建数据 $insert = [