예제 #1
0
 public function show()
 {
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $condition = $this->get_condition();
     $orderby = '  ORDER BY order_id DESC,id DESC ';
     $limit = ' LIMIT ' . $offset . ' , ' . $count;
     $ret = $this->mode->show($condition, $orderby, $limit);
     $video_ids = array();
     $channel_ids = array();
     foreach ($ret as $k => $v) {
         $video_ids[] = $v['video_id'];
         $channel_ids[] = $v['channel_id'];
     }
     /*******************此处是为了请求视频库的图片******************/
     if ($video_ids) {
         $livmedia = new livmedia();
         $video = $livmedia->get_videos(implode(',', $video_ids));
         $video_img = array();
         $video_url = array();
         if ($video && $video[0]) {
             foreach ($video[0] as $k => $v) {
                 $video_img[$v['id']] = @unserialize($v['img_info']);
                 $video_url[$v['id']] = $v['hostwork'] . '/' . $v['video_path'] . $v['video_filename'];
             }
         }
     }
     /*******************此处是为了请求视频库的图片*****************/
     /*******************此处是为了频道名称***********************/
     if ($channel_ids) {
         $mLive = new live();
         $channel = $mLive->getChannelById(implode(',', $channel_ids), -1);
         $channel_name[] = array();
         if ($channel) {
             foreach ($channel as $k => $v) {
                 $channel_name[$v['id']] = $v['name'];
             }
         }
     }
     /*******************此处是为了频道名称***********************/
     if (!empty($ret)) {
         foreach ($ret as $k => $v) {
             if ($video_img) {
                 $v['img_info'] = $video_img[$v['video_id']];
             }
             if ($channel_name) {
                 $v['channel_name'] = $channel_name[$v['channel_id']];
             }
             if ($video_url) {
                 $v['video_url'] = $video_url[$v['video_id']];
             }
             $this->addItem($v);
         }
         $this->output();
     }
 }
예제 #2
0
파일: create.php 프로젝트: h3len/Project
 private function storage_data($video, $vod_config)
 {
     if ($video['column_id']) {
         $publish_column = new publishconfig();
         $column_id = $video['column_id'];
         $column_id = $publish_column->get_columnname_by_ids('id,name', $column_id);
         $column_id = serialize($column_id);
     }
     $channel_id = $video['channel_id'];
     if ($video['create_time'] != -1) {
         $create_time = strtotime($video['create_time']);
     }
     $pathinfo = pathinfo($video['filepath']);
     //如果不存在分类就默认其分类与类型相同
     $vod_leixing = $video['vod_leixing'] ? $video['vod_leixing'] : 1;
     if (!$video['vod_sort_id'] || intval($video['vod_sort_id']) == -1) {
         $video['vod_sort_id'] = $vod_leixing;
     }
     /************创建视频的权限控制**********/
     if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
         $prms['_action'] = 'create';
         $prms['node'] = $video['vod_sort_id'];
         if (!$this->verify_self_prms($prms)) {
             $this->errorOutput('NO_PRIVILEGE');
             //$this->addItem(array('return' => 'fail'));
             //$this->output();
         }
     }
     foreach ($video as $k => $v) {
         if (is_string($v)) {
             $video[$k] = rawurldecode($v);
         }
     }
     $data = array('cur_clarity' => $vod_config['unique_id'], 'title' => $video['title'] ? $video['title'] : $this->dir_info['original'], 'source' => $video['source'], 'subtitle' => $video['subtitle'], 'keywords' => $video['keywords'], 'weight' => $video['weight'], 'comment' => $video['comment'], 'author' => $video['author'], 'vod_leixing' => $vod_leixing, 'bitrate' => $vod_config['video_bitrate'], 'vod_sort_id' => $video['vod_sort_id'], 'is_allow' => $video['is_mark'], 'starttime' => $video['starttime'] ? strtotime($video['starttime']) : '', 'hostwork' => defined("TARGET_VIDEO_DOMAIN") ? 'http://' . ltrim(TARGET_VIDEO_DOMAIN, 'http://') : $this->settings['videouploads']['protocol'] . $this->settings['videouploads']['host'], 'source_hostwork' => defined("SOURCE_VIDEO_DOMIAN") ? 'http://' . ltrim(SOURCE_VIDEO_DOMIAN, 'http://') : '', 'source_base_path' => UPLOAD_DIR, 'source_path' => rtrim($pathinfo['dirname'], '/') . '/', 'source_filename' => $pathinfo['basename'], 'video_base_path' => TARGET_DIR, 'video_path' => $this->dir_info['target_dir'], 'video_filename' => $this->dir_info['output_filename'] . '.' . $this->dir_info['output_format'], 'channel_id' => $channel_id, 'column_id' => $column_id, 'from_appid' => $this->user['appid'], 'from_appname' => $this->user['display_name'], 'user_id' => $video['_user_id'] ? $video['_user_id'] : ($this->input['user_id'] ? $this->input['user_id'] : $this->user['user_id']), 'addperson' => $video['_user_name'] ? $video['_user_name'] : ($this->input['user_name'] ? $this->input['user_name'] : $this->user['user_name']), 'org_id' => $this->input['org_id'] ? $this->input['org_id'] : $this->user['org_id'], 'create_time' => $create_time ? $create_time : TIMENOW, 'update_time' => TIMENOW, 'ip' => hg_getip(), 'app_uniqueid' => $video['app_uniqueid'] ? $video['app_uniqueid'] : 'livmedia', 'mod_uniqueid' => $video['mod_uniqueid'] ? $video['mod_uniqueid'] : MOD_UNIQUEID, 'morebitrate_config_id' => $video['vod_config_id'], 'template_sign' => $video['template_sign']);
     if ($video['is_time_shift']) {
         $sql = "UPDATE " . DB_PREFIX . "vodinfo SET ";
     } else {
         $sql = " INSERT INTO " . DB_PREFIX . "vodinfo SET ";
     }
     foreach ($data as $k => $v) {
         $sql .= " {$k} = '{$v}',";
     }
     $sql = trim($sql, ',');
     if ($video['is_time_shift']) {
         $sql .= ' WHERE id = ' . $video['id'];
     }
     $this->db->query($sql);
     if ($video['is_time_shift']) {
         $vid = $video['id'];
     } else {
         $vid = $this->db->insert_id();
     }
     //记录发布库栏目分发表
     $this->update_pub_column($vid, $video['column_id']);
     //记录发布库栏目分发表
     if ($video['index_pic']) {
         $material = new material();
         $img_info = $material->localMaterial($video['index_pic'], $vid);
         $img_info = $img_info[0];
     } else {
         //获取一张截图,并且提交到图片服务器
         $img_info = getimage(UPLOAD_DIR . $video['filepath'], TARGET_DIR . $this->dir_info['target_dir'], $vid);
         if (!$img_info || !$img_info['filename']) {
             if ($this->settings['App_live'] && $channel_id) {
                 include_once ROOT_PATH . 'lib/class/live.class.php';
                 $live = new live();
                 $channelinfo = $live->getChannelById($channel_id, 1, 1);
                 if ($channelinfo && $channelinfo[0] && $channelinfo[0]['snap']) {
                     $img_info = $channelinfo[0]['snap'];
                 }
             }
         }
     }
     if ($img_info && is_array($img_info)) {
         $image_info = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename'], 'imgwidth' => $img_info['imgwidth'], 'imgheight' => $img_info['imgheight']);
     } else {
         $image_info = array();
     }
     $sql = " UPDATE " . DB_PREFIX . "vodinfo SET video_order_id = {$vid},img_info = '" . serialize($image_info) . "'  WHERE id = {$vid}";
     $this->db->query($sql);
     //存储vod_extend表
     if ($video['content_id']) {
         $extend_data = array('vodinfo_id' => $vid, 'content_id' => $video['content_id'], 'extend_data' => $video['extend_data']);
         $sql = " INSERT INTO " . DB_PREFIX . "vod_extend SET ";
         foreach ($extend_data as $k => $v) {
             $sql .= " {$k} = '{$v}',";
         }
         $sql = trim($sql, ',');
         $this->db->query($sql);
     }
     //加入日志
     $data['id'] = $vid;
     $this->addLogs('创建视频', '', $data, $data['title']);
     return array('vid' => $vid, 'img_info' => $image_info);
 }
