request->get('id', 0); $custom = $this->custom; if (empty($custom)) { util::fail('用户信息缺失'); } $shop = $this->shop; $params = []; $goods = GoodsClass::getGoodsInfo($id, $shop, $custom, $params); if ($goods['mainId'] != $this->mainId) { util::fail('不是你的商品'); } $goods = \bizHd\goods\classes\GoodsClass::appendUseCasesAndSpecs($goods, $this->mainId); // $setting = GoodsSettingClass::getByCondition(['mainId' => $this->mainId]); // $intro = $setting['goodsIntroduce'] ?? ''; // $info['commonIntro'] = $intro; // 商品详情图文 if (empty($goods['masterId'])) { $picTextGoodsId = $id; } else { $picTextGoodsId = $goods['masterId']; } $pixTextGoods = PicTextGoodsClass::getByCondition(['mainId' => $this->mainId, 'goodsId' => $picTextGoodsId], true); $goods['picTextGoods'] = $pixTextGoods; $categoryId = intval(Yii::$app->request->get('categoryId')); if ($categoryId <= 0 && $id > 0) { $categoryMap = GoodsCategoryClass::getGoodsHasCategoryIdsBatch([$picTextGoodsId]); $categoryIds = $categoryMap[$picTextGoodsId] ?? []; if (!empty($categoryIds)) { $categoryId = intval($categoryIds[0]); } } // 商品所属分类图文 $goods['picText'] = []; $category = CategoryClass::getById($categoryId); if (!empty($category)) { $picTextId = $category['picTextId']; $picText = PicTextClass::getById($picTextId, true); $goods['picText'] = $picText; } $goods['customId'] = $this->customId; util::success($goods); } }