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()); } }
public function redis() { $this->cache = new Redis(); $this->cache->connect(DOO::conf()->redis[0], DOO::conf()->redis[1]); if ($this->cache) { return $this->cache; } else { return false; } }
public function __construct() { parent::__construct(); Doo::loadClass('UserSession'); $this->usession = new UserSession(); $username = $this->usession->uget('username'); if (!$username) { header('Location:' . DOO::conf()->SUBFOLDER . 'login'); } $this->init(); }
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()); } }
<form class="navbar-search pull-right" action="<?php echo DOO::conf()->SUBFOLDER . $data['filter_action']; ?> " method="POST" > <select name="table_row" onchange="this.form.submit();" style="width:80px;margin-left:10px;"> <?php foreach ($data['table_row_option'] as $dr) { ?> <option value="<?php echo $dr; ?> " <?php echo $data['limit'] == $dr ? "selected" : ""; ?> ><?php echo $dr; ?> </option> <?php } ?> </select> </form>
function redirectit() { header('Location:' . DOO::conf()->SUBFOLDER); }
</td> </tr> <tr> <td>Voucher Code</td> <td><?php $voucher_list = $data['dbapi']->get_voucher_code($cv['user_id']); foreach ($voucher_list as $rs) { /* $orderInfo = array(); if($rs['validate']=='1'){ $orderInfo = $data['dbapi']->get_user_order_by_transaction_id($rs['transaction_id'],$rs['order_type']); } */ $vUsed = $data['dbapi']->get_used_voucher_code($cv['user_id'], $rs['code']); $usedTime = date("d-m-Y", strtotime($rs['expire_time'])); if ($vUsed['created_time']) { $usedTime = date("d-m-Y", strtotime($vUsed['created_time'])); } echo $rs['code'] . ' - Puchased at ' . date("d-m-Y", strtotime($rs['create_time'])) . ' ' . ($rs['validate'] == '1' || $vUsed['created_time'] ? 'Used at ' . $usedTime : 'Not used') . '<br/>'; } ?> </td> </tr> </table> </content> <div class="clear"></div> <div style="text-align:right"> <a href="<?php echo DOO::conf()->SUBFOLDER; ?> ">Back to list</a> </div> </div>
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); } }
/** * 实例化redis * @return void */ public function getObjRedis() { if (!self::$_redis) { self::$_redis = new Redis(); self::$_redis->connect(DOO::conf()->redis[0], DOO::conf()->redis[1]); //'127.0.0.1','6379' } }
protected function init() { /* $this->regional = false; */ if ($this->username == 'dcs_timur') { /* $this->regional = "14','15','16','17"; */ $_REQUEST['userProvider'] = 1; } if ($this->username == 'dcs_barat') { /* $this->regional = "11','12','13"; */ $_REQUEST['userProvider'] = 1; } if (isset($_POST['table_row'])) { $this->usession->uset('table_row_option', $_POST['table_row']); } $rows_data = $this->usession->uget('table_row_option'); if (!$this->username) { header('Location:' . DOO::conf()->SUBFOLDER . 'login'); } $dbapi = $this->dbapi; $data['limit'] = 20; if ($rows_data) { $data['limit'] = $rows_data; } $gpage = $_GET['page'] - 1; if ($_REQUEST['print'] == 'excel') { set_time_limit(0); ini_set('memory_limit', '512M'); $data['limit'] = 99999999; unset($gpage); } $gord = $_GET['ord']; $gsearch = trim(addslashes($_REQUEST['search'])); $gdtform = addslashes($_GET['dtform']); $gdtto = addslashes($_GET['dtto']); if (!$gdtform) { $gdtform = date("m/d/Y", strtotime("-1 month")); } if (!$gdtto) { $gdtto = date("m/d/Y"); } $data['gdtto'] = $gdtto; $data['gdtform'] = $gdtform; if (isset($gpage) && $gpage >= 0) { $start = $gpage * $data['limit']; } $start_date = date("Y-m-d", strtotime($gdtform)) . ' 00:00:00'; $end_date = date("Y-m-d", strtotime($gdtto)) . ' 23:59:59'; /* if(!$start_date) $start_date = date("Y-m-d",strtotime("-1 month")); if(!$end_date) $end_date = date("Y-m-d"); */ if ($_GET['ascd'] == '0') { $ordby = "DESC"; } switch ($gord) { case 'user': $ord = 'user_id'; break; case 'movie': $ord = 'content_name '; break; case 'bill': $ord = 'pay_business_account '; break; case 'created': $ord = 'create_time '; break; default: $ord = 'create_time '; $ordby = "DESC"; break; } if ($ord) { $ord .= $ordby; } $this->ord = $ord; $this->start_date = $start_date; $this->end_date = $end_date; $this->start = $start; $this->limit = $data['limit']; $this->gdtto = $data['gdtto']; $this->gdtform = $data['gdtform']; $this->gsearch = $gsearch; }