| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /**
- * User: admin
- * Date Time: 2021/3/2 14:33
- */
- namespace hd\controllers;
- use biz\shop\services\ShopService;
- use bizGhs\admin\classes\AdminClass;
- use bizGhs\item\classes\ItemClass;
- use bizGhs\item\classes\ItemClassClass;
- use bizGhs\product\classes\ProductClass;
- use bizGhs\product\services\ProductService;
- use bizGhs\item\services\ItemService;
- use common\components\util;
- use Yii;
- class GhsProductController extends BaseController
- {
- //零售进店采购
- public function actionIndex()
- {
- $get = Yii::$app->request->get();
- $shopId = $get['shopId']??0;
- $sjId = $get['sjId']??0;
- //获取所有当前供应商的分类 (全部、常用)
- //根据分类组装分类下的花材信息
- $classIds = ItemClassClass::getGhsItemClassAll($sjId);
- $where['sjId'] = $sjId;
- $where['shopId'] = $shopId;
- $where['delStatus'] = 0;
- $itemInfoData = ProductClass::getAllByCondition($where,['actualSold'=>SORT_DESC,'inTurn'=>SORT_DESC],"*");
- $itemInfoData = ProductClass::groupProductInfo($itemInfoData);
- //常用的itemIds
- $oftenItemIds = ProductClass::getOftenItemIds($shopId);
- //获取供应商下所有花材ID (itemIds)
- $itemIdsInfo = ItemService::getGhsItemIds($this->sjId);
- //dd($itemInfoData);
- //组装数据: [{classId:'','className:'',child:[{itemInfoData}]}]
- $data = ProductService::assembleData($classIds, $itemIdsInfo,$itemInfoData, $oftenItemIds, '',true);
- ShopService::totalViewPlus($shopId);
- util::success($data);
- }
- }
|