From b18fe1c8ac1f5f83de2d957609e90f0a1c371c8e Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Fri, 9 Aug 2024 04:56:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/MallNewsLogic.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/app/api/logic/MallNewsLogic.php b/app/api/logic/MallNewsLogic.php index bd3910b8..c783b758 100755 --- a/app/api/logic/MallNewsLogic.php +++ b/app/api/logic/MallNewsLogic.php @@ -84,18 +84,30 @@ class MallNewsLogic extends Logic private static function content(&$arg) { foreach ($arg as &$v) { - if ($v['shop_id'] > 0) { - $v['shop'] = Goods::field('name, image, min_price')->find($v['shop_id']); - } + if ($v['mall_type'] == 0) { + if ($v['shop_id'] > 0) { + $v['shop'] = Goods::field('name, image, min_price')->find($v['shop_id']); + } - if (isset($v['files'])) { - foreach ($v['files'] as &$v1) { - if ($v['type'] == 0) { - $v1['src'] = UrlServer::getFileUrl('uploads/images/' . $v1['src']); - } else { - $v1['src'] = Config::get('aliyunoss.domain') . self::$FILE_VIDEO_PATH . '/'. $v1['src']; + if (isset($v['files'])) { + foreach ($v['files'] as &$v1) { + if ($v['type'] == 0) { + $v1['src'] = UrlServer::getFileUrl('uploads/images/' . $v1['src']); + } else { + $v1['src'] = Config::get('aliyunoss.domain') . self::$FILE_VIDEO_PATH . '/'. $v1['src']; + } } } + } else if ($v['mall_type'] == 1) { + $ids = explode(',', $v['mall_news_goods_id']); + foreach ($ids as $k => &$v2) { + $res = MallNewsFile::where('mall_news_shop_id', $v2)->field('mall_news_shop_id, src')->select()->toArray(); + foreach ($res as &$v3) { + $v3['image'] = UrlServer::getFileUrl('uploads/images/' . $v3['src']); + } + $arr[$k] = $res; + } + $v['shop'] = $arr; } } }