Commit 29b6c6ec 29b6c6eca58c5ed540990957a229e895332fbe15 by 杨俊

fix(develop): 修复报错

1 parent 5a471c60
...@@ -90,7 +90,12 @@ public function bandList(Request $request) ...@@ -90,7 +90,12 @@ public function bandList(Request $request)
90 $data = $query->get(['id']); 90 $data = $query->get(['id']);
91 //插入有序集合中 91 //插入有序集合中
92 Redis::client()->del($key); 92 Redis::client()->del($key);
93 Redis::client()->zAdd($key, ...$data->map(fn(Project $item) => [random_int(50, 200), $item->getKey()])->flatten()->toArray() ?? []); 93
94 if (empty($data)) {
95 Redis::client()->zAdd($key, []);
96 } else {
97 Redis::client()->zAdd($key, ...$data->map(fn(Project $item) => [random_int(50, 200), $item->getKey()])->flatten()->toArray());
98 }
94 Redis::client()->expire($key, 2 * 60 * 60); 99 Redis::client()->expire($key, 2 * 60 * 60);
95 } 100 }
96 $recommendIds = Redis::client()->zRevRange($key, $startIndex, $endIndex); 101 $recommendIds = Redis::client()->zRevRange($key, $startIndex, $endIndex);
......