public function actionDetail() { $serviceID = Yii::app()->user->getOrganID(); $goodsid = Yii::app()->request->getParam('goods'); $result = MallService::getredis($goodsid); //$payment = 1; //$result = MallService::getGoodByID($goodsid, $payment, 'mall'); if ($result == 'null') { echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; echo "<script>alert('该商品不存在!');window.location.href='" . Yii::app()->createUrl('pap/mall/index') . "'</script>"; exit; } else { if ($result == 'nosale') { echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; echo "<script>alert('该商品已下架!');window.location.href='" . Yii::app()->createUrl('pap/mall/index') . "'</script>"; exit; } } $result['GoodsID'] = $result['ID']; $result['CommentNo'] = PapGoods::model()->findByPk($result['ID'])->attributes['CommentNo']; //商品折扣价 if ($result['IsPro'] != 1) { $PriceRatio = MallService::getDisprice($result['OrganID'], $serviceID); if ($PriceRatio > 0 && $PriceRatio < 100) { $result['DisPrice'] = sprintf('%.2f', $result['Price'] * $PriceRatio / 100); } } $cookie = Yii::app()->request->getCookies(); $car = array('make' => $cookie['mallmake']->value, 'series' => $cookie['mallseries']->value, 'year' => $cookie['mallyear']->value, 'model' => $cookie['mallmodel']->value); $carmodeltext = MallService::getCarmodeltxt($car); $res = array(); if ($car['make'] && $car['series'] && $car['year'] && $car['model']) { $params = $car; $params['goodsid'] = $goodsid; $res = MallService::checkCarfit($params); } //店内分类 $rows = $this->Getmaincate($result['OrganID']); $cate = $this->findsub($rows); //获取经销商客服列表 $csparams['organID'] = $result['OrganID']; $csparams['type'] = 1; $csinfo = CsService::getcslists($csparams); //大类、子类、标准名称 if (is_array($result['gcategory']) && !$result['gcategory']['BigName']) { $result['BigName'] = $result['gcategory']['BigName']; $result['SubName'] = $result['gcategory']['SubName']; $result['sub'] = $result['gcategory']['SubParts']; } else { $cpArr = MallService::getCategory($result['StandCode']); $result['BigName'] = $cpArr['BigParts']; $result['SubName'] = $cpArr['SubParts']; $result['sub'] = $cpArr['sub']; } //公告信息 $model = new PapGoodsSendnotice(); $sellerID = $result['OrganID']; $notice = $model->find("OrganID = {$sellerID}"); //var_dump($data);die; //店家积分 $result['TotalScore'] = DefaultService::getrecord($result['OrganID']); //店家信息 $organInfo = Organ::model()->findByPk($result['OrganID'])->attributes; $result['Address'] = array(Area::getCity($organInfo['Province']), Area::getCity($organInfo['City']), Area::getCity($organInfo['Area'])); $result['spec']['UnitName'] = GoodsUnit::model()->findByPk($result['spec']['Unit'])->attributes['UnitName']; //单位 //最小交易金额 $result['MinTurnover'] = PapOrderMinTurnover::model()->find("OrganID=:ID", array(":ID" => $result['OrganID']))->attributes['MinTurnover']; $this->pageTitle = Yii::app()->name . '-' . "商品详情"; $this->render('detail', array('r' => $result, 'cate' => $cate, 'carmodeltext' => $carmodeltext, 'res' => $res, 'csinfo' => $csinfo, 'car' => $car, 'data' => $notice)); }
public function actionGetGoods() { if (Yii::app()->request->isAjaxRequest) { $goodsid = Yii::app()->request->getParam('goodsid'); $serviceID = Yii::app()->user->getOrganID(); $result = MallService::getredis($goodsid); //商品折扣价 if ($result['IsPro'] != 1) { $PriceRatio = MallService::getDisprice($result['OrganID'], $serviceID); if ($PriceRatio > 0 && $PriceRatio < 100) { $result['DisPrice'] = sprintf('%.2f', $result['Price'] * $PriceRatio / 100); } } $result['spec']['UnitName'] = GoodsUnit::model()->findByPk($result['spec']['Unit'])->attributes['UnitName']; //单位 echo json_encode($result, true); } else { $this->redirect('index'); } }