fix(develop): 修复报错
Showing
1 changed file
with
3 additions
and
2 deletions
... | @@ -88,13 +88,14 @@ public function bandList(Request $request) | ... | @@ -88,13 +88,14 @@ public function bandList(Request $request) |
88 | if ($page === 1) { | 88 | if ($page === 1) { |
89 | //查询符合条件活动 | 89 | //查询符合条件活动 |
90 | $data = $query->get(['id']); | 90 | $data = $query->get(['id']); |
91 | dd($data); | ||
91 | //插入有序集合中 | 92 | //插入有序集合中 |
92 | Redis::client()->del($key); | ||
93 | if (!empty($data)) { | 93 | if (!empty($data)) { |
94 | Redis::client()->del($key); | ||
94 | Redis::client()->zAdd($key, ...$data->map(fn(Project $item) => [random_int(50, 200), $item->getKey()])->flatten()->toArray()); | 95 | Redis::client()->zAdd($key, ...$data->map(fn(Project $item) => [random_int(50, 200), $item->getKey()])->flatten()->toArray()); |
95 | } | ||
96 | Redis::client()->expire($key, 2 * 60 * 60); | 96 | Redis::client()->expire($key, 2 * 60 * 60); |
97 | } | 97 | } |
98 | } | ||
98 | $recommendIds = Redis::client()->zRevRange($key, $startIndex, $endIndex); | 99 | $recommendIds = Redis::client()->zRevRange($key, $startIndex, $endIndex); |
99 | $data = $query->whereIn('projects.id', $recommendIds)->get(); | 100 | $data = $query->whereIn('projects.id', $recommendIds)->get(); |
100 | return JsonResource::success(JsonResource::SUCCESS, ['data' => $data, 'count' => Redis::client()->zCard($key), 'identifier' => $identifier]); | 101 | return JsonResource::success(JsonResource::SUCCESS, ['data' => $data, 'count' => Redis::client()->zCard($key), 'identifier' => $identifier]); | ... | ... |
-
Please register or sign in to post a comment