Просмотр исходного кода

Merge branch 'master' of http://git.huaml.com/zhh/huahuibao

shish 5 лет назад
Родитель
Сommit
174cf193f8

+ 8 - 2
app-ghs/controllers/ProductController.php

@@ -68,7 +68,7 @@ class ProductController extends BaseController
     }
 
 
-    //当前门店所有花材分类
+    //当前门店所有花材
     public function actionList()
     {
         $classId = Yii::$app->request->get('classId',0);
@@ -123,7 +123,6 @@ class ProductController extends BaseController
         util::success(['list' => $data]);
     }
 
-
     //改价
     public function actionChangePrice()
     {
@@ -230,6 +229,13 @@ class ProductController extends BaseController
         $post = Yii::$app->request->post();
         ProductClass::updateProduct($post);
         util::complete();
+    }
 
+    //详情 ruidian 2021.5.3
+    public function actionDetail()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $respond = ProductClass::getItemInfo($id);
+        util::success($respond);
     }
 }

+ 2 - 1
app-ghs/controllers/ShopController.php

@@ -43,6 +43,7 @@ class ShopController extends BaseController
     {
         $data = Yii::$app->request->post();
         $data['merchantId'] = $this->sjId;
+        $data['img'] = is_array($data['img']) ? json_encode($data['img']) : $data['img'];
         $id = $data['id'] ?? 0;
         $shop = ShopService::getById($id);
         if (empty($shop)) {
@@ -58,7 +59,7 @@ class ShopController extends BaseController
     {
         $data = Yii::$app->request->post();
         $data['merchantId'] = $this->sjId;
-
+        $data['img'] = is_array($data['img']) ? json_encode($data['img']) : $data['img'];
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {

+ 17 - 0
biz-ghs/merchant/classes/ShopClass.php

@@ -10,15 +10,32 @@ use common\components\util;
 use common\components\wxUtil;
 use Yii;
 use bizHd\base\classes\BaseClass;
+use common\components\imgUtil;
 
 class ShopClass extends BaseClass
 {
 
     public static $baseFile = '\bizGhs\merchant\models\Shop';
 
+    //组装门店基本信息 ssh 2019.12.2
+    public static function groupBaseInfo($list)
+    {
+        foreach ($list as $key => $val) {
+            if ($val['img']) {
+                $list[$key]['img'] = json_decode($val['img'], true);
+                $list[$key]['imgUrl'] = [];
+                foreach ($list[$key]['img'] as $img) {
+                    $list[$key]['imgUrl'][] = imgUtil::groupImg($img);
+                }
+            }
+        }
+        return $list;
+    }
+
     public static function getShopList($where)
     {
         $list = self::getList('*', $where, 'addTime DESC');
+        $list['list'] = self::groupBaseInfo($list['list']);
         return $list;
     }
 

+ 11 - 0
biz-ghs/product/classes/ProductClass.php

@@ -70,6 +70,17 @@ class ProductClass extends BaseClass
         return $list;
     }
 
+    //获取详情 ruidian 2021.5.3
+    public static function getItemInfo($id)
+    {
+        $info = self::getById($id);
+        if (empty($info)) {
+            return $info;
+        }
+        $list = self::groupProductInfo([$info]);
+        return current($list);
+    }
+
     //花材图片,名称,大小单位,小单位价格
     public static function groupProductInfo($list)
     {

+ 3 - 4
biz-hd/goods/classes/GoodsClass.php

@@ -25,9 +25,6 @@ class GoodsClass extends BaseClass
 
         $list = self::groupGoodsBaseInfo([$info]);
         $info = current($list);
-        //商品的分类
-        $category = GoodsCategoryService::getGoodsHasCategoryIdList($id);
-        $info['categoryIdList'] = $category;
         return $info;
     }
 
@@ -66,7 +63,9 @@ class GoodsClass extends BaseClass
             //临时加100块
             //$price = $val['price'];
             //$val['price'] = $price + 100;
-
+            //商品的分类
+            $category = GoodsCategoryService::getGoodsHasCategoryIdList($id);
+            $val['categoryIdList'] = $category;
             $list[$key] = $val;
 
         }