Exemplo n.º 1
0
 /**
  * 系统函数beforeAction 定义在该类中进行操作之前的动作
  * @access public
  */
 function beforeAction()
 {
     //print_r($_SESSION);
     //print_r($_COOKIE);
     /**
      * session cookie tourists
      *
      * 1.判断是登陆,服务器是否保留session
      * 2.如果没有session可取,判断是否本地保存cookie
      * 3.如果session cookie 都没有值可取采用游客登录
      *
      */
     if (isset($_SESSION['username']) && !empty($_SESSION['username'])) {
         //检测session
         $this->assign('username', $_SESSION['username']);
     } else {
         if (!empty($_COOKIE["username"])) {
             //检测cookie
             $userCookie = $_COOKIE["username"];
             $this->assign('username', $userCookie);
         } else {
             //游客登陆
             $tourists_id = Login::getTouristsId();
             if ($tourists_id == null) {
                 Login::setTouristsId();
             }
         }
     }
 }
Exemplo n.º 2
0
 function add_cart()
 {
     $this->doNotRenderHeader = 1;
     $user_id = Login::getUserId();
     $tourists_id = Login::getTouristsId();
     $m = new Cart();
     $data = $m->save_cart($user_id, $tourists_id);
     $this->assign('message', '1');
     $this->setReturnType('message');
 }
Exemplo n.º 3
0
 function Index()
 {
     //print_r($_SESSION);
     //print_r($_COOKIE);
     /**
      * session cookie tourists
      * 
      * 1.判断是登陆,服务器是否保留session
      * 2.如果没有session可取,判断是否本地保存cookie
      * 3.如果session cookie 都没有值可取采用游客登录
      * 
      */
     if (isset($_SESSION['username']) && !empty($_SESSION['username'])) {
         //检测session
         $this->assign('username', $_SESSION['username']);
     } else {
         if (!empty($_COOKIE["username"])) {
             //检测cookie
             $userCookie = $_COOKIE["username"];
             $this->assign('username', $userCookie);
         } else {
             //游客登陆
             $tourists_id = Login::getTouristsId();
             if ($tourists_id == null) {
                 Login::setTouristsId();
             }
         }
     }
     /**
      * 获取顶部banner1数据
      * 
      */
     $index = new Index();
     $banner1 = $index->getBanner1();
     if ($banner1) {
         $this->assign('banner1', $banner1);
     }
     /**
      * 获取banner2数据
      *
      */
     $banner2 = $index->getBanner2();
     if ($banner2) {
         $this->assign('banner2', $banner2);
     }
     /**
      * 获取website数据
      *
      */
     $websites = $index->getWebsites();
     if ($websites) {
         $this->assign('websites', $websites);
     }
 }
Exemplo n.º 4
0
 function Index()
 {
     //echo "session=";
     // print_r($_SESSION);
     // echo "<br>cookie=";
     // print_r($_COOKIE);
     if (isset($_SESSION['username']) && !empty($_SESSION['username'])) {
         //检测session
         $this->assign('username', $_SESSION['username']);
     } else {
         if (!empty($_COOKIE["username"])) {
             //检测cookie
             $userCookie = $_COOKIE["username"];
             $this->assign('username', $userCookie);
         } else {
             //游客登陆
             $tourists_id = Login::getTouristsId();
             if ($tourists_id == null) {
                 Login::setTouristsId();
             }
             //
         }
     }
     //else结束
     //
     $c = new Category();
     $category_1 = $c->getCategory_1_id();
     $this->assign('category_1', $category_1);
     $f = new Floor();
     $floor_1 = $f->getFloor_1_id();
     $this->assign('floor_1', $floor_1);
     //
     $m = new Category();
     $num = count($m->getCategory_1_id()) * 10000;
     $category_2_all = $this->get_category_2();
     $this->assign('category_2_all', $category_2_all);
     //var_dump($category_2_all);
     //echo $num1."<br>";
     $category_3_all = $this->get_category_3();
     //echo "oh:".$num2."<br>";
     //$this->assign('category_3_'.$i."_".$j.$k, $category_3_1[$k]);
     //var_dump($category_3_all);
     $this->assign('category_3_all', $category_3_all);
     //$a=new Banner();
     $floor_2_all = $this->get_floor_2();
     $floor_3_all = $this->get_floor_3();
     $this->assign('floor_2_all', $floor_2_all);
     $this->assign('floor_3_all', $floor_3_all);
     //********************************
     $type = get_post_value('type');
     $language = get_post_value('language');
     $key = get_post_value('key');
     $field = array('category_id', 'type', 'title', 'created', 'start_time', 'end_time', 'status', 'language');
     $m = new Banner();
     $m->clear();
     $m->setField($field);
     $m->setTable('vcb_banner_categor');
     //$m->setWhere('status', '!=', '60000');//暂不设置
     if ($type != '') {
         $m->setWhere('type', '=', $type);
     }
     if ($language != '') {
         $m->setWhere('language', '=', $language);
     }
     if ($key != '') {
         $m->setWhere('title', 'LIKE', '%' . $key . '%');
     }
     $m->setOrderBy('type');
     $data = $m->select();
     //状态标题    在每一条数据后加上4个数据
     $count = count($data);
     for ($i = 0; $i < $count; $i++) {
         $data[$i]['status_cn'] = $m->getStatus('cn', $data[$i]['status']);
         $data[$i]['status_th'] = $m->getStatus('th', $data[$i]['status']);
         //$data[$i]['type'] = $m->getTypeCaption($data[$i]['type']);//返回位置对应描述
         $data[$i]['dataInformation'] = $m->getImage($data[$i]['category_id']);
     }
     //print_r($data);
     $this->assign('dataOfBanner', $data);
 }
Exemplo n.º 5
0
 /**
  * 返回购物车列表
  */
 function getCartList()
 {
     $user_id = Login::getUserId();
     $tourists_id = Login::getTouristsId();
     $field = array('cart_id', 'shop_username', 'shop_url', 'product_url', 'product_id', 'product', 'image_url', 'product', 'price', 'sku_name', 'qty');
     $orderby = array('shop_username', 'cart_id');
     $this->clear();
     $this->setField($field);
     $this->setTable('vcb_cart');
     $this->setWhere('user_id', '=', $user_id);
     if ($user_id == null) {
         $this->setWhere('tourists_id', '=', $tourists_id);
     }
     $this->setWhere('status', '=', '10000');
     // 		/$this->setGroupBy('shop_username');
     $this->setOrderBy($orderby);
     $data = $this->select();
     $count = count($data);
     for ($i = 0; $i < $count; $i++) {
         $data[$i]['price_cn'] = $data[$i]['price'];
         $data[$i]['price_th'] = $data[$i]['price'] * RATE;
     }
     return $data;
 }