예제 #3
0
 /**
  * 根据频道,按时段显示节目,包含节目计划以及没有节目时自动填充
  * @name show
  * @access public
  * @author repheal
  * @category hogesoft
  * @copyright hogesoft
  * @param $channel_id int 频道ID
  * @return $program array 节目内容,键为日期,必须产生键,保证输出数据的完整性
  */
 function show()
 {
     $condition = $this->get_condition();
     $channel_id = intval($this->input['channel_id']);
     if (empty($channel_id)) {
         $this->errorOutput("未传入频道ID");
     }
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $obj_newLive = new live();
     $channel = $obj_newLive->getChannelById($channel_id, -1);
     if (!$channel) {
         $this->errorOutput("此频道不存在或者已被删除!");
     } else {
         if (count($channel) == 1) {
             $channel = $channel[0];
         }
     }
     $channel_name = $channel['name'];
     $save_time = $channel['time_shift'];
     $start_time = strtotime(date("Y-m-d", TIMENOW - 3600 * $save_time) . " 00:00:00");
     $end_time = strtotime(date("Y-m-d", TIMENOW) . " 23:59:59");
     $condition = " AND channel_id=" . $channel_id . " AND  start_time>'" . $start_time . "' AND start_time<" . $end_time . "";
     $info = $this->obj->show($condition, $channel_id, $start_time, $end_time, $save_time);
     $date_type = array('00:00~09:00' => array('start' => '00:00:00', 'end' => '08:59:59'), '09:00~13:00' => array('start' => '09:00:00', 'end' => '12:59:59'), '13:00~19:00' => array('start' => '13:00:00', 'end' => '18:59:59'), '19:00~24:00' => array('start' => '19:00:00', 'end' => '23:59:59'));
     //串联单时移
     $dates = urldecode($this->input['dates']);
     $today = date('Y-m-d');
     $stime = urldecode($this->input['stime']);
     if ($dates > $today) {
         $day_offset = (strtotime($dates) - strtotime($today)) / 86400;
     }
     $i = $day_offset;
     if (!empty($info)) {
         $tmp_info = $info;
         $info = array();
         foreach ($tmp_info as $k => $v) {
             $info[$v['dates']][] = $v;
         }
         $program = array();
         foreach ($info as $ks => $vs) {
             $day_program = array();
             $v['dates'] = '';
             foreach ($vs as $k => $v) {
                 if ($dates > $today) {
                     $_dates = date('Y-m-d', strtotime($today) + 86400 * $i);
                 }
                 $v['starttime'] = date("Y-m-d H:i:s", $v['start_time']);
                 $v['endtime'] = date("Y-m-d H:i:s", $v['start_time'] + $v['toff']);
                 $v['start'] = date("H:i", $v['start_time']);
                 $v['channel_name'] = $channel_name;
                 //补齐频道id
                 $v['channel_id'] = $v['channel_id'] ? $v['channel_id'] : $channel_id;
                 foreach ($date_type as $key => $value) {
                     $start = strtotime($v['dates'] . " " . $value['start']);
                     $end = strtotime($v['dates'] . " " . $value['end']);
                     if ($v['start_time'] >= $start && $v['start_time'] < $end) {
                         if ($dates > $today) {
                             $v['starttime'] = $_dates . ' ' . date('H:i:s', $v['start_time']);
                             $v['endtime'] = $_dates . ' ' . date('H:i:s', $v['start_time'] + $v['toff']);
                             $v['dates'] = $_dates;
                             $v['start_time'] = strtotime($v['starttime']);
                             $v['weeks'] = date('W', $v['start_time']);
                             if (strtotime($_dates . ' ' . $stime) < $v['start_time'] + $v['toff'] && $i == $day_offset) {
                                 $v['display'] = 0;
                             }
                         }
                         $day_program[$key][] = $v;
                     }
                 }
             }
             if ($day_program) {
                 $program[$v['dates']] = $day_program;
             }
             $i--;
         }
         $this->addItem($program);
         $this->output();
     } else {
         $this->addItem();
         $this->output();
     }
 }
