Example #1
0
 public function detail()
 {
     global $tpl, $bid, $product;
     //設定 Action 相關參數
     set_status($this->controller);
     //成交狀態
     $type = $_GET['type'];
     $productid = $_GET['productid'];
     $channelid = $_GET['channelid'];
     if (empty($productid)) {
         return_to('site/bid');
     } else {
         // error_log("[bid/detail] Check for productid : ".$productid.", type : ".$type);
         if (file_exists('/var/www/html' . APP_DIR . '/static/html/BidDetail_' . $productid . '.html')) {
             // Static bid detail page file exists
             error_log("[bid/detail] Show /var/www/html" . APP_DIR . "/static/html/BidDetail_" . $productid . ".html ");
         } else {
             // Static bid detail page does not exist
             // Generate Static Html Page
             $this->genBidDetailHtml();
             // $tpl->assign('product', $get_product);
             // $tpl->assign('bid_info', $get_bid_info);
         }
     }
     $tpl->assign('type', $type);
     $tpl->assign('productid', $productid);
     $tpl->set_title('');
     $tpl->render("bid", "detail", true);
 }
Example #2
0
 public function detail()
 {
     global $tpl, $faq;
     //設定 Action 相關參數
     set_status($this->controller);
     if (empty($_GET['fid'])) {
         return_to('site/tech');
     } else {
         //資料
         $get_faq = $faq->faq_detail($_GET['fid']);
         $tpl->assign('detail', $get_faq);
     }
     $tpl->set_title('');
     $tpl->render("tech", "detail", true);
 }
Example #3
0
 /**
  * Default home page.
  */
 public function home()
 {
     global $tpl, $googlemap;
     //設定 Action 相關參數
     set_status($this->controller);
     //資料
     $gmap = urldecode($_GET['k']);
     $tpl->assign('gmap', $gmap);
     //print_r($gmap);exit;
     mb_regex_encoding('UTF-8');
     mb_internal_encoding('UTF-8');
     $location_array = mb_split("到", mb_substr($_GET['k'], 1));
     //print_r($_GET['k']);
     //print_r($location_array);exit;
     $maplocation['from'] = $location_array[0];
     if (count($location_array) == 1) {
         $mapstate = "loc";
     } else {
         if (count($location_array) > 1) {
             $mapstate = "nav";
             $maplocation['to'] = end($location_array);
             array_shift($location_array);
             //去頭
             array_pop($location_array);
             //去尾
             $maplocation['waypoint'] = implode(",", $location_array);
             if (!empty($maplocation['waypoint'])) {
                 $maplocation['waypoint'] = "waypoint: ['" . $maplocation['waypoint'] . "'], ";
             }
         } else {
             if (count($location_array) < 1) {
                 $mapstate = "";
                 return_to('site/');
             }
         }
     }
     $tpl->assign('mapstate', $mapstate);
     $tpl->assign('maplocation', $maplocation);
     $tpl->set_title('');
     $tpl->render("googlemap", "home", true);
 }
Example #4
0
 /**
  * User registration page.
  */
 function register()
 {
     global $user, $template;
     if ($_POST) {
         if ($user->create($_POST)) {
             $template->set_msg($user->msg, $user->ok);
             if ($_POST['return_to']) {
                 return_to($_POST['return_to']);
             } else {
                 return_to("site/home");
             }
         }
         $template->set_msg($user->msg, $user->ok);
         $template->assign('email', $_POST['email']);
         $template->assign('name', $_POST['name']);
     }
     $template->set_title('Register');
     $template->render("user", "register", true);
 }
Example #5
0
 public function exchange()
 {
     global $tpl, $mall, $user;
     //設定 Action 相關參數
     set_status($this->controller);
     if (empty($_GET['epid'])) {
         return_to('site/mall');
     } else {
         if ($user->is_logged && !empty($_SESSION['user'])) {
             //會員認證資料
             $get_auth = $user->validUserAuth($_SESSION['auth_id'], $_SESSION['user']['profile']['phone']);
             $tpl->assign('auth', $get_auth);
         }
         //商品資料
         $get_product = $mall->get_info($_GET['epid']);
         $tpl->assign('product', $get_product);
         //商品類別
         $get_product_category = $mall->get_product_category();
         $tpl->assign('product_category', $get_product_category);
         //訂單列表
         $order_exchange = $mall->order_exchange($_SESSION['auth_id'], $_GET['epid']);
         $tpl->assign('order_exchange', $order_exchange);
         //查詢卡包資料
         $user_extrainfoArr[1] = $user->get_user_extrainfo(1);
         //查詢中油卡資料
         $user_extrainfoArr[2] = $user->get_user_extrainfo(2);
         //查詢校園一卡通資料
         $user_extrainfoArr[3] = $user->get_user_extrainfo(3);
         //查詢支付宝資料
         $user_extrainfoArr[4] = $user->get_user_extrainfo(4);
         //查詢qq資料
         $tpl->assign('user_extrainfoArr', $user_extrainfoArr);
         //庫存
         $stock = $mall->get_stock($_GET['epid']);
         if ($get_product['epid'] == '493') {
             $stock = 1;
         }
         $tpl->assign('stock', $stock);
     }
     $tpl->set_title('');
     $tpl->render("mall", "exchange", true);
 }
