Ejemplo n.º 1
0
 function get_content()
 {
     if ($this->settings['cache_expire_time']) {
         /**先从缓存读取数据 缓存不存在或过期时再从表中查询*/
         include_once ROOT_PATH . 'lib/class/cache/cache.class.php';
         $cache_factory = cache_factory::get_instance();
         $cache_type = $this->settings['cache_type'] ? $this->settings['cache_type'] : 'file';
         $cache_driver = $cache_factory->get_cache_driver($cache_type);
         $input = $this->input;
         unset($input['access_token'], $input['lpip']);
         $cache_id = md5(serialize($input));
         $data = $cache_driver->get($cache_id);
         if ($data) {
             $this->addItem($data);
             $this->output();
         }
         /**先从缓存读取数据 缓存不存在或过期时再从表中查询*/
     }
     //$condition = $this->get_condition();
     $offset = $this->input['page'] ? $this->input['page_num'] * ($this->input['page'] - 1) : 0;
     $count = $this->input['page_num'] ? intval($this->input['page_num']) : 20;
     $con = $con_count = $this->con_process();
     $con['offset'] = $offset;
     $con['count'] = $count;
     $content = $this->obj->get_content($con);
     include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
     $this->publishcontent = new publishcontent();
     $content_type = $this->publishcontent->get_all_content_type();
     $pub_content_bundle = array();
     foreach ((array) $content_type as $k => $v) {
         $pub_content_bundle[] = $v['bundle_id'];
     }
     include_once ROOT_PATH . 'lib/class/auth.class.php';
     $this->auth = new Auth();
     $app_info = $this->auth->get_app();
     $module = array();
     foreach ((array) $app_info as $k => $v) {
         if (!empty($v)) {
             $module[$v['bundle']] = $v['name'];
         }
     }
     $cidArr = array();
     $conArr = array();
     $other_content = array();
     foreach ((array) $content as $row) {
         if (!in_array($row['app_bundle'], $pub_content_bundle)) {
             $row['bundle_name'] = $module[$row['app_bundle']];
             if (!$row['bundle_name']) {
                 $row['bundle_name'] = $this->settings["App_{$row['app_bundle']}"]['name'];
             }
             if (!$row['bundle_name']) {
                 $row['bundle_name'] = $row['app_bundle'];
             }
             $row['content_url'] = $row['url'];
             $row['access_nums'] = $row['num'];
             $other_content[] = $row;
         } else {
             $cidArr[] = $row['cid'];
             $conArr[$row['cid']] = array('access_nums' => $row['num']);
         }
     }
     $cidStr = implode(',', $cidArr);
     $ret = $this->publishcontent->get_content_by_cid($cidStr);
     if (!is_array($ret)) {
         //return array();
     }
     $ret = (array) $ret;
     $arExistIds = array();
     foreach ($ret as $k => $v) {
         $arExistIds[] = $v['cid'];
         $ret[$k]['bundle_name'] = $module[$v['bundle_id']];
         if (!$ret[$k]['bundle_name']) {
             $ret[$k]['bundle_name'] = $this->settings["App_{$v['bundle_id']}"]['name'];
         }
         if (!$ret[$k]['bundle_name']) {
             $ret[$k]['bundle_name'] = $v['bundle_id'];
         }
         $ret[$k] = array_merge($ret[$k], $conArr[$k]);
     }
     $ret = array_merge($ret, $other_content);
     //发布库删除没有更新统计时条数不准确 下面代码为解决此bug
     //对比cid差集
     $delCid = array_diff($cidArr, $arExistIds);
     //更新已经不存在的内容
     if (!empty($delCid)) {
         $cid = implode(',', $delCid);
         $sql = "UPDATE " . DB_PREFIX . "nums SET del = 1 WHERE cid IN(" . $cid . ")";
         $this->db->query($sql);
         include_once CUR_CONF_PATH . 'lib/cache.class.php';
         $cache = new CacheFile();
         $table = $cache->get_cache('access_table_name');
         $table = convert_table_name($table);
         if ($table) {
             $table_str = implode(',', $table);
         }
         $sql = "ALTER TABLE " . DB_PREFIX . "merge UNION(" . $table_str . ")";
         $this->db->query($sql);
         $sql = "UPDATE " . DB_PREFIX . "merge SET del = 1 WHERE cid IN(" . $cid . ")";
         $this->db->query($sql);
     }
     $ret = hg_array_sort($ret, 'access_nums', 'DESC');
     $pagearr = $this->obj->get_content($con_count, 1);
     $pagearr['page_num'] = $count;
     $pagearr['total_num'] = $pagearr['total'];
     $pagearr['total_page'] = ceil($pagearr['total'] / $count);
     $pagearr['current_page'] = floor($offset / $count) + 1;
     $ret = array('content' => array_values($ret), 'page' => $pagearr);
     if ($this->settings['cache_expire_time']) {
         /*将数据写入缓存*/
         $cache_driver->set($cache_id, $ret, $this->settings['cache_expire_time']);
         /*将数据写入缓存*/
     }
     $this->addItem($ret);
     $this->output();
 }
Ejemplo n.º 2
0
 public function show($condition, $offset, $count)
 {
     include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
     $this->publishcontent = new publishcontent();
     $content_type = $this->publishcontent->get_all_content_type();
     $pub_content_bundle = array();
     foreach ((array) $content_type as $k => $v) {
         $pub_content_bundle[] = $v['bundle_id'];
     }
     include_once ROOT_PATH . 'lib/class/auth.class.php';
     $this->auth = new Auth();
     $app_info = $this->auth->get_app();
     $module = array();
     foreach ((array) $app_info as $k => $v) {
         if (!empty($v)) {
             $module[$v['bundle']] = $v['name'];
         }
     }
     $limit = " LIMIT " . $offset . " , " . $count;
     $sql = "SELECT * FROM " . DB_PREFIX . "nums WHERE 1 " . $condition . $limit;
     $q = $this->db->query($sql);
     $cidArr = array();
     $conArr = array();
     $other_content = array();
     while ($row = $this->db->fetch_array($q)) {
         if (!in_array($row['app_bundle'], $pub_content_bundle)) {
             $row['bundle_name'] = $module[$row['app_bundle']];
             if (!$row['bundle_name']) {
                 $row['bundle_name'] = $this->settings["App_{$row['app_bundle']}"]['name'];
             }
             if (!$row['bundle_name']) {
                 $row['bundle_name'] = $row['app_bundle'];
             }
             $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']);
             $row['content_url'] = $row['url'];
             $other_content[] = $row;
         } else {
             $cidArr[] = $row['cid'];
             $conArr[$row['cid']] = array('access_nums' => $row['access_nums'], 'update_time' => date('Y-m-d H:i:s', $row['update_time']));
         }
     }
     $cidStr = implode(',', $cidArr);
     //		include_once(ROOT_PATH . 'lib/class/publishcontent.class.php');
     //		$this->publishcontent = new publishcontent();
     $ret = $this->publishcontent->get_content_by_cid($cidStr);
     if (!is_array($ret)) {
         //return array();
     }
     $ret = (array) $ret;
     $arExistIds = array();
     foreach ($ret as $k => $v) {
         $arExistIds[] = $v['cid'];
         $ret[$k]['bundle_name'] = $module[$v['bundle_id']];
         if (!$ret[$k]['bundle_name']) {
             $ret[$k]['bundle_name'] = $this->settings["App_{$v['bundle_id']}"]['name'];
         }
         if (!$ret[$k]['bundle_name']) {
             $ret[$k]['bundle_name'] = $v['bundle_id'];
         }
         $ret[$k] = array_merge($ret[$k], $conArr[$k]);
     }
     $ret = array_merge($ret, $other_content);
     //发布库删除没有更新统计时条数不准确 下面代码为解决此bug
     //对比cid差集
     $delCid = array_diff($cidArr, $arExistIds);
     //更新已经不存在的内容
     if (!empty($delCid)) {
         $cid = implode(',', $delCid);
         $sql = "UPDATE " . DB_PREFIX . "nums SET del = 1 WHERE cid IN(" . $cid . ")";
         $this->db->query($sql);
         include_once CUR_CONF_PATH . 'lib/cache.class.php';
         $cache = new CacheFile();
         $table = $cache->get_cache('access_table_name');
         $table = convert_table_name($table);
         if ($table) {
             $table_str = implode(',', $table);
         }
         $sql = "ALTER TABLE " . DB_PREFIX . "merge UNION(" . $table_str . ")";
         $this->db->query($sql);
         $sql = "UPDATE " . DB_PREFIX . "merge SET del = 1 WHERE cid IN(" . $cid . ")";
         $this->db->query($sql);
     }
     //		switch($this->input['access_nums'])
     //		{
     //			case 1:
     //				$info = hg_array_sort($ret,'access_nums','DESC');
     //				break;
     //			case 2:
     //				$info = hg_array_sort($ret,'access_nums','ASC');
     //				break;
     //			default:
     //				$info = hg_array_sort($ret,'update_time','DESC');
     //		}
     $info = hg_array_sort($ret, 'access_nums', 'DESC');
     return $info;
 }
Ejemplo n.º 3
0
 function show()
 {
     $id = intval($this->input['sort_id']);
     if ($id) {
         $sql = "SELECT * FROM " . DB_PREFIX . "webapp_rank WHERE id = " . $id;
         $sort_data = $this->db->query_first($sql);
         if (empty($sort_data)) {
             $this->errorOutput(INVALID_SORT_ID);
         }
         if ($sort_data['start_time']) {
             $create_time = $sort_data['start_time'];
         }
         if ($sort_data['duration']) {
             $duration = $sort_data['duration'] * 60;
         }
         $map = array('ding' => 'up', 'cai' => 'down', 'pingfen' => 'score');
         if (!in_array($sort_data['ranktype'], array_flip($map))) {
             $this->errorOutput(INVALID_SORT_TYPE);
         }
         $sort_data['app_uniqueid'] = $sort_data['type'] ? explode(',', $sort_data['type']) : '';
         $sort_data['limit_num'] = $sort_data['limit_num'] ? $sort_data['limit_num'] : 20;
         $data_limit = " LIMIT 0, " . intval($sort_data['limit_num']);
         if ($create_time || $duration) {
             $sql = 'SELECT content_type,listid, count(*) as total FROM ' . DB_PREFIX . 'webapp_list WHERE 1 ';
             $where = ' AND mark_name = "' . $sort_data['ranktype'] . '"';
             if ($sort_data['app_uniqueid']) {
                 $where .= ' AND content_type IN("' . implode('","', $sort_data['app_uniqueid']) . '")';
             }
             if ($create_time && !$duration) {
                 $where .= ' AND create_time >= ' . $create_time;
             }
             if ($duration && !$create_time) {
                 $where .= ' AND create_time >= ' . (TIMENOW - $duration);
             }
             if ($create_time && $duration) {
                 $where .= ' AND create_time >= ' . $create_time . ' AND create_time <= ' . ($create_time + $duration);
             }
             $gourpby = ' GROUP BY listid ';
             $orderby = ' ORDER BY total ' . $sort_data['sort_type'];
             $sql .= $where . $gourpby . $orderby . $data_limit;
             $query = $this->db->query($sql);
             while ($row = $this->db->fetch_array($query)) {
                 $listid[] = $row['listid'];
             }
             if ($listid) {
                 $sql = 'SELECT content_id,' . $map[$sort_data['ranktype']] . ' FROM ' . DB_PREFIX . 'webapp WHERE id iN(' . implode(',', $listid) . ')';
                 $query = $this->db->query($sql);
                 while ($row = $this->db->fetch_array($query)) {
                     $cidArr[] = $row['content_id'];
                     $conArr[$row['content_id']] = $row[$map[$sort_data['ranktype']]];
                 }
             }
         } else {
             $sort_data['sort_type'] = $sort_data['sort_type'] && in_array($sort_data['sort_type'], array('asc', 'desc')) ? $sort_data['sort_type'] : 'desc';
             $orderby = ' ORDER BY ' . $map[$sort_data['ranktype']] . ' ' . $sort_data['sort_type'];
             if (!$sort_data['app_uniqueid']) {
                 $where = '';
             } else {
                 $where = '  AND app_uniqueid IN("' . implode('","', $sort_data['app_uniqueid']) . '")';
             }
             $sql = "SELECT content_id, " . $map[$sort_data['ranktype']] . " FROM " . DB_PREFIX . "webapp WHERE 1 " . $where . $orderby . $data_limit;
             $q = $this->db->query($sql);
             $cidArr = array();
             while ($row = $this->db->fetch_array($q)) {
                 $cidArr[] = $row['content_id'];
                 $conArr[$row['content_id']] = $row[$map[$sort_data['ranktype']]];
             }
         }
         if ($cidArr) {
             $cidStr = implode(',', $cidArr);
             if ($cidStr) {
                 include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
                 $this->publishtcontent = new publishcontent();
                 $ret = $this->publishtcontent->get_content_by_rids($cidStr);
                 if (is_array($ret) && count($ret) > 0) {
                     foreach ($ret as $k => $v) {
                         $ret[$k]['_value'] = $conArr[$v['rid']];
                     }
                 }
                 if (is_array($ret) && count($ret)) {
                     $ret = hg_array_sort($ret, '_value', strtoupper($sort_data['sort_type']));
                     foreach ($ret as $k => $v) {
                         $this->addItem($v);
                     }
                 }
             }
         }
     }
     $this->output();
 }
Ejemplo n.º 4
0
 /**
  * 获取某一个聊天室的消息内容
  * 移动app接口 手机端调用  前段聊天室调用
  */
 public function detail()
 {
     $session_id = intval($this->input['session_id']);
     if (!$session_id) {
         $this->errorOutput(NO_SESSION_ID);
     }
     //        if(!$this->user['user_id']) {
     //            $this->errorOutput(NOT_LOGIN);
     //        }
     $condition = $this->get_condition();
     $condition .= ' AND session_id = ' . $session_id;
     $condition .= ' ORDER BY id DESC';
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $data_limit = ' LIMIT ' . $offset . ', ' . $count;
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'message WHERE 1 ' . $condition . $data_limit;
     $q = $this->db->query($sql);
     $messages = $messages_id = array();
     while ($row = $this->db->fetch_array($q)) {
         if (isset($row['send_time'])) {
             $row['send_time_show'] = date('Y-m-d H:i:s', $row['send_time']);
         }
         isset($row['status']) && ($row['status_text'] = $this->settings['status_show'][$row['status']]);
         $row['send_uavatar'] = $row['send_uavatar'] ? unserialize($row['send_uavatar']) : array();
         $row['imgs'] = $row['imgs'] ? unserialize($row['imgs']) : array();
         $row['videos'] = $row['videos'] ? unserialize($row['videos']) : array();
         $row['audios'] = $row['audios'] ? unserialize($row['audios']) : array();
         //手机会员昵称处理  隐藏手机号中间四位
         if ($row['send_utype'] == 'shouji') {
             $row['send_uname'] = hg_hidtel($row['send_uname']);
         }
         //手机会员昵称处理 隐藏手机号中间四位
         $messages[] = $row;
     }
     $messages = hg_array_sort($messages, 'id', 'ASC');
     if ($offset === 0) {
         //更新用户的最近阅读时间
         if ($this->user['user_id']) {
             $utype = $this->user['user_type'];
             $sql = 'UPDATE ' . DB_PREFIX . 'session_user SET unread_counts = 0 AND last_read_time = ' . TIMENOW . '' . ' WHERE session_id = ' . $session_id . ' AND uid = ' . $this->user['user_id'] . ' AND utype = \'' . $utype . '\'';
             $this->db->query($sql);
         }
     }
     $this->addItem(array('messages' => $messages));
     $this->output();
 }
Ejemplo n.º 5
0
 public function show()
 {
     if (!$this->input['sort_id']) {
         $this->errorOutput(NO_SORTID);
     }
     $sql = "SELECT status,output_type,column_id FROM " . DB_PREFIX . "ranking_sort WHERE id = " . $this->input['sort_id'];
     $sort = $this->db->query_first($sql);
     include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
     $this->publishcontent = new publishcontent();
     $content_type = $this->publishcontent->get_all_content_type();
     $pub_content_bundle = array();
     foreach ((array) $content_type as $k => $v) {
         $pub_content_bundle[] = $v['bundle_id'];
     }
     include_once ROOT_PATH . 'lib/class/auth.class.php';
     $this->auth = new Auth();
     $app_info = $this->auth->get_app();
     $module = array();
     foreach ((array) $app_info as $k => $v) {
         if (!empty($v)) {
             $module[$v['bundle']] = $v['name'];
         }
     }
     $condition = $this->get_condition();
     $condition .= $this->input['orderby'] ? " ORDER BY " . $this->input['orderby'] : " ORDER BY count";
     $condition .= $this->input['descasc'] ? " " . $this->input['descasc'] : ' DESC';
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $data_limit = " LIMIT " . $offset . ", " . $count;
     $sql = "SELECT * FROM " . DB_PREFIX . "ranking_cont WHERE 1 " . $condition . $data_limit;
     $q = $this->db->query($sql);
     $cidArr = array();
     $conArr = array();
     $other_content = array();
     while ($row = $this->db->fetch_array($q)) {
         if ($row['app_bundle'] && !in_array($row['app_bundle'], $pub_content_bundle)) {
             $row['bundle_name'] = $module[$row['app_bundle']];
             if (!$row['bundle_name']) {
                 $row['bundle_name'] = $this->settings["App_{$row['app_bundle']}"]['name'];
             }
             if (!$row['bundle_name']) {
                 $row['bundle_name'] = $row['app_bundle'];
             }
             $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']);
             $row['content_url'] = $row['url'];
             $other_content[] = $row;
         } else {
             $cidArr[] = $row['cid'];
             $conArr[$row['cid']] = $row['count'];
         }
     }
     $cidStr = implode(',', $cidArr);
     //		$sql = "SELECT * FROM " . DB_PREFIX ."app WHERE  father != 0" ;
     //		$q = $this->db->query($sql);
     //		$module = array();
     //		while($row = $this->db->fetch_array($q))
     //		{
     //			$module[$row['bundle']] = $row['name'];
     //		}
     if ($cidStr) {
         if ($sort['output_type'] == 1) {
             include_once ROOT_PATH . 'lib/class/publishconfig.class.php';
             $this->publishconfig = new publishconfig();
             $ret = $this->publishconfig->get_column_info_by_ids($cidStr);
         } else {
             include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
             $this->publishtcontent = new publishcontent();
             $useColumn = array();
             foreach ($cidArr as $cv) {
                 $useColumn[$cv] = $sort['column_id'];
             }
             $ret = $this->publishtcontent->get_content_by_cid($cidStr, $useColumn);
         }
     }
     foreach ((array) $ret as $k => $v) {
         $ret[$k]['bundle_name'] = $module[$v['bundle_id']];
         if (!$ret[$k]['bundle_name']) {
             $ret[$k]['bundle_name'] = $this->settings["App_{$v['bundle_id']}"]['name'];
         }
         if (!$ret[$k]['bundle_name']) {
             $ret[$k]['bundle_name'] = $v['bundle_id'];
         }
         $ret[$k]['count'] = $sort['output_type'] == 1 ? $conArr[$v['id']] : $conArr[$v['cid']];
         //栏目时统计记录的是id  内容统计记录的是cid
     }
     $ret = (array) $ret;
     $ret = array_merge($other_content, $ret);
     $ret = hg_array_sort($ret, 'count', 'DESC');
     if (!empty($ret) && is_array($ret)) {
         foreach ($ret as $k => $v) {
             if ($sort['output_type'] == 1) {
                 $v['title'] = $v['name'];
             }
             $this->addItem($v);
         }
     }
     $this->output();
 }
Ejemplo n.º 6
0
 function show()
 {
     $id = intval($this->input['sort_id']);
     $column_id = $this->input['column_id'];
     $exclude_column_id = $this->input['exclude_column_id'];
     if ($id) {
         $sql = "SELECT status,output_type,column_id FROM " . DB_PREFIX . "ranking_sort WHERE id = " . $id;
         $sort = $this->db->query_first($sql);
         if (empty($sort) || $sort['status'] != 1) {
             $this->errorOutput("unexist or unaudited");
         }
         include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
         $this->publishcontent = new publishcontent();
         $content_type = $this->publishcontent->get_all_content_type();
         $pub_content_bundle = array();
         foreach ((array) $content_type as $k => $v) {
             $pub_content_bundle[] = $v['bundle_id'];
         }
         $offset = intval($this->input['offset']) ? intval($this->input['offset']) : 0;
         $count = intval($this->input['count']) ? intval($this->input['count']) : 30;
         $data_limit = " LIMIT " . $offset . ", " . $count;
         $sql = "SELECT * FROM " . DB_PREFIX . "ranking_cont WHERE sort_id = " . $id . " ORDER BY count DESC " . $data_limit;
         $q = $this->db->query($sql);
         $cidArr = array();
         $conArr = array();
         $other_content = array();
         while ($row = $this->db->fetch_array($q)) {
             if ($row['app_bundle'] && !in_array($row['app_bundle'], $pub_content_bundle)) {
                 $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']);
                 $row['content_url'] = $row['url'];
                 $other_content[] = $row;
             } else {
                 $cidArr[] = $row['cid'];
                 $conArr[$row['cid']] = $row['count'];
             }
         }
         $cidStr = implode(',', $cidArr);
         $blDirectReturn = $this->input['direct_return'] && $this->input['direct_return'] != 'false' ? 1 : 0;
         if ($blDirectReturn) {
             $this->addItem($cidStr);
         } else {
             if ($cidStr) {
                 if ($sort['output_type'] == 1) {
                     include_once ROOT_PATH . 'lib/class/publishconfig.class.php';
                     $this->publishconfig = new publishconfig();
                     $ret = $this->publishconfig->get_column_info_by_ids($cidStr);
                 } else {
                     include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
                     $this->publishtcontent = new publishcontent();
                     $useColumn = array();
                     if ($column_id) {
                         $sort['column_id'] = $column_id;
                     }
                     if ($exclude_column_id) {
                         $exclude_column_id = explode(',', $exclude_column_id);
                         $sort['column_id'] = explode(',', $sort['column_id']);
                         $sort['column_id'] = array_diff($sort['column_id'], $exclude_column_id);
                         $sort['column_id'] = implode(',', $sort['column_id']);
                     }
                     foreach ($cidArr as $cv) {
                         $useColumn[$cv] = $sort['column_id'];
                     }
                     $ret = $this->publishtcontent->get_content_by_cid($cidStr, $useColumn);
                 }
                 $arExistIds = array();
                 if (is_array($ret) && count($ret) > 0) {
                     foreach ($ret as $k => $v) {
                         $arExistIds[] = $sort['output_type'] == 1 ? $v['id'] : $v['cid'];
                         //栏目时统计记录的是id  内容统计记录的是cid
                         $ret[$k]['count'] = $sort['output_type'] == 1 ? $conArr[$v['id']] : $conArr[$v['cid']];
                     }
                 }
                 //发布库删除没有更新统计时条数不准确 下面代码为解决此bug
                 //对比cid差集
                 $cidStr = explode(',', $cidStr);
                 $delCid = array_diff($cidStr, $arExistIds);
                 //更新已经不存在的内容
                 if (0 && !empty($delCid)) {
                     $cid = implode(',', $delCid);
                     $sql = "UPDATE " . DB_PREFIX . "nums SET del = 1 WHERE cid IN(" . $cid . ")";
                     $this->db->query($sql);
                     include_once CUR_CONF_PATH . 'lib/cache.class.php';
                     $cache = new CacheFile();
                     $table = $cache->get_cache('access_table_name');
                     $table = convert_table_name($table);
                     if ($table) {
                         $table_str = implode(',', $table);
                     }
                     $sql = "ALTER TABLE " . DB_PREFIX . "merge UNION(" . $table_str . ")";
                     $this->db->query($sql);
                     $sql = "UPDATE " . DB_PREFIX . "merge SET del = 1 WHERE cid IN(" . $cid . ")";
                     $this->db->query($sql);
                     $sql = "DELETE FROM " . DB_PREFIX . "ranking_cont WHERE sort_id=" . $id . " AND cid IN(" . $cid . ")";
                     $this->db->query($sql);
                 }
                 //
                 $ret = (array) $ret;
                 $ret = array_merge($other_content, $ret);
                 if (is_array($ret) && count($ret)) {
                     $ret = hg_array_sort($ret, 'count', 'DESC');
                     foreach ($ret as $k => $v) {
                         if ($sort['output_type'] == 1) {
                             $v['title'] = $v['name'];
                         }
                         $this->addItem($v);
                     }
                 }
             }
         }
     } else {
         $sql = "SELECT * FROM " . DB_PREFIX . "ranking_sort WHERE status = 1 ";
         $q = $this->db->query($sql);
         $ret = array();
         while ($row = $this->db->fetch_array($q)) {
             $ret[] = $row;
         }
         if ($ret) {
             foreach ($ret as $k => $v) {
                 $this->addItem($v);
             }
         }
     }
     $this->output();
 }