소스 검색

批发:product/ghs-product-detail 接口增加返回花材图文信息

shizhongqi 10 달 전
부모
커밋
d44df00dd5

+ 12 - 3
app-hd/controllers/ProductController.php

@@ -12,6 +12,7 @@ use bizGhs\product\services\ProductService;
 use bizHd\admin\classes\ShopAdminClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseItemClass;
+use bizHd\pictext\classes\PicTextGhsItemClass;
 use common\components\printUtil;
 use common\components\stringUtil;
 use common\components\util;
@@ -828,16 +829,24 @@ class ProductController extends BaseController
     public function actionGhsProductDetail()
     {
         $get = Yii::$app->request->get();
-        $id = $get['id'] ?? 0;
-        $ghsId = $get['ghsId'] ?? 0;
+        $id = isset($get['id']) ? intval($get['id']) : 0;
+        $ghsId = isset($get['ghsId']) ? intval($get['ghsId']) : 0;
+        if ($id == 0 || $ghsId == 0) {
+            util::fail('请求参数出错');
+        }
+
         $product = ProductClass::getById($id);
         if (empty($product)) {
             util::fail('没有花材信息');
         }
-        $ghsInfo = GhsClass::getById($ghsId, true);
+        $ghsInfo = GhsClass::getById($ghsId, true, 'giveLevel, mainId');
         $level = isset($ghsInfo->giveLevel) ? $ghsInfo->giveLevel : 1;
         $list = ProductClass::groupProductInfo([$product], $level);
         $product = current($list);
+
+        $pixTextGoods = PicTextGhsItemClass::getByCondition(['mainId' => $ghsInfo->mainId, 'ghsItemId' => $id], true);
+        $product['picTextGoods'] = $pixTextGoods;
+
         util::success($product);
     }
 

+ 0 - 2
app-mall/controllers/GoodsController.php

@@ -7,13 +7,11 @@ use bizMall\goods\classes\GoodsSettingClass;
 use bizMall\pictext\classes\PicTextGoodsClass;
 use bizMall\goods\classes\CategoryClass;
 use bizMall\pictext\classes\PicTextClass;
-use bizMall\goods\services\GoodsService;
 use Yii;
 use common\components\util;
 
 class GoodsController extends BaseController
 {
-
     //获取商品详情 ssh 2019.12.3
     public function actionDetail()
     {

+ 10 - 0
biz-hd/pictext/classes/PicTextGhsItemClass.php

@@ -0,0 +1,10 @@
+<?php
+namespace bizHd\pictext\classes;
+
+use bizHd\base\classes\BaseClass;
+
+class PicTextGhsItemClass extends BaseClass
+{
+    public static $baseFile = '\bizHd\pictext\models\PicTextGhsItem';
+
+}

+ 12 - 0
biz-hd/pictext/models/PicTextGhsItem.php

@@ -0,0 +1,12 @@
+<?php
+namespace bizHd\pictext\models;
+use bizHd\base\models\Base;
+
+class PicTextGhsItem extends Base
+{
+    public static function tableName()
+    {
+        return 'xhPicTextGhsItem';
+    }
+    
+}

+ 0 - 3
biz/ghs/classes/GhsClass.php

@@ -2,14 +2,11 @@
 
 namespace biz\ghs\classes;
 
-use biz\notice\classes\NoticeClass;
 use biz\shop\classes\ShopClass;
-use biz\shop\services\ShopService;
 use biz\sj\classes\MerchantAssetClass;
 use biz\sj\classes\SjClass;
 use biz\wx\classes\WxMessageClass;
 use bizGhs\custom\classes\CustomClass;
-use bizGhs\order\classes\PurchaseOrderClass;
 use common\components\imgUtil;
 use common\components\stringUtil;
 use common\components\util;