后台-图片处理

wxl
674780036@qq.com 11 months ago
parent 6ebedbe576
commit 2c11f483e6
  1. 23
      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;
}

Loading…
Cancel
Save