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 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 static function cateToOption($id = 0, $child = true, $type = 'html', $data = array()) { //所有分类转成按父类排序的数组 if (empty($data)) { $category = DBproxy::getProcedure('Manage')->setDimension(2)->getCategory(); } else { $category = $data; } self::cateToArr($category['data'], 0, 0, $type); //输出的数据类型 $option = $type == 'html' ? '' : array(); foreach (self::$cateVal as $key => $value) { $selected = ''; $attr = ''; //有子类的时候不可以选上 if ($value['child'] == '1' && $child) { $attr = 'disabled="disabled"'; } else { $attr = ' style="color:#000"'; } if ($key == $id) { $selected = 'selected="selected"'; } //输出的数据类型 if ($type == 'array') { $option[$key] = array('id' => $key, 'name' => $value['name'], 'parentid' => $value['parentid']); //找子类 self::findArrChild($category['data'], $key); Category::$arrchildids[] = $key; $option[$key]['arrchildid'] = implode(',', Category::$arrchildids); Category::$arrchildids = array(); //找父类 self::findArrParent($category['data'], $value['parentid']); $option[$key]['arrparentid'] = implode(',', Category::$arrparentids); Category::$arrparentids = array(); //child $option[$key]['child'] = count($option[$key]['arrchildid']) == 1 && $option[$key]['arrchildid'] == $key ? 0 : 1; } else { $option .= '<option value="' . $key . '" ' . $attr . $selected . ' >' . $value['name'] . '</option>'; } } return $option; }
/** * 检查页面权限 * @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 修改表单时传入数组 * @param array $nowUserRole 角色数组,根据此参数生成要提交的表单 * @return array */ protected function _getFormConfig($isInsert = true, $data = array(), $nowUserRole = array()) { Doo::loadClassAt('DataExt', 'default'); $dataExt = new DataExt(); Doo::loadClassAt('Menu', 'default'); $menu = new Menu(DBproxy::getManage()); $perms = array(); $menus = $menu->get_menu_formlists($perms); if (isset($data['perm'])) { $menus = $data['perm']; } $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' => '', 'help' => '<span class="label label-warning"> *最长为30个字符</span>')), 'uname' => array('text', array('label' => '登陆账号', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'password' => array('password', array('label' => '登陆密码', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'password2' => array('password', array('label' => '确认密码', 'attributes' => array('class' => "m-wrap small"), 'value' => '')), 'roleid' => array('select', array('label' => '所属角色', 'multioptions' => UserController::getRoleList(), 'value' => Doo::conf()->adminRoleId)), 'is_locked' => array('select', array('label' => '账号是否被锁', 'attributes' => array('class' => 'm-wrap small'), 'multioptions' => ApplicationController::$locked, 'value' => 0)), 'is_check' => array('select', array('label' => '账号是否通过验证', 'attributes' => array('class' => 'm-wrap small'), 'multioptions' => array(0 => '未通过验证', 1 => '验证通过'), 'value' => 0)), 'mobile' => array('text', array('label' => '手机号码', 'attributes' => array('class' => 'm-wrap small'), 'value' => '', 'help' => ' 注:请输入包括国家/地区代码的手机号码。')), 'email' => array('text', array('label' => '邮箱账号', 'attributes' => array('class' => 'm-wrap small'), 'value' => '')))); $btnArr = $this->_btnForm(); $insertForm['elements'] = array_merge($insertForm['elements'], $btnArr); if ($isInsert) { unset($insertForm['elements']['is_check']); return $insertForm; } else { // //编辑时筹码不需要修改 // $insertForm['elements']['CasinoChips'][0] = 'display'; // $insertForm['elements']['CasinoChips'][1]['content'] = '<label class="m-wrap text">' . $data['CasinoChips'] . '</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>'; //修改时,不需要显示密码 unset($insertForm['elements']['password']); unset($insertForm['elements']['password2']); // 将数据写入表单 foreach ($data as $key => $val) { if (isset($insertForm['elements'][$key])) { $insertForm['elements'][$key][1]['value'] = $val; } } return $insertForm; } }
public function del() { $success = true; $errors = '删除成功'; $id = (int) $this->getUrlVar('id', 0); // 删除数据 $return = DBproxy::getProcedure('Manage')->setDimension(2)->bookDel($id); if ($return['status'] != 0) { $errors = '操作失败'; } $this->alert($errors, $success ? 'success' : 'error'); }
<?php Doo::loadClassAt('Menu', 'default'); Doo::loadClassAt('Role', 'default'); Doo::loadClassAt('User', 'default'); $_SERVER['REDIRECT_URL'] = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : ''; $role = new role(DBproxy::getManage()); $user = new user(DBproxy::getManage()); $data['userinfo'] = $userinfo = $user->getUserInfo(); $roles = $role->get_roles(); $data['menu'] = new menu(DBproxy::getManage()); $role_name = array(); if (!empty($userinfo['roleids'])) { foreach ($userinfo['roleids'] as $roleid) { $role_names[] = $roles[$roleid]; } } $role_name = $role_name_s = !empty($role_names) ? implode(', ', $role_names) : ''; if (!empty($role_names) && count($role_names) > 1) { $role_name_s = $role_names[0] . '...'; } else { $role_name_s = $role_names[0]; } //顶部导航index $data['top'] = isset($_GET['top']) ? $_GET['top'] : -1; if (isset($_GET['top'])) { $data['top'] = $_SESSION['menu_top'] = $_GET['top']; } else { $data['top'] = isset($_SESSION['menu_top']) ? $_SESSION['menu_top'] : $data['menu']->getTop(); } $data['role_name_s'] = $role_name_s;
public function checkBook($id) { $params['id'] = intval($id); $book = DBproxy::getProcedure('Manage')->setDimension(2)->getBook($params); if (isset($book['data']) && !empty($book['data']) && $book['total'] > 0 && isset($book['data'][0]['endSaleTime']) && time() < strtotime($book['data'][0]['endSaleTime'])) { return true; } else { return false; } }
/** * 取得表单配置 * @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; } }
/** * 取manage库mysql对象 * @return object */ public static function getManage() { return DBproxy::get('manage'); }
private function orderPrintPaySUCCESS($orderid = 0) { // $params['orderid'] = '12413237022015092911210327222'; $params['orderid'] = $orderid; $params['pagesize'] = $this->getCurPage() . ',' . Doo::conf()->pagesize; //验证此订单是本人的,店长打印则跳开 if ($this->shopMaster() == false) { $params['uid'] = $_SESSION['uid']; } if (!isset($params['orderid']) || trim($params['orderid']) == '') { $this->alert('data null2'); exit; } $order = DBproxy::getProcedure('Manage')->setDimension(2)->getOrder($params); if ($order['total'] < '1') { $this->alert('data null2'); exit; } //打印处理 if ($order['data'][$params['orderid']]['0']['printStatus'] > 0 && $this->shopMaster() == false) { $this->alert('已经打印过了'); exit; } //订单的状态是否能打印,在微信接口验证 $orderStatus = $this->queryOrder($params['orderid'], $order['data'][$params['orderid']][0]['status']); if ($orderStatus != 'SUCCESS') { $this->alert('未支付成功,order status err '); exit; } //D($order['data'][$params['orderid']]); foreach ($order['data'][$params['orderid']] as $key => $value) { $title[] = $value['title'] . ' ' . $value['wxprice'] . ' (' . $value['sum'] . ')'; } $msgNo = time() + rand(1, 9999); /* 自由格式的打印内容 */ if ($order['data'][$params['orderid']]['0']['waimai'] == '1') { $waimai = '外卖单 '; $sb = ' ******'; $addr = "\r\n" . '送货地址:' . $order['data'][$params['orderid']]['0']['addr'] . "\r\n"; } else { $waimai = '堂食单'; $addr = ''; $sb = ''; } $freeMessage = array('memberCode' => MEMBER_CODE, 'msgDetail' => ' 微微乐餐饮欢迎您订购 ' . $waimai . ': 序号:' . $order['data'][$params['orderid']]['0']['oid'] . $sb . ' 条目 单价(元) 数量 ----------------- ' . implode("\r\n", $title) . ' ----------------- 合计:' . $order['data'][$params['orderid']]['0']['allPrice'] . '元 店名:' . $order['data'][$params['orderid']]['0']['shopname'] . $addr . ' 联系电话:' . $order['data'][$params['orderid']]['0']['phone'] . ' 订购时间:' . date('Y-m-d H:i:s', $order['data'][$params['orderid']]['0']['addtime']) . ' ', 'deviceNo' => DEVICE_NO, 'msgNo' => $msgNo); $order = DBproxy::getProcedure('Manage')->setDimension(2)->upOrderPrint($order['data'][$params['orderid']]['0']['oid']); $printStatus = $this->sendFreeMessage($freeMessage); Doo::logger()->info('time:' . date("Y-m-d H:i:s", time()) . "\tip:" . getIP() . "\tprintStatus:" . $printStatus, 'print'); if ($printStatus == 0) { echo '打印请求/任务中队列中,等待打印'; $order = DBproxy::getProcedure('Manage')->setDimension(2)->upOrderPrint($order['data'][$params['orderid']]['0']['oid']); } elseif ($printStatus == 1) { echo '打印任务已完成/请求数据已打印'; $order = DBproxy::getProcedure('Manage')->setDimension(2)->upOrderPrint($order['data'][$params['orderid']]['0']['oid']); } elseif ($printStatus == 2) { echo '打印任务/请求失败'; } else { echo $printStatus; } return $msgNo; }
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 $uid * @return array */ public function get_user_roles($uid) { $param = array('uid' => $uid); // $result = $this->db->execute('sp_sys_user_role_s', $param); $result = DBproxy::getProcedure('Manage')->setDimension(2)->spSysUserRoleS($param); $roleids = array(); if (!empty($result)) { foreach ($result as $v) { $roleids[] = $v['role_id']; } } return $roleids; }
public function callBack() { $file = '/ding/protected/module/default/cache/callback-' . date("Y-m--d") . '.php'; $xml = $GLOBALS['HTTP_RAW_POST_DATA']; $result = WxPayResults::Init($xml); file_put_contents($file, var_export($result, true), FILE_APPEND); if ($result['result_code'] == 'SUCCESS') { $callBackOrderid = $result['out_trade_no']; $orderStatus = $result['result_code']; $order = DBproxy::getProcedure('Manage')->setDimension(2)->orderUp($orderStatus, 0, $callBackOrderid); if ($order['status'] == 0) { echo 'SUCCESS'; } } }
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()); } }
/** * 取角色权限 * @param int $roleid * @return array */ public function get_role_perm($roleid) { $result = DBproxy::getProcedure('manage')->spSysRolePermS($roleid); //db权限和菜单拆分 $permids = explode('),', $result[0]['perm_id']); foreach ($permids as $key => $value) { $perms_menu_peridArr = explode(',', $value); $perms_menu_perid[] = array('menu_id' => $perms_menu_peridArr[1], 'perm_id' => $perms_menu_peridArr[2]); } $perms = array(); if (!empty($perms_menu_perid)) { foreach ($perms_menu_perid as $k => $v) { $perms[$v['menu_id']] = $v['perm_id']; } } return $perms; }