Example #6
0
 public function bid_confirm()
 {
     global $tpl, $history, $config;
     //設定 Action 相關參數
     set_status($this->controller);
     login_required();
     if (empty($_GET['productid'])) {
         return_to('site/history/bid/');
     } else {
         $record = $history->bid_checkout($_GET['productid'], $this->userid);
         //得標價格
         $get_price = (double) $record['price'] * $config['sjb_rate'];
         $record['price'] = round($get_price, 2);
         //中标处理费 = 市價 * 处理费% * 兌換比率
         $get_process_fee = (double) $record['retail_price'] * ((double) $record['process_fee'] / 100) * $config['sjb_rate'];
         $record['real_process_fee'] = round($get_process_fee, 2);
         //费用总计
         $record['total'] = round($get_process_fee + $get_price, 2);
         $tpl->assign('product', $record);
     }
     $tpl->set_title('');
     $tpl->render("history", "bid_confirm", true);
 }
Example #7
0
 public function saja()
 {
     global $tpl, $product, $scodeModel, $user, $oscode;
     //設定 Action 相關參數
     set_status($this->controller);
     if (empty($_REQUEST['productid'])) {
         return_to('site/product');
     } else {
         // 抓source IP
         if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             $temp_ip = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
             $src_ip = $temp_ip[0];
         } else {
             $src_ip = $_SERVER['REMOTE_ADDR'];
         }
         // 抓user_agent
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
         // 判斷是否微信
         $is_wx = strpos($user_agent, 'MicroMessenger');
         $productid = $_REQUEST['productid'];
         $get_product['use_scode'] = false;
         //商品資料
         $get_product = $product->get_info($productid);
         //下標支付方式: 1.殺幣(a) 2.殺幣+S碼+限定S碼(b) 3.殺幣+限定S碼(c) 4.S碼+限定S碼(d) 5.限定S碼(e)
         $pay_type = $get_product['pay_type'];
         /*可否使用S碼(暫時停用)
         		if(!empty($_SESSION['auth_id']) ) {
         			$_scode = $scodeModel->get_scode($_SESSION['auth_id']); 
         			$get_product['use_scode'] = (!empty($_scode) && $_scode > 0) ? true : false;
         		}
                   */
         $tpl->assign('product', $get_product);
         /*下标礼券(暫時停用)
         		 $sgift = $product->get_sgift($_GET['productid']);
         		 $tpl->assign('sgift_num', $sgift);
         		*/
         $sgift = 0;
         $tpl->assign('sgift_num', $sgift);
         // 可用殺价券數量
         $oscode_num = $oscode->get_prod_oscode($productid, $_SESSION['auth_id']);
         $tpl->assign('oscode_num', $oscode_num);
         //目前中标
         $redis = new Redis();
         $redis->connect('127.0.0.1');
         $bid_name = $redis->get('PROD:' . $productid . ':BIDDER');
         if (empty($bid_name)) {
             $bidded = $product->get_bidded($productid);
             $bid_name = !empty($bidded['nickname']) ? $bidded['nickname'] : '无';
             $redis->set('PROD:' . $productid . ':BIDDER', $bid_name);
             error_log("[product/saja]Winner:" . $bid_name . " of Prod:" . $productid . " From DB and sync to redis : " . $bid_name);
         } else {
             error_log("[product/saja]Winner:" . $bid_name . " of Prod:" . $productid . " From redis");
         }
         $tpl->assign('bidded', $bid_name);
         //Add By Thomas 20150721 for LINE 分享
         if ($get_product['is_flash'] == 'Y') {
             $meta['title'] = $get_product['name'] . " 閃殺搶標中 !!";
             $meta['description'] = '閃殺活動地點 : ' . $get_product['flash_loc'];
         } else {
             $meta['title'] = $get_product['name'] . " 搶標中 !!";
             $meta['description'] = '';
         }
         if (!empty($get_product['thumbnail'])) {
             $meta['image'] = BASE_URL . APP_DIR . '/images/site/product/' . $get_product['thumbnail'];
         } elseif (!empty($get_product['thumbnail_url'])) {
             $meta['image'] = $get_product['thumbnail_url'];
         }
         /* 記錄連線來源 20151022改由頁面trigger socket去記錄
         			// $come_from, $productid, $act, $goto, $memo, $userid='', $user_agent='', $intro_by=''
         			if($is_wx>0) {
         			   $user->logAffiliate($src_ip, $productid, 'FLASH|LOGIN' ,'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ,$user_agent, $_SESSION['auth_id'],'WEIXIN','');
         			} else {
         			   $user->logAffiliate($src_ip, $productid, 'PROD|VIEW' ,'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ,$user_agent, $_SESSION['auth_id'],'BROWSER','');
         			}
         			*/
         $tpl->assign('meta', $meta);
     }
     $tpl->set_title('');
     if ($get_product['is_flash'] == 'Y') {
         $tpl->render("product", "kuso_saja", true);
     } else {
         $tpl->render("product", "saja", true);
     }
 }