Example #1
0
 public function actionIndex()
 {
     $this->pageTitle = Yii::app()->name . '-经销商店铺';
     $dealerid = Yii::app()->request->getParam('dealerid');
     $model = Organ::model()->findByPk($dealerid, "Identity=2");
     if (!$model) {
         $this->redirect(array('/pap/home/index'));
     }
     if (!isset($dealerid) || empty($dealerid)) {
         throw new CHttpException(404, 'Invalid request. Please do not repeat this request again.');
     }
     $orderGet = Yii::app()->request->getParam('order');
     $brandGet = Yii::app()->request->getParam('brand');
     $priceGet = Yii::app()->request->getParam('price');
     $skwd1 = urldecode(Yii::app()->request->getParam('skwd'));
     $skwd = MallService::checkKey($skwd1);
     $sub = Yii::app()->request->getParam('sub');
     $ispro = Yii::app()->request->getParam('ispro');
     $partslevel = Yii::app()->request->getParam('partslevel');
     //车型车系
     $cookie = Yii::app()->request->getCookies();
     //var_dump($cookie);
     $car['make'] = $cookie['mallmake']->value;
     $car['series'] = $cookie['mallseries']->value;
     $car['year'] = $cookie['mallyear']->value;
     $car['model'] = $cookie['mallmodel']->value;
     //获取商品品牌
     $brandparams['dealerid'] = $dealerid;
     $brandparams['type'] = 2;
     $brandparams['brand'] = $brandGet;
     $brandparams['sub'] = $sub;
     $brandparams['skwd'] = $skwd;
     $brandparams['car'] = $car;
     $brandModel = MallService::getDealerbrand($brandparams);
     //$brandModel = MallService::getBrand($brandparams);
     $brandData = $brandModel['data'];
     $brand = $brandModel['brand'];
     //价格区间
     $priceModel = MallService::getPrice(array('price' => $priceGet));
     $priceData = $priceModel['data'];
     $price = $priceModel['price'];
     //获得排序
     $orderData = $this->getOrder($orderGet);
     //获取url
     $get = $this->getSearchParams($_GET);
     $params = array('order' => $orderData[0], 'dealerid' => $dealerid, 'skwd' => $skwd, 'brand' => $brandGet, 'price' => $price['cond'], 'car' => $car, 'sub' => $sub, 'ispro' => $ispro, 'rows' => 12, 'resource' => "mall", 'partslevel' => $partslevel, 'type' => 3, 'organID' => Yii::app()->user->getOrganID());
     //获取适用车型text
     //$carmodeltxt = MallService::getCarmodeltxt($car);
     //经销商店铺信息
     $seller = DefaultService::sellerstore($dealerid);
     //店铺积分
     $TotalScore = DefaultService::getrecord($dealerid);
     //获取大类名称
     if ($sub) {
         $big = Gcategory::model()->findByPk($sub);
     }
     //获取商品
     $goods = MallService::getGoodsData($params);
     $rows = $this->Getmaincate($dealerid);
     $cate = $this->findsub($rows);
     // var_dump($cate);exit;
     //底部分页
     //推荐商品
     //获取经销商客服列表
     $csparams['organID'] = $dealerid;
     $csparams['type'] = 1;
     $csinfo = CsService::getcslists($csparams);
     $data = array('seller' => $seller, 'csinfo' => $csinfo, 'TotalScore' => $TotalScore, 'dataProvider' => $goods['dataProvider'], 'pages' => $this->getShortPage($goods["count"], $params['rows']), 'dealerID' => $dealerid, 'order' => $orderData, 'get' => $get, 'cate' => $cate, 'displayType' => MallService::getDisplayType("seller_displayType"), 'params' => array('brand' => $brand, 'price' => $price, 'ispro' => $ispro, 'partslevel' => $partslevel), 'brand' => $brandData, 'price' => $priceData, 'order' => $orderData, 'bigid' => $big['ParentID']);
     $this->render('index', $data);
 }
Example #2
0
 public function actionSearch()
 {
     //获取商品
     $this->pageTitle = Yii::app()->name . '-' . "商品搜索";
     $searchtype = Yii::app()->request->getParam('seatype');
     $keyword1 = Yii::app()->request->getParam('keyword');
     $keyword = MallService::checkKey($keyword1);
     $keyword = str_replace('/', ' ', $keyword);
     $keyword = str_replace('-', ' ', $keyword);
     $skwd1 = urldecode(Yii::app()->request->getParam('skwd'));
     $skwd = MallService::checkKey($skwd1);
     $subGet = Yii::app()->request->getParam('sub');
     $codeGet = Yii::app()->request->getParam('code');
     $brandGet = Yii::app()->request->getParam('brand');
     $dealerid = intval(Yii::app()->request->getParam('dealerid'));
     $orderGet = Yii::app()->request->getParam('order');
     $priceGet = Yii::app()->request->getParam('price');
     $ispro = Yii::app()->request->getParam('ispro');
     $partslevel = Yii::app()->request->getParam('partslevel');
     //你要找的是不是
     $keywordtwo = Yii::app()->request->getParam('keyword');
     if ($keywordtwo) {
         $keywordtwo = trim($keywordtwo);
         $keywordtwo = str_replace(' ', '%', $keywordtwo);
         $keywordtwo = strtoupper($keywordtwo);
     }
     $organID = Yii::app()->user->getOrganID();
     $organ = F::getOrgan($organID);
     $province = $organ['Province'];
     $sql = "select DISTINCT( `value`) as title,alias from `pap_search_word` where `key` like '%{$keyword}%' and `order`=1 and area={$province}";
     $huoqq = Yii::app()->papdb->createCommand($sql)->queryAll();
     if (!empty($huoqq) && is_array($huoqq)) {
         foreach ($huoqq as $key => $val) {
             $title = $val['title'];
             $val['alias'] = str_replace($keywordtwo, "<span style='color:red'>{$keywordtwo}</span>", $val['alias']);
             $alias = $val['alias'];
             $huoqq[$key]['titles'] = $val['title'] . '/' . $alias;
             $huoqq[$key]['title'] = $val['title'];
         }
     }
     //车型车系
     $cookie = Yii::app()->request->getCookies();
     $car['make'] = $cookie['mallmake']->value;
     $car['series'] = $cookie['mallseries']->value;
     $car['year'] = $cookie['mallyear']->value;
     $car['model'] = $cookie['mallmodel']->value;
     //价格区间
     $priceModel = MallService::getPrice(array('price' => $priceGet));
     $priceData = $priceModel['data'];
     $price = $priceModel['price'];
     //获得排序
     $orderData = $this->getOrder($orderGet);
     $param = array('rows' => 12, 'keyword' => $keyword, 'skwd' => $skwd, 'type' => 1, 'page' => Yii::app()->request->getParam("page") ? Yii::app()->request->getParam("page") : 1, 'brand' => $brandGet, 'price' => $price['cond'], 'order' => $orderData[0], 'code' => $codeGet, 'sub' => $subGet, 'car' => $car, 'ispro' => $ispro, 'resource' => "mall", 'partslevel' => $partslevel, 'organID' => $organID, 'searchtype' => $searchtype);
     //经销商id
     if ($dealerid && $dealerid > 0) {
         $sql = "SELECT ID,OrganName FROM `jpd_organ` where UnionID=(select UnionID from jpd_organ where ID={$organID})" . " and ID={$dealerid} and Identity=2";
         $res = Yii::app()->jpdb->createCommand($sql)->queryRow();
         if (!$res) {
             $param['dealerid'] = '-1';
         } else {
             $param['dealerid'] = $dealerid;
             $dealer = array('ID' => $dealerid, 'OrganName' => $res['OrganName']);
         }
     } else {
         $union = MallService::getUnion($organID);
         $param['union'] = $union;
     }
     $model = MallService::getGoodsData($param);
     //mongodb用户商品查询操作日志
     $url = 'pap/mall/search';
     $urlparams = $_GET;
     $goodsnum = $model['count'];
     $gd = F::goods_operation($url, $urlparams, $goodsnum);
     $pages = $this->getShortPage($model["count"], $param['rows']);
     //var_dump($pages);exit;
     //获取url
     $get = $this->getSearchParams($_GET);
     $this->render('search', array('dataProvider' => $model["dataProvider"], 'pages' => $pages, 'huoqq' => $huoqq, 'displayType' => MallService::getDisplayType("allgoods_displayType"), 'params' => array('dealer' => $dealer, 'brand' => $brandGet, 'price' => $price, 'ispro' => $ispro, 'partslevel' => $partslevel), 'get' => $get, 'brand' => $model["branddata"], 'dealer' => $model["dealerdata"], 'price' => $priceData, 'order' => $orderData, 'm' => $model["codedata"]));
 }