diff --git a/app/Service/ServiceTrait/Admin/Catering/PrintTrait.php b/app/Service/ServiceTrait/Admin/Catering/PrintTrait.php index f1fccc9..ac97693 100644 --- a/app/Service/ServiceTrait/Admin/Catering/PrintTrait.php +++ b/app/Service/ServiceTrait/Admin/Catering/PrintTrait.php @@ -172,7 +172,7 @@ trait PrintTrait */ protected function closeWholeLine(): void { - $siteArr = $this->siteModel->where('delivered_id',$this->siteInfo->delivered_id)->pluck('id'); + $siteArr = $this->siteModel->where('delivered_id',$this->siteInfo->delivered_id)->pluck('id')->toArray(); //没有日志数据 跳出 $logArr = $this @@ -183,23 +183,20 @@ trait PrintTrait ->toArray(); if (empty($logArr)) return; + //没有缓存数据 跳出 $cacheData = $this->redis->hGetAll($this->stopOrderKey); if (empty($cacheData)) return; $cacheData = array_diff(array_keys($cacheData),[0]); //需要排除默认写的值 //数量不对等 跳出 - if (count($logArr) !== count($cacheData)) return; - - //如果相反交集有一个不为空就是不对的 跳出 - if (!empty(array_diff($logArr,$cacheData)) || !empty(array_diff($cacheData,$logArr))) return; + if(count(array_diff($logArr, $cacheData)) !== 0) return; //批量写入 hashmap $insertCacheData = []; foreach ($siteArr as $one) { $insertCacheData[$one] = CateringCode::REDIS_FINISH_VALUE; } - $this->redis->hMset($this->stopOrderKey, $insertCacheData); }