From 2c11f483e6a9b1f940e5cb5598b68f1ac7cea53b Mon Sep 17 00:00:00 2001 From: "674780036@qq.com" <674780036@qq.com> Date: Tue, 27 Feb 2024 13:57:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0-=E5=9B=BE=E7=89=87=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/model/ActiveMain.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/store/model/ActiveMain.php b/app/store/model/ActiveMain.php index b8a6b7c4..4bd5d92f 100644 --- a/app/store/model/ActiveMain.php +++ b/app/store/model/ActiveMain.php @@ -43,17 +43,18 @@ class ActiveMain extends ActiveMainModal { $data = $this->paginate(); - // foreach ($data as &$item) { - // // $item['index_icon'] = getUrl($item['index_icon']); - // // $index_icon = UploadFile::where('file_id', $item['index_icon'])->field('file_id,file_path,file_type,storage,domain')->find(); - // // $item['index_icon_url'] = getUrl($index_icon['file_path'], $index_icon['domain']); - // // $item['index_icon_image'] = $index_icon; - // } - - /* $transfer_image_ids = UploadFile::whereIn('file_id', explode(",", $item['transfer_image_id']))->field('file_id,file_path,file_type,storage,domain')->select(); - foreach ($transfer_image_ids as &$transfer_image_id) { - $transfer_image_id['file_path'] = getUrl($transfer_image_id['file_path'], $transfer_image_id['domain']); - } */ + foreach ($data as &$item) { + $index_icon_image_ids = UploadFile::whereIn('file_id', explode(",", $item['index_icon']))->field('file_id,file_path,file_type,storage,domain')->select()->toArray(); + foreach ($index_icon_image_ids as &$index_icon_image_id) { + $index_icon_image_id['file_path'] = getUrl($index_icon_image_id['file_path'], $index_icon_image_id['domain']); + } + $item['index_icons'] =$index_icon_image_ids ?? []; + $theme_pic_image_ids = UploadFile::whereIn('file_id', explode(",", $item['theme_pic']))->field('file_id,file_path,file_type,storage,domain')->select()->toArray(); + foreach ($theme_pic_image_ids as &$theme_pic_image_id) { + $theme_pic_image_id['file_path'] = getUrl($theme_pic_image_id['file_path'], $theme_pic_image_id['domain']); + } + $item['theme_pics'] =$theme_pic_image_ids ?? []; + } return $data; }