public function __construct($db = '') { $this->db = $db; Doo::loadClassAt('KVCache', 'default'); $KVCache = new KVCache(); $this->_redis = $KVCache->cfile(); }
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 static function getProcedure($dbName) { $dbName = ucfirst($dbName); if (!isset(self::$_procedureList[$dbName])) { Doo::loadClassAt('procedures/' . $dbName, 'default'); self::$_procedureList[$dbName] = new $dbName(); } return self::$_procedureList[$dbName]; }
public function dataTable() { Doo::loadClassAt('html/DataTable', 'default'); Doo::loadClassAt('html/DooFormExt', 'default'); $dt = new DataTable(); $param['starttime'] = $this->getUrlVar('starttime', NULL); $param['endtime'] = $this->getUrlVar('endtime', NULL); //$param['bookid'] = $this->getUrlVar('bookid',NULL); $param['order'] = $this->getUrlVar('order', NULL); $param['bookname'] = $this->getUrlVar('bookname', NULL); //$param['booktypeid'] = $this->getUrlVar('booktypeid',0); $param['waimai'] = $this->getUrlVar('waimai', '2'); $param['shopname'] = $this->getUrlVar('shopname', ''); $export = $this->getUrlVar('export'); // 表头 $header = array('bookid' => array('name' => '菜品ID'), 'title' => array('name' => '菜品名称'), 'sum' => array('name' => '销量'), 'price' => array('name' => '微信单价'), 'totle' => array('name' => '总价')); //所有店列表 $shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName(); $shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element"><option>全部门店</option>'; 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>'; $res = DBproxy::getProcedure('Manage')->setDimension(2)->queryOrderHit($param); $sum = 0; foreach ($res['data'] as $key => $value) { $sum += $value['sum']; $res['data'][$key]['totle'] = $value['sum'] * $value['price']; } // 生产表格 $content = $dt->setTitle('')->setAttr(array('class' => 'table table-hover ', 'id' => 'js-queryTable '))->setHeader($header)->setData($res['data'])->setTopContent('')->setBottomContent('')->setDefaultValue('unkown')->render(false); //查询表单 $form = new DooFormExt(array('method' => 'get', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-get-form', 'class' => 'form-horizontal'), 'elements' => array('starttime' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '开始日期', 'attributes' => array('class' => "m-wrap", "onClick" => "WdatePicker()"), 'value' => $this->getUrlVar('starttime'))), 'endtime' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '结束日期', 'attributes' => array('class' => "m-wrap", "onClick" => "WdatePicker({maxDate:'%y-%M-%d'})"), 'value' => $this->getUrlVar('endtime'))), 'shopname' => array('display', array('left' => '', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'content' => $shopNameOpt)), 'bookname' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '菜品名称', 'attributes' => array('class' => "m-wrap"), 'value' => $this->getUrlVar('bookname'))), 'waimai' => array('select', array('left' => ' 是否外卖', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'multioptions' => array('2' => '全部', '1' => '是', '0' => '否'), 'value' => $this->getUrlVar('waimai'))), 'order' => array('select', array('left' => ' 点击量排序', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'multioptions' => array('desc' => '多', 'asc' => '少'), 'value' => $this->getUrlVar('order'))), 'search' => array('button', array('div' => false, 'label' => '<i class="icon-search"></i>查询', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'export' => array('button', array('div' => false, 'label' => ' <i class="icon-export"></i> 导出', 'attributes' => array('class' => "btn black"), 'value' => 1))))); $sumDiv = '销售总数量:' . $sum; $content .= $sumDiv; //export if (trim($export) == 1) { exportExcel($content); exit; } // 显示模版 $this->contentlayoutRender($form->render() . $content); }
/** * 登录 */ public function in() { if ($this->_user->isLogin()) { $result = $this->_user->logout(); } // 自动登录 // if($this->_user->autoLogin()) { // $this->alert('自动登录成功','success'); // return; // } if ($this->isAjax() && $_POST) { $result = $this->_user->login($_POST['username'], $_POST['password'], $_POST['safecode'], $_POST['lang'], isset($_POST['remember']) ? 1 : 0); $this->ajaxFormResult($result['success'], $result['success'] ? adminAppUrl('home') : $result['errors']); } else { Doo::loadClassAt('html/DooFormExt', 'default'); $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'array', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-vertical login-form'), 'elements' => array('username' => array('text', array('hide-label' => FALSE, 'placeholder' => '用户名', 'attributes' => array('class' => "m-wrap placeholder-no-fix"))), 'lang' => array('select', array('multioptions' => Doo::conf()->langList, 'hide-label' => FALSE, 'attributes' => array('class' => "m-wrap small"))), 'password' => array('password', array('hide-label' => FALSE, 'placeholder' => '密码', 'attributes' => array('class' => "m-wrap placeholder-no-fix"))), 'remember' => array('checkbox', array('hide-label' => FALSE, 'div' => FALSE, 'attributes' => array('class' => ""))), 'safecode' => array('text', array('div' => FALSE, 'hide-label' => FALSE, 'placeholder' => '验证码', 'attributes' => array('class' => "m-wrap small")))))); $this->renderc($this->_templateDefault . '/login/in', $form->render()); } }
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()); } }
/** * 检查页面权限 * @param unknown $authority * @param unknown $checkvalue * @return boolean */ public function checkAuthority($authority, $checkvalue) { if (empty($authority)) { return false; } //超管直接返回成功 if ($authority == '-1') { return true; } Doo::loadClassAt('Menu', 'default'); $menu = new menu(DBproxy::getManage()); $menuList = $menu->getMenuArray(); foreach ($menuList as $key => $var) { if (empty($var['url'])) { continue; } if (strpos($var['url'], '/') !== 0) { continue; } $menuid = -2; if (strpos($var['url'], '/') === 0) { $first = ''; } else { $first = '/'; } // var_dump($_SERVER['REDIRECT_URL'] , trim('/'.Doo::conf()->adminRoute.$first.$var['url']),'<br>'); //寻找后台菜单URL和当前URL 是否匹配。 if ($_SERVER['REDIRECT_URL'] == trim('/' . Doo::conf()->adminRoute . $first . $var['url'])) { $menuid = $var['id']; // echo '<pre>';var_dump($_SESSION['authory'],isset($authority[$menuid]),$var); // var_dump($authority,$menuid,$checkvalue);die; } if (isset($authority[$menuid]) && ($authority[$menuid] & $checkvalue) == $checkvalue) { return true; } } return false; }
/** * 取得表单配置 * @param boolean $isInsert 1 是插入表单配置,0 是修改表单 * @param array $data 修改表单时传入数组 * @return array */ protected function _getFormConfig($isInsert = true, $data = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'name' => array('text', array('label' => '门店名称:', 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'longitude' => array('text', array('label' => '经度:', 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'latitude' => array('text', array('label' => '纬度', 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'city' => array('select', array('label' => L('城市:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => MapController::$city, 'value' => '')), 'status' => array('select', array('label' => L('可用状态:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => MapController::$status, 'value' => 0)), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>保存&返回', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'saveAndAdd' => array('button', array('div' => false, 'left' => ' ', 'label' => '<i class="icon-plus"></i>保存&新增', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>取消</a>')), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . MapController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))); if ($isInsert) { return $insertForm; } else { // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { $insertForm['elements'][$key][1]['value'] = $val; } } return $insertForm; } }
/** * 取得表单配置 * @param boolean $isInsert 1 是插入表单配置,0 是修改表单 * @param array $data 修改表单时传入数组 * @return array */ protected function _getFormConfig($isInsert = true, $data = array(), $info = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'cityid' => array('display', array('label' => L('所属城市:'), 'attributes' => array('class' => "m-wrap"), 'content' => PeiSongController::$city)), 'shopname' => array('text', array('label' => L('店名:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'shopNamePhone' => array('text', array('label' => L('店长电话:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'peisongPhone' => array('text', array('label' => L('配送间电话:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>' . L('保存&返回'), 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'saveAndAdd' => array('button', array('div' => false, 'left' => ' ', 'label' => '<i class="icon-plus"></i>' . L('保存&新增'), 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>' . L('取消') . '</a>')), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . PeiSongController::$dataTableUrl . '"><i class="icon-arrow-left"></i>' . L('取消&返回') . '</a>')))); if ($isInsert) { return $insertForm; } else { // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { if ($key == 'name') { $val = $data['cname']; } $insertForm['elements'][$key][1]['value'] = $val; } } $insertForm['elements']['cityid'][1]['content'] = '<select class="m-wrap" name="city" id="city-element"><option value="0">' . L('顶级城市') . '</option>' . City::cateToOption($data['cityid'], false) . '</select>'; return $insertForm; } }
public function cacheKV() { Doo::loadClassAt('KVCache', 'default'); $KVCache = new KVCache(); return $this->_redis = $KVCache->redis(); }
session_start(); include '../protected/config/common.conf.php'; include '../protected/config/routes.default.conf.php'; include '../protected/config/db.default.conf.php'; include '../protected/config/timezone.conf.php'; include '../protected/config/area.conf.php'; include '../protected/module/default/class/func.php'; // 旧方法库 #Just include this for production mode //include $config['BASE_PATH'].'deployment/deploy.php'; include $config['BASE_PATH'] . 'Doo.php'; include $config['BASE_PATH'] . 'app/DooConfig.php'; # Uncomment for auto loading the framework classes. //spl_autoload_register('Doo::autoload'); Doo::conf()->set($config); # remove this if you wish to see the normal PHP error view. include $config['BASE_PATH'] . 'diagnostic/debug.php'; # database usage //Doo::useDbReplicate(); #for db replication master-slave usage //Doo::db()->setMap($dbmap); Doo::conf()->add('dbconfig', $dbconfig); Doo::loadClassAt('DBproxy', 'default'); // Doo::db()->setDb($dbconfig, $config['APP_MODE']); // Doo::db()->sql_tracking = true; #for debugging/profiling purpose Doo::app()->route = $route; # Uncomment for DB profiling //Doo::logger()->beginDbProfile('doowebsite'); Doo::app()->run(); //Doo::logger()->endDbProfile('doowebsite'); Doo::logger()->rotateFile(102400); Doo::logger()->writeLogs('framework/' . date('Ym') . '/' . date('d') . '.log', false);
/** * 取得修改密码表单配置 * @param boolean $isInsert 1 是插入表单配置,0 是修改表单 * @param array $data 修改表单时传入数组 * @return array */ protected function _getPasswordFormConfig($isInsert = true, $data = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'name' => array('text', array('label' => '操作员姓名', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'uname' => array('text', array('label' => '登陆账号', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'password' => array('password', array('label' => '原登陆密码', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'password1' => array('password', array('label' => '新登陆密码', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'password2' => array('password', array('label' => '再次输入密码', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>保存', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>取消</a>')))); if ($isInsert) { return $insertForm; } else { //编辑时登录账户不需要修改 $insertForm['elements']['name'][0] = 'display'; $insertForm['elements']['name'][1]['content'] = '<label class="m-wrap text">' . $data['name'] . '<input type="hidden" name="name" id="name-element" value="' . $data['name'] . '"> </label>'; //编辑时登录账户不需要修改 $insertForm['elements']['uname'][0] = 'display'; $insertForm['elements']['uname'][1]['content'] = '<label class="m-wrap text">' . $data['uname'] . '<input type="hidden" name="uname" id="uname-element" value="' . $data['uname'] . '"> </label>'; // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { $insertForm['elements'][$key][1]['value'] = $val; } } return $insertForm; } }
/** * 取得表单配置 * @param boolean $isInsert 1 是插入表单配置,0 是修改表单 * @param array $data 修改表单时传入数组 * @return array */ protected function _getFormConfig($isInsert = true, $data = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); $id = isset($data['categoryid']) ? $data['categoryid'] : ''; $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'categoryid' => array('display', array('label' => L('父分类:'), 'attributes' => array('class' => "m-wrap"), 'content' => '<select id="categoryid-element" name="categoryid" class="m-wrap">' . Category::cateToOption($id) . '</select>')), 'name' => array('text', array('label' => L('名称:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'price' => array('text', array('label' => L('价格'), 'attributes' => array('class' => "m-wrap"), 'value' => 0)), 'wxprice' => array('text', array('label' => L('微信预定价格'), 'attributes' => array('class' => "m-wrap"), 'value' => 0)), 'peiSongSum' => array('text', array('label' => L('配送调度数'), 'attributes' => array('class' => "m-wrap"), 'value' => 10)), 'la' => array('text', array('label' => L('辣程序(越高越辣)'), 'attributes' => array('class' => "m-wrap"), 'value' => 0)), 'sort' => array('text', array('label' => L('排序:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '数字越大排越前')), 'status' => array('select', array('label' => L('可用状态:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => BookController::$status, 'value' => 0)), 'descript' => array('text', array('label' => L('描述'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'img' => array('file', array('label' => L('菜品图片:'), 'attributes' => array('class' => "m-wrap"), 'help' => '图片规格:(宽*高)640*480px,大小200-300k左右')), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>保存&返回', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'saveAndAdd' => array('button', array('div' => false, 'left' => ' ', 'label' => '<i class="icon-plus"></i>保存&新增', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>取消</a>')), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . BookController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))); if ($isInsert) { return $insertForm; } else { #$insertForm['elements']['img'][1]['help'].= '<label class="m-wrap text"><img style="height:100px" src="' . Doo::conf()->APP_URL.$data['img'] . '"> <input type="hidden" name="img" id="img-element" value="' . $data['img'] . '"> </label>'; #$insertForm['elements']['img'][0] = 'display'; #$insertForm['elements']['img'][1]['content'] = '<label class="m-wrap text"><img style="height:100px" src="' . Doo::conf()->APP_URL.$data['img'] . '"> <input type="hidden" name="img" id="img-element" value="' . $data['img'] . '"> </label>'; // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { $insertForm['elements'][$key][1]['value'] = $val; } } $insertForm['elements']['img'][1]['help'] .= '<label class="m-wrap text"><img style="height:100px" src="' . Doo::conf()->APP_URL . $data['img'] . '"> <input type="hidden" name="img" id="img-element" value="' . $data['img'] . '"> </label>'; $insertForm['elements']['img'][1]['value'] = ''; return $insertForm; } }
private function sendMessage($msgInfo) { Doo::loadClassAt('HttpClient', 'default'); $client = new HttpClient(FEYIN_HOST, FEYIN_PORT); if (!$client->post('/api/sendMsg', $msgInfo)) { //提交失败 return 'faild'; } else { return $client->getContent(); } }
public function beforeRun($resource, $action) { header("Content-type:text/html;charset=utf-8"); parent::beforeRun($resource, $action); Doo::loadClassAt('User', 'default'); $this->_user = new User(DBproxy::getManage()); $this->_pageAuth = new PageAuth(); $this->_action = $action; if ($this->_checkIsLogin) { if (!$this->_user->isLogin()) { $this->notLoginPage(); exit; } } else { $this->_checkPageAuth = TRUE; // 关闭登录验证时,自动关闭页面权限验证 } if ($this->_checkPageAuth) { $this->_currentPageAuth = isset($this->_checkActionAuthList[$action]) ? $this->_checkActionAuthList[$action] : $this->_checkActionAuthList['notauth']; if (!$this->_pageAuth->auth($this->_currentPageAuth)) { $this->notAuthPage(); exit; } } $this->_pageTitle = Doo::conf()->siteName; $this->_opname = $this->_user->getUsername(); $this->init(); }
/** * 获取角色菜单权限 * @param int $roleid 角色ID * @return array 权限列表(menu_id,perm_id) */ public function getRoleAuthority($roleid) { Doo::loadClassAt('Role', 'default'); $role = new role(); $result = $role->get_role_perm($roleid); foreach ($result as $key => $value) { $res[] = array('menu_id' => $key, 'perm_id' => $value); } return $res; }
/** * 取得表单配置 * @param boolean $isInsert 1 是插入表单配置,0 是修改表单 * @param array $data 修改表单时传入数组 * @return array */ protected function _getFormConfig($isInsert = true, $data = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); // D($data); $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'userid' => array('display', array('label' => '用户id:', 'attributes' => array('class' => "m-wrap"))), 'openid' => array('display', array('label' => 'openid:', 'attributes' => array('class' => " large m-wrap"))), 'phone' => array('text', array('label' => L('电话:'), 'attributes' => array('class' => "m-wrap"), 'value' => 0)), 'shopname' => array('display', array('label' => '门长所属门店:', 'attributes' => array('class' => 'small m-wrap'), 'content' => UserController::$shopList)), 'addr' => array('text', array('label' => L('地址:'), 'attributes' => array('class' => "large m-wrap"), 'value' => '')), 'regtime' => array('display', array('label' => L('注册时间:'), 'attributes' => array('class' => "m-wrap"))), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>保存&返回', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . UserController::$dataTableUrl . '"><i class="icon-arrow-left"></i>返回</a>')))); if ($isInsert) { return $insertForm; } else { // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { $insertForm['elements'][$key][1]['value'] = $val; } } $insertForm['elements']['regtime'][1]['content'] = date("Y-m-d H:i:s", $data['regtime']); $insertForm['elements']['userid'][1]['content'] = '<label class=" m-wrap">' . $data['userid'] . '</label>'; $insertForm['elements']['openid'][1]['content'] = $data['openid']; return $insertForm; } }
public function mod() { $id = (int) $this->getUrlVar('id'); Doo::loadClassAt('Role', 'default'); $role = new role(); $data = $role->get_one($id); if (empty($data)) { $this->alert('没有找到数据'); return; } if ($this->isAjax() && $_POST) { $v = Doo::loadHelper('DooValidator', true); $success = true; $errors = array(); //D($postData); $rules = array('name' => array(array('required', "请填写角色名"), array('minlength', 2, "角色名最少长度不允许少于2个字节"), array('maxlength', 12, "角色名最大长度不允许大于12个字节")), 'perm' => array(array('required', "请勾选角色权限"))); // 验证数据 if ($errors = $v->validate($_POST, $rules)) { $success = false; } // 插入角色数据 if ($success) { $role = Doo::loadClass('Role', true); $_POST['id'] = $id; list($success, $errors) = array_values($role->update($_POST)); } // 处理返回路径 if ($success) { if (isset($_POST['saveAndReutrn'])) { $errors = RoleController::$dataTableUrl; } else { if (isset($_POST['saveAndSee'])) { $errors = RoleController::$modUrl . $errors; } else { $errors = RoleController::$addUrl; } } } $this->ajaxFormResult($success, $errors); } else { Doo::loadClassAt('html/DooFormExt', 'default'); Doo::loadClassAt('Menu', 'default'); $menu = new Menu(DBproxy::getManage()); $perms = $role->get_role_perm($id); $menus = $menu->get_menu_formlists($perms); // 引入树状css array_push($this->_includeCssFileList, 'css/tree.css'); $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>')), 'name' => array('text', array('label' => '角色名', 'attributes' => array('class' => "m-wrap"), 'value' => $data[0]['name'])), 'menus' => array('display', array('label' => '菜单', 'content' => '<div style="width:800px;height:500px;overflow-y:auto;" class="tree-wrapper">' . $menus . '</div>')), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>保存&返回', 'attributes' => array('class' => "btn blue"), 'value' => 1)), '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="' . RoleController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>'))))); $this->contentlayoutRender($form->render()); } }
/** * 更新所有分类的,所有子类,父类,是否有子类 *@return bool */ public function changeCategory() { Doo::loadClassAt('Category', 'default'); $name = Category::cateToOption(0, false, 'array'); foreach ($name as $key => $value) { $arrparent = trim($value['arrparentid']) == '' ? 0 : trim($value['arrparentid']); $upSql = "UPDATE `type` SET `child` = '" . intval($value['child']) . "' ,\n `arrparentid`='" . $arrparent . "' ,\n `arrchildid`='" . trim($value['arrchildid']) . "' \n WHERE `id` = '" . intval($value['id']) . "'"; self::execute($upSql, 'u'); } return array('status' => 0); }
/** * 取得表单配置 * @param boolean $isInsert 1 是插入表单配置,0 是修改表单 * @param array $data 修改表单时传入数组 * @return array */ protected function _getFormConfig($isInsert = true, $data = array(), $info = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); Doo::loadClassAt('Menu', 'default'); $menu = new menu(DBproxy::getManage()); // D($info); $name = isset($info['menu_name']) ? $info['menu_name'] : ''; $typeId = isset($info['type_id']) ? $info['type_id'] : 0; $sortId = isset($info['sort_id']) ? $info['sort_id'] : 0; $permId = isset($info['perm_id']) ? $info['perm_id'] : 0; //权限换算 $permList = $menu->getMenuList($permId); $isShow = isset($info['is_show']) ? $info['is_show'] : 1; $pageUrl = isset($info['page_url']) ? $info['page_url'] : ''; $parentId = isset($info['parent_id']) ? $info['parent_id'] : 0; $sep = isset($info['_sep']) ? $info['_sep'] : ''; $menuRecursStr = $menu->getParentidTree(0); $list = array(); $list[0] = '顶层菜单'; foreach ($data as $row => $rowData) { if ($rowData['type_id'] == 1) { continue; } $sep = substr($rowData['_sep'], 1); if ($sep != '') { $sep = str_replace('.', ' ', $sep); $dot = '└─'; if (isset($data[$row + 1])) { if ($data[$row + 1]['parent_id'] == $rowData['parent_id']) { $dot = '├─'; } } //$sep = $sep.$dot; //$dot = ''; } else { $dot = '├─'; } $sep = $sep . $dot; $dot = ''; $list[$rowData['id']] = $sep . $rowData['menu_name']; } $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'parent_id' => array('select', array('label' => '父类标识:', 'attributes' => array('class' => "m-wrap"), 'multioptions' => $list, 'value' => $parentId)), 'type_id' => array('select', array('label' => '菜单类型:', 'attributes' => array('class' => "m-wrap"), 'multioptions' => array(1 => '页面', 2 => '分类'), 'value' => $typeId)), 'menu_name' => array('text', array('label' => '菜单名称:', 'attributes' => array('class' => "m-wrap"), 'value' => $name, 'help' => '必填项')), 'page_url' => array('text', array('label' => '菜单地址:', 'attributes' => array('class' => "m-wrap"), 'value' => $pageUrl, 'help' => '必填项')), 'permission' => array('MultiCheckbox', array('label' => '菜单权限:', 'multioptions' => PageAuth::getDefined(), 'value' => $permList, 'help' => '<span class="label-warning label">修改菜单地址时将自动勾选</span>')), 'sort_id' => array('text', array('label' => '排序标识:', 'attributes' => array('class' => "m-wrap"), 'value' => $sortId, 'help' => '必填项')), 'is_show' => array('MultiRadio', array('label' => '是否显示:', 'multioptions' => array(1 => '是', 0 => '否'), 'value' => array($isShow))), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>保存&返回', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'saveAndAdd' => array('button', array('div' => false, 'left' => ' ', 'label' => '<i class="icon-plus"></i>保存&新增', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>取消</a>')), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . MenuController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))); if ($isInsert) { return $insertForm; } else { // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { $insertForm['elements'][$key][1]['value'] = $val; } } return $insertForm; } }
public function login() { Doo::loadClassAt('html/DataTable', 'default'); Doo::loadClassAt('html/DooFormExt', 'default'); $dt = new DataTable(); $form = new DooFormExt(array('method' => 'get', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-get-form', 'class' => 'form-horizontal'), 'elements' => array('code' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '登陆验证码', 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'search' => array('button', array('div' => false, 'label' => '<i class="icon-search"></i>提交', 'attributes' => array('class' => "btn blue"), 'value' => 1))))); $uname = $this->getCacheUrlVar('uname'); //用户账号 $code = trim($this->getUrlVar('code', '')); //登陆验证码 $codeConf = Doo::conf()->code; //登陆验证码(配置文件) if (!empty($code)) { if ($code == $codeConf) { $this->_user->accountLogin($uname); } else { $this->alert('验证码错误', 'ERROR', false); } } $content = $dt->setTitle('')->setAttr(array('class' => 'table'))->setDefaultValue('unkown')->setTopContent('<a href="' . UserController::$addUrl . '" class="btn green-stripe"><i class="icon-plus"></i>返回列表</a>' . $form->render())->render(false); $this->contentlayoutRender($content); }
/** * 取得表单配置 * @param boolean $isInsert 1 是插入表单配置,0 是修改表单 * @param array $data 修改表单时传入数组 * @return array */ protected function _getFormConfig($isInsert = true, $data = array(), $info = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); $id = isset($data['parentid']) ? $data['parentid'] : ''; $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'parentid' => array('display', array('label' => L('父分类:'), 'attributes' => array('class' => "m-wrap"), 'content' => '<select id="parentid-element" name="parentid" class="m-wrap"><option value="0">' . L('顶级父类') . '</option>' . Category::cateToOption($id, false) . '</select>')), 'name' => array('text', array('label' => L('分类名称:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'status' => array('select', array('label' => L('可用状态:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => CategoryController::$status, 'value' => 0)), 'city' => array('display', array('label' => L('所属城市:'), 'attributes' => array('class' => "m-wrap"), 'content' => CategoryController::$city)), 'sort' => array('text', array('label' => L('排序:'), 'attributes' => array('class' => "m-wrap"), 'value' => '0')), 'opentimeDay' => array('select', array('label' => L('开始预定日期:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => array(0 => '当天'), 'value' => 0)), 'opentime' => array('text', array('label' => L('开始预定时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 9:00')), 'endtime' => array('text', array('label' => L('结束预定时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 12:00')), 'waimaiEndtime' => array('text', array('label' => L('结束外卖预定时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 9:00')), 'endSaleTime' => array('text', array('label' => L('结束售卖时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 12:00')), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>' . L('保存&返回'), 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'saveAndAdd' => array('button', array('div' => false, 'left' => ' ', 'label' => '<i class="icon-plus"></i>' . L('保存&新增'), 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>' . L('取消') . '</a>')), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . CategoryController::$dataTableUrl . '"><i class="icon-arrow-left"></i>' . L('取消&返回') . '</a>')))); if ($isInsert) { return $insertForm; } else { // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { if ($key == 'name') { $val = $data['cname']; } $insertForm['elements'][$key][1]['value'] = $val; } } $insertForm['elements']['city'][1]['content'] = '<select class="m-wrap" name="city" id="city-element"><option value="0">' . L('顶级城市') . '</option>' . City::cateToOption($data['city'], false) . '</select>'; return $insertForm; } }
<?php /** * 数据库MySQL5驱动 * @package class * @author xinkq * @since 1.0.0 * @version 1.0.0 + build date 2015-6-3 */ Doo::loadClassAt('User', 'default'); class Mysql { private $sql; private $conn; /** * @param array $config 数据库配置,数组格式:array('host'=>ip, 'port'=>port, 'uid'=>dbuser, 'pwd'=>dbpass, 'db'=>dbname) * @return void * @since 1.0.0 */ public function __construct($config) { $this->connect($config); } /** * db 处理统一接口 */ public function execute($sql = '', $type = 's') { $res['status'] = 1; $dbRes = false;
<?php Doo::loadClassAt('procedures/base/ManageBase', 'default'); class Manage extends ManageBase { }