one(); $data['contact'] = Dever::url('contact'); return $data; } # 分享js配置 public function share() { $title = ''; $pic = ''; $content = ''; $uri = Uri::$value; $id = Dever::input('id'); $config = Dever::load('main/content.config'); if ($id) { if ($uri == 'xnr-detail') { $data = Dever::db('content/xuniren')->one($id); if (isset($data['ins']) && $data['ins']) { $config['ins'] = $data['ins']; } if (isset($data['ins_link']) && $data['ins_link']) { $config['ins_link'] = $data['ins_link']; } if (isset($data['douyin']) && $data['douyin']) { $config['douyin'] = $data['douyin']; } if (isset($data['bilibili']) && $data['bilibili']) { $config['bilibili'] = $data['bilibili']; } } elseif ($uri == 'zwz-detail') { $data = Dever::db('content/creater')->one($id); $data['pic'] = $data['logo']; } else { $data = Dever::db('content/news')->one($id); } if (isset($data['share_title']) && $data['share_title']) { $title = $data['share_title']; } else { $title = $data['name']; } if (isset($data['share_pic']) && $data['share_pic']) { $pic = $data['share_pic']; } else { $pic = $data['pic']; } if (isset($data['share_content']) && $data['share_content']) { $pic = $data['share_content']; } else { $pic = $data['info']; } } else { $title = $config['name']; $pic = $config['logo']; } $ralateUid = ''; $appkey = ''; $url = Dever::url(); $share = 'config.wbshare = { title: "'.$title.'", url: "'.$url.'", pic: "'.$pic.'", ralateUid: "'.$ralateUid.'", appkey: "'.$appkey.'", content: "'.$content.'" }'; $share .= ';config.ins="'.$config['ins'].'"'; $share .= ';config.ins_link="'.$config['ins_link'].'"'; $share .= ';config.douyin="'.$config['douyin'].'"'; $share .= ';config.bili="'.$config['bilibili'].'"'; return $share; } # 获取菜单 public function menu() { $uri = Uri::$value; $type = Dever::input('type'); $menu = array ( 'home' => array ( 'name' => '首 页', 'active' => $uri == 'search' ? true : false, ), 'news' => array ( 'name' => '资 讯', 'active' => $type == 1 ? true : false, ), 'xnr' => array ( 'name' => '虚 拟 人', 'active' => false, 'uri' => array('xnr-detail', 'zwz-detail'), ), 'feature' => array ( 'name' => '专 题', 'active' => $type == 2 ? true : false, ), 'video' => array ( 'name' => '视 频', 'active' => $type == 3 ? true : false, ), 'activity' => array ( 'name' => '活 动', 'active' => $type == 4 ? true : false, ), 'contact' => array ( 'name' => '关于我们', 'active' => false, ), ); foreach ($menu as $k => $v) { $menu[$k]['link'] = Dever::url($k); if ($v['active'] || $uri == $k || (isset($v['uri']) && in_array($uri, $v['uri']))) { $menu[$k]['class'] = 'active'; } else { $menu[$k]['class'] = ''; } } return $menu; } # 首页广告 public function ad() { $key = Dever::input('key', 'home_ad'); $name = Dever::input('name', '首页广告'); return Dever::load('push/lib/data')->get($key, $name, 3, '1,5'); } # 焦点图 public function focus() { $key = Dever::input('key', 'home_focus'); $name = Dever::input('name', '首页焦点图'); $num = Dever::input('num', 0); return Dever::load('push/lib/data')->get($key, $name, 5, '1,2,5', '10', false, $num); } # 获取热门推荐 public function hot() { $type = Dever::input('type'); if ($type == 1) { $key = 'news'; $name = '资讯'; } elseif ($type == 2) { $key = 'feature'; $name = '专题'; } elseif ($type == 3) { $key = 'video'; $name = '视频'; } elseif ($type == 4) { $key = 'act'; $name = '活动'; } $data = Dever::load('push/lib/data')->get($key . '_hot', $name . '详情页热门推荐', 4, '1,3,5', ($type + 2). ',10'); if (!$data) { $data = Dever::load('content/lib/news')->getHome($type, 4); } return $data; } # 获取首页资讯 public function home_news() { //$data = Dever::load('push/lib/data')->get('home_news', '首页资讯', 3, '1,2,3,4,5,6,7'); $data = false; if (!$data) { $data = Dever::load('content/lib/news')->getHome(1, 3); } return $data; } # 获取首页专题 public function home_feature() { $data = Dever::load('push/lib/data')->get('home_feature', '首页专题', 5, '1,2,3,4,5,6,7'); //$data = false; if (!$data) { $data = Dever::load('content/lib/news')->getHome(2, 5); } return $data; } # 获取列表页专题 public function list_feature() { $data = Dever::load('push/lib/data')->get('list_feature', '专题列表顶部推荐位', 5, '1,2,3,4,5,6,7'); //$data = false; if (!$data) { $data = Dever::load('content/lib/news')->getHome(2, 5); } return $data; } # 获取首页视频 public function home_video_first() { //$data = Dever::load('push/lib/data')->get('home_video', '首页视频', 5, '1,2,3,4,5,6,7'); $data = false; if (!$data) { $data = Dever::load('content/lib/news')->getHome(3, 3); } if ($data) { $data[0]['sname'] = ''.$data[0]['sname'].''; return $data[0]; } return false; } public function home_video_other() { //$data = Dever::load('push/lib/data')->get('home_video', '首页视频', 5, '1,2,3,4,5,6,7'); $data = false; if (!$data) { $data = Dever::load('content/lib/news')->getHome(3, 3); } if ($data) { unset($data[0]); } return $data; } # 获取首页活动 public function home_act() { //$data = Dever::load('push/lib/data')->get('home_act', '首页活动', 4, '1,2,3,4,5,6,7'); $data = false; if (!$data) { $data = Dever::load('content/lib/news')->getHome(4, 4); } return $data; } # 获取首页虚拟人 public function home_xnr() { //$data = Dever::load('push/lib/data')->get('home_xnr', '首页虚拟人', 10, '1,2,3,4,5'); $data = false; if (!$data) { $data = Dever::load('content/lib/xuniren')->getHome(10); } return $data; } # 获取资讯 public function news() { $type = Dever::input('type', 1); $name = Dever::input('v'); $data = Dever::load('content/lib/news')->getAll($type, $name); return $data; } # 获取资讯 public function getNews() { $data = Dever::load('main/content.news'); if ($data) { return true; } return false; } # 获取资讯 public function getNoNews() { $data = Dever::load('main/content.news'); if ($data) { return false; } return true; } # 获取资讯详情 public function view() { $type = Dever::input('type', 1); $id = Dever::input('id'); if (!$id) { Dever::alert('错误的数据id'); } $data = Dever::load('content/lib/news')->getInfo($type, $id); return $data; } # 获取底层页封面图 public function view_pic() { $data = Dever::load('main/content.view_video_1'); if ($data) { return false; } return true; } # 获取底层页视频 public function view_video() { $data = Dever::load('main/content.view'); $result = array(); if ($data['video']) { return true; } return false; } # 获取底层页头部视频 public function view_video_1() { $data = Dever::load('main/content.view'); $result = array(); if ($data['type'] == 3 && $data['video']) { return true; } return false; } # 获取底层页尾部视频 public function view_video_2() { $data = Dever::load('main/content.view'); $result = array(); if ($data['type'] != 3 && $data['content_video']) { return true; } return false; } # 获取标签 public function view_tag() { $data = Dever::load('main/content.view'); $result = array(); if ($data['tag']) { $tag = ''; if (strstr($data['tag'], ',')) { $tag = explode(',', $data['tag']); } elseif (strstr($data['tag'], ',')) { $tag = explode(',', $data['tag']); } if ($tag && is_array($tag)) { foreach($tag as $k => $v) { $result[$k]['name'] = $v; $result[$k]['link'] = Dever::url('search?type='.$data['type'].'&v=' . $v); } } } return $result; } # 获取单页内容 public function getPage() { $key = Dever::input('key', 1); $where['key'] = $key; $data = Dever::db('main/page')->one($where); return $data; } # 获取单页内容 public function getAbout() { Dever::setInput('key', 'about'); return $this->getPage(); } # 搜索页面 public function search() { $url = Dever::url('search?v='); $html = 'location.href=\''.$url.'\'+$(\'#search\').val()'; return $html; } # 手机搜索页面 public function msearch() { $url = Dever::url('search?v='); $html = 'location.href=\''.$url.'\'+$(\'#msearch\').val()'; return $html; } # 获取联系我们的需求分类 public function contact_xuqiu() { return Dever::db('act/contact')->config['xuqiu']; } # 新增联系我们 public function contact_add() { $username = Dever::input('username'); $mobile = Dever::input('mobile'); $email = Dever::input('email'); $content = Dever::input('content'); $xuqiu = Dever::input('xuqiu', 3); if (!$username) { Dever::alert('请填写姓名'); } if (!$mobile) { Dever::alert('请填写联系电话'); } if (!$email) { Dever::alert('请填写电子信箱'); } Dever::load('act/lib/contact')->add($username, $mobile, $email, $content, $xuqiu); return 'ok'; } # 新增订阅 public function ding_add() { $username = Dever::input('username'); $email = Dever::input('email'); $qudao = Dever::input('qudao', 1); if (!$username) { Dever::alert('请填写用户名'); } if (!$email) { Dever::alert('请填写电子信箱'); } Dever::load('act/lib/ding')->add($username, $email, $qudao); return 'ok'; } # 新增分享 public function share_add() { $name = Dever::input('name'); $link = Dever::input('link'); $type = Dever::input('type', 1); if (!$name) { Dever::alert('请填写内容名称'); } if (!$link) { Dever::alert('请填写链接'); } Dever::load('act/lib/share')->add($name, $link, $type); return 'ok'; } # 造物主信息 public function getZwzOne() { $id = Dever::input('id'); if (!$id) { Dever::alert('错误的数据id'); } $data = Dever::load('content/lib/creater')->getInfo($id); return $data; } # 获取造物主下的虚拟人列表 public function getXnrByZwz() { $id = Dever::input('id'); if (!$id) { Dever::alert('错误的数据id'); } $data = Dever::load('content/lib/xuniren')->getDataByCreater($id); return $data; } # 虚拟人信息 public function getXnrOne() { $id = Dever::input('id'); if (!$id) { Dever::alert('错误的数据id'); } $data = Dever::load('content/lib/xuniren')->getInfo($id); return $data; } # 虚拟人信息 相关资讯 public function getXnrOne_news() { $data = Dever::load('main/content.getXnrOne'); if ($data && $data['news']) { foreach($data['news'] as $k => $v) { $data['news'][$k]['class'] = ''; } $data['news'][] = array ( 'name' => '相关资讯', 'link' => '#', 'class' => 'tag', ); return $data['news']; } return array(); } # 虚拟人信息 多个图片 public function getXnrOne_pic() { $data = Dever::load('main/content.getXnrOne'); if ($data && isset($data['pic_list']) && $data['pic_list']) { return $data['pic_list']; } return array(); } # 获取虚拟人列表 public function getXnr() { $data = Dever::db('content/xuniren')->getAll(); $html = ''; foreach ($data as $k => $v) { $k = strtoupper($k); $html .= '