| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace mall\controllers;
- use bizGhs\item\classes\ItemClassClass;
- use bizGhs\product\classes\ProductClass;
- use bizGhs\product\services\ProductService;
- use bizHd\custom\classes\CustomClass;
- use bizMall\item\classes\ItemClass;
- use bizMall\user\classes\UserClass;
- use common\components\util;
- use Yii;
- class ItemController extends BaseController
- {
- public $guestAccess = ['show-info'];
- //扫码看价格 ssh 20221008
- public function actionShowInfo()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $item = ItemClass::getById($id, true);
- $price = $item->skPrice ?? 0;
- $price = floatval($price);
- echo '<span style="font-size:80px;margin-top:80px;margin-left:60px;">' . $price . '元</span>';
- }
- 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;
- $where['frontHide'] = 0;
- $level = 0;
- $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], "*");
- $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
- $data = ProductService::assembleData($classIds, $itemInfoData, true);
- CustomClass::buildRelation($this->shop, $this->user);
- util::success($data);
- }
- }
|