public function _initialize() { //微信授权(如果是微信浏览器) $user_agent = $_SERVER['HTTP_USER_AGENT']; if (strpos($user_agent, 'MicroMessenger') != false) { $str = __ACTION__; $str = explode("/", $str); $url = '/userwx/' . $str['2']; $_SESSION['wx_url'] = $url; $Wechat = new WechatAction(); $Wechat->wechat(); if (!isset($_SESSION['openid'])) { exit; } //p($_SESSION); } if (!isset($_SESSION['user'])) { $url = 'index.php/User/indexlogin'; $this->redirect($url); exit; } //设置页大小 $this->pageSize = 15; //设置订单状态 $this->status = array('1' => '下单成功', '2' => '已接单', '3' => '已完成', '4' => '待支付'); }
public function addOrderIndex() { //微信授权(如果是微信浏览器) $user_agent = $_SERVER['HTTP_USER_AGENT']; if (strpos($user_agent, 'MicroMessenger') != false) { $url = '/user/addOrderIndex'; $_SESSION['wx_url'] = $url; $Wechat = new WechatAction(); $Wechat->wechat(); if (!isset($_SESSION['openid'])) { exit; } //p($_SESSION); } if ($_SESSION['user']) { //获取地址 $address = $this->getAddress(); //如果还为设置地址,先添加地址 if (!$address) { $this->addAddressIndex(); exit; } //获取餐馆列表 $restaurant = $this->getRestaurant(); //获取配置项 $condition['type'] = 'service'; $option = M('options')->where($condition)->select(); $this->address = $address; $this->restaurant = $restaurant; $this->option = $option; $this->display(order); } else { $this->display('login'); } //p($address); //p($option); }