Commit 1a0913cc 1a0913cce8229fb85be3c519865451344d27395d by 杨俊

fix(develop): 修复报错

1 parent 234ff4d0
......@@ -88,13 +88,14 @@ public function bandList(Request $request)
if ($page === 1) {
//查询符合条件活动
$data = $query->get(['id']);
dd($data);
//插入有序集合中
Redis::client()->del($key);
if (!empty($data)) {
Redis::client()->del($key);
Redis::client()->zAdd($key, ...$data->map(fn(Project $item) => [random_int(50, 200), $item->getKey()])->flatten()->toArray());
}
Redis::client()->expire($key, 2 * 60 * 60);
}
}
$recommendIds = Redis::client()->zRevRange($key, $startIndex, $endIndex);
$data = $query->whereIn('projects.id', $recommendIds)->get();
return JsonResource::success(JsonResource::SUCCESS, ['data' => $data, 'count' => Redis::client()->zCard($key), 'identifier' => $identifier]);
......