예제 #4
0
 public function detail($condition = '')
 {
     $sql = "SELECT p.* FROM " . DB_PREFIX . "program_record p " . $condition;
     $row = $this->db->query_first($sql);
     if (is_array($row) && $row) {
         include_once ROOT_PATH . 'lib/class/program.class.php';
         $program_plan = new program();
         include_once ROOT_PATH . 'lib/class/live.class.php';
         $newLive = new live();
         $channel = $newLive->getChannelById($row['channel_id']);
         $channel = $channel[0];
         $row['create_time'] = date('Y-m-d H:i:s', $row['create_time']);
         $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']);
         $row['end_time'] = date('Y-m-d H:i:s', $row['start_time'] + $row['toff']);
         $row['start_time'] = date('Y-m-d H:i:s', $row['start_time']);
         $row['week_day'] = $row['week_day'] ? unserialize($row['week_day']) : array();
         $start_time = strtotime($row['dates'] . " " . $row['start_time']);
         $end_time = strtotime($row['dates'] . " " . $row['start_time']) + $row['toff'];
         $row['title'] = $row['title'] ? $row['title'] : (trim($program_plan->get_program_plan($row['channel_id'], $start_time, $end_time)) ? trim($program_plan->get_program_plan($row['channel_id'], $start_time, $end_time)) : '精彩节目');
         $mins = floor($row['toff'] / 60);
         $sen = $row['toff'] - $mins * 60;
         $row['toff_decode'] = ($mins ? $mins . "'" : '') . ($sen ? $sen . "''" : '');
         $row['channel_name'] = $channel['name'];
         return $row;
     }
 }
예제 #5
0
 public function detail()
 {
     if (!$this->input['channel_id']) {
         $this->errorOutput("缺少频道ID");
     }
     $channel_id = intval($this->input['channel_id']);
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $newLive = new live();
     $channel = $newLive->getChannelById($channel_id, -1);
     $channel = $channel[0];
     if (!$channel['id']) {
         $this->errorOutput('该频道已经不存在!');
     }
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $nodes = array();
     $nodes['_action'] = 'manage';
     $nodes['nodes'][$channel['id']] = $channel['id'];
     $this->verify_content_prms($nodes);
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $condition = $this->get_condition();
     $info = $this->obj->detail($condition);
     $this->addItem($info);
     $this->output();
 }
예제 #6
0
 public function copy_day()
 {
     $channel_id = $this->input['channel_id'];
     if (!$channel_id) {
         $this->errorOutput("未传入频道ID");
     }
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $newLive = new live();
     $channel = $newLive->getChannelById($channel_id, -1);
     $channel = $channel[0];
     if (!$channel['id']) {
         $this->errorOutput('该频道已经不存在!');
     }
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $nodes = array();
     $nodes['_action'] = 'manage';
     $nodes['nodes'][$channel_id] = $channel_id;
     $this->verify_content_prms($nodes);
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $dates = rawurldecode($this->input['dates']);
     //源日期
     if (!$dates) {
         $this->errorOutput("未传入更新日期");
     }
     $copy_dates = rawurldecode($this->input['copy_dates']);
     if (!$copy_dates) {
         $this->errorOutput("未传入更新日期");
     }
     $diff = strtotime($copy_dates) - strtotime($dates);
     //相差时间
     $sql = "DELETE FROM  " . DB_PREFIX . "program WHERE channel_id=" . $channel_id . " AND dates='" . $copy_dates . "'";
     $this->db->query($sql);
     $sql = "INSERT  INTO  " . DB_PREFIX . "program (channel_id,start_time, toff, theme, subtopic, type_id, dates, weeks, describes, create_time, update_time, ip, is_show) SELECT channel_id,start_time+" . $diff . ", toff, theme, subtopic, type_id, '" . $copy_dates . "', " . date('N', strtotime($copy_dates)) . ", describes, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), ip, is_show FROM " . DB_PREFIX . "program ";
     $sql .= "WHERE dates='" . $dates . "' AND channel_id=" . $channel_id;
     $this->db->query($sql);
     $tip = array('ret' => 1);
     $this->addItem($tip);
     $this->output();
 }
