lqmac 8 months ago
parent 01b807f044
commit 33d6a9c0c7
  1. 35
      app/api/model/Goods.php

@ -330,22 +330,29 @@ class Goods extends GoodsModel
$jd = new \app\common\service\Jd(); $jd = new \app\common\service\Jd();
$res = $jd->getGoodsMainImageAndDetail($goodsInfo->goods_no); $res = $jd->getGoodsMainImageAndDetail($goodsInfo->goods_no);
if ($res) { if ($res) {
$goods_images = []; if ($res['mainImageList']) {
foreach ($res['mainImageList'] as $seq => $image) { $goods_images = [];
$goods_images[] = [ foreach ($res['mainImageList'] as $seq => $image) {
'file_id' => $seq, $goods_images[] = [
'file_type' => 10, 'file_id' => $seq,
'preview_url' => $image, 'file_type' => 10,
'external_url' => $image, 'preview_url' => $image,
]; 'external_url' => $image,
];
}
$goodsInfo->goods_images = $goods_images;
$goodsInfo->goods_image = $res['mainImageList'][0];
} }
$goodsInfo->goods_images = $goods_images;
$goodsInfo->goods_image = $res['mainImageList'][0]; if ($res['infoImageList']) {
$content = ""; $content = "";
foreach ($res['infoImageList'] as $value) { foreach ($res['infoImageList'] as $value) {
$content .= '<p><img src="' . $value . '"/></p>'; $content .= '<p><img src="' . $value . '"/></p>';
}
$goodsInfo->content = $content;
} }
$goodsInfo->content = $content;
} }
break; break;
case 'sn': case 'sn':

Loading…
Cancel
Save