public function getVideo() { $infovideoModel = new Model_InfoVideo(); $filter['where'] = " id='{$this->info_id}' and customer_id='{$this->customer_id}' and state='1' "; $sql = $infovideoModel->select($filter); $inforesult = $infovideoModel->fetchRow($sql); $sql = "update info_video set push_num=push_num+1 where id='{$this->info_id}' and customer_id='{$this->customer_id}' limit 1"; $infovideoModel->query($sql); $data['msgtype'] = 'news'; $data['title'] = $inforesult['video_name']; $data['description'] = $inforesult['video_desc']; $data['picurl'] = 'http://' . $_SERVER['HTTP_HOST'] . "/data/image_c/" . $inforesult['video_pic']; $data['url'] = $inforesult['video_url']; $movie_play_url = null; $preg_content = "|v\\.youku\\.com/v_show/id_(.*?)\\.html|s"; preg_match($preg_content, $data['url'], $match); if (!empty($match)) { $movie_play_url = 'http://player.youku.com/embed/' . $match['1']; } $preg_content = "|http://v.qq.com/(.*)|s"; preg_match($preg_content, $data['url'], $match); if (!empty($match)) { $movie_play_url = $data['url']; } $data['url'] = $movie_play_url; return $data; }
//var $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; $act = isset($_REQUEST['act']) ? $_REQUEST['act'] : ''; $customer_id = (int) $_SESSION['customer_id']; $info_type = 'video'; $data = array(); //delete if ($act == 'del' && $id) { Model_Table::get('InfoVideo')->delete("id='{$id}' and customer_id='{$customer_id}'"); Model_Table::get('KeywordList')->delete("info_id='{$id}' and customer_id='{$customer_id}' and info_type='{$info_type}'"); header("location:/home/info/index.php?type=video"); die; } //method:add||modify if ($id) { $music_table = new Model_InfoVideo(); $data = $music_table->fetchRow("select * from info_video where id='{$id}' and customer_id='{$customer_id}'"); $smarty->assign('infoRow', $data); } //submit if (method_is('post')) { $data['customer_id'] = $customer_id; //$data['info_type'] = Model_InfoVideo::get_type($info_type); $data['keyword'] = isset($_POST['keyword']) ? str_inmysql(str_replace(array(';', ','), ',', $_POST['keyword'])) : ''; $data['cate_id'] = isset($_POST['cate_id']) ? (int) $_POST['cate_id'] : ''; $data['create_date'] = date('Y-m-d H:i:s', $_WGT['TIME']); $data['video_name'] = isset($_POST['video_name']) ? str_inmysql($_POST['video_name']) : ''; $data['video_pic'] = isset($_POST['video_pic']) ? str_inmysql($_POST['video_pic']) : ''; $data['video_desc'] = isset($_POST['video_desc']) ? str_inmysql($_POST['video_desc']) : ''; $data['video_url'] = isset($_POST['video_url']) ? str_inmysql($_POST['video_url']) : ''; $data['state'] = isset($_POST['state']) ? str_inmysql($_POST['state']) : '';
$sql = $infocommonModel->select($filter, 'count(id) as count_num,info_type'); $infocommonarray = $infocommonModel->fetchAll($sql); foreach ($infocommonarray as $key => $value) { $infocount[$value['info_type']] = $value['count_num']; } //图片统计 $infopicModel = new Model_InfoPic(); $filter = array(); $filter['where'] = "customer_id = '{$customer_id}'"; $infocount['pic'] = $infopicModel->count($filter); //音乐统计 $infomusicModel = new Model_InfoMusic(); $filter = array(); $filter['where'] = "customer_id = '{$customer_id}'"; $infocount['music'] = $infomusicModel->count($filter); //视频统计 $infovideoModel = new Model_InfoVideo(); $filter = array(); $filter['where'] = "customer_id = '{$customer_id}'"; $infocount['video'] = $infovideoModel->count($filter); $chart_data1['label'] = rtrim($days_str, ','); $chart_data1['value'] = rtrim($days_value_str, ','); $chart_data1b['value'] = rtrim($days_valueb_str, ','); $chart_data1c['value'] = rtrim($days_valuec_str, ','); $smarty->assign("count", $count); $smarty->assign("chart_data1", $chart_data1); $smarty->assign("chart_data1b", $chart_data1b); $smarty->assign("chart_data1c", $chart_data1c); $smarty->assign("topmessage", $topmessage); $smarty->assign("infocount", $infocount); $smarty->setTpl('data/templates/index.html')->display();