search(array('ids' => $yes)); } if (!$keyword) { $where['limit'] = '0,50'; $data = Dever::db($table)->search($where); } else { $where['name'] = $keyword; $data = Dever::db($table)->search($where); } $result = array(); if ($yes) { foreach ($yes as $k => $v) { if (isset($data[$k])) { unset($data[$k]); } $yes[$k]['selected'] = 'selected'; } $data = $yes + $data; $data = array_merge($data, array()); } if (!$data) { Dever::alert('暂无数据'); } return $data; } # 搜索文章 public function search_article_api() { return $this->search('content/article'); } # 搜索视频 public function search_vod_api() { return $this->search('video/vod'); } # 搜索直播 public function search_live_api() { return $this->search('video/live'); } # 搜索小刊 public function search_journal_api() { return $this->search('journal/info'); } # 显示杂志内页 public function journalContent() { $where['info_id'] = Dever::input('search_option_info_id'); $where['state'] = Dever::input('search_option_state'); $data = Dever::db('journal/content')->all($where); $database = Dever::load('manage/database'); $type = Dever::db('journal/content')->config['gettype']; if ($data) { foreach ($data as $k => $v) { if ($v['type'] <= 2) { $data[$k]['name'] = ''; } elseif ($v['type'] == 3) { $data[$k]['pic'] = $v['focus']; } if ($v['type'] == 11) { # 图文 $info = Dever::load('content/lib/article')->get($v['article_id']); if ($info) { $data[$k]['pic'] = $info['pic_cover']; $data[$k]['name'] = $info['name']; } } elseif ($v['type'] == 12) { # 视频 $info = Dever::load('video/lib/vod')->get($v['vod_id']); if ($info) { $data[$k]['pic'] = $info['pic_cover']; $data[$k]['name'] = $info['name']; } } elseif ($v['type'] == 13) { # 直播 $info = Dever::load('video/lib/live')->get($v['live_id']); if ($info) { $data[$k]['pic'] = $info['pic_cover']; $data[$k]['name'] = $info['name']; } } $data[$k]['typename'] = $type[$v['type']]; if ($v['type'] == 1) { $data[$k]['text'] = $this->text($database, $v['id'], $where['info_id']); } else { $data[$k]['text'] = ''; } $link = $database->url('edit', $v['id']) . '&search_option_info_id=' . $where['info_id']; $data[$k]['edit'] = "fastEdit($(this), '".$link."', '编辑内页', '', 1)"; $data[$k]['editurl'] = $link; $data[$k]['delete'] = $database->url('delete', $v['id']); } } return $data; } private function text_name($link, $content_id, $info_id, $location, $name) { $where['info_id'] = $info_id; $where['content_id'] = $content_id; $where['location'] = $location; $info = Dever::db('journal/content_text')->one($where); $link .= '&search_option_info_id=' . $info_id. '&search_option_content_id=' . $content_id.'&table=content_text&search_option_location='.$location; if ($info) { $link .= '&where_id=' . $info['id']; } $html = ''.$name.''; return $html; } public function text($database, $content_id, $info_id) { $link = $database->url('edit'); $location = Dever::db('journal/content_text')->config['location']; $html = ''; $i = 0; foreach ($location as $k => $v) { $name = $this->text_name($link, $content_id, $info_id, $k, $v); $html .= ''; if ($i == 2 || $i == 5) { $html .= ''; } $i++; } $html .= '
'.$name.'
'; return $html; } public function updateJournalContent_api() { $data = Dever::input('data'); if ($data) { $data = explode(',', str_replace('data-', '', $data)); foreach ($data as $k => $v) { $k = $k + 1; $where['where_id'] = $v; $where['reorder'] = $k; Dever::db('journal/content')->update($where); } } return $data; } }