| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace mall\controllers;
- use bizGhs\item\classes\ItemClassClass;
- use bizGhs\product\classes\ProductClass;
- use bizGhs\product\services\ProductService;
- use common\components\util;
- use Yii;
- class ItemController extends BaseController
- {
- public function actionIndex()
- {
- $py = Yii::$app->request->get('py', '');
- //默认显示上架商品
- $status = Yii::$app->request->get('status', 1);
- //默认显示未删除商品
- $delStatus = Yii::$app->request->get('delStatus', 0);
- //获取所有当前供应商的分类 (全部、常用)
- //根据分类组装分类下的花材信息
- //中央ID
- $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
- $where['mainId'] = $this->mainId;
- if ($py) {
- $pyName = strtolower($py);
- $where['py'] = $pyName;
- }
- if (!empty($status)) {
- $where['status'] = $status;
- }
- $where['delStatus'] = $delStatus;
- $level = 0;
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], "*");
- $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
- $data = ProductService::assembleData($classIds, $itemInfoData, true);
- util::success($data);
- }
- }
|