/** * [index 管理员列表] * @return [type] [description] */ public function index() { if (IS_AJAX) { $draw = I('draw', 1, 'intval'); //排序设置 $mycolumns = I('mycolumns', ''); $myorder = I('order', ''); if (empty($myorder) || empty($mycolumns)) { $order = 'id desc'; } else { foreach ($myorder as $key => $v) { $order .= $mycolumns[$v['column']] . ' ' . $v['dir'] . ' ,'; } $order = rtrim($order, ','); } $db = D('UsersView'); $lists = $db->where(true)->order($order)->select(); foreach ($lists as $key => $v) { $lists[$key]['loginTime'] = $v['loginTime'] ? date('Y/m/d H:i:s', $v['loginTime']) : ''; $lists[$key]['loginIp'] = $v['loginIp'] ? long2ip($v['loginIp']) : ''; if ($v['status']) { $lists[$key]['status'] = '正常'; } else { $lists[$key]['status'] = '禁用'; } } $result['draw'] = $draw; $result['recordsTotal'] = $db->where(true)->count(); $result['recordsFiltered'] = $result['recordsTotal']; $result['data'] = $lists; $this->ajaxReturn($result); } else { $this->display(); } }
public function update() { $name = $this->getActionName(); $model = D($name); $tablename = $_POST['tablename']; foreach ($tablename as $key => $val) { $data = array(); $data['one'] = $_POST['one'][$val]; $data['two'] = $_POST['two'][$val]; $data['three'] = $_POST['three'][$val]; $data['four'] = $_POST['four'][$val]; $data['five'] = $_POST['five'][$val]; $data['six'] = $_POST['six'][$val]; $data['seven'] = $_POST['seven'][$val]; $data['eight'] = $_POST['eight'][$val]; $data['nine'] = $_POST['nine'][$val]; $data['ten'] = $_POST['ten'][$val]; $data['eleven'] = $_POST['eleven'][$val]; $data['twelve'] = $_POST['twelve'][$val]; $data['thirteen'] = $_POST['thirteen'][$val]; $where = array(); $where['tablename'] = $val; $result = $model->where($where)->save($data); if (!$result) { $this->error("编码方案修改失败"); } } $this->success("编码方案修改成功"); }
public function step3() { if (IS_POST) { if ($_POST['if2011'] != '是') { $this->error("您已放弃报名", addons_url('Join2011://Join2011/index')); } //print_array($_POST); $Stu = D('Stu'); $Bmb = D('Bmb'); $data['ksh'] = $_SESSION['ksh']; $data['score'] = $_POST['score']; $data['jsscore'] = $_POST['jsscore']; $data['phone'] = $_POST['phone']; if ($Stu->where(array('ksh' => $_SESSION['ksh']))->find()) { } else { $this->error("您不在初选名单", addons_url('Join2011://Join2011/index')); } if ($Bmb->where(array('ksh' => $_SESSION['ksh']))->find()) { $this->error("您已经报名", addons_url('Join2011://Join2011/index')); } if ($Bmb->data($data)->add()) { session('ksh', ''); $this->success('报名成功', U('Home/Index/index')); } else { $this->error("报名失败,请重新报名", addons_url('Join2011://Join2011/index')); } } else { $this->error("您不可以直接访问这个页面", addons_url('Join2011://Join2011/index')); } }
/** * 用户登录认证 * @param string $username 用户名 * @param string $password 用户密码 * @param integer $type 用户名类型 (1-用户名,2-邮箱,3-手机,4-UID) * @return integer 登录成功-用户ID,登录失败-错误编号 */ public function login($username, $password, $type = 1) { if (file_exists('./api/uc_login.lock')) { include_once './api/uc_client/client.php'; if (strtolower(UC_CHARSET) == 'gbk') { $username = iconv('UTF-8', 'GBK', $username); } $uc_user = uc_user_login($username, $password, 0); if ($uc_user[0] == -2) { return '密码错误'; } elseif ($uc_user[0] == -1) { return '用户不存在,或者被删除'; } elseif ($uc_user[0] > 0) { if (strtolower(UC_CHARSET) == 'gbk') { $uc_user[1] = iconv('GBK', 'UTF-8', $uc_user[1]); } D('member')->where(array('uid' => $uc_user[0]))->setField('nickname', $uc_user[1]); D('ucenter_member')->where(array('id' => $uc_user[0]))->setField('username', $uc_user[1]); return $uc_user[0]; } } else { if (UC_SYNC && $username != get_username(1)) { return $this->ucLogin($username, $password); } return $this->model->login($username, $password, $type); } }
public function textSkip($msg) { $o = D('MatchKeyword'); $target = $o->matchKeyword($msg['keyword']); $o = D("{$target}"); return $o->main($msg); }
/** * 删除 */ public function delete() { $db = D("Tags"); if (IS_POST) { $tagid = $_POST['tagid']; if (is_array($tagid)) { foreach ($tagid as $tid) { $r = $db->where(array("tagid" => $tid))->find(); if ($r) { $db->where(array("tagid" => $tid))->delete(); M("Tags_content")->where(array("tag" => $r['tag']))->delete(); } } $this->success("删除成功!"); } else { $this->error("参数错误!"); } } else { $tagid = (int) $this->_get('tagid'); if (!$tagid) { $this->error("缺少参数!"); } $r = $db->where(array("tagid" => $tagid))->find(); if (!$r) { $this->error("该TAG不存在!"); } $status = $db->where(array("tagid" => $tagid))->delete(); if ($status) { M("Tags_content")->where(array("tag" => $r['tag']))->delete(); $this->success("删除成功!"); } else { $this->error("删除失败!"); } } }
public function upload() { session('upload_error', null); /* 上传配置 */ $setting = C('EDITOR_UPLOAD'); $setting['callback'] = array($this, 'isFile'); /* 调用文件上传组件上传文件 */ $this->uploader = new Upload($setting, C('PICTURE_UPLOAD_DRIVER')); $info = $this->uploader->upload($_FILES); if ($info) { $dao = D('Home/Picture'); foreach ($info as &$file) { $file['rootpath'] = __ROOT__ . ltrim($setting['rootPath'], "."); /* 已经存在文件记录 */ if (isset($file['id']) && is_numeric($file['id'])) { $file['path'] = __ROOT__ . ltrim($file['path'], "."); continue; } /* 记录文件信息 */ $file['path'] = __ROOT__ . ltrim($setting['rootPath'], ".") . $file['savepath'] . $file['savename']; $file['status'] = 1; $file['create_time'] = NOW_TIME; if ($dao->create($file) && ($id = $dao->add())) { $file['id'] = $id; } } } session('upload_error', $this->uploader->getError()); return $info; }
public function index() { //列表过滤器,生成查询Map对象 $map = $this->_search(); $map['_string'] = " (is_investor=1 or is_investor=2) and investor_status!=1 "; //追加默认参数 if ($this->get("default_map")) { $map = array_merge($map, $this->get("default_map")); } if (trim($_REQUEST['user_name']) != '') { $map[DB_PREFIX . 'user.user_name'] = array('like', '%' . trim($_REQUEST['user_name']) . '%'); } if (trim($_REQUEST['email']) != '') { $map[DB_PREFIX . 'user.email'] = array('like', '%' . trim($_REQUEST['email']) . '%'); } if (method_exists($this, '_filter')) { $this->_filter($map); } $name = $this->getActionName(); $model = D('User'); if (!empty($model)) { $this->_list($model, $map); } $this->display(); return; }
public function edit($single_id = null) { $model = D('Single'); if (IS_POST) { if ($model->create()) { $result = $model->save(); if ($result > 0) { $this->success(L('_UPDATE_SUCCESS_'), U('Single/index')); } else { $this->error(L('_UNKNOWN_ERROR_')); } } else { $this->error($model->geterror()); } } else { if (empty($single_id)) { $this->error(L('_ID_NOT_NULL_')); } $data = M('Single')->where("single_id={$single_id}")->find(); //$field=Api('Model/SingleModel'); $field = get_model_attr('single'); $this->meta_title = '编辑单页'; $this->assign('fieldarr', $field); $this->assign('data', $data); $this->display(); } }
/** * 编辑配置 * @author 麦当苗儿 <*****@*****.**> */ public function edit($id = 0) { if (IS_POST) { $Config = D('Config'); $data = $Config->create(); if ($data) { if ($Config->save()) { S('DB_CONFIG_DATA', null); //记录行为 action_log('update_config', 'config', $data['id'], UID); $this->success('更新成功', Cookie('__forward__')); } else { $this->error('更新失败'); } } else { $this->error($Config->getError()); } } else { $info = array(); /* 获取数据 */ $info = M('Config')->field(true)->find($id); if (false === $info) { $this->error('获取配置信息错误'); } $this->assign('info', $info); $this->meta_title = '编辑配置'; $this->display(); } }
public function get_run_link($id) { static $des; $des = empty($des) ? new \Common\ORG\DES(C('API_DATA_CRYPT_KEY')) : $des; $item = $this->find($id); $item_data = $this->get_item_data($id, true); $service_db = D('Service'); $service = $service_db->find($item['sid']); $item_data_field = array_keys($item_data); foreach ($item_data_field as $key => $var) { $item_data_field[$key] = '{' . $var . '}'; } $item_data_value = array_values($item_data); $service_db = D('Service'); $service = $service_db->find($item['sid']); $environment_db = D('Environment'); $eid = $environment_db->get_current_environment(); $link = []; $link_tpl = '[protocol]://[type]/[path](des)/[parameter](des)/[attach](des)/'; $replace['[protocol]'] = C('API_PROTOCOL'); $replace['[type]'] = $service['protocol']; $replace['[path](des)'] = ''; $replace['[parameter](des)'] = ''; $replace['[attach](des)'] = ''; $soft = D('Soft')->get_soft($item['sid'], $eid); foreach ($soft as $var) { $replace['[parameter](des)'] = $des->encrypt(str_replace($item_data_field, $item_data_value, $var['tpl'])); $replace['[path](des)'] = $des->encrypt($var['path']); $replace['[attach](des)'] = $des->encrypt('pathid-' . $var['pathid'] . ',item-' . $item['id'] . ',user-' . session("admin_username")); $link[] = array('name' => $var['name'], 'link' => str_replace(array_keys($replace), array_values($replace), $link_tpl)); } return $link; }
public function pubs() { $Pubs = D('pub'); $pub = $Pubs->where('id=' . $_GET['pid'] . ' and state=1')->find(); $this->assign('pub', $pub); $this->display(); }
public function index() { $id = intval($_GET['id']); $article = sp_sql_post($id, ''); $termid = $article['term_id']; $term_obj = D("Terms"); $term = $term_obj->where("term_id='{$termid}'")->find(); $article_id = $article['object_id']; $should_change_post_hits = sp_check_user_action("posts{$article_id}", 1, true); if ($should_change_post_hits) { $posts_model = M("Posts"); $posts_model->save(array("id" => $article_id, "post_hits" => array("exp", "post_hits+1"))); } $smeta = json_decode($article['smeta'], true); $content_data = sp_content_page($article['post_content']); $article['post_content'] = $content_data['content']; $this->assign("page", $content_data['page']); $this->assign($article); $this->assign("smeta", $smeta); $this->assign("term", $term); $this->assign("article_id", $article_id); $tplname = $term["one_tpl"]; $tplname = sp_get_apphome_tpl($tplname, "article"); $this->display(":{$tplname}"); }
/** * 行为扩展的执行入口必须是run * @author jry <*****@*****.**> */ public function run(&$content) { //安装模式下直接返回 if (defined('BIND_MODULE') && BIND_MODULE === 'Install') { return; } $data = S('hooks'); if (!$data) { $hooks = D('AddonHook')->getField('name,addons'); foreach ($hooks as $key => $value) { if ($value) { $map['status'] = 1; $names = explode(',', $value); $map['name'] = array('IN', $names); $data = D('Addon')->where($map)->getField('id,name'); if ($data) { $addons = array_intersect($names, $data); Hook::add($key, array_map('get_addon_class', $addons)); } } } S('hooks', Hook::get()); } else { Hook::import($data, false); } }
/** * Member overview */ public function index() { $keyword = isset($_GET['keyword']) ? trim($_GET['keyword']) : ''; if ($this->isAjax()) { $page = isset($_GET['page']) ? $_GET['page'] : 1; $pageSize = isset($_GET['pagesize']) ? $_GET['pagesize'] : 20; $order = isset($_GET['sortname']) ? $_GET['sortname'] : 'id'; $sort = isset($_GET['sortorder']) ? $_GET['sortorder'] : 'ASC'; $member = D('Member'); $total = $member->getMemberCount($keyword); if ($total) { $rows = $member->getMemberList($page, $pageSize, $order, $sort, $keyword); foreach ($rows as &$v) { $v['register_time'] = date("Y-m-d H:i:s", $v['register_time']); $v['last_time'] = $v['last_time'] ? date("Y-m-d H:i:s", $v['last_time']) : $v['last_time']; $v['upgrade_time'] = $v['upgrade_time'] ? date("Y-m-d H:i:s", $v['upgrade_time']) : $v['upgrade_time']; } } else { $rows = null; } $this->ajaxReturn(array('Rows' => $rows, 'Total' => $total)); } else { $this->assign('keyword', $keyword); $this->display(); } }
public function getHot($hour = 1, $num = 10, $page = 1) { $map['create_time'] = array('gt', time() - $hour * 60 * 60); $map['status'] = 1; $weiboModel = D('Weibo'); $all_topic = $this->where(array('status' => 1), array(array('read_count' => array('neq', 0))))->select(); foreach ($all_topic as $key => &$v) { $map['content'] = array('like', "%#{$v['name']}#%"); $v['weibos'] = $weiboModel->where($map)->count(); if ($v['weibos'] == 0) { unset($all_topic[$key]); } $v['user'] = query_user(array('space_link'), $v['uadmin']); } unset($v); $all_topic = $this->arraySortByKey($all_topic, 'weibos', false); $i = 0; foreach ($all_topic as &$v) { $v['top_num'] = ++$i; } unset($v); $pager = new Page(count($all_topic), $num); // dump($all_topic);exit; $list['data'] = array_slice($all_topic, ($page - 1) * $num, $num); $list['html'] = $pager->show(); return $list; }
public function insert() { C('TOKEN_ON', false); $db = D('Call'); $where['uid'] = $_SESSION['uid']; $where['token'] = $_SESSION['token']; $res = $db->where($where)->find(); if ($res == false) { $where['phone_account'] = $this->_post('phone_account', 'trim'); if (isset($_POST['phone_password'])) { $where['phone_password'] = $this->_post('phone_password', 'trim'); } if ($where['phone_account'] == false) { $this->error('标题必须填写'); } $id = $db->data($where)->add(); if ($id) { $this->success('添加成功', U('Call/index')); } else { $this->error('添加失败', U('Call/index')); } } else { $where['id'] = $res['id']; $where['phone_account'] = $this->_post('phone_account', 'trim'); if (isset($_POST['phone_password'])) { $where['phone_password'] = $this->_post('phone_password', 'trim'); } if ($db->save($where)) { $this->success('更新成功', U('Call/index')); } else { $this->error('更新失败', U('Call/index')); } } }
public function task() { $loginService = D('Login', 'Service')->getuserInfo(); //user $staffUser = M('ScheduleStaff'); $attr = getdaykey(NOW_TIME); $staffname = $staffUser->where('area = "%s" and status = 1 and %s =1', $loginService['area'], $attr)->select(); $staffRegister = M('StaffRegister'); $staffreg = $staffRegister->where('time = "%s" and area = "%s"', date('Y-m-d', NOW_TIME), $loginService['area'])->select(); $reg_leave = count($staffname) - count($staffreg); $this->assign('reg_sum', $reg_leave); $reg_percent = round((1 - $reg_leave / count($staffname)) * 100); $this->assign('reg_percent', $reg_percent); $this->assign('reg_color', getpercentcolor($reg_percent)); $this->assign('reg_all', count($staffname)); $staffVacation = D('StaffVacationUserView'); $staffvac = $staffVacation->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('vac_sum', count($staffvac)); $staffDimission = D('DimissionUserView'); $staffdim = $staffDimission->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('dim_sum', count($staffdim)); $homeApply = D('ApplyView'); $homeapp = $homeApply->where('a_status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('app_sum', count($homeapp)); $this->assign('task_sum', $reg_leave + count($staffvac) + count($staffdim) + count($homeapp)); $this->display('QuickInfo:task'); }
static function remoteDelete($id) { if (!Usr()->superuser) { return false; } return D()->module->Entry($id)->remoteDelete(); }
public function single($id) { $tiaojian['id'] = array('neq', 1); $fangke = D('guest')->where($tiaojian)->order('logintime DESC')->limit('8')->select(); $this->assign('fangke', $fangke); $where['diaryid'] = array('eq', 0); $where['uid'] = array('eq', 0); $liuyan['huifuid'] = array('neq', 1); $huifu = D('liuyan')->where($liuyan)->order('time DESC')->limit('4')->select(); foreach ($huifu as $key => $value) { $huifu[$key]['user'] = D('guest')->where('id=' . $value['huifuid'])->find(); } $this->assign('huifu', $huifu); $hotdiary = D('diary')->where($where)->limit('4')->order('view DESC')->select(); $newdiary = D('diary')->where($where)->limit('4')->order('time DESC')->select(); $type = D('diary_type')->select(); if ($id <= 12) { $single = D('photopb')->find($id); } else { $single = D('photo')->find($id); } $this->assign('type', $type); $this->assign('newdiary', $newdiary); $this->assign('hotdiary', $hotdiary); $this->assign('single', $single); $this->display(); }
/** * Called when new frame received. * @param string Frame's contents. * @param integer Frame's type. * @return void */ public function onFrame($data, $type) { D($data); if ($data === 'ping') { $this->client->sendFrame('pong'); } }
public function coupon() { if (trim($_REQUEST['msg']) != '') { $map['msg'] = array('like', '%' . trim($_REQUEST['msg']) . '%'); } if (trim($_REQUEST['query_id']) != '') { $map['query_id'] = trim($_REQUEST['query_id']); } if (trim($_REQUEST['coupon_sn']) != '') { $map['coupon_sn'] = trim($_REQUEST['coupon_sn']); } $this->assign("default_map", $map); //列表过滤器,生成查询Map对象 $map = $this->_search(); //追加默认参数 if ($this->get("default_map")) { $map = array_merge($map, $this->get("default_map")); } if (method_exists($this, '_filter')) { $this->_filter($map); } $model = D("CouponLog"); if (!empty($model)) { $this->_list($model, $map); } $this->display(); return; }
public function cartLst() { $mid = session('id'); if ($mid) { // 登陆了从数据库中取 $cartModel = M('Cart'); $_cart = $cartModel->where(array('member_id' => array('eq', $mid)))->select(); } else { // 如果没有登陆则从cookie中取 $cart = isset($_COOKIE['cart']) ? unserialize($_COOKIE['cart']) : array(); $_cart = array(); foreach ($cart as $k => $v) { // 从下标中解析出商品ID和商品属性ID $_k = explode('-', $k); $_cart[] = array('goods_id' => $_k[0], 'goods_attr_id' => $_k[1], 'goods_number' => $v, 'member_id' => $mid); } } // 构造出模板中的结构 $gmodel = D('Admin/Goods'); foreach ($_cart as $k => $v) { $ginfo = $gmodel->field('sm_logo,goods_name')->where(array('id' => array('eq', $v['goods_id'])))->find(); $_cart[$k]['goods_name'] = $ginfo['goods_name']; $_cart[$k]['sm_logo'] = $ginfo['sm_logo']; // 计算会员价格 $_cart[$k]['price'] = $gmodel->getMemPrice($v['goods_id']); $_cart[$k]['goods_attr_str'] = $gmodel->convertGoodsAttrIdToGoodsAttrStr($v['goods_attr_id']); } return $_cart; }
/** * 登录 * @return 用户对象 -2 密码错误 -1 用户不存在或被禁用 */ public function login($username, $password) { $map = array('username' => $username); $user = D('UcenterMember')->where($map)->find(); if (is_array($user) && $user['status'] == 1) { /* 验证用户密码 */ if (think_ucenter_md5($password, UC_AUTH_KEY) === $user['password']) { $this->updateLogin($user['id']); //更新用户登录信息 $uid = $user['id']; //登录成功,返回用户ID } else { $uid = -2; //密码错误 } } else { $uid = -1; //用户不存在或被禁用 } if ($uid > 0) { $admin = $this->where(array('member_id' => $uid))->find(); if (is_array($admin) && $admin['status'] == 1) { return $admin; } else { $uid = -1; //用户不存在或被禁用 } } return $uid; }
public function index() { if (!USER_LOGINED) { jump(U('Public/login')); } global $member; import('@.ORG.Page'); $status = $this->_get('status', false); $status = empty($status) ? 0 : $status; if ($status == 0) { $map['arcrank'] = array('in', '1,2,3'); } elseif ($status == 1) { $map['arcrank'] = array('in', '4'); } $map['mid'] = $member['id']; $model = D('ArchiveView'); $count = $model->where($map)->count(); $fenye = 20; $p = new Page($count, $fenye); $list = $model->field('litpic,id,typeid,modelid,arcrank,title,flag,color,click,pubdate,mid,username,description')->where($map)->limit($p->firstRow . ',' . $p->listRows)->order('pubdate desc')->select(); $p->setConfig('prev', '上一页'); $p->setConfig('header', '条记录'); $p->setConfig('first', '首 页'); $p->setConfig('last', '末 页'); $p->setConfig('next', '下一页'); $p->setConfig('theme', "%first%%upPage%%linkPage%%downPage%%end%<li><span>共<font color='#009900'><b>%totalRow%</b></font>条记录 " . $fenye . "条/每页</span></li>\n"); $this->assign('page', $p->show()); $this->assign('list', $list); $this->display(); }
public function login() { #是否显示验证码 $msg = ''; if (IS_POST) { $name = I('name'); $password = I('password'); if (!empty($name) && !empty($password)) { #验证用户信息 $user_info = D('Common/Admin')->loginCheck($name, $password); #记录登录日志 $log_data = array('admin_id' => isset($user_info['id']) ? $user_info['id'] : 0, 'login_time' => date('Y-m-d H:i:s'), 'login_ip' => get_client_ip()); $log_result = D('Common/Adminlog')->log_add($log_data); #跳转 if (isset($user_info['id'])) { session('user', $user_info['id']); redirect(U('admin/Index/index')); } else { $this->error('登录失败,用户名或密码错误。'); } } else { $this->error('登录失败,用户名或密码错误。'); } } $this->display(); }
/** * 文档保存成功后执行行为 * @param array $data 文档数据 * @param array $catecory 分类数据 */ public function documentSaveComplete($param) { if (MODULE_NAME == 'Home') { list($data, $category) = $param; /* 附件默认配置项 */ $default = C('ATTACHMENT_DEFAULT'); /* 合并当前配置 */ $config = $category['extend']['attachment']; $config = empty($config) ? $default : array_merge($default, $config); $attach = I('post.attachment'); /* 该分类不允许上传附件 */ if (!$config['is_upload'] || !in_array($attach['type'], str2arr($config['allow_type']))) { return; } switch ($attach['type']) { case 1: //外链 # code... break; case 2: //文件 $info = json_decode(think_decrypt($attach['info']), true); if (!empty($info)) { $Attachment = D('Addons://Attachment/Attachment'); $Attachment->saveFile($info['name'], $info, $data['id']); } else { return; //TODO:非法附件上传,可记录日志 } break; } } }
public function add($pid = 0) { $Category = D('Category'); if (IS_POST) { //提交表单 if (false !== $Category->update()) { $this->success('新增成功!', U('index')); } else { $error = $Category->getError(); $this->error(empty($error) ? '未知错误!' : $error); } } else { $cate = array(); if ($pid) { /* 获取上级分类信息 */ $cate = $Category->info($pid, 'id,name,title,status'); if (!($cate && 1 == $cate['status'])) { $this->error('指定的上级分类不存在或被禁用!'); } } /* 获取分类信息 */ $this->assign('info', null); $this->assign('category', $cate); $this->meta_title = '新增分类'; $this->display('edit'); } }
public function index() { if (isset($_POST['name'])) { if ($this->_session('verify') != md5($this->_post('proving'))) { $this->error('验证码错误!'); exit; } $User = D("Admin"); // 实例化User对象 $condition['name'] = $this->_post('name'); $condition['password'] = $User->adminMd5($this->_post('passw')); $list = $User->where($condition)->find(); if ($list) { session('admin_name', $list['username']); //设置session session('admin_uid', $list['id']); session('verify', null); //删除验证码 //session(null); //清空 $this->Record('管理员登陆成功'); //后台操作 $this->success('用户登录成功', U('Index/index')); exit; } else { $this->error('用户名或密码错误'); exit; } } $this->display(); }
/** * 修改权限 */ public function rule_edit($id) { $model = D('Rule'); if (IS_POST) { if ($data = $model->create()) { //判断提交的父id是否是自己和自己的子分类 $id = I('post.id'); $data['ru_id'] = $id; if ($model->save($data) !== false) { $this->success('修改成功', U('rule_list')); exit; } else { $this->error($model->getError()); } } else { $this->error($model->getError()); } } $id = (int) $id; //取出要修改的分类的数据 $info = $model->find($id); $this->assign('id', $id); $this->assign('info', $info); $data = $model->order('ru_order')->where(array('ru_pid' => '0', 'ru_status' => '1'))->select(); $this->assign('data', $data); $this->display(); }