예제 #7
0
 function show($condition, $channel_id, $start_time, $end_times, $save_time = 0, $tf_by_endtime = false)
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "program WHERE 1 " . $condition . " ORDER BY dates DESC,start_time ASC";
     $q = $this->db->query($sql);
     $program = array();
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $newLive = new live();
     $channel_info = $newLive->getChannelById($channel_id, -1);
     if ($tf_by_endtime) {
         $dates = date("Y-m-d", $end_times);
     } else {
         $dates = date("Y-m-d", TIMENOW);
     }
     $start = strtotime(date("Y-m-d", $start_time) . " 00:00:00");
     $end = strtotime(date("Y-m-d", $end_times) . " 23:59:59") + 1;
     $channel_info = $channel_info[0];
     $com_time = 0;
     while ($row = $this->db->fetch_array($q)) {
         $start_time = $row['start_time'];
         $end_time = $row['start_time'] + $row['toff'];
         $dates = date("Y-m-d", $start_time);
         $start = strtotime(date("Y-m-d", $start_time) . " 00:00:00");
         $end = strtotime(date("Y-m-d", $end_time) . " 23:59:59");
         $display = $lave_time = $now_play = $zhi_play = 0;
         if (!$com_time && $start_time > $start) {
             $program[] = $this->getInfo($start, $start_time, $dates, $channel_id);
         }
         $row['start'] = date("H:i", $start_time);
         $row['end'] = date("H:i", $end_time);
         $row['zhi_play'] = $zhi_play;
         $row['now_play'] = $now_play;
         $row['display'] = $display;
         $row['lave_time'] = $lave_time;
         $row['is_program'] = 1;
         if (!$row['theme']) {
             $row['theme'] = '精彩节目';
         }
         $row['stime'] = date("H:i", $start_time);
         $com_time = $end_time;
         $program[] = $row;
     }
     $all_program = $program_plan = $program_plan_tmp = $program_plan_keys = array();
     if ($save_time) {
         $day = ceil($save_time / 24);
         if ($day > 1) {
             for ($i = 0; $i < $day; $i++) {
                 $tmp_dates = date('Y-m-d', strtotime($dates . ' 23:59:59') - $i * 86400);
                 $tmp = $this->getPlan($channel_id, $tmp_dates);
                 $program_plan_tmp = array_merge($program_plan_tmp, $tmp);
             }
         }
     } else {
         $program_plan_tmp = $this->getPlan($channel_id, $dates);
     }
     //hg_pre($program_plan_tmp);exit;
     if (!empty($program_plan_tmp)) {
         foreach ($program_plan_tmp as $k => $v) {
             $program_plan[strtotime($v['dates'] . ' ' . date('H:i:s', $v['start_time']))] = $v;
             $program_plan[strtotime($v['dates'] . ' ' . date('H:i:s', $v['start_time']))]['start_time'] = strtotime($v['dates'] . ' ' . date('H:i:s', $v['start_time']));
         }
         $program_plan_keys = array_keys($program_plan);
     }
     if (empty($program)) {
         $program = $this->copy_program($start, $end, $channel_id);
         if (defined('PROGRAM_DEFAULT') && !PROGRAM_DEFAULT && !empty($program_plan_tmp)) {
             $program = $program_plan_tmp;
             $length_tmp = count($program);
             foreach ($program as $k => $v) {
                 if ($k < $length_tmp - 1) {
                     $program[$k]['toff'] = strtotime($program[$k + 1]['dates'] . ' ' . $program[$k + 1]['start']) - strtotime($program[$k]['dates'] . ' ' . $program[$k]['start']);
                 } else {
                     $program[$k]['toff'] = strtotime($program[$k]['dates'] . ' 23:59:59') - strtotime($program[$k]['dates'] . ' ' . $program[$k]['start']);
                 }
             }
         }
     }
     //hg_pre($program);exit;
     foreach ($program as $key => $value) {
         $value['channel_name'] = $channel_info['name'];
         $value['channel_logo'] = array('rectangle' => $channel_info['logo_rectangle'], 'square' => $channel_info['logo_square']);
         $value['channel_id'] = $channel_info['id'];
         $value['toff'] = isset($program[$key + 1]) ? $program[$key + 1]['start_time'] - $program[$key]['start_time'] : $end - $program[$key]['start_time'];
         $value['end'] = date("H:i", $program[$key]['start_time'] + $value['toff']);
         //频道接管
         $channel_info['starttime'] = $value['start_time'];
         $channel_info['toff'] = $value['toff'];
         $value['m3u8'] = $this->set_m3u8($channel_info);
         $new_unit_program = array();
         if ($program_plan_keys && 0) {
             foreach ($program_plan_keys as $k => $v) {
                 if ($v > $value['start_time'] && $v < $value['start_time'] + $value['toff']) {
                     if ($v == $value['start_time']) {
                         if ($value['is_program']) {
                             unset($program_plan[$v], $program_plan_keys[$k]);
                             //	continue;
                         } else {
                             $value['theme'] = $program_plan[$v]['theme'];
                             $value['is_plan'] = 1;
                             $value['end'] = date("H:i", $value['start_time'] + $value['toff']);
                             $channel_info['starttime'] = $value['start_time'];
                             $channel_info['toff'] = $value['toff'];
                             $value['m3u8'] = $this->set_m3u8($channel_info);
                             $all_program[date("Y-m-d", $value['start_time'])][$value['start']] = $value;
                             unset($program_plan[$v], $program_plan_keys[$k]);
                             //	continue;
                         }
                     } else {
                         $new_unit_program = $value;
                         //是被切的节目单的上班部分的节目
                         $new_unit_program['toff'] = $program_plan[$v]['start_time'] - $new_unit_program['start_time'];
                         $new_unit_program['start'] = date("H:i", $new_unit_program['start_time']);
                         $new_unit_program['end'] = date("H:i", $new_unit_program['start_time'] + $new_unit_program['toff']);
                         $channel_info['starttime'] = $new_unit_program['start_time'];
                         $channel_info['toff'] = $new_unit_program['toff'];
                         $new_unit_program['m3u8'] = $this->set_m3u8($channel_info);
                         $all_program[date("Y-m-d", $new_unit_program['start_time'])][$new_unit_program['start']] = $new_unit_program;
                         //被切的下半部分,即为节目计划
                         $value['theme'] = $program_plan[$v]['theme'];
                         $value['toff'] = $value['toff'] - $new_unit_program['toff'];
                         $value['start_time'] = $program_plan[$v]['start_time'];
                         $value['is_plan'] = 1;
                         $value['id'] = $program_plan[$v]['start_time'];
                         $value['start'] = date("H:i", $value['start_time']);
                         $value['end'] = date("H:i", $value['start_time'] + $value['toff']);
                         //频道接管
                         $channel_info['starttime'] = $value['start_time'];
                         $channel_info['toff'] = $value['toff'];
                         $value['m3u8'] = $this->set_m3u8($channel_info);
                         //
                         $all_program[date("Y-m-d", $value['start_time'])][$value['start']] = $value;
                         unset($program_plan[$v], $program_plan_keys[$k]);
                         //	continue;
                     }
                 } else {
                     $all_program[date("Y-m-d", $value['start_time'])][$value['start']] = $value;
                 }
             }
         } else {
             $all_program[date("Y-m-d", $value['start_time'])][$value['start']] = $value;
         }
     }
     //	hg_pre($all_program);exit;
     $start_range = $end_range = 0;
     if ($save_time && 0) {
         if ($tf_by_endtime) {
             $end_range = $end_times;
             $start_range = $end_times - 3600 * ($save_time + 24);
         } else {
             $end_range = TIMENOW;
             $start_range = TIMENOW - 3600 * $save_time;
         }
     }
     $tmp_all_program = array();
     foreach ($all_program as $key => $value) {
         foreach ($value as $k => $v) {
             if ($start_range && $end_range) {
                 if ($v['start_time'] >= $start_range && $v['start_time'] + $v['toff'] <= $end_range) {
                     $tmp_all_program[] = $v;
                 }
             } else {
                 $tmp_all_program[] = $v;
             }
         }
     }
     $all_program = $tmp_all_program;
     //	hg_pre($all_program);exit;
     //排序
     $tmp_program = $program = array();
     $length = count($all_program);
     for ($i = 0, $j = $length; $i < $j; $i++) {
         for ($k = $j - 1; $k > $i; $k--) {
             if ($all_program[$k]['start_time'] < $all_program[$k - 1]['start_time']) {
                 list($all_program[$k - 1], $all_program[$k]) = array($all_program[$k], $all_program[$k - 1]);
             }
         }
         if ($all_program[$i]['start_time'] < TIMENOW) {
             if ($all_program[$i]['start_time'] < TIMENOW - $channel_info['time_shift'] * 3600) {
                 $all_program[$i]['display'] = 0;
             } else {
                 $all_program[$i]['display'] = 1;
             }
         }
         if ($all_program[$i]['start_time'] < TIMENOW && $all_program[$i]['start_time'] + $all_program[$i]['toff'] > TIMENOW) {
             $all_program[$i]['zhi_play'] = $is_zhi = empty($is_zhi) ? 1 : 0;
             $all_program[$i]['lave_time'] = $all_program[$i]['start_time'] + $all_program[$i]['toff'] - TIMENOW;
             if (!$play_time) {
                 $all_program[$i]['now_play'] = 1;
             }
         }
         if ($play_time && $all_program[$i]['start_time'] <= $play_time && $all_program[$i]['start_time'] + $all_program[$i]['toff'] > $play_time) {
             $all_program[$i]['now_play'] = 1;
             $all_program[$i]['lave_time'] = 1;
         }
         $all_program[$i]['stime'] = $all_program[$i]['start'];
         $program[] = $all_program[$i];
     }
     // hg_pre($program);exit;
     return $program;
 }
예제 #8
0
 function uploads()
 {
     if (!$this->input['channel_id']) {
         $this->errorOutput('未传入频道ID');
     }
     $channel_id = intval($this->input['channel_id']);
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $newLive = new live();
     $channel = $newLive->getChannelById($channel_id, -1);
     $channel = $channel[0];
     if (!$channel['id']) {
         $this->errorOutput('该频道已经不存在!');
     }
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $nodes = array();
     $nodes['_action'] = 'manage';
     $nodes['nodes'][$channel_id] = $channel_id;
     $this->verify_content_prms($nodes);
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     /**/
     if ($_FILES) {
         if ($_FILES['program']['error'] != 0) {
             exit('文件上传出错');
         }
     } else {
         //$this->errorOutput();
     }
     $file = $_FILES['program'];
     //$file['name'] = $file['tmp_name'] = '../cache/20130424161051.txt';
     $type = substr($file['name'], strrpos($file['name'], '.') + 1);
     $programs = $this->file2array($file['tmp_name'], $type);
     foreach ($programs as $dates => $value) {
         foreach ($value as $v) {
             $timestamp = strtotime(str_replace(':', ':', $dates . ' ' . $v['start_time']));
             $r['start_time'] = $timestamp;
             //  $r['start'] = date("Y-m-d H:i:s",$r['start_time']);
             if ($v['toff']) {
                 //if()
                 $r['toff'] = strtotime($dates . ' ' . $v['toff']);
                 if ($r['toff'] <= $r['start_time']) {
                     $r['toff'] = strtotime(date("Y-m-d", strtotime($dates) + 86400) . ' ' . $v['toff']);
                 }
             } else {
                 $r['toff'] = 0;
             }
             $r['theme'] = $v['theme'];
             $r['subtopic'] = $v['subtopic'];
             $r['type_id'] = $v['type_id'];
             $r['weeks'] = date('W', strtotime($dates));
             $r['dates'] = $dates;
             $return[$dates][] = $r;
         }
     }
     $next_day = array();
     if (!empty($return)) {
         foreach ($return as $dat => $items) {
             if ($next_day[$dat]) {
                 if ($next_day[$dat]['toff'] > $items[0]['start_time']) {
                     $this->addItem($dat . '的跨天数据有误!');
                     $this->output();
                 } else {
                     array_unshift($return[$dat], $next_day[$dat]);
                     array_unshift($items, $next_day[$dat]);
                     unset($next_day[$dat]);
                 }
             }
             $last_end = 0;
             foreach ($items as $i => $v) {
                 if ($i == count($items) - 1) {
                     $tmp_start = strtotime($v['dates']) + 86399;
                     if ($return[$dat][$i]['toff']) {
                         if ($v['toff'] > $tmp_start) {
                             $tmp_time = $items[$i];
                             $tmp_time['start_time'] = strtotime($v['dates']) + 86400;
                             $tmp_time['dates'] = date("Y-m-d", strtotime($v['dates']) + 86400);
                             $next_day[date("Y-m-d", $v['toff'])] = $tmp_time;
                         }
                     }
                     $return[$dat][$i]['toff'] = $tmp_start - $v['start_time'];
                 } else {
                     $tmp_start = $items[$i + 1]['start_time'];
                     if ($return[$dat][$i]['toff']) {
                         $tmp_start = $v['toff'];
                     }
                     $return[$dat][$i]['toff'] = $items[$i + 1]['start_time'] - $v['start_time'];
                 }
                 $return[$dat][$i]['start'] = date("H:i:s", $v['start_time']);
                 $return[$dat][$i]['end'] = date("H:i:s", $v['start_time'] + $return[$dat][$i]['toff']);
                 if ($return[$dat][$i]['toff'] < 0 || $last_end && $last_end > $v['start_time']) {
                     //$this->errorOutput('时间线不正确,请检查确认后重新提交!');
                     $this->addItem('时间线不正确,请检查确认后重新提交!');
                     $this->output();
                 }
                 $last_end = $v['start_time'] + $return[$dat][$i]['toff'];
             }
         }
     }
     if (!empty($next_day)) {
         $i = 0;
         foreach ($next_day as $dat => $v) {
             $return[$dat][$i] = $v;
             $return[$dat][$i]['toff'] = $v['toff'] - $v['start_time'];
             $return[$dat][$i]['start'] = date("H:i:s", $v['start_time']);
             $return[$dat][$i]['end'] = date("H:i:s", $v['start_time'] + $return[$dat][$i]['toff']);
             $i++;
         }
     }
     $info = $return;
     if (!empty($info)) {
         $del_id = $space = "";
         foreach ($info as $key => $value) {
             $program_single = $this->getProgram($channel_id, $key);
             foreach ($value as $kk => $vv) {
                 $start = $vv['start_time'];
                 $end = $vv['start_time'] + $vv['toff'];
                 if (!empty($program_single)) {
                     foreach ($program_single as $k => $r) {
                         if ($start == $r['start_time'] && $end == $r['start_time'] + $r['toff']) {
                             //	unset($info[$key][$kk]);
                             $del_id .= $space . $r["id"];
                             $space = ",";
                         } else {
                             if ($r['start_time'] >= $start && $r['start_time'] < $end) {
                                 $del_id .= $space . $r["id"];
                                 $space = ",";
                             }
                             if ($r['start_time'] < $start) {
                                 if ($r['start_time'] + $r['toff'] > $start) {
                                     $del_id .= $space . $r["id"];
                                     $space = ",";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($del_id) {
         $sql = "DELETE FROM " . DB_PREFIX . "program WHERE id IN(" . $del_id . ")";
         $this->db->query($sql);
     }
     //数据入库
     if (!empty($info)) {
         foreach ($info as $kk => $vv) {
             $sql = "INSERT INTO " . DB_PREFIX . "program(channel_id,start_time,toff,theme,subtopic,type_id,weeks,dates,create_time,update_time,ip,is_show,user_id,user_name,org_id,appid,appname) values";
             $space = $sql_extra = "";
             foreach ($vv as $k => $v) {
                 $sql_extra .= $space . "(" . $channel_id . "," . $v['start_time'] . "," . $v['toff'] . ",'" . $v['theme'] . "','" . $v['subtopic'] . "'," . ($v['type_id'] ? $v['type_id'] : 0) . "," . intval($v['weeks']) . ",'" . $v['dates'] . "'," . TIMENOW . "," . TIMENOW . ",'" . hg_getip() . "',1,'" . $this->user['user_id'] . "','" . $this->user['user_name'] . "','" . $this->user['org_id'] . "','" . $this->user['appid'] . "','" . $this->user['display_name'] . "')";
                 $space = ",";
             }
             if ($sql_extra) {
                 $sql .= $sql_extra;
                 $this->db->query($sql);
             }
         }
     }
     $this->addItem('success');
     $this->output();
 }
예제 #9
0
 function delete()
 {
     if (!$this->input['id']) {
         $this->errorOutput("未传入对象ID");
     }
     $id = intval($this->input['id']);
     $sql = "SELECT * FROM " . DB_PREFIX . "program_plan WHERE id=" . $id;
     $f = $this->db->query_first($sql);
     $channel_id = $f['channel_id'];
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $newLive = new live();
     $channel = $newLive->getChannelById($channel_id, -1);
     $channel = $channel[0];
     if (!$channel['id']) {
         $this->errorOutput('该频道已经不存在!');
     }
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $nodes = array();
     $nodes['_action'] = 'manage';
     $nodes['nodes'][$channel['id']] = $channel['id'];
     $this->verify_content_prms($nodes);
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $info = $this->obj->delete(intval($this->input['id']));
     if (!$info) {
         $this->errorOutput("删除失败!");
     }
     if ($info['id']) {
         $this->addLogs('删除节目计划', $f, '', '', '', $f['program_name'] . $f['id']);
     }
     $this->addItem(array('id' => $info));
     $this->output();
 }
예제 #10
0
 public function delete()
 {
     $id = urldecode($this->input['id']);
     if (!$id) {
         $this->errorOutput(OBJECT_NULL);
     } else {
         $sql = "SELECT * FROM " . DB_PREFIX . "server_config WHERE 1 AND state=1";
         $q = $this->db->query($sql);
         $server_config = array();
         while ($row = $this->db->fetch_array($q)) {
             $server_config[$row['id']] = $row;
         }
         $sql = "SELECT * FROM " . DB_PREFIX . "program_record WHERE id IN (" . $id . ")";
         $q = $this->db->query($sql);
         include_once ROOT_PATH . 'lib/class/live.class.php';
         $newLive = new live();
         $info = array();
         $channel_id = array();
         while ($row = $this->db->fetch_array($q)) {
             $info[] = $row;
             $channel_id[$row['channel_id']] = $row['channel_id'];
         }
         $channel_node = $channel_parent_node = array();
         if ($channel_id) {
             $channel = $newLive->getChannelById(implode(',', $channel_id), -1);
             if (!empty($channel)) {
                 foreach ($channel as $k => $v) {
                     $tmp_data = $newLive->getFatherNodeByid($v['node_id']);
                     $channel_node[$v['id']] = $tmp_data[0];
                     $channel_parent_node[$v['id']] = $v['node_id'];
                 }
             }
         }
         include_once ROOT_PATH . 'lib/class/curl.class.php';
         $id_success = array();
         $delete_id = $space = "";
         $ret = array();
         foreach ($info as $k => $row) {
             $this->curl = new curl($server_config[$row['server_id']]['host'] . ':' . $server_config[$row['server_id']]['port'], $server_config[$row['server_id']]['dir']);
             #####整合数据进行权限
             $nodes = array();
             $nodes['nodes'][$row['channel_id']] = $row['channel_id'];
             //hg_pre($nodes);exit;
             $this->verify_content_prms($nodes);
             if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
                 switch ($this->user['prms']['default_setting']['manage_other_data']) {
                     case 1:
                         //组织内,修改者和作者是否在同一组织
                         if ($this->user['org_id'] != $row['org_id']) {
                             $this->errorOutput(NO_PRIVILEGE);
                         }
                         break;
                     case 5:
                         //全部
                         break;
                     case 0:
                         //只能自己修改
                         if ($this->user['user_id'] != $row['user_id']) {
                             $this->errorOutput(NO_PRIVILEGE);
                         }
                         break;
                     default:
                         break;
                 }
             }
             #####整合数据进行权限结束
             if ($row['conid'] && $row['start_time'] > TIMENOW + 5) {
                 $sql = "SELECT * FROM " . DB_PREFIX . "program_queue WHERE id=" . $row['conid'];
                 $tmp_first = $this->db->query_first($sql);
                 if (!empty($tmp_first)) {
                     $this->curl->mPostContentType('string');
                     $this->curl->setSubmitType('get');
                     $this->curl->setReturnFormat('json');
                     $this->curl->initPostData();
                     if (!defined('IS_WOZA') || !IS_WOZA) {
                         $this->curl->addRequestData('action', 'DELETE');
                     } else {
                         $this->curl->addRequestData('action', 'delete');
                     }
                     $this->curl->addRequestData('id', $tmp_first['conid']);
                     $record_xml = $this->curl->request('');
                     $record_array = xml2Array($record_xml);
                     if ($record_array['result']) {
                         $id_success[] = $row['id'];
                     }
                 }
             }
             $delete_id .= $space . $row['id'];
             $space = ',';
             $ret[] = $row;
         }
         if ($delete_id) {
             $sql = "DELETE FROM " . DB_PREFIX . "program_record WHERE id IN (" . $delete_id . ")";
             $this->db->query($sql);
             $sql = "DELETE FROM " . DB_PREFIX . "program_record_relation WHERE record_id IN (" . $delete_id . ")";
             $this->db->query($sql);
             $sql = "DELETE FROM " . DB_PREFIX . "program_record_log WHERE record_id IN (" . $delete_id . ")";
             $this->db->query($sql);
             $sql = "DELETE FROM " . DB_PREFIX . "program_queue WHERE record_id IN (" . $delete_id . ")";
             $this->db->query($sql);
         }
         $this->addLogs('删除录制', $ret, '', '', '', '删除录制' . $delete_id);
     }
     $re = array();
     $id_array = explode(',', $id);
     $delid_array = explode(',', $delete_id);
     if (count($id_array) == count($delid_array)) {
         $re['info'] = '';
     } else {
         $re['info'] = '来自于节目单或者节目单计划的录制内容无法删除!';
     }
     $re['id'] = $delete_id;
     $this->setXmlNode('program_record', 'info');
     $this->addItem($re);
     $this->output();
 }
예제 #11
0
파일: program.php 프로젝트: h3len/Project
 public function getTimeshiftNew()
 {
     $channel_id = intval($this->input['channel_id'] ? $this->input['channel_id'] : '');
     if (empty($channel_id)) {
         $this->errorOutput('缺少频道ID');
     }
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $newLive = new live();
     $channel = $newLive->getChannelById($channel_id);
     if (empty($channel)) {
         $this->errorOutput("此频道不存在或者已被删除!");
     }
     $channel = $channel[0];
     $channel_name = $channel['name'];
     $save_time = $channel['time_shift'];
     $start_time = strtotime(date("Y-m-d", TIMENOW - 3600 * $save_time) . " 00:00:00");
     $end_time = strtotime(date("Y-m-d", TIMENOW) . " 23:59:59") + 1;
     $condition = " AND channel_id=" . $channel_id . " AND  start_time>'" . $start_time . "' AND start_time<" . $end_time . "";
     $info = $this->obj->show($condition, $channel_id, $start_time, $end_time, $save_time);
     $this->addItem($info);
     $this->output();
 }
예제 #12
0
 function show()
 {
     //$id = '126,106,100,127,217,111,134,139,119';
     $id = $this->input['id'];
     $condition = '';
     if ($id) {
         $condition .= ' pr.id IN(' . $this->input['id'] . ')';
         $day = intval($this->input['day']);
     } else {
         $condition .= "is_record=1 and (pr.start_time) > " . strtotime(date('Y-m-d', TIMENOW)) . " and (pr.start_time+pr.toff) < " . TIMENOW;
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "program_record pr WHERE " . $condition;
     $record_info = $channel_info = array();
     $q = $this->db->query($sql);
     while ($row = $this->db->fetch_array($q)) {
         $channel_info[$row['channel_id']] = $row['channel_id'];
         $record_info[] = $row;
     }
     if (!empty($channel_info)) {
         $channel_ids = implode(',', $channel_info);
         include_once ROOT_PATH . 'lib/class/live.class.php';
         $newLive = new live();
         $channel_tmp = $newLive->getChannelById($channel_ids);
         foreach ($channel_tmp as $k => $v) {
             $channel[$v['id']] = $v;
         }
     }
     include_once ROOT_PATH . 'lib/class/program.class.php';
     $program_plan = new program();
     $info = array();
     foreach ($record_info as $k => $row) {
         $channel_tmp = $channel[$row['channel_id']];
         $row['name'] = $channel_tmp['name'];
         $row['save_time'] = $channel_tmp['save_time'];
         $row['record_time'] = $channel_tmp['record_time'];
         $program = $row['title'] ? $row['title'] : trim($program_plan->get_program_plan($row['channel_id'], $row['starttime'], $row['endtime']));
         if ($id) {
             $row['start_time'] = $row['start_time'] - $day * 86400;
         }
         $start_time = date('YmdHis', $row['start_time'] + $row['record_time'] - 1);
         /*
         $data = array(
         	'start_time' => $start_time,
         	'id' =>  $row['id'],
         	'duration' => $row['toff'],
         	'exit_status' => 1,
         	'save_time' => $row['save_time'],
         	'source' => $row['channel_id'],
         	'is_allow' => $row['is_mark'],
         	'vod_sort_id' => $row['item'],
         	'week_flag' => $row['week_day'] ? 1 : 0,
         	'column_id' => $row['columnid'],
         	'audit_auto' => $row['audit_auto'] ? 2 : 0,
         	'title' => base64_encode(json_encode(trim($program ? $program : '精彩节目'))),
         	'name' => $row['name'],
         	'channel_id' => $row['channel_id'],
         	'file_path' => substr($start_time,0,4) . '/' . substr($start_time,4,2). '/' . substr($start_time,6,2). '/' . substr($start_time,8,2). '/' . substr($start_time,10,2). '/' . substr($start_time,12,2) . '/' . $row['id'] . '.mp4',
         	'extend' => base64_encode(json_encode(array('user_id' => $row['user_id'],'user_name' => $row['user_name'],'org_id' => $row['org_id'],'force_codec'=>$row['force_codec']))),
         	'update_state' => 1,
         );
         */
         $data = array('id' => $row['id'], 'is_time_shift' => $row['time_shift'] ? 1 : 0, 'title' => $program ? $program : '精彩节目', 'filepath' => substr($start_time, 0, 4) . '/' . substr($start_time, 4, 2) . '/' . substr($start_time, 6, 2) . '/' . substr($start_time, 8, 2) . '/' . substr($start_time, 10, 2) . '/' . substr($start_time, 12, 2) . '/' . $row['id'] . '.flv', 'source' => $row['name'], 'is_mark' => $row['is_mark'], 'vod_sort_id' => $row['item'], 'audit_auto' => $row['audit_auto'] ? 2 : 0, 'column_id' => $row['columnid'], 'channel_id' => $row['channel_id'], 'vod_leixing' => 3, 'start' => '0', 'end' => $row['toff'] * 1000, 'starttime' => $start_time, 'create_time' => -1, 'appid' => $this->input['appid'], 'appkey' => $this->input['appkey'], 'user_id' => $row['user_id'], 'user_name' => $row['user_name'], 'org_id' => $row['org_id'], 'force_codec' => $row['force_codec']);
         hg_pre($data);
         exit;
         $info[] = $data;
         if ($this->input['debug']) {
             hg_pre($data);
             exit;
         }
         foreach ($data as $k => $v) {
             $curl->addRequestData($k, $v);
         }
         $ret = $curl->request('create.php');
         /*	
         			$this->curl->setSubmitType('post');
         			$this->curl->initPostData();
         			$this->curl->addRequestData('a','callBack');
         			$this->curl->addRequestData('appkey',$this->input['appkey']);
         			$this->curl->addRequestData('appid',$this->input['appid']);
         			$this->curl->addRequestData('data',json_encode($data));
         			$this->curl->addRequestData('html',1);
         			$ret = $this->curl->request('record_callback.php');
         			hg_pre($ret);
         */
     }
     //hg_pre($info);
 }
예제 #13
0
 function create()
 {
     $channel_id = intval($this->input['channel_id'] ? $this->input['channel_id'] : 0);
     if (empty($channel_id)) {
         $this->errorOutput('请传入频道ID');
     }
     include_once ROOT_PATH . 'lib/class/live.class.php';
     $newLive = new live();
     $channel = $newLive->getChannelById($channel_id, -1);
     $channel = $channel[0];
     if (!$channel['id']) {
         $this->errorOutput('该频道已经不存在!');
     }
     $start_time = strtotime(trim(urldecode($this->input['dates'])) . ' ' . trim(urldecode($this->input['start_time'])));
     $end_time = strtotime(trim(urldecode($this->input['dates'])) . ' ' . trim(urldecode($this->input['end_time'])));
     $toff = $end_time - $start_time;
     if ($toff < 0) {
         $toff = $toff + 24 * 3600;
     }
     $is_record = 0;
     //判断录制状态
     $is_out = 0;
     //判断是否超时
     if (is_array($this->input['week_day']) && $this->input['week_day']) {
         $is_record = 0;
         if ($start_time > TIMENOW + 5) {
             $week_now = date('N', TIMENOW);
             $week_num = $this->input['week_day'];
             if (in_array($week_now, $week_num)) {
                 $dates = date('Y-m-d', TIMENOW);
             }
             $i = 0;
             $next_day = $next_week_day = 0;
             foreach ($week_num as $k => $v) {
                 if (!$i && $v > $week_now) {
                     $next_day = $v;
                     $i = 1;
                 }
                 if (!$k) {
                     $next_week_day = $v;
                 }
             }
             if (!$next_day) {
                 $next_day = $next_week_day;
             }
             $next_week = $next_day - $week_now > 0 ? $next_day - $week_now : $next_day - $week_now + 7;
             $dates = date('Y-m-d', TIMENOW + $next_week * 86400);
             $start_time = strtotime($dates . ' ' . trim(urldecode($this->input['start_time'])));
             $end_time = strtotime($dates . ' ' . trim(urldecode($this->input['end_time'])));
         }
         $week_day = serialize($this->input['week_day']);
     } else {
         //单天
         if ($start_time > TIMENOW) {
             $is_record = 0;
             $is_out = 0;
         } else {
             $is_record = 2;
             $is_out = 1;
         }
     }
     $sql = "SELECT channel_id, start_time, toff FROM " . DB_PREFIX . "program_record WHERE channel_id =" . $channel_id . " AND " . $start_time . "=start_time and " . $end_time . "=(start_time+toff) AND week_day='" . $week_day . "'";
     $f = $this->db->query_first($sql);
     if ($f['channel_id']) {
         $this->errorOutput('此段时间已经有节目被录制!');
     }
     $columnid = $this->input['column_id'] ? $this->input['column_id'] : '';
     $column_name = $this->input['column_name'] ? $this->input['column_name'] : '';
     $info = array('channel_id' => $channel_id, 'start_time' => $start_time, 'title' => $this->input['title'] ? $this->input['title'] : '', 'toff' => $toff, 'week_day' => $week_day ? $week_day : '', 'item' => intval($this->input['item']), 'columnid' => $columnid, 'column_name' => $column_name, 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'is_mark' => $this->input['is_mark'], 'ip' => hg_getip(), 'force_codec' => $this->input['force_codec'] ? 1 : 0, 'is_record' => $is_record, 'audit_auto' => $this->input['audit_auto'], 'is_out' => $is_out, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'org_id' => $this->user['org_id'], 'appid' => $this->user['appid'], 'appname' => $this->user['display_name']);
     if (!$info['channel_id'] || !$info['start_time']) {
         $this->errorOutput(OBJECT_NULL);
     }
     if (empty($toff)) {
         $this->errorOutput('录制时长不能为零!');
     }
     $server = $this->_get_server();
     if (empty($server)) {
         $this->errorOutput('录制服务不存在or有误~');
     }
     $info['server_id'] = $server['id'];
     $ret = $this->obj->create($info);
     $info['id'] = $ret['id'];
     $this->setXmlNode('program_record', 'info');
     $this->addItem($ret);
     $this->output();
 }