Esempio n. 1
0
 public function mod()
 {
     $configKey = 'settingConfig';
     // $cachePath = Doo::conf()->CACHE_PATH;
     // Doo::conf()->CACHE_PATH = Doo::conf()->SITE_PATH.'protect/confCache/';
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.config.js');
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.all.min.js');
     array_push($this->_includeJsFileList, 'js/ueditor/lang/zh-cn/zh-cn.js');
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.use.js');
     $shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName();
     $shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element">';
     foreach ($shopNameList as $key => $value) {
         $selected = $this->getUrlVar('shopname') == $value['cityid'] . ',' . $value['shopname'] ? 'selected=selected' : '';
         $shopNameOpt .= '<option ' . $selected . ' value="' . $value['cityid'] . ',' . $value['shopname'] . '">' . $value['cityNshopname'] . '</option>';
     }
     $shopNameOpt .= '</select>';
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         DOO::cache('php')->set($configKey, json_encode($_POST), 3600 * 24 * 365 * 100);
         // 处理返回路径
         if ($success) {
             $errors = ConfigController::$dataTableUrl;
         }
         $this->ajaxFormResult($success, $errors);
     } else {
         $infoCache = DOO::cache('php')->get($configKey);
         $info = json_decode($infoCache, true);
         // echo Doo::conf()->CACHE_PATH = $cachePath;
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label' => false, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'peiSwitch' => array('select', array('label' => L('菜品调剂发送开关:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => array(0 => '关', 1 => '开'), 'value' => isset($info['peiSwitch']) ? $info['peiSwitch'] : '0')), 'waimaiSum' => array('text', array('label' => '外卖起送份数', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['waimaiSum']) ? $info['waimaiSum'] : '1')), 'aboutTxt' => array('display', array('label' => '关于我们', 'attributes' => array('class' => "m-wrap"), 'content' => '<script id="about" type="text/plain" style="width:1024px;height:500px;">' . $info['editorValue'] . '</script>')), 'saveAndSee' => array('button', array('div' => false, 'left' => ' ', 'label' => '保存&查看<i class="icon-arrow-right"></i>', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . ConfigController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))));
         $this->contentlayoutRender($form->render());
     }
 }
Esempio n. 2
0
 public function mod()
 {
     $configKey = 'settingConfig';
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         DOO::cache('php')->set($configKey, json_encode($_POST), 3600 * 24 * 365 * 100);
         // 处理返回路径
         if ($success) {
             $errors = ConfigController::$dataTableUrl;
         }
         $this->ajaxFormResult($success, $errors);
     } else {
         Doo::loadClassAt('html/DooFormExt', 'default');
         $infoCache = DOO::cache('php')->get($configKey);
         $info = json_decode($infoCache, true);
         $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label' => false, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'peiSum' => array('text', array('label' => '菜品调剂数', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['peiSum']) ? $info['peiSum'] : '', 'help' => '根据历史的订单加上这个数量,作为菜品配送数')), 'shopMaster' => array('text', array('label' => '店长微信openid', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['shopMaster']) ? $info['shopMaster'] : '', 'help' => '可以根据店长订餐时绑定的电话号码,从用户列表中查到店长的微信openid')), 'saveAndSee' => array('button', array('div' => false, 'left' => ' ', 'label' => '保存&查看<i class="icon-arrow-right"></i>', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . ConfigController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))));
         $this->contentlayoutRender($form->render());
     }
 }
Esempio n. 3
0
 public function submitOrder()
 {
     $addRes = false;
     $list = $this->countPrice();
     if (empty($list)) {
         header("Location:" . appurl('index'));
         exit;
     }
     // 验证数据
     $v = Doo::loadHelper('DooValidator', true);
     $success = true;
     $errors = array('Exception!');
     $rules = $this->_getFormRule(true);
     if ($errors = $v->validate($list, $rules)) {
         $success = false;
     }
     //验证外卖起送份数
     $infoCache = DOO::cache('php')->get($this->_configKey);
     $info = json_decode($infoCache, true);
     $waimaiSum = isset($info['waimaiSum']) ? intval($info['waimaiSum']) : 1;
     if ($list['allSum'] < $waimaiSum) {
         $this->alert('外卖起送份数为:' . $info['waimaiSum'] . '份');
         exit;
     }
     //检查验证
     foreach ($list['data'] as $key => $value) {
         $this->checkCanSum($key, $value);
         // //验证剩余数量是否足够
         // $todayBookOrder = DBproxy::getProcedure('Manage')->setDimension(2)->getTodayOKBookSum($key,0);
         // $yestodayBookOrder = DBproxy::getProcedure('Manage')->setDimension(2)->getTodayOKBookSum($key,1);
         // // var_dump($yestodayBookOrder,$todayBookOrder);die;
         // $todayCanSum = $todayBookOrder[0]['booksum'];
         // $yestodayCanSum = $yestodayBookOrder[0]['booksum']+$yestodayBookOrder[0]['peiSongSum'];
         // $hasBookSum = $yestodayCanSum - $todayCanSum;
         // if($value['sum'] > $hasBookSum){
         //     $this->alert($value['name'].'已经供应完毕,明天请尽早下单~');exit;
         // }
         //验证是否能预定
         if (!$this->checkBook($key)) {
             $this->alert($value['name'] . '的售卖结束时间是:' . $value['endSaleTime']);
             exit;
         }
     }
     //#验证数据
     if ($success) {
         //gen_orderid
         $orderid = DBproxy::getProcedure('Manage')->setDimension(2)->gen_orderid($_SESSION['uid']);
         $list['orderid'] = $orderid;
         if (isset($_SESSION['waimai'])) {
             $iswaimai = $_SESSION['waimai'];
             unset($_SESSION['waimai']);
         } else {
             $iswaimai = 0;
         }
         $list['waimai'] = $iswaimai;
         $addRes = DBproxy::getProcedure('Manage')->setDimension(2)->addOrder($list);
         if ($addRes == true) {
             $cartKey = $_SESSION['uid'] . '_cart';
             $cart = DOO::cache('php')->flush($cartKey);
         } else {
             $this->alert('生成订单失败');
         }
     }
     $dbres = DBproxy::getProcedure('Manage')->setDimension(2)->getMsg();
     $res = array_keys($dbres);
     // $res[0] = 4;//4是成功
     if ($res[0] == 4) {
         // Doo::loadControllerAt('PayController','default');
         // //调用支付接口
         // $pay = new PayController();
         // $pay->wxJsPay($list);
         $_SESSION['orderinfo'] = $list;
         $cartKey = $_SESSION['uid'] . '_cart';
         $cart = DOO::cache('php')->flush($cartKey);
         header("Location:" . appurl('wxpay'));
     } else {
         $this->alert($dbres, 'success', true, appurl('getMeOrder'), 2);
     }
 }