one(array('key' => $key)); if (!$info) { $insert['key'] = $key; $insert['name'] = $name; $insert['num'] = $total; $insert['col'] = $col; $insert['function'] = $function; $info['id'] = Dever::db('push/info')->insert($insert); $info['num'] = $insert['num']; } $data = array(); if ($info) { if (!$info['num']) { $info['num'] = 20; } if ($limit > 0) { $info['num'] = $limit; } $where = array(); $where['info_id'] = $info['id']; if ($page) { $where['page'] = array($info['num'], 'list'); $data = Dever::db('push/data')->getAllPage($where); } else { $where['limit'] = '0,' . $info['num']; $data = Dever::db('push/data')->getAll($where); } if ($data) { foreach ($data as $k => $v) { $data[$k] = $this->getOne($v); } } } return $data; } private function getOne($info) { $info['id'] = 0; if ($info['type'] == 10) { $info['link'] = $info['olink']; } if ($info['type'] < 10) { $table = Dever::config('base')->table_name[$info['type']]; $method = 'one'; $id = $table[1]; $id = $info[$id]; unset($info[$id]); if ($id > 0) { if (!$info['link']) { if ($info['type'] >= 3) { $info['link'] = Dever::url('main/article?type='.($info['type']-2).'&id=' . $id); } elseif ($info['type'] == 1) { $info['link'] = Dever::url('main/zwz-detail?id=' . $id); } elseif ($info['type'] == 2) { $info['link'] = Dever::url('main/xnr-detail?id=' . $id); } } $info['id'] = $id; $data = Dever::db($table[0])->$method($id); if (isset($data) && $data) { if (isset($data['name']) && $data['name'] && !$info['name']) { $info['name'] = $data['name']; } if (isset($data['desc']) && $data['desc'] && !$info['desc']) { $info['desc'] = $data['desc']; } if (isset($data['info']) && $data['info'] && !$info['content']) { $info['content'] = $data['info']; } if (isset($data['author']) && $data['author'] && !$info['author']) { $info['author'] = $data['author']; } if (isset($data['pdate']) && $data['pdate'] && !$info['pdate']) { $info['pdate'] = $data['pdate']; } if (isset($data['pic']) && $data['pic'] && !$info['pic']) { $info['pic'] = $data['pic']; } if (isset($data['small_pic']) && $data['small_pic'] && !$info['pic']) { $info['pic'] = $data['small_pic']; } if (isset($data['link']) && $data['link'] && !$info['link']) { $info['link'] = $data['link']; } if (isset($data['video']) && $data['video']) { /* $info['video'] = $data['video']; $info['video_info'] = Dever::qqvideo($data['video']); $info['video_id'] = isset($info['video_info'][1]) ? $info['video_info'][1] : 0; */ $info['video_link'] = Dever::url('main/content.video?id=' . $id); } } } } if ($info['link']) { if (!strstr($info['link'], 'http')) { $info['link'] = 'http://' . $info['link']; } } $info['small_pic'] = $info['pic']; if ($info['pdate']) { $info['pdate_string'] = date('M d, Y', $info['pdate']); if ($info['author']) { $info['pdate_string'] .= ' by ' . $info['author']; } } $info['info'] = $info['content']; $info['cdate'] = date('Y-m-d', $info['cdate']); if (isset($info['pic']) && $info['pic']) { $info['pic'] = Dever::load('main/lib/core')->replacePic($info['pic']); } if (isset($info['name']) && $info['name']) { $info['name'] = Dever::cut($info['name'], 20, '...'); } return $info; } }