帖子收藏
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user