帖子收藏

This commit is contained in:
2025-12-10 15:29:48 +08:00
parent ba452f7a3b
commit 37a1eb6a6c
2 changed files with 20 additions and 8 deletions
@@ -32,10 +32,18 @@ class PostFavoriteController extends BaseController
try {
// $raw = $this->service->serviceSelfList($request);
$raw = $this->service->serviceList($request);
$data = $this->transformData($raw, method_exists($this, 'indexFormat')
? [$this, 'indexFormat']
: null);
return $this->success($data);
// $data = $this->transformData($raw, method_exists($this, 'indexFormat')
// ? [$this, 'indexFormat']
// : null);
$data = [];
foreach ($raw['records'] as $key => $item) {
$item['created_at'] = strtotime($item['created_at']);
$item['updated_at'] = strtotime($item['updated_at']);
$data[$key] = $this->indexFormat($item);
}
$raw['records'] = $data;
return $this->success($raw);
} catch (\Throwable $e) {
return $this->error($e->getMessage());
}