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; } } }