示例#1
0
 public function index()
 {
     $id = $_REQUEST["id"];
     $page = $_REQUEST["page"];
     if (!$page) {
         $page = 1;
     }
     $pageSize = 20;
     //查询店铺的基本信息
     $ShopModel = new \Home\Model\ShopModel();
     $shop_info = $ShopModel->get_shop_info($id);
     //$shop=M("shop");
     //$data=$shop->field("")
     $this->assign("shop_info", $shop_info);
     //渲染样式表
     if ($shop_info["shop_display"] == 2) {
         $this->assign("shop_display", "shop2.css");
     } else {
         $this->assign("shop_display", "shop1.css");
     }
     //
     $mall = M("mall");
     $mall_info = $mall->where("id={$shop_info['mall_id']}")->find();
     $this->assign("mall_info", $mall_info);
     //查询店铺的图片
     /*$ShopPicModel = new \Home\Model\ShopPicModel();
                $this->assign("pic", $ShopPicModel->get_shop_pic($id)); 
     		*/
     $shophomeFocus = D("ShopHomeFocus");
     $pic = $shophomeFocus->where("role={$id}")->select();
     $this->assign("pic", $pic);
     //查询店铺的特价商品
     $GoodModel = new \Home\Model\GoodModel();
     $this->assign("dis_count", $GoodModel->get_shop_discount_good($id));
     //查询店铺的所有商品
     $this->assign("all_good", $GoodModel->get_shop_all_good($id, $page, $pageSize));
     $all_good_num = $GoodModel->get_shop_good_num($id);
     $page_num = ceil($all_good_num / $pageSize);
     $this->assign("page_num", $page_num);
     $page_element = array();
     while ($page_num-- > 0) {
         array_push($page_element, "<span>" . ($page_num + 1) . "</span>");
     }
     $this->assign("page_element", array_reverse($page_element));
     $this->display();
 }
 public function footprint()
 {
     $id = $this->id;
     $result_array = array();
     $FootprintModel = new \Home\Model\FootprintModel();
     $footprint_info = $FootprintModel->get_user_footprint($id);
     $GoodModel = new \Home\Model\GoodModel();
     foreach ($footprint_info as $piece) {
         $good_info = $GoodModel->get_info($piece["good_id"]);
         array_push($result_array, array("good_info" => $good_info, "footprint_info" => $piece));
     }
     $this->assign("result", $result_array);
     $this->display();
 }