Пример #1
0
 public function indel()
 {
     //验证用户权限
     parent::userauth(20);
     if ($this->isAjax()) {
         if (!($delid = explode(',', $this->_post('delid')))) {
             R('Public/errjson', array('请选中后再删除'));
         }
         //将最后一个元素弹出栈
         array_pop($delid);
         $id = join(',', $delid);
         $log = M('loginlog');
         if ($log->delete("{$id}")) {
             parent::operating(__ACTION__, 0, '登录日志删除成功');
             R('Public/errjson', array('ok'));
         } else {
             parent::operating(__ACTION__, 1, '登录日志删除失败');
             R('Public/errjson', array('删除失败'));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #2
0
 public function del()
 {
     //验证用户权限
     parent::userauth(63);
     if ($this->isAjax()) {
         if (!($delid = explode(',', $this->_post('delid')))) {
             R('Public/errjson', array('请选中后再删除'));
         }
         //将最后一个元素弹出栈
         array_pop($delid);
         $id = join(',', $delid);
         $dmenu = M('dmenu');
         if ($dmenu->delete("{$id}")) {
             parent::operating(__ACTION__, 0, '删除成功');
             R('Public/errjson', array('ok'));
         } else {
             parent::operating(__ACTION__, 1, '删除失败:' . $dmenu->getError());
             R('Public/errjson', array('删除失败'));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #3
0
 public function roledel()
 {
     //验证用户权限
     parent::userauth(10);
     //判断是否是ajax请求
     if ($this->isAjax()) {
         if (I('post.post', '') == 'ok') {
             $id = I('post.id', '');
             if ($id == '' || !is_numeric($id)) {
                 parent::operating(__ACTION__, 1, '参数错误');
                 R('Public/errjson', array('参数ID类型错误'));
             } else {
                 $id = intval($id);
                 if ($id == 1) {
                     parent::operating(__ACTION__, 1, '不能删除系统默认角色');
                     R('Public/errjson', array('不能删除此角色'));
                 }
                 $role = M('role');
                 $where = array('ID' => $id);
                 if ($role->where($where)->getField('ID')) {
                     $role->where($where)->delete();
                     parent::operating(__ACTION__, 0, '删除成功');
                     R('Public/errjson', array('ok'));
                 } else {
                     parent::operating(__ACTION__, 1, '数据不存在:' . $id);
                     R('Public/errjson', array('数据不存在'));
                 }
             }
         } else {
             parent::operating(__ACTION__, 1, '非法请求');
             R('Public/errjson', array('非法请求'));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #4
0
 public function indel()
 {
     //验证用户权限
     parent::userauth(83);
     if ($this->isAjax()) {
         if (!($delid = explode(',', $this->_post('delid')))) {
             R('Public/errjson', array('请选中后再删除'));
         }
         //将最后一个元素弹出栈
         array_pop($delid);
         $id = join(',', $delid);
         $operating = M('operating');
         if ($operating->delete("{$id}")) {
             R('Public/errjson', array('ok'));
         } else {
             R('Public/errjson', array('删除失败'));
         }
     } else {
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #5
0
 public function newsindel()
 {
     //验证用户权限
     parent::userauth(51);
     if ($this->isAjax()) {
         if (!($delid = explode(',', I('post.delid', '')))) {
             R('Public/errjson', array('请选中后再删除'));
         }
         //将最后一个元素弹出栈
         array_pop($delid);
         $id = join(',', $delid);
         $news = M('news');
         if ($news->delete("{$id}")) {
             parent::operating(__ACTION__, 0, '删除成功');
             R('Public/errjson', array('ok'));
         } else {
             parent::operating(__ACTION__, 1, '删除失败');
             R('Public/errjson', array('删除失败'));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #6
0
 public function moduledel()
 {
     //验证用户权限
     parent::userauth(28);
     //判断是否是ajax请求
     if ($this->isAjax()) {
         $id = I('post.id', '');
         if ($id == '' || !is_numeric($id)) {
             parent::operating(__ACTION__, 1, '参数错误');
             R('Public/errjson', array('参数ID类型错误'));
         } else {
             $id = intval($id);
             $module = M('module');
             $where = array('ID' => $id);
             if ($module->where($where)->getField('ID')) {
                 $module->where($where)->delete();
                 parent::operating(__ACTION__, 0, '删除模块成功');
                 R('Public/errjson', array('ok'));
             } else {
                 parent::operating(__ACTION__, 1, '数据不存在');
                 R('Public/errjson', array('数据不存在'));
             }
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #7
0
 public function in_user_del()
 {
     //验证用户权限
     parent::userauth(5);
     if ($this->isAjax()) {
         if (!($delid = explode(',', I('post.delid', '')))) {
             R('Public/errjson', array('请选中后再删除'));
         }
         //将最后一个元素弹出栈
         array_pop($delid);
         if (in_array(1, $delid)) {
             R('Public/errjson', array('不能删除ID号为1的数据'));
         }
         $id = join(',', $delid);
         $user = M('user');
         if ($user->delete("{$id}")) {
             parent::operating(__ACTION__, 0, '批量删除ID为:' . $id . '的数据');
             R('Public/errjson', array('ok'));
         } else {
             parent::operating(__ACTION__, 1, '批量删除用户失败:' . $user->getError());
             R('Public/errjson', array($user->getError()));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #8
0
 public function filemovedo()
 {
     parent::userauth(39);
     $moveid = I('post.moveid', '');
     $sid = I('post.sid', '');
     //切割文件ID
     $arrid = explode(',', $moveid);
     array_pop($arrid);
     //判断目录ID是否正确
     if ($sid != '' && is_numeric($sid)) {
         $file = M('file');
         $data['Sid'] = $sid;
         //循环更新对应文件目录
         for ($i = 0; $i < count($arrid); $i++) {
             if (!$file->where('ID=' . $arrid[$i])->save($data)) {
                 //失败直接返回
                 parent::operating(__ACTION__, 1, '文件移动失败');
                 R('Public/errjson', array('文件移动失败'));
             }
         }
         parent::operating(__ACTION__, 0, '文件移动成功');
         R('Public/errjson', array('ok'));
     } else {
         parent::operating(__ACTION__, 1, '目录ID获取失败');
         R('Public/errjson', array('目录ID获取失败'));
     }
 }
Пример #9
0
 public function cdel()
 {
     //验证用户权限
     parent::userauth(15);
     //判断是否是ajax请求
     if ($this->isAjax()) {
         if (I('post.post', '') == 'ok') {
             $id = I('post.id', '');
             if ($id == '' || !is_numeric($id)) {
                 parent::operating(__ACTION__, 1, '参数错误');
                 R('Public/errjson', array('参数ID类型错误'));
             } else {
                 $id = intval($id);
                 $role = M('competence');
                 $where = array('ID' => $id, 'Sid' => $id, '_logic' => 'OR');
                 if ($role->where("ID={$id}")->getField('ID')) {
                     $role->where($where)->delete();
                     parent::operating(__ACTION__, 0, '删除成功');
                     R('Public/errjson', array('ok'));
                 } else {
                     parent::operating(__ACTION__, 1, '删除失败');
                     R('Public/errjson', array('数据不存在'));
                 }
             }
         } else {
             parent::operating(__ACTION__, 1, '非法请求');
             R('Public/errjson', array('非法请求'));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }
Пример #10
0
 public function with_indel()
 {
     //验证用户权限
     parent::userauth(81);
     if ($this->isAjax()) {
         if (!($delid = explode(',', I('post.delid', '')))) {
             R('Public/errjson', array('请选中后再删除'));
         }
         //将最后一个元素弹出栈
         array_pop($delid);
         $id = join(',', $delid);
         $with = M('with');
         $co['ID'] = array('in', $id);
         if ($with->delete("{$id}")) {
             parent::operating(__ACTION__, 0, '删除成功');
             R('Public/errjson', array('ok'));
         } else {
             parent::operating(__ACTION__, 1, '删除失败');
             R('Public/errjson', array('删除失败'));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         $this->error('非法请求');
     }
 }
Пример #11
0
 public function client_c_indel()
 {
     //验证用户权限
     parent::userauth(76);
     if ($this->isAjax()) {
         if (!($delid = explode(',', I('post.delid', '')))) {
             R('Public/errjson', array('请选中后再删除'));
         }
         //将最后一个元素弹出栈
         array_pop($delid);
         $id = join(',', $delid);
         $client = M('client');
         $contact = M('contact');
         $co['Cid'] = array('in', $id);
         if ($client->delete("{$id}")) {
             $contact->where($co)->delete();
             parent::operating(__ACTION__, 0, '删除成功');
             R('Public/errjson', array('ok'));
         } else {
             parent::operating(__ACTION__, 1, '删除失败');
             R('Public/errjson', array('删除失败'));
         }
     } else {
         parent::operating(__ACTION__, 1, '非法请求');
         R('Public/errjson', array('非法请求'));
     }
 }