예제 #1
0
 public function indexAction()
 {
     $queryAdd = I('get.condition');
     $data = array();
     if (is_numeric($queryAdd)) {
         $openId = get_openid();
         $orderFormModel = new OrderFormModel();
         $orderFormModel->setQueryAdd($queryAdd);
         $orderFormModel->setOpenId($openId);
         $orderForm = $orderFormModel->getOrderFormInfo();
         $num = count($orderForm);
         if ($num < 1) {
             $data['content'] = $this->fetch('noForm');
         } else {
             $orderGoods = new OrderGoodsModel();
             $orderGoods->setOrderForm($orderForm);
             $res = $orderGoods->getOrderGoods();
             $this->assign('res', $res);
             $data['content'] = $this->fetch('list');
         }
         $data['state'] = 0;
         //表示返回的订单信息
     } else {
         $goodsDetailUrl = U('Goods/GoodsDetail/index');
         $this->assign('goodsDetailUrl', $goodsDetailUrl);
         $goodsModel = new GoodsModel();
         $goodsModel->setPageSize($this->pageSize);
         $goodsModel->setName($queryAdd);
         $num = $goodsModel->likeNameCount();
         if ($num == 0) {
             $data['content'] = 'soory';
         } else {
             if ($num > $this->pageSize) {
                 $this->assign('nextPageNum', 2);
                 $data['page'] = $this->fetch('page');
             }
             $res = $goodsModel->goodsList();
             //添加物流方式
             $logistic = new LogisticsModel();
             $key = 'logistics_mode';
             $res = $logistic->getLogisticInfo($res, $key);
             //添加来源
             $source = new SourceModel();
             $key = 'source';
             $keyRes = 'source';
             $res = $source->getInfoById($res, $key, $keyRes);
             $this->assign('list', $res);
             $data['content'] = $this->fetch($this->goodsList);
         }
         $data['state'] = 1;
         //表示返回的商品信息
     }
     $jsonData = json_encode($data);
     echo $jsonData;
 }
 public function indexAction()
 {
     $customerInfo = get_customer_info(get_openid());
     $this->assign('customerType', $customerInfo['subscribe_state']);
     $this->assign('config_buy_max', $this->config_buy_max);
     $this->assign('config_buy_min', $this->config_buy_min);
     $this->assign('payNowUrl', U('OrderForm/Submit/index'));
     $addGoodsToCartUrl = U('Goods/GoodsDetail/add');
     $this->assign('addGoodsToCartUrl', $addGoodsToCartUrl);
     $this->assign('footer', '');
     $goods = new GoodsModel();
     $goodsId = I('get.goodsId');
     $goods->setGoodsId($goodsId);
     $res = $goods->getGoodsInf();
     if ($res == false || $res['state'] != 1) {
         $this->assign('js', $this->fetch('indexJs'));
         $this->assign('css', $this->fetch('indexCss'));
         $detail2 = $this->fetch('error');
         $this->assign('YZBody', $detail2);
         $this->display(YZ_TEMPLATE);
         return;
     }
     //计算运费
     //        if($res['logistics_mode'] == 0)
     //        {
     //            $logistic = new ConfigModel(); //运费配置
     //            $res['internation_transportation_expenses'] = $logistic->getFee($weightTotal);
     //        }
     //
     //获取来源国信息
     $source = new SourceModel();
     $map['id'] = $res['source'];
     $res['source'] = $source->getSource($map);
     $res['source']['icon_url'] = __ROOT__ . "/" . $res['source']['icon_url'];
     $logistic = new LogisticsModel();
     $key = 'logistics_mode';
     $data[0] = $res;
     $data = $logistic->getLogisticInfo($data, $key);
     $res = $data[0];
     $detail = $res;
     //        var_dump($detail);
     $this->assign('goods', $detail);
     $this->assign('js', $this->fetch('indexJs'));
     $this->assign('css', $this->fetch('indexCss'));
     $detail2 = $this->fetch('index');
     $this->assign('YZBody', $detail2);
     $this->display(YZ_TEMPLATE);
 }