request->get(); $id = $get['id'] ?? 0; $item = ItemClass::getById($id, true); $price = $item->skPrice ?? 0; $price = floatval($price); echo '' . $price . '元'; } 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); } }