예제 #1
0
 /**
  * 按时间倒序文件
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-06-27 16:30:54
  *
  * @param array $a 文件a
  * @param array $b 文件b
  *
  * @return int -1,0,1
  */
 private function _cmp($a, $b)
 {
     static $sort = null;
     static $order = null;
     static $array = null;
     if (null === $sort) {
         $sort = Filter::string('sort', 'get', 'time');
         //排序字段
         $sort = in_array($sort, array('time', 'size', 'filename')) ? $sort : 'time';
         $order = empty($_GET['dir']) ? Filter::string('order', 'get') : Filter::string('dir', 'get');
         //排序
         $order = toggle_order($order);
         $array = 'ASC' == $order ? array(1, -1) : array(-1, 1);
     }
     if (isset($a['is_file']) && isset($b['is_file'])) {
         //都是文件
         return $a[$sort] > $b[$sort] ? $array[0] : $array[1];
     } elseif (isset($a['is_file']) && !isset($b['is_file'])) {
         //$a文件,$b文件夹
         return $array[0];
     } elseif (!isset($a[$sort]) && isset($b[$sort])) {
         //$a文件夹,$b文件
         return $array[1];
     }
     return 0;
 }
예제 #2
0
 /**
  * 列表
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-06-07 11:09:51
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     if (!in_array($sort, $this->_getDbFields())) {
         $log = __METHOD__ . ': ' . __LINE__ . ',' . L('QUERY,CONTROLLER_NAME,%。,ORDER,COLUMN') . $sort . L('NOT_EXIST');
         C('TRIGGER_ERROR', array($log));
         $this->_model->addLog($log, LOG_TYPE_INVALID_PARAM);
         $this->_ajaxReturn(false, L('SERVER_ERROR'));
     }
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //开始时间
     $date_end = Filter::string('date_end', 'get');
     //结束时间
     $template_id = Filter::int('template_id', 'get');
     //
     $column = Filter::string('column', 'get');
     //搜索字段
     $where = array();
     if ('' !== $keyword && in_array($column, array('subject', 'content', 'email'))) {
         $where[$column] = $this->_buildMatchQuery($column, $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['add_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['add_time'][] = array('ELT', $date_end);
     }
     if (isset($where['add_time']) && count($where['add_time']) == 1) {
         $where['add_time'] = $where['add_time'][0];
     }
     if ($template_id) {
         $where['template_id'] = $template_id;
     }
     $total = $this->_model->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->where($where)->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $templates = $this->_getCache(false, 'Mail');
     foreach ($data as &$v) {
         $v['template_name'] = isset($templates[$id = $v['template_id']]) ? $templates[$id]['template_name'] : '';
     }
     $this->_ajaxReturn(true, '', $data, $total);
 }
 /**
  * 列表
  *
  * @author          mrmsl <*****@*****.**>
  * @lastmodify      2013-01-22 10:40:26 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = 'a.' . $sort;
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //开始时间
     $date_end = Filter::string('date_end', 'get');
     //结束时间
     $column = Filter::string('column', 'get');
     //搜索字段
     $where = array();
     if ($keyword !== '' && in_array($column, array('username', 'realname', 'admin_id'))) {
         $where['b.' . $column] = $this->_buildMatchQuery('b.' . $column, $keyword, Filter::string('match_mode', 'get'), 'admin_id');
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['a.login_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['a.login_time'][] = array('ELT', $date_end);
     }
     if (isset($where['a.login_time']) && count($where['a.login_time']) == 1) {
         $where['a.login_time'] = $where['a.login_time'][0];
     }
     $where && $this->_model->join('JOIN ' . TB_ADMIN . ' AS b ON a.admin_id=b.admin_id');
     $total = $this->_model->alias('a')->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->alias('a')->join('JOIN ' . TB_ADMIN . ' AS b ON a.admin_id=b.admin_id')->where($where)->field('a.*,b.username,b.realname,INET_NTOA(a.login_ip) AS login_ip')->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
 }
예제 #4
0
 /**
  * 列表
  *
  * @author          mrmsl <*****@*****.**>
  * @lastmodify      2013-01-22 10:40:26 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $this->_getDbFields()) ? $sort : $this->_pk_field;
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //注册开始时间
     $date_end = Filter::string('date_end', 'get');
     //注册结束时间
     $log_type = Filter::int('log_type', 'get');
     //日志类型
     $where = $log_type != LOG_TYPE_ALL ? array('log_type' => $log_type) : array();
     if ($keyword !== '') {
         $where['content'] = $this->_buildMatchQuery('content', $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['log_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['log_time'][] = array('ELT', $date_end);
     }
     if (isset($where['log_time']) && count($where['log_time']) == 1) {
         $where['log_time'] = $where['log_time'][0];
     }
     $total = $this->_model->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_LOG') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->where($where)->field('*,INET_NTOA(user_ip) AS user_ip')->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_LOG') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
 }
예제 #5
0
 /**
  * 管理员列表
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2012-12-26 14:22:09
  * @lastmodify      2013-03-31 19:03:13 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $db_fields = $this->_getDbFields();
     //表字段
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $db_fields) ? $sort : $this->_pk_field;
     $order = empty($_GET['dir']) ? Filter::string('order', 'get') : Filter::string('dir', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //注册开始时间
     $date_end = Filter::string('date_end', 'get');
     //注册结束时间
     $cate_id = Filter::int('cate_id', 'get');
     //所属管理组
     $column = Filter::string('column', 'get');
     //搜索字段
     $is_delete = Filter::int('is_delete', 'get');
     //删除
     $is_issue = Filter::int('is_issue', 'get');
     //状态
     $where = array();
     if ($keyword !== '' && in_array($column, array('title', 'seo_keyword', 'seo_description', 'content', 'from_name', 'from_url'))) {
         $where['' . $column] = $this->_buildMatchQuery('' . $column, $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['add_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['add_time'][] = array('ELT', $date_end);
     }
     if (isset($where['add_time']) && count($where['add_time']) == 1) {
         $where['add_time'] = $where['add_time'][0];
     }
     if (-1 != $is_delete) {
         //删除
         $where['is_delete'] = $is_delete;
     }
     if (-1 != $is_issue) {
         //状态
         $where['is_issue'] = $is_issue;
     }
     if ($cate_id) {
         $cate_arr = $this->_getCache($cate_id, 'Category');
         if (!$cate_arr) {
             $this->_model->addLog(L("INVALID_PARAM,%:,BELONG_TO_CATEGORY,%cate_id({$cate_id}),NOT_EXIST"), LOG_TYPE_INVALID_PARAM);
             $this->_ajaxReturn(true);
         }
         $where['cate_id'] = array('IN', $this->_getChildrenIds($cate_id, true, true, 'Category'));
     }
     $total = $this->_model->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_BLOG') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->where($where)->field('content', true)->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_BLOG') . L('LIST,ERROR'));
     //出错
     $cate_arr = $this->_getCache(false, 'Category');
     foreach ($data as &$v) {
         $v['cate_name'] = $cate_arr[$v['cate_id']]['cate_name'];
     }
     $this->_ajaxReturn(true, '', $data, $total);
 }
예제 #6
0
 /**
  * 列表
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-05-13 15:54:17
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $db_fields = $this->_getDbFields();
     //表字段
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $db_fields) ? $sort : 'sort_order';
     $order = empty($_GET['dir']) ? Filter::string('order', 'get') : Filter::string('dir', 'get');
     //排序
     $order = toggle_order($order);
     $data = $this->_model->order($sort . ' ' . $order)->select();
     false === $data && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data);
 }
 /**
  * 列表管理
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2012-12-28 16:45:42
  * @lastmodify      2013-01-22 10:48:23 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', 'sort_order');
     //排序字段
     $order = empty($_GET['dir']) ? Filter::string('order', 'get') : Filter::string('dir', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $module_id = Filter::int('module_id', 'get');
     //所属模块
     $column = Filter::string('column', 'get');
     //搜索字段
     $where = array();
     if ($keyword !== '' && in_array($column, array('var_name', 'var_value_zh_cn', 'var_value_en'))) {
         $where['a.' . $column] = $this->_buildMatchQuery('a.' . $column, $keyword, Filter::string('match_mode', 'get'));
     }
     if ($module_id) {
         !$this->cache($module_id, 'LanguageModules') && $this->_ajaxReturn(true, '', array(), 0);
         $where['a.module_id'] = $module_id;
     }
     $total = $this->_model->alias('a')->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->alias('a')->join('JOIN ' . TB_LANGUAGE_MODULES . ' AS m ON a.module_id=m.module_id')->where($where)->field('a.*,m.module_name')->limit($page_info['limit'])->order('a.' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
 }
예제 #8
0
 /**
  * 列表管理
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2012-08-01 16:53:52
  * @lastmodify      2013-01-22 10:29:43 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $this->_getDbFields()) ? $sort : $this->_pk_field;
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $column = Filter::string('column', 'get');
     //搜索字段
     $keyword = Filter::string('keyword', 'get');
     //搜索关键字
     $menu_id = Filter::int('menu_id', 'get');
     //所属菜单
     $is_enable = Filter::int('is_enable', 'get');
     //是否启用 by mrmsl on 2012-09-15 02:18:18
     $where = array();
     if ($menu_id) {
         //getChildrenIds($item_id, $include_self = true, $return_array = false, $filename = null, $level_field = 'level', $node_field = 'node') {
         $menu_id = $this->_getChildrenIds($menu_id, true, false, 'Menu');
         $menu_id ? $where['a.menu_id'] = array('IN', $menu_id) : '';
     }
     if ($keyword !== '' && in_array($column, array($this->_name_column, 'field_code', 'validate_rule', 'input_name'))) {
         $where['a.' . $column] = $this->_buildMatchQuery('a.' . $column, $keyword, Filter::string('match_mode', 'get'));
     }
     if ($is_enable != -1) {
         //启用状态 by mrmsl on 2012-09-15 02:20:43
         $where['a.is_enable'] = array('EQ', $is_enable);
     }
     $total = $this->_model->alias('a')->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_ADMIN') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->alias('a')->join('JOIN ' . TB_MENU . ' AS m ON a.menu_id=m.menu_id')->where($where)->field('a.*,m.menu_name')->limit($page_info['limit'])->order('a.' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_FIELD') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
     //搜索
     if (!$field_id && $column && $keyword && in_array($column, array($this->_name_column, 'field_code', 'field_value'))) {
         $this->_queryTree($column, $keyword);
     } elseif ($field_id) {
         $this->_ajaxReturn(true, '', $this->_getTreeData($field_id, false));
     }
     $data = $this->_getCache(0, CONTROLLER_NAME . '_tree');
     $this->_ajaxReturn(true, '', $data, count($this->_getCache()));
 }
예제 #9
0
 /**
  * 管理员列表
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2012-12-26 14:22:09
  * @lastmodify      2013-03-31 19:03:13 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $db_fields = $this->_getDbFields();
     //表字段
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $db_fields) ? $sort : $this->_pk_field;
     $sort = 'c.' . $sort;
     $order = empty($_GET['dir']) ? Filter::string('order', 'get') : Filter::string('dir', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //添加开始时间
     $date_end = Filter::string('date_end', 'get');
     //添加结束时间
     $column = Filter::string('column', 'get');
     //搜索字段
     $type = Filter::int('type', 'get');
     //类型
     $status = Filter::int('auditing', 'get');
     //状态
     $reply_type = Filter::int('admin_reply_type', 'get');
     //回复状态
     $where = array();
     $column_arr = array('username' => 'c.username', 'email' => 'c.email', 'content' => 'c.content', 'blog_id' => 'c.blog_id', 'miniblog_id' => 'c.blog_id', 'blog_content' => 'b.content', 'blog_title' => 'b.title');
     if ($keyword !== '' && isset($column_arr[$column])) {
         $where[$column_arr[$column]] = $this->_buildMatchQuery($column_arr[$column], $keyword, Filter::string('match_mode', 'get'));
         if ('blog_content' == $column || 'blog_title' == $column) {
             $table = ' JOIN ' . TB_BLOG . ' AS b ON b.blog_id=c.blog_id';
         }
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['c.add_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['c.add_time'][] = array('ELT', $date_end);
     }
     if (isset($where['c.add_time']) && count($where['c.add_time']) == 1) {
         $where['c.add_time'] = $where['c.add_time'][0];
     }
     if (-1 != $type) {
         //类型
         $where['c.type'] = $type;
     }
     if (-1 != $status) {
         //状态
         $where['c.status'] = $status;
     }
     if (-1 != $reply_type) {
         //回复状态
         $where['c.admin_reply_type'] = $reply_type;
     }
     isset($table) && $this->_model->join($table);
     $total = $this->_model->alias('c')->where($where)->count('c.blog_id');
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     isset($table) && $this->_model->join($table);
     $data = $this->_model->alias('c')->field('c.*,INET_NTOA(user_ip) AS user_ip')->where($where)->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $selected = array(COMMENT_TYPE_BLOG => array(), COMMENT_TYPE_MINIBLOG => array());
     foreach ($data as $k => $v) {
         $type = $v['type'];
         $blog_id = $v['blog_id'];
         if (COMMENT_TYPE_BLOG == $type) {
             if (isset($selected[COMMENT_TYPE_BLOG][$blog_id])) {
                 $info = $selected[COMMENT_TYPE_BLOG][$blog_id];
             } else {
                 $info = $this->_model->table(TB_BLOG)->where('blog_id=' . $blog_id)->field('title,link_url')->find();
                 $selected[COMMENT_TYPE_BLOG][$blog_id] = $info;
             }
             $data[$k]['title'] = $info['title'];
             $data[$k]['link_url'] = $info['link_url'];
         } elseif (COMMENT_TYPE_MINIBLOG == $type) {
             if (isset($selected[COMMENT_TYPE_MINIBLOG][$blog_id])) {
                 $info = $selected[COMMENT_TYPE_MINIBLOG][$blog_id];
             } else {
                 $info = $this->_model->table(TB_MINIBLOG)->where('blog_id=' . $v['blog_id'])->field('add_time,link_url')->find();
                 $selected[COMMENT_TYPE_MINIBLOG][$blog_id] = $info;
             }
             $data[$k]['title'] = new_date('Y-m-d', $info['add_time']) . ' ' . L('MINIBLOG');
             $data[$k]['link_url'] = $info['link_url'];
         }
     }
     //end foreach
     $this->_ajaxReturn(true, '', $data, $total);
 }
예제 #10
0
 /**
  * 管理员列表
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2012-12-26 14:22:09
  * @lastmodify      2013-01-21 15:46:28 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $db_fields = $this->_getDbFields();
     //表字段
     $db_fields = array_filter($db_fields, create_function('$v', 'return strpos($v, "_") !== 0;'));
     //过滤_开头
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $db_fields) || $sort == 'is_lock' ? $sort : $this->_pk_field;
     $order = empty($_GET['dir']) ? Filter::string('order', 'get') : Filter::string('dir', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //注册开始时间
     $date_end = Filter::string('date_end', 'get');
     //注册结束时间
     $role_id = Filter::int('role_id', 'get');
     //所属管理组
     $column = Filter::string('column', 'get');
     //搜索字段
     $is_lock = Filter::int('is_lock', 'get');
     //锁定
     $is_restrict = Filter::int('is_restrict', 'get');
     //绑定登陆 by mrmsl on 2012-09-15 11:53:58
     $where = array();
     if ($keyword !== '' && in_array($column, array('username', 'realname'))) {
         $where['a.' . $column] = $this->_buildMatchQuery('a.' . $column, $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['a.add_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['a.add_time'][] = array('ELT', $date_end);
     }
     if (isset($where['a.add_time']) && count($where['a.add_time']) == 1) {
         $where['a.add_time'] = $where['a.add_time'][0];
     }
     if ($is_lock == 0) {
         //未锁定 by mrmsl on 2012-09-15 11:26:36
         $where['a.lock_end_time'] = array('ELT', APP_NOW_TIME);
     } elseif ($is_lock == 1) {
         //未锁定 by mrmsl on 2012-09-15 11:26:44
         $where['a.lock_start_time'] = array('ELT', APP_NOW_TIME);
         $where['a.lock_end_time'] = array('EGT', APP_NOW_TIME);
     }
     if ($role_id) {
         $where['a.role_id'] = $role_id;
     }
     if ($is_restrict == 0) {
         $where['a.is_restrict'] = $is_restrict;
     } elseif ($is_restrict == 1) {
         $where['a.is_restrict'] = $is_restrict;
     }
     $total = $this->_model->alias('a')->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_ADMIN') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $now = APP_NOW_TIME;
     $fields = str_replace(array(',a.password', ',a.mac_address', ',a.lock_start_time', ',a.lock_end_time', ',a.lock_memo'), '', join(',a.', $db_fields));
     $page_info = Filter::page($total);
     $data = $this->_model->alias('a')->join('JOIN ' . TB_ADMIN_ROLE . ' AS r ON a.role_id=r.role_id')->where($where)->field($fields . ',r.role_name,' . "(a.lock_start_time AND a.lock_start_time<{$now} AND a.lock_end_time AND a.lock_end_time>{$now}) AS is_lock")->limit($page_info['limit'])->order(($sort == 'is_lock' ? 'is_lock' : 'a.' . $sort) . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_ADMIN') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
 }