修改接口

This commit is contained in:
wangxiaowei 2024-08-09 04:56:15 +08:00
parent a0ebd8e0a1
commit b18fe1c8ac

@ -84,18 +84,30 @@ class MallNewsLogic extends Logic
private static function content(&$arg) private static function content(&$arg)
{ {
foreach ($arg as &$v) { foreach ($arg as &$v) {
if ($v['shop_id'] > 0) { if ($v['mall_type'] == 0) {
$v['shop'] = Goods::field('name, image, min_price')->find($v['shop_id']); if ($v['shop_id'] > 0) {
} $v['shop'] = Goods::field('name, image, min_price')->find($v['shop_id']);
}
if (isset($v['files'])) { if (isset($v['files'])) {
foreach ($v['files'] as &$v1) { foreach ($v['files'] as &$v1) {
if ($v['type'] == 0) { if ($v['type'] == 0) {
$v1['src'] = UrlServer::getFileUrl('uploads/images/' . $v1['src']); $v1['src'] = UrlServer::getFileUrl('uploads/images/' . $v1['src']);
} else { } else {
$v1['src'] = Config::get('aliyunoss.domain') . self::$FILE_VIDEO_PATH . '/'. $v1['src']; $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;
} }
} }
} }