From 2dd65cefe5d4c355a0eac9bc9234f0c97352a58e Mon Sep 17 00:00:00 2001 From: weigang Date: Thu, 17 Sep 2020 16:05:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=88=86=E7=B1=BB=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/CategoryService.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/Service/v3/Implementations/CategoryService.php b/app/Service/v3/Implementations/CategoryService.php index 033b580..63fa60e 100644 --- a/app/Service/v3/Implementations/CategoryService.php +++ b/app/Service/v3/Implementations/CategoryService.php @@ -87,14 +87,12 @@ class CategoryService implements CategoryServiceInterface $returnData = []; foreach ($categories as $key => &$category) { $value = json_decode($category, true); - $iconUrl = $value['icon']; - if(strripos($iconUrl,"http") === false){ - $iconUrl = config('alioss.img_host').'/'.$value['icon']; - } - $iconUrl = $this->attachmentService->switchImgToAliOss($iconUrl, OssThumbnail::THUMBNAIL_100_Q90); - $returnData[] = ['id' => $key, 'icon' => $iconUrl , 'name' => $value['name']]; + $iconUrl = $this->attachmentService->switchImgToAliOss($value['icon'], OssThumbnail::THUMBNAIL_100_Q90); + $returnData[] = ['id' => $value['id'], 'icon' => $iconUrl , 'name' => $value['name'], 'sort' => $value['sort']]; } - return $returnData; + $returnData = collect($returnData)->sortByDesc('sort')->all(); + + return array_values($returnData); } } \ No newline at end of file