feat: good
This commit is contained in:
@@ -32,20 +32,19 @@ class CategoryService extends BaseService
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$list = $this->categoryModel->get(['category.id','category.name','category.image_id']);
|
||||
$limit = $this->request->input('limit', 10);
|
||||
$list = $this->categoryModel->paginate($limit)->toArray();
|
||||
|
||||
if (empty($list)) return $this->return->success('success',['list' => []]);
|
||||
if (empty($list['data'])) return $this->return->success('success',['list' => $list]);
|
||||
|
||||
$res = $list->toArray();
|
||||
|
||||
$ossIds = array_column($res['data'],'image_id');
|
||||
$ossIds = array_column($list['data'],'image_id');
|
||||
$ossInfo = $this->getOssObjects($ossIds);
|
||||
foreach ($res['data'] as &$one)
|
||||
foreach ($list['data'] as &$one)
|
||||
{
|
||||
$one['url'] = $ossInfo[$one['image_id']]['url'];
|
||||
}
|
||||
|
||||
return $this->return->success('success',['list' => $res]);
|
||||
return $this->return->success('success',['list' => $list]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user