This commit is contained in:
尖叫 2023-12-04 15:24:49 +08:00
parent 0f1585a23e
commit 17f5975f30

View File

@ -35,7 +35,7 @@ class GoodsController extends Controller
'class' => LoginBehavior::className(),
'ignore' => [
'api/mall/integral/goods/index',
// 'api/mall/integral/goods/index-one',
'api/mall/integral/goods/index-one',
'api/mall/integral/goods/index-cat',
'api/mall/integral/goods/tree',
@ -135,7 +135,7 @@ class GoodsController extends Controller
$form->cx_mch_id = $this->cx_mch_id;
$form->status = Goods::STATUS_ONLINE;
$form->plugin_sign = SysConst::$cxPluginSceneIntegralMall;
$form->setFields('g.id,g.price,g.date,g.sort,gh.subtitle,gh.banner_urls,g.created_at,gh.name,gh.cover_pic,gh.video_url,gh.pic_urls');
$form->setFields('g.id,g.price,g.date,g.sort,gh.subtitle,gh.banner_urls,g.created_at,gh.name,gh.cover_pic,gh.video_url,gh.pic_urls,gh.video_banner_urls');
$data = $form->search();
foreach ($data['data'] as $key => $value) {
@ -143,7 +143,6 @@ class GoodsController extends Controller
$data['data'][$key]['pic_arr'] = [];
if ($value['pic_urls'] != null) {
$pic_arr = json_decode($value['pic_urls'], true);
if (is_array($pic_arr)) {
foreach ($pic_arr as $index => $item) {
// $item = SiteHelper::getFullUrl($item);
@ -152,16 +151,17 @@ class GoodsController extends Controller
$data['data'][$key]['pic_arr'] = $pic_arr;
}
}
$data['data'][$key]['video_arr'] = [];
if ($value['video_url'] != null) {
$video_arr = json_decode($value['video_url'], true);
if (is_array($video_arr)) {
foreach ($video_arr as $index => $item) {
// $item = SiteHelper::getFullUrl($item);
$video_arr[$index] = $item;
}
$data['data'][$key]['video_arr'] = $video_arr;
$video_banner_urls = json_decode($value['video_banner_urls'], true);
$video = [];
foreach ($video_arr as $key1 => $value1) {
$video[$key1]['img'] = $video_banner_urls[$key1] ?? '';
$video[$key1]['video_url'] = $value1 ?? '';
}
$data['data'][$key]['video_arr'] = $video;
}
}
$goods_id = \Yii::$app->request->get('goods_id');