Пример #1
0
    function message_info($condition = '', $orderby = ' i.id DESC ', $offset = 0, $count = 20)
    {
        $limit = " limit {$offset}, {$count}";
        $sql = 'SELECT i.*,f.id as fid,f.file_name,f.file_path 
				FROM ' . DB_PREFIX . 'interview i 
				LEFT  JOIN ' . DB_PREFIX . 'files f ON i.cover_pic = f.id 
				WHERE i.isclose=0 ' . $condition . $orderby . $limit;
        $res = $this->db->query($sql);
        $k = array();
        while (!false == ($r = $this->db->fetch_array($res))) {
            $arr['id'] = $r['id'];
            $arr['title'] = $r['title'];
            $arr['start_time'] = $r['start_time'];
            $arr['end_time'] = $r['end_time'];
            //$a = unserialize($r['moderator']);
            //$r['moderator'] = $a[key($a)];
            $r['moderator'] = unserialize($r['moderator']);
            $arr['moderator'] = empty($r['moderator']) ? $r['moderator'] : '';
            $b = unserialize($r['honor_guests']);
            $arr['honor_guests'] = empty($b) ? '' : $b;
            $arr['object_type'] = $this->settings['object_type'][$r['object_type']];
            $arr['description'] = $r['description'];
            $arr['is_pre_ask'] = $r['is_pre_ask'];
            $arr['need_login'] = $r['nedd_login'];
            $arr['cover_pic'] = $r['file_path'] && $r['file_name'] ? hg_material_link(IMG_URL, app_to_dir(APP_UNIQUEID), $r['file_path'], $r['file_name']) : '';
            $k[] = $arr;
        }
        return $k;
    }
Пример #2
0
 function show()
 {
     $channel_id = intval($this->input['channel_id']);
     if (!$channel_id) {
         $this->errorOutput('未传入频道id');
     }
     $sql = "SELECT id, start_time, toff, theme FROM " . DB_PREFIX . "program ";
     $sql .= " WHERE channel_id = " . $channel_id . " AND start_time>=" . TIMENOW;
     $sql .= " ORDER BY start_time ASC LIMIT 1";
     $program_info = $this->db->query_first($sql);
     $sql = "SELECT name, logo_info, stream_id FROM " . DB_PREFIX . "channel ";
     $sql .= " WHERE id = " . $channel_id;
     $channel_info = $this->db->query_first($sql);
     $logo_url = '';
     if ($channel_info['logo_info']) {
         $logo_info = @unserialize($channel_info['logo_info']);
         $logo_url = hg_material_link($logo_info['host'], $logo_info['dir'], $logo_info['filepath'], $logo_info['filename']);
     }
     header('Content-Type: text/xml; charset=UTF-8');
     $dom = new DOMDocument('1.0', 'utf-8');
     $channel = $dom->createElement('channel');
     $channel->setAttribute('name', $channel_info['name']);
     $channel->setAttribute('url', $logo_url);
     $channel->setAttribute('current', $channel_info['stream_id']);
     $logos = $dom->createElement('logos');
     $item = $dom->createElement('item');
     $item->setAttribute('url', $channel_info['logo']);
     $logos->appendChild($item);
     $channel->appendChild($logos);
     $dom->appendChild($channel);
     echo $dom->saveXml();
 }
Пример #3
0
 function show()
 {
     //权限判断
     $this->verify_content_prms(array('_action' => 'manage_maga'));
     $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
     $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 10;
     $orderby = ' ORDER BY m.order_id  DESC';
     $condition = $this->get_condition();
     if ($this->input['show_last_issue']) {
         $condition .= ' AND m.issue_id > 0 ';
     }
     $res = $this->maga->show($condition, $orderby, $offset, $count);
     if (!$this->input['show_last_issue']) {
         foreach ($res as $k => $r) {
             $r['url'] = hg_material_link($r['host'], $r['dir'], $r['file_path'], $r['file_name'], $size);
             $this->addItem($r);
         }
     } else {
         foreach ($res as $k => $v) {
             $v['url'] = hg_material_link($v['host'], $v['dir'], $v['file_path'], $v['file_name'], $size);
             $v['release_cycle'] = $this->settings['release_cycle'][$v['release_cycle']];
             $arr[] = $v;
         }
         $this->addItem($arr);
     }
     $this->output();
 }
Пример #4
0
 public function make_url($info, $size = '40x30/')
 {
     if ($info) {
         $url = '';
         $url = unserialize($info);
         $url = hg_material_link($url['host'], $url['dir'], $url['filepath'], $url['filename'], $size);
     }
     return $url;
 }
Пример #5
0
 /**
  * 会员头像
  * Enter description here ...
  */
 public function memberAvatarDetail($member_id, $width, $height)
 {
     $condition = ' WHERE member_id IN (' . urldecode($this->input['member_id']) . ')';
     $sql = "SELECT * FROM " . DB_PREFIX . "member_avatar " . $condition;
     $row = $this->db->query_first($sql);
     if (is_array($row) && $row) {
         //40*40
         $row['avatar_small'] = hg_material_link($row['host'], $row['dir'], $row['filepath'], $row['filename'], $width . 'x' . $height . '/');
         $row['create_time'] = date('Y-m-d H:i:s', $row['create_time']);
         return $row;
     }
     return false;
 }
Пример #6
0
 public function show()
 {
     $channel_id = intval($this->input['channel_id']);
     $dates = $this->input['dates'] ? urldecode($this->input['dates']) : date('Y-m-d', TIMENOW);
     $appid = intval($this->input['appid']);
     if (!$channel_id) {
         $this->errorOutput('NO_CHANNEL_ID');
     }
     //频道信息
     $channel_info = $this->mChannel->get_channel_by_id($channel_id);
     if (empty($channel_info)) {
         $this->errorOutput('NO_CHANNEL_INFO');
     }
     if ($channel_info['client_logo'][$appid]) {
         unset($channel_info['client_logo'][$appid]['appid'], $channel_info['client_logo'][$appid]['appname']);
         $channel_info['logo_rectangle'] = $channel_info['client_logo'][$appid];
     }
     unset($channel_info['client_logo']);
     if ($channel_info['logo_rectangle']) {
         $channel_info['logo_url'] = hg_material_link($channel_info['logo_rectangle']['host'], $channel_info['logo_rectangle']['dir'], $channel_info['logo_rectangle']['filepath'], $channel_info['logo_rectangle']['filename'], '113x43/');
     }
     //	unset($channel_info['logo_rectangle']);
     $this->addItem_withkey('channel_info', $channel_info);
     $this->addItem_withkey('dates', $dates);
     //节目屏蔽
     $condition = $this->get_condition();
     $orderby = " ORDER BY start_time ASC ";
     $ret_shield = $this->mProgramShield->show($channel_id, $dates, $condition, $orderby);
     $start = strtotime($dates . ' ' . '00:00:00');
     $end = strtotime($dates . ' ' . '23:59:59');
     $tmp_time = 0;
     $shield = array();
     if (!empty($ret_shield)) {
         foreach ($ret_shield as $v) {
             if (!$tmp_time && $v['start_time'] > $start) {
                 $shield[] = $this->get_blank_time($start, $v['start_time'], $dates);
             }
             if ($tmp_time && $tmp_time != $v['start_time']) {
                 $shield[] = $this->get_blank_time($tmp_time, $v['start_time'], $dates);
             }
             $tmp_time = $v['start_time'] + $v['toff'];
             $shield[] = $v;
         }
     }
     $this->addItem($shield);
     $this->output();
 }
Пример #7
0
 public function show()
 {
     $condition = $this->get_condition();
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $width = $this->settings['avatar_size']['width'];
     $height = $this->settings['avatar_size']['height'];
     $members = $this->mMember->show($condition, $offset, $count);
     $this->setXmlNode('member', 'info');
     if (!empty($members)) {
         foreach ($members as $member) {
             //	hg_pre($member);
             if ($member['filename']) {
                 $member['avatar_url'] = hg_material_link($member['host'], $member['dir'], $member['filepath'], $member['filename'], $width . 'x' . $height . '/');
             }
             $this->addItem($member);
         }
     }
     $this->output();
 }
Пример #8
0
 public function show()
 {
     $interviewid = $this->input['interview_id'];
     if (empty($interviewid)) {
         //$this->errorOutput('无效参数');
     }
     //首页图片
     $res = $this->db->query_first('SELECT cover_pic FROM ' . DB_PREFIX . 'interview where id=' . $interviewid);
     $cover_pic = $res['cover_pic'];
     $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
     $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 10;
     $limit = " limit {$offset}, {$count}";
     $orderby = ' ORDER BY order_id  DESC';
     $condition = $this->get_condition();
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'files WHERE interview_id=' . $interviewid . $condition . $orderby . $limit;
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $r['interview_id'] = $interviewid;
         $r['cover_pic'] = $cover_pic;
         $r['create_time'] = date('Y-m-d H:i:s', $r['create_time']);
         $r['file_size'] = round($r['file_size'] / 1024 / 8, 2) . ' KB';
         switch ($r['show_pos']) {
             case 0:
                 $r['show_pos'] = '头部';
                 break;
             case 1:
                 $r['show_pos'] = '背景';
                 break;
             case 2:
                 $r['show_pos'] = '其它';
                 break;
         }
         $r['ori_pic'] = hg_material_link(IMG_URL, app_to_dir(APP_UNIQUEID), $r['file_path'], $r['file_name']);
         //$r['ori_pic'] = $this->obj->pic_path($r['server_mark'], $r['file_path'], $r['file_name'], '');
         //$r['pic'] = $this->obj->pic_path($r['server_mark'], $r['file_path'], $r['file_name'], '50x50');
         $r['pic'] = hg_material_link(IMG_URL, app_to_dir(APP_UNIQUEID), $r['file_path'], $r['file_name'], '40x30/');
         $this->addItem($r);
     }
     $this->output();
 }
Пример #9
0
 public function show()
 {
     //检测是否具有配置权限
     if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
         if (!$this->user['prms']['app_prms'][APP_UNIQUEID]['setting']) {
             //$this->errorOutput(NO_PRIVILEGE);
         }
     }
     $condition = $this->get_condition();
     $offset = intval($this->input['offset']);
     $count = intval($this->input['count']);
     $mobileModuleList = $this->mMobileModule->show($condition, $offset, $count);
     if ($mobileModuleList) {
         foreach ($mobileModuleList as $mobileModule) {
             if ($mobileModule['icon1']) {
                 $mobileModule['icon1'] = hg_material_link($mobileModule['icon1']['host'], $mobileModule['icon1']['dir'], $mobileModule['icon1']['filepath'], $mobileModule['icon1']['filename']);
             } else {
                 if ($mobileModule['filename']) {
                     $mobileModule['icon1'] = hg_material_link($mobileModule['host'], $mobileModule['dir'], $mobileModule['filepath'], $mobileModule['filename']);
                 }
             }
             /*if ($mobileModule['icon2'])
             		{
             			$mobileModule['icon2'] = hg_material_link($mobileModule['icon2']['host'], $mobileModule['icon2']['dir'], $mobileModule['icon2']['filepath'], $mobileModule['icon2']['filename']);
             		}
             		if ($mobileModule['icon3'])
             		{
             			$mobileModule['icon3'] = hg_material_link($mobileModule['icon3']['host'], $mobileModule['icon3']['dir'], $mobileModule['icon3']['filepath'], $mobileModule['icon3']['filename']);
             		}
             		if ($mobileModule['icon4'])
             		{
             			$mobileModule['icon4'] = hg_material_link($mobileModule['icon4']['host'], $mobileModule['icon4']['dir'], $mobileModule['icon4']['filepath'], $mobileModule['icon4']['filename']);
             		}*/
             //$info[] = $mobileModule;
             $this->addItem($mobileModule);
         }
         //hg_pre($info,0);
     }
     $this->output();
 }
Пример #10
0
 /**
  * 根据文章ID检索文章信息
  * @name show_opration
  * @access public 
  * @author wangleyuan
  * @category hogesoft
  * @copyright hogesoft
  * @param id int 文章id
  * @return array $return 文章信息
  */
 public function show_opration()
 {
     if (!$this->input['id']) {
         $this->errorOutput('ID不能为空');
     }
     $sql = "select a.* ,c.*,s.name from ((" . DB_PREFIX . "article a left join " . DB_PREFIX . "article_contentbody c on a.id=c.articleid) left join " . DB_PREFIX . "sort s on a.sort_id=s.id) where a.id=" . $this->input['id'];
     $return = $this->db->query_first($sql);
     if (!empty($return['indexpic'])) {
         //查询索引图片地址
         $sql = "select * from " . DB_PREFIX . "material where material_id=" . $return['indexpic'];
         $q = $this->db->query_first($sql);
         $size = array('label' => '400x300', 'width' => 400, 'height' => 300);
         if (!empty($q)) {
             $return['url'] = hg_material_link($q['host'], $q['dir'], $q['filepath'], $q['filename'], $size['label'] . '/');
         }
     }
     if (!$return) {
         $this->errorOutput('文章不存在或已被删除');
     }
     //记录页面的所处的类型与类别
     if ($this->input['frame_type']) {
         $return['frame_type'] = intval($this->input['frame_type']);
     } else {
         $return['frame_type'] = '';
     }
     if ($this->input['frame_sort']) {
         $return['frame_sort'] = intval($this->input['frame_sort']);
     } else {
         $return['frame_sort'] = '';
     }
     $return['create_time'] = date('Y-m-d H:i', $return['create_time']);
     $return['update_time'] = date('Y-m-d H:i', $return['update_time']);
     $return['pub_time'] = date('Y-m-d H:i', $return['pub_time']);
     $this->addItem($return);
     $this->output();
 }
Пример #11
0
 public function show_win_info_more()
 {
     $id = intval($this->input['id']);
     if (!$id) {
         $this->errorOutput('活动id不存在');
     }
     $pp = $this->input['page'] ? intval($this->input['page']) : 1;
     //如果没有传第几页,默认是第一页
     $count = $this->input['count'] ? intval($this->input['count']) : 12;
     $offset = intval(($pp - 1) * $count);
     $limit = ' LIMIT ' . $offset . ' , ' . $count;
     $orderby = '  ORDER BY red_bag DESC,create_time  ASC ';
     $sql = "SELECT * FROM " . DB_PREFIX . "win_info WHERE tv_interact_id = " . $id . $orderby . $limit;
     $q = $this->db->query($sql);
     $member_id = array();
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d H:i', $r['create_time']);
         $info[] = $r;
         $member_id[] = $r['member_id'];
     }
     if (!empty($member_id)) {
         include_once ROOT_DIR . 'lib/class/members.class.php';
         $obj = new members();
         $member_id = implode(',', $member_id);
         $member_info = array();
         $member_info_tmp = array();
         $member_info_tmp = $obj->get_member_info($member_id);
         if (!empty($member_info_tmp)) {
             $size = '82x62/';
             foreach ($member_info_tmp as $val) {
                 $member_info[$val['member_id']]['member_name'] = $val['member_name'];
                 if (!empty($val['avatar'])) {
                     $member_info[$val['member_id']]['avatar'] = hg_material_link($val['avatar']['host'], $val['avatar']['dir'], $val['avatar']['filepath'], $val['avatar']['filename'], $size);
                 } else {
                     $member_info[$val['member_id']]['avatar'] = array();
                 }
                 $member_info[$val['member_id']]['phone_num'] = $val['mobile'];
             }
         }
     }
     if (!empty($info)) {
         foreach ($info as $val) {
             foreach ($val as $k => $v) {
                 if ($k == 'member_id' && $member_info[$v]) {
                     $val['member_name'] = $member_info[$v]['member_name'];
                     $val['phone_num'] = $member_info[$v]['phone_num'];
                     $val['avatar'] = $member_info[$v]['avatar'];
                 }
             }
             $ret[] = $val;
         }
     }
     //分页信息
     $sql = 'SELECT COUNT(*) AS total FROM ' . DB_PREFIX . 'win_info WHERE 1 AND tv_interact_id = ' . $id;
     $re = $this->db->query_first($sql);
     $total_num = $re['total'];
     //总的记录数
     //总页数
     if (intval($total_num % $count) == 0) {
         $return['total_page'] = intval($total_num / $count);
     } else {
         $return['total_page'] = intval($total_num / $count) + 1;
     }
     $return['total_num'] = $total_num;
     //总的记录数
     $return['page_num'] = $count;
     //每页显示的个数
     $return['current_page'] = $pp;
     //当前页码
     $data['info'] = $ret;
     $data['page_info'] = $return;
     $this->addItem($data);
     $this->output();
 }
Пример #12
0
 /**
  * 显示节目单
  */
 function show()
 {
     $condition = '';
     $channel_id = intval($this->input['channel_id']) ? intval($this->input['channel_id']) : 0;
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $dates = array();
     if ($channel_id) {
         $dates = $this->getWeekInfo($channel_id);
     } else {
         $this->errorOutput(NO_CHANNEL_ID);
     }
     if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
         $is_action = trim($this->input['a']) == 'count' ? true : false;
         if ($this->user['prms']['app_prms'][APP_UNIQUEID]['action']) {
             foreach ($this->user['prms']['app_prms'][APP_UNIQUEID]['action'] as $k => $v) {
                 if ($v == $this->input['a']) {
                     $is_action = true;
                 }
             }
         }
         if ($is_action && $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes']) {
             $all_node = $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes'];
             $cond = array();
             if (intval($this->input['_id'])) {
                 if (in_array(intval($this->input['_id']), $all_node)) {
                     $cond['channel_id'] = intval($this->input['_id']);
                 }
             } else {
                 $cond['channel_id'] = '';
                 $space = '';
                 foreach ($all_node as $k => $v) {
                     if ($v > 0) {
                         $cond['channel_id'] .= $space . $v;
                         $space = ',';
                     }
                 }
             }
             //	echo $cond['node_id'].'<br/>';exit;
             $cond['is_stream'] = 0;
             $cond['field'] = 'id, name, code, is_control, is_audio, is_mobile_phone, server_id, logo_rectangle, logo_square, node_id';
             $channel = $this->mNewLive->getChannelInfo($cond);
             $channel_id = array();
             if (!empty($channel)) {
                 foreach ($channel as $v) {
                     $channel_id[] = $v['id'];
                 }
             }
             if ($this->input['channel_id']) {
                 if (!in_array($this->input['channel_id'], $channel_id)) {
                     $this->errorOutput(NO_PRIVILEGE);
                 } else {
                     $channel_condition = intval($this->input['channel_id']);
                 }
             } else {
                 $channel_condition = $channel_id ? implode(',', $channel_id) : '';
             }
             $channel_condition = $channel_condition ? $channel_condition : -1;
             if ($channel_condition > -1) {
                 $condition .= ' AND channel_id = ' . $channel_condition;
             } else {
                 $this->errorOutput(NO_PRIVILEGE);
             }
         }
     } else {
         $channel_condition = intval($this->input['channel_id']) ? intval($this->input['channel_id']) : -1;
     }
     $this->verify_content_prms();
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     $channel_id_info = $channel_id;
     $channel_id = $channel_condition;
     $week = array('日', '一', '二', '三', '四', '五', '六');
     $get_week = $this->getWeek();
     $channel = $this->mNewLive->getChannel();
     $_dates = $short_week = array();
     foreach ($get_week as $k => $v) {
         $short_week[] = $week[date('w', strtotime($v))];
         $_dates[$k] = 0;
     }
     $channel_info = array();
     if (!empty($channel)) {
         foreach ($channel as $k => $row) {
             $row['is_schedule'] = $dates[$row['id']] ? $dates[$row['id']]['is_schedule'] : $_dates;
             if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
                 if (in_array($row['id'], $channel_id_info)) {
                     if (empty($channel_info)) {
                         $channel_info['default'] = $row;
                     }
                     $row['logo_info'] = unserialize($row['logo_info']);
                     if ($row['logo_info']) {
                         $row['logo_url'] = hg_material_link($row['logo_info']['host'], $row['logo_info']['dir'], $row['logo_info']['filepath'], $row['logo_info']['filename'], '112x43/');
                     }
                     unset($row['logo_info']);
                     $channel_info[$row['id']] = $row;
                 }
             } else {
                 if (empty($channel_info)) {
                     $channel_info['default'] = $row;
                 }
                 $row['logo_info'] = unserialize($row['logo_info']);
                 if ($row['logo_info']) {
                     $row['logo_url'] = hg_material_link($row['logo_info']['host'], $row['logo_info']['dir'], $row['logo_info']['filepath'], $row['logo_info']['filename'], '112x43/');
                 }
                 unset($row['logo_info']);
                 $channel_info[$row['id']] = $row;
             }
         }
     }
     $this->addItem_withkey('channel_info', $channel_info);
     $this->addItem_withkey('week', $get_week);
     $this->addItem_withkey('short_week', $short_week);
     $dates = $this->input['dates'] ? $this->input['dates'] : date("Y-m-d");
     $condition .= " AND FROM_UNIXTIME(start_time, '%Y-%m-%d')='" . $dates . "'";
     if ($channel_condition > -1) {
         $condition .= ' AND channel_id = ' . $channel_condition;
     }
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $data_limit = " LIMIT " . $offset . " , " . $count;
     $sql = "select *,FROM_UNIXTIME(start_time, '%Y-%m-%d') as start,FROM_UNIXTIME(start_time, '%U') as week_set from " . DB_PREFIX . "program ";
     $sql .= ' where 1 ' . $condition . ' ORDER BY start_time ASC';
     $q = $this->db->query($sql);
     $this->addItem_withkey('date', $dates);
     //$program_plan = $this->getPlan($channel_id,$dates);
     $program_template = $this->getTemplate($channel_id, $dates);
     $program_plan = $program_template;
     $all_program = array();
     $key = '';
     while ($row = $this->db->fetch_array($q)) {
         $start_time = $row['start_time'];
         $end_time = $row['start_time'] + $row['toff'];
         $display = $lave_time = $now_play = $zhi_play = 0;
         $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;
     }
     if (!empty($program)) {
         foreach ($program_plan as $k => $v) {
             $program_plan[$k]['start_time'] = strtotime($v['dates'] . ' ' . date('H:i:s', $v['start_time']));
         }
         foreach ($program as $key => $value) {
             $new_unit_program = array();
             if ($program_plan) {
                 $length_plan = count($program_plan);
                 for ($i = 0; $i < $length_plan; $i++) {
                     if ($value['start_time'] < $program_plan[$i]['start_time'] && $value['start_time'] + $value['toff'] > $program_plan[$i]['start_time']) {
                         if ($value['start_time'] == $program_plan[$i]['start_time']) {
                             $value['theme'] = $program_plan[$i]['theme'];
                             $value['is_plan'] = 1;
                             $value['end'] = date("H:i", $value['start_time'] + $value['toff']);
                             $all_program[$value['start']] = $value;
                             break;
                         } else {
                             $new_unit_program = $value;
                             //是被切的节目单的上班部分精彩节目
                             $new_unit_program['toff'] = $program_plan[$i]['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']);
                             $all_program[$new_unit_program['start']] = $new_unit_program;
                             //被切的下半部分,即为节目计划
                             $value['theme'] = $program_plan[$i]['theme'];
                             $value['toff'] = $value['toff'] - $new_unit_program['toff'];
                             $value['start_time'] = $program_plan[$i]['start_time'];
                             $value['is_plan'] = 1;
                             $value['start'] = date("H:i", $value['start_time']);
                             $value['end'] = date("H:i", $value['start_time'] + $value['toff']);
                             $all_program[$value['start']] = $value;
                             break;
                         }
                     } else {
                         $all_program[$value['start']] = $value;
                         continue;
                     }
                 }
             } else {
                 $all_program[$value['start']] = $value;
             }
         }
         $tmp_all_program = array();
         foreach ($all_program as $k => $v) {
             $tmp_all_program[] = $v;
         }
         $all_program = $tmp_all_program;
     }
     $program_line = array();
     if ($program_plan) {
         if (empty($all_program)) {
             $all_program = $program_plan;
         }
         $tmp_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]);
                 }
             }
             $program_line[$i] = $all_program[$i];
         }
     } else {
         $program_line = $all_program;
     }
     $program = array();
     if ($program_line) {
         $noon = strtotime($dates . " 12:00");
         foreach ($program_line as $k => $v) {
             if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
                 switch ($this->user['prms']['default_setting']['show_other_data']) {
                     case 0:
                         //不允许
                         if ($this->user['user_id'] != $v['user_id']) {
                             $this->errorOutput(NO_PRIVILEGE);
                         }
                         break;
                     case 1:
                         if ($this->user['org_id'] != $v['org_id']) {
                             $this->errorOutput(NO_PRIVILEGE);
                         }
                         break;
                     case 5:
                         break;
                     default:
                         break;
                 }
             }
             if ($v['start_time'] < $noon) {
                 $v['pos'] = hg_get_pos($v['start_time'] - strtotime($dates));
                 $v['slider'] = hg_get_slider($v['start_time'] - strtotime($dates));
                 $key = 'am';
             } else {
                 $v['pos'] = hg_get_pos($v['start_time'] - strtotime($dates . " 12:00"));
                 $v['slider'] = hg_get_slider($v['start_time'] - strtotime($dates . " 12:00"));
                 $key = 'pm';
             }
             $v['key'] = hg_rand_num(4);
             $program[$key][] = $v;
         }
     }
     $this->addItem_withkey('program', $program);
     $this->output();
 }
Пример #13
0
 private function getThumbById($id, $size = array())
 {
     if (empty($id)) {
         return false;
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "material WHERE 1 AND material_id=" . $id;
     $ret = $this->db->query_first($sql);
     if (empty($ret)) {
         return false;
     }
     if ($ret['mark'] != 'img') {
         return false;
     }
     $size = $size ? $size : $this->settings['small_size'];
     return hg_material_link($ret['host'], $ret['dir'], $ret['filepath'], $ret['filename'], $size['label'] . "/");
 }
Пример #14
0
 public function get_win_info()
 {
     $tv_interact_id = intval($this->input['tv_interact_id']);
     if (!$tv_interact_id) {
         $this->errorOutput(NOID);
     }
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     $limit = ' LIMIT ' . $offset . ' , ' . $count;
     $sql = "SELECT * FROM " . DB_PREFIX . "win_info WHERE tv_interact_id = " . $tv_interact_id . " ORDER BY create_time DESC LIMIT 0," . $count;
     $q = $this->db->query($sql);
     $info = array();
     $member_id = array();
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d H:i:s', $r['create_time']);
         $member_id[] = $r['member_id'];
         $info[] = $r;
     }
     if (!empty($member_id)) {
         include_once ROOT_PATH . 'lib/class/members.class.php';
         $obj = new members();
         $member_id = implode(',', $member_id);
         $member_info = array();
         $member_info_tmp = array();
         $member_info_tmp = $obj->get_member_info($member_id);
         if (!empty($member_info_tmp)) {
             $size = '30x30/';
             foreach ($member_info_tmp as $val) {
                 $member_info[$val['member_id']]['member_name'] = $val['member_name'];
                 if (!empty($val['avatar'])) {
                     $member_info[$val['member_id']]['avatar'] = hg_material_link($val['avatar']['host'], $val['avatar']['dir'], $val['avatar']['filepath'], $val['avatar']['filename'], $size);
                 } else {
                     $member_info[$val['member_id']]['avatar'] = array();
                 }
                 $member_info[$val['member_id']]['phone_num'] = $val['mobile'];
             }
         }
     }
     if (!empty($info) && $member_info) {
         $win_info = array();
         foreach ($info as $val) {
             foreach ($val as $k => $v) {
                 if ($k == 'member_id' && $member_info[$v]) {
                     $val['member_name'] = $member_info[$v]['member_name'];
                     $val['phone_num'] = $member_info[$v]['phone_num'];
                     $val['avatar'] = $member_info[$v]['avatar'];
                 }
             }
             $this->addItem($val);
         }
     }
     $this->output();
 }
Пример #15
0
 function detail_history()
 {
     if (empty($this->input['id'])) {
         $this->errorOutput('未传入版本ID');
     }
     $id = intval($this->input['id']);
     $sql = "SELECT * FROM " . DB_PREFIX . "article_history WHERE id=" . $id;
     $f = $this->db->query_first($sql);
     if (empty($f)) {
         return FALSE;
     }
     $info = unserialize($f['content']);
     $info['history_id'] = $f['id'];
     $info['create_time'] = date('Y-m-d H:i:s', $info['create_time']);
     $info['newcontent'] = $info['content'];
     //分页
     $info['allpages'] = $info['content'];
     if (!empty($info['indexpic'])) {
         //查找索引图
         $info['indexpic_url'] = $this->getThumbById($info['indexpic'], $this->settings['default_index']);
     } else {
         $info['indexpic_url'] = '';
     }
     $ret = $this->getMaterialByMaterialId($info['material_id']);
     if (!empty($ret)) {
         foreach ($ret as $k => $v) {
             //				if(in_array($v['material_id'],$out['id'])) //去除文章中包含的素材图片
             //				{
             //					unset($ret[$k]);
             //					continue;
             //				}
             switch ($v['mark']) {
                 case 'img':
                     //将缩略图信息加入info数组
                     $info['material'][$v['id']] = $v;
                     $info['material'][$v['id']]['filename'] = $v['filename'];
                     $info['material'][$v['id']]['path'] = $v['host'] . $v['dir'];
                     $info['material'][$v['id']]['dir'] = $v['filepath'];
                     $info['material'][$v['id']]['type'] = $v['type'];
                     $info['material'][$v['id']]['url'] = hg_material_link($v['host'], $v['dir'], $v['filepath'], $v['filename'], $this->settings['default_index']['label'] . '/');
                     $info['material'][$v['id']]['small_url'] = hg_material_link($v['host'], $v['dir'], $v['filepath'], $v['filename'], $this->settings['default_size']['label'] . '/');
                     $other_img .= '[img id="' . $v['id'] . '" width="' . $v['imgwidth'] . '" height="' . $v['imgheight'] . '"]' . $info['material'][$v['id']]['ori_url'] . '[/img]';
                     break;
                 case 'doc':
                     $info['material'][$v['id']] = $v;
                     $info['material'][$v['id']]['url'] = MATERIAL_TYPE_THUMB . "doc.png?" . hg_generate_user_salt(5);
                     //返回小图
                     $other_doc .= '[doc id="' . $v['id'] . '" width="' . $v['imgwidth'] . '" height="' . $v['imgheight'] . '"]' . $info['material'][$v['id']]['ori_url'] . '[/doc]';
                     break;
                 case 'real':
                     $info['material'][$v['id']] = $v;
                     $info['material'][$v['id']]['url'] = MATERIAL_TYPE_THUMB . "real.png?" . hg_generate_user_salt(5);
                     //返回小图
                     $other_real .= '[real id="' . $v['id'] . '" width="' . $v['imgwidth'] . '" height="' . $v['imgheight'] . '"]' . $info['material'][$v['id']]['ori_url'] . '[/real]';
                     break;
                 default:
                     break;
             }
         }
     }
     $info['pubstatus'] = $info['state'];
     $info['status'] = $info['state'] ? 2 : 0;
     $encode = array('user_name', 'content', 'newcontent', 'allpages');
     foreach ($encode as $v) {
         $info[$v] = rawurlencode($info[$v]);
     }
     $this->addItem($info);
     $this->output();
 }
Пример #16
0
 public function getChannelInfo($condition, $offset, $count, $width = '112', $height = '43')
 {
     $limit = " LIMIT " . $offset . " , " . $count;
     $orderby = " ORDER BY id DESC ";
     $sql = "SELECT id, name, code, server_id, logo_info, audio_only FROM " . DB_PREFIX . "channel ";
     $sql .= " WHERE 1 " . $condition . $orderby . $limit;
     $q = $this->db->query($sql);
     $return = array();
     while ($row = $this->db->fetch_array($q)) {
         $row['logo_info'] = @unserialize($row['logo_info']);
         if ($row['logo_info']) {
             $imgsize = $width . 'x' . $height . '/';
             $row['logo_url'] = hg_material_link($row['logo_info']['host'], $row['logo_info']['dir'], $row['logo_info']['filepath'], $row['logo_info']['filename'], $imgsize);
         }
         $return[$row['id']] = $row;
     }
     return $return;
 }
Пример #17
0
 private function fetch_message($msg_id, $feedback_id, $no_btn = 0)
 {
     if ($msg_id) {
         $this->curl = new curl($this->settings['App_im']['host'], $this->settings['App_im']['dir']);
         $this->curl->setSubmitType('post');
         $this->curl->setReturnFormat('json');
         $this->curl->initPostData();
         $this->curl->addRequestData('session_id', $msg_id);
         $this->curl->addRequestData('sort_type', 'ASC');
         $this->curl->addRequestData('a', 'session_detail');
         $message = $this->curl->request('message.php');
         $message = $message[0];
         $msg = $message['messages'][$msg_id];
         $userinfo = $message['users'];
         if ($feedback_id) {
             $sql = 'SELECT admin_reply_count FROM ' . DB_PREFIX . 'record_person WHERE feedback_id = ' . $feedback_id . ' AND user_id = ' . $this->user['user_id'];
             $back = $this->db->query_first($sql);
             $reply = $back['admin_reply_count'];
             $sql = 'UPDATE ' . DB_PREFIX . 'record_person SET admin_reply_count = 0 WHERE feedback_id = ' . $feedback_id . ' AND user_id = ' . $this->user['user_id'];
             $this->db->query($sql);
             if ($message['session_info']['id'] && $reply) {
                 /*************会员查看过消息之后,管理员的回复数量加新消息数************/
                 if ($this->settings['App_members']) {
                     require_once ROOT_PATH . 'lib/class/members.class.php';
                     $members = new members();
                     $data = array('member_id' => $this->user['user_id'], 'mark' => 'apply', 'math' => 2, 'total' => $reply);
                     $ret = $members->updateMyData($data);
                 }
                 /*************会员查看过消息之后,管理员的回复数量加新消息数************/
             }
         }
         if ($userinfo && is_array($userinfo)) {
             foreach ($userinfo as $k => $v) {
                 $user[$v['uid']] = $v['utype'];
             }
         }
         if ($msg && is_array($msg)) {
             $body_html = '';
             $body_html .= '<ul class="talk-list">';
             foreach ($msg as $k => $v) {
                 if ($user[$v['send_uid']] == 'admin') {
                     $body_html .= '<li class="feedback-flex">';
                     $body_html .= '<img class="service-provider-avatar" src="' . hg_material_link($v['send_uavatar']['host'], $v['send_uavatar']['dir'], $v['send_uavatar']['filepath'], $v['send_uavatar']['filename'], '48x48/') . '" />';
                     $body_html .= '<div class="feedback-flex-one">';
                     $body_html .= '<span class="msg service-provider">' . $v['message'] . '</span>';
                     $body_html .= '</div>';
                     $body_html .= '</li>';
                 } else {
                     $body_html .= '<li>';
                     $body_html .= '<span class="msg user">' . $v['message'] . '</span>';
                     $body_html .= '</li>';
                 }
             }
             $body_html .= '</ul>';
         }
     }
     if ($msg_id && !$no_btn) {
         $body_html .= '<div class="replay feedback-flex">';
         $body_html .= '<input class="feedback-flex-one" type="text" name="replay" placeholder="在此输入回复内容">';
         $body_html .= '<span class="btn-default replay-btn">发送</span>';
         $body_html .= '</div>';
     }
     return $body_html;
 }
Пример #18
0
 public function query()
 {
     //require_once(ROOT_PATH . 'lib/class/publishcontent.class.php');
     $this->puscont = new publishcontent();
     $pp = $this->input['page'] ? intval($this->input['page']) : 1;
     //如果没有传第几页,默认是第一页
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     $offset = intval(($pp - 1) * $count);
     $data = array('offset' => $offset, 'count' => $count, 'client_type' => '2', 'need_count' => '1');
     if ($this->input['site_id']) {
         $data['site_id'] = intval($this->input['site_id']);
     }
     if ($this->input['info']) {
         foreach ($this->input['info'] as $k => $v) {
             $info[$v['name']] = $v['value'];
         }
     }
     //查询
     if ($info['special_modules']) {
         $data['bundle_id'] = $info['special_modules'];
     }
     //查询时间
     if ($info['special_date_search']) {
         $data['date_search'] = $info['special_date_search'];
     }
     //查询标题
     if ($info['k']) {
         $data['k'] = $info['k'];
     }
     //查询创建的起始时间
     if ($info['start_time']) {
         $data['starttime'] = $info['start_time'];
     }
     //查询创建的结束时间
     if ($info['end_time']) {
         $data['endtime'] = $info['end_time'];
     }
     //查询权重
     if (isset($info['start_weight']) && intval($info['start_weight']) >= 0) {
         $data['start_weight'] = $info['start_weight'];
     }
     if (isset($info['end_weight']) && intval($info['end_weight']) >= 0) {
         $data['end_weight'] = $info['end_weight'];
     }
     $re = $this->puscont->get_content($data);
     $return = $this->publishcontent->get_pub_content_type();
     if (is_array($return)) {
         foreach ($return as $k => $v) {
             $bundles[$v['bundle']] = $v['name'];
         }
     }
     $columns = $this->get_column();
     if (is_array($re['data'])) {
         foreach ($re['data'] as $k => $v) {
             $co_names = array();
             if ($v['column_id']) {
                 $co_arr = explode(" ", $v['column_id']);
                 foreach ($co_arr as $ke => $va) {
                     $co_names[] = $columns[$va];
                 }
             }
             $v['column_name'] = implode(" ", $co_names);
             //$v['app_name']	=	$apps[$v['bundle_id']];
             $v['module_name'] = $bundles[$v['bundle_id']];
             $v['pic'] = json_encode($v['indexpic']);
             $v['picture'] = hg_material_link($v['indexpic']['host'], $v['indexpic']['dir'], $v['indexpic']['filepath'], $v['indexpic']['filename']);
             $ret[] = $v;
         }
     }
     $total_num = $re['total'];
     //总的记录数
     //总页数
     if (intval($total_num % $count) == 0) {
         $return['total_page'] = intval($total_num / $count);
     } else {
         $return['total_page'] = intval($total_num / $count) + 1;
     }
     $return['total_num'] = $total_num;
     //总的记录数
     $return['page_num'] = $count;
     //每页显示的个数
     $return['current_page'] = $pp;
     //当前页码
     $retu['info'] = $ret;
     $retu['page_info'] = $return;
     $this->addItem($retu);
     $this->output();
 }
Пример #19
0
 public function show()
 {
     if ($this->user['user_id'] < 0) {
         $this->errorOutput('请登录');
     }
     if ($this->settings['admin_type']['presenter'] == $this->user['group_type']) {
         $this->errorOutput('您没有权限访问此页面');
     }
     $channel_id = intval($this->input['channel_id']);
     if (!$channel_id) {
         $this->errorOutput('未传入频道id');
     }
     //获取频道信息
     $channel_info = $this->mInteractive->get_channel_info($channel_id);
     $this->addItem_withkey('channel', $channel_info);
     //获取主持人信息
     $admin_info = $this->mInteractiveProgram->get_admin($this->settings['admin_type']['presenter']);
     if (!empty($admin_info)) {
         $presenter = array();
         foreach ($admin_info as $v) {
             $presenter[$v['id']] = $v['user_name'];
         }
     }
     $this->addItem_withkey('presenter', $presenter);
     //根据日期选择节目单
     $dates = $this->input['dates'] ? urldecode($this->input['dates']) : date('Y-m-d');
     $start_end = urldecode($this->input['start_end']);
     $this->addItem_withkey('dates', $dates);
     $program_start_end = $this->mInteractiveProgram->get_program_start_end($channel_id, $dates, $start_end);
     $start_time = $program_start_end['start_time'];
     $end_time = $program_start_end['end_time'];
     $program = $program_start_end['program'];
     $start_end = $program_start_end['start_end'];
     $this->addItem_withkey('start_end', $start_end);
     $this->addItem_withkey('program', $program);
     //获取节目环节
     $ret_interactive_program = $this->mInteractiveProgram->show($channel_id, $dates, $start_time, $end_time);
     $this->addItem_withkey('interactive_program', $ret_interactive_program);
     //获取互动节目单
     $in_program = $this->mBasicInfo->get_program_by_time($channel_id, $dates, $start_time, $end_time);
     //	$this->addItem_withkey('in_program', $in_program);
     $in_program_id = $in_program[0]['id'];
     $this->addItem_withkey('in_program_id', $in_program_id);
     $this->addItem_withkey('program_id', $in_program[0]['program_id']);
     $condition = $this->get_condition();
     //互动总数
     $total_all = $this->mInteractive->count($condition, $start_time, $end_time);
     $this->addItem_withkey('total_all', $total_all['total']);
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $orderby = " ORDER BY id DESC ";
     if ($this->input['offset_flag'] == 1) {
         $count = intval($this->input['counts']);
         //	$offset = $total_all['total'] - $offset - $count;
     }
     $interactive_info = $this->mInteractive->get_interactive_info($condition, $offset, $count, $orderby, $start_time, $end_time);
     //互动推荐总数
     $condition_2 = $this->get_condition();
     //		$condition_2 .= " AND status = 1 ";
     $condition_2 .= " AND is_recommend = 1 ";
     $total_2 = $this->mInteractive->count($condition_2, $start_time, $end_time);
     $this->addItem_withkey('total_2', $total_2['total']);
     /*
     //获取站外平台名称
     $ret_get_plat = $this->mShare->get_plat();
     if ($ret_get_plat)
     {
     	$plat_info = array();
     	foreach ($ret_get_plat AS $k => $v)
     	{
     		$plat_info[$v['id']] = $v['name'];
     	}
     }
     */
     if (!empty($interactive_info)) {
         $interactive = array();
         foreach ($interactive_info as $v) {
             $member_ids[$v['id']] = $v['member_id'];
             $v['channel_name'] = $channel_info['channel_name'];
             $v['plat_name'] = $v['plat_name'] ? $v['plat_name'] : $v['appname'];
             if (!$v['avatar_url'] && $v['host']) {
                 $v['avatar_url'] = hg_material_link($v['host'], $v['dir'], $v['filepath'], $v['filename'], '36x36/');
             } else {
                 $v['avatar_url'] = $v['weibo_avatar'];
             }
             $interactive[$v['id']] = $v;
             //	$this->addItem($v);
         }
     }
     $this->addItem_withkey('interactive', $interactive);
     $this->output();
 }
Пример #20
0
 public function download_excel()
 {
     $this->verify_content_prms(array('_action' => 'show_result'));
     $feedback_id = $this->input['fid'];
     if (!$feedback_id) {
         $this->errorOutput(NO_FEEDBACK_ID);
     }
     $person = array();
     $condition = $this->get_condition();
     $sql = "SELECT * FROM " . DB_PREFIX . "record_person rp  WHERE rp.feedback_id IN(" . $feedback_id . ")" . $condition;
     $person = $this->db->fetch_all($sql);
     if ($person && count($person) > 0) {
         foreach ($person as $k => $v) {
             $fid[] = $v['id'];
         }
         $fids = implode(',', $fid);
     }
     if ($fids) {
         $forms = $this->mode->get_forms($feedback_id);
         if ($forms && is_array($forms)) {
             foreach ($forms as $k => $v) {
                 $form_name[$v['type']][$v['id']] = $v['name'];
             }
         }
         $form_ids = array();
         $sql = 'SELECT * FROM ' . DB_PREFIX . 'materials WHERE content_id = ' . $feedback_id;
         $q = $this->db->query($sql);
         while ($rs = $this->db->fetch_array($q)) {
             if ($rs['vodid']) {
                 if ($this->settings['App_mediaserver']) {
                     $rs['url'] = $this->settings['App_mediaserver']['protocol'] . $this->settings['App_mediaserver']['host'] . '/' . $this->settings['App_mediaserver']['dir'] . '/admin/download.php?id=' . $rs['vodid'];
                 } else {
                     $rs['url'] = $rs['host'] . '/' . $rs['dir'] . $rs['filename'] . '.mp4';
                 }
             }
             if ($rs['original_id']) {
                 $rs['url'] = hg_material_link($rs['host'], $rs['dir'], $rs['material_path'], $rs['pic_name']);
             }
             $mat[$rs['id']] = $rs['url'];
         }
         $sql = "SELECT r.*,f.title,f.brief FROM " . DB_PREFIX . "record r LEFT JOIN " . DB_PREFIX . "feedback f ON r.feedback_id = f.id WHERE r.person_id in( " . $fids . ") ORDER BY r.order_id desc";
         $q = $this->db->query($sql);
         while ($r = $this->db->fetch_array($q)) {
             $rec['title'] = $r['title'];
             $rec['brief'] = $r['brief'];
             if ($r['type'] == 'file') {
                 $r['type'] = 'standard';
                 $fvalue = trim($r['value'], ',');
                 if ($fvalue) {
                     $file_value = array();
                     $mat_ids = explode(',', $fvalue);
                     foreach ($mat_ids as $k => $vm) {
                         if ($vm) {
                             $mat_id = @explode('_', $vm);
                             $file_value[] = $mat[$mat_id[0]];
                         }
                     }
                     $r['value'] = implode(", ", $file_value);
                 }
             }
             $formname = $r['form_name'] ? $r['form_name'] : ($form_name[$r['type']][$r['form_id']] ? $form_name[$r['type']][$r['form_id']] : '组件' . $r['form_id']);
             $rec['names'][$r['type'] . '_' . $r['form_id']] = $formname;
             $rec['data'][$r['person_id']][$r['type'] . '_' . $r['form_id']] = $r['value'];
         }
         $rec['names']['user_name'] = '用户昵称';
         $rec['names']['create_time'] = '填写时间';
         $rec['names']['process'] = '是否处理';
         $rec['names']['device_token'] = '设备号';
         if (is_array($person) && count($person) > 0) {
             foreach ($person as $k => $v) {
                 $rec['data'][$v['id']]['user_name'] = $v['user_name'] ? $v['user_name'] : '未登录';
                 $rec['data'][$v['id']]['create_time'] = $v['create_time'] ? date('Y-m-d H:i:s', $v['create_time']) : '';
                 $rec['data'][$v['id']]['process'] = $v['process'] ? '已处理' : '未处理';
                 $rec['data'][$v['id']]['device_token'] = $v['device_token'] ? $v['device_token'] : '';
             }
         }
     }
     if (!$rec) {
         $this->errorOutput(NO_CONTENT);
     }
     include_once CUR_CONF_PATH . 'lib/XmlExcel.php';
     $xls = new XmlExcel();
     $xls->setDefaultWidth(80);
     $xls->setDefaultAlign("center");
     $xls->setDefaultHeight(18);
     $xls->addTitle($rec['title'], $rec['title']);
     $xls->addHead($rec['names'], $rec['title']);
     if (is_array($rec['data']) && count($rec['data']) > 0) {
         foreach ($rec['data'] as $k => $value) {
             foreach ($rec['names'] as $key => $rs) {
                 $mac[$k][] = $value[$key];
             }
             $xls->addRow($mac[$k], $rec['title']);
         }
     }
     $xls->export($rec['title']);
     exit;
 }
Пример #21
0
 public function get_image($ids)
 {
     if (!$ids) {
         return false;
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "material WHERE id IN (" . $ids . ")";
     $res = $this->db->query($sql);
     while ($mat = $this->db->fetch_array($res)) {
         $p[$mat['id']] = array('id' => $mat['id'], 'img_info' => hg_material_link($mat['host'], $mat['dir'], $mat['filepath'], $mat['filename']), 'pic_arr' => array('host' => $mat['host'], 'dir' => $mat['dir'], 'filepath' => $mat['filepath'], 'filename' => $mat['filename']), 'upload_type' => '图片');
     }
     return $p;
 }
Пример #22
0
 public function show_opration()
 {
     $id = trim($this->input['id']);
     if (!$id) {
         $this->errorOutput('NO_ID');
     }
     $info = $this->mChannel->detail($id);
     $server_id = $info['server_id'];
     if ($server_id) {
         $server_info = $this->mServerConfig->get_server_config_by_id($server_id);
         $info['server_name'] = $server_info['name'];
     }
     $server_info = $this->mChannel->get_server_info($server_info);
     $wowzaip_output = $server_info['wowzaip_output'];
     $suffix_output = $this->settings['wowza']['output']['suffix'];
     if (!empty($info['channel_stream'])) {
         $channel_stream = array();
         foreach ($info['channel_stream'] as $v) {
             $v['output_url'] = hg_set_stream_url($wowzaip_output, $info['code'], $v['stream_name'] . $suffix_output, 'rtmp://');
             if ($info['is_mobile_phone']) {
                 $v['m3u8'] = hg_set_stream_url($wowzaip_output, $info['code'], $v['stream_name'] . $suffix_output, 'm3u8');
             }
             $channel_stream[] = $v;
         }
         $info['channel_stream'] = $channel_stream;
     }
     //获取截图
     $ret_img_url = $this->mChannel->get_img_url();
     $img_url = '';
     if (!empty($ret_img_url)) {
         $img_url = $ret_img_url['define']['IMG_URL'];
     }
     if (!$info['is_audio']) {
         $info['preview'] = $img_url . LIVE_CONTROL_LIST_PREVIEWIMG_URL . date('Y') . '/' . date('m') . '/live_' . $info['id'] . '.png?time=' . TIMENOW;
     } else {
         if ($info['logo_audio']['host']) {
             $info['preview'] = hg_material_link($info['logo_audio']['host'], $info['logo_audio']['dir'], $info['logo_audio']['filepath'], $info['logo_audio']['filename']);
         } else {
             if ($info['logo_rectangle']['host']) {
                 $info['preview'] = hg_material_link($info['logo_rectangle']['host'], $info['logo_rectangle']['dir'], $info['logo_rectangle']['filepath'], $info['logo_rectangle']['filename']);
             } else {
                 $info['preview'] = '';
             }
         }
     }
     $this->addItem($info);
     $this->output();
 }
Пример #23
0
 /**
  * 文件上传
  */
 public function upload()
 {
     //参数接收
     $data = array('interview_id' => intval(urldecode($this->input['interview_id'])), 'user_id' => intval(urldecode($this->user['user_id'])), 'user_name' => addslashes(trim(urldecode($this->user['user_name']))), 'name' => $this->input['name']);
     if (!$data['user_name']) {
         $data['user_name'] = addslashes(trim(urldecode($this->input['nickname'])));
         if (!$data['user_name']) {
             $data['user_name'] = '匿名用户';
         }
     }
     $data['size'] = $this->input['size'] ? trim(urldecode($this->input['size'])) . '/' : '';
     //获取访谈信息时更新用户的在线时间
     $this->check->update_time(array('login_time' => TIMENOW), array('user_id' => $data['user_id'], 'name' => $data['user_name'], interview_id => $data['interview_id']));
     //图片信息处理
     if ($_FILES['photos']) {
         $count = count($_FILES['photos']['error']);
         for ($i = 0; $i < $count; $i++) {
             //存储入库数据
             $arr = array();
             if ($_FILES['photos']['error'][$i] == 0) {
                 $pics = array();
                 foreach ($_FILES['photos'] as $k => $v) {
                     $pics['Filedata'][$k] = $_FILES['photos'][$k][$i];
                 }
                 $material = $this->pic->interview_uplaod($pics, $data['interview_id']);
                 //插入各类服务器
                 if ($material) {
                     //准备好入库数据
                     $arr['interview_id'] = $data['interview_id'];
                     $arr['user_id'] = $data['user_id'];
                     $arr['user_name'] = $data['user_name'];
                     $arr['name'] = $data['name'][$i];
                     $arr['file_name'] = $material['filename'];
                     $arr['file_path'] = $material['filepath'];
                     $arr['file_type'] = $material['type'];
                     $arr['file_size'] = $material['filesize'];
                     $arr['original_id'] = $material['id'];
                     $arr['is_img'] = 1;
                     $arr['create_time'] = TIMENOW;
                     $arr['is_ban'] = 0;
                     $arr['show_pos'] = 2;
                     $ret = $this->interview->upload($arr);
                     if ($ret) {
                         $data['photos'][$i]['url'] = hg_material_link($material['host'], $material['dir'], $material['filepath'], $material['filename'], $data['size']);
                         $data['photos'][$i]['name'] = $data['name'][$i];
                     }
                 }
             }
         }
     }
     $this->addItem($data);
     $this->output();
 }
Пример #24
0
 /**
  * 获取某一样式下的所有心情
  * Enter description here ...
  * @param unknown_type $style_id 样式的id
  */
 public function get_mood($style_id = '')
 {
     if ($style_id) {
         $condition .= "AND style_id = " . $style_id;
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "mood_option  WHERE 1 " . $condition;
     $query = $this->db->query($sql);
     while ($r = $this->db->fetch_array($query)) {
         if ($r['picture']) {
             $r['picture'] = @unserialize($r['picture']);
         }
         $mood[$r['id']] = array('id' => $r['id'], 'mood_name' => $r['mood_name'], 'picture' => hg_material_link($r['picture']['host'], $r['picture']['dir'], $r['picture']['filepath'], $r['picture']['filename']));
     }
     return $mood;
 }
Пример #25
0
 function getProgramByDay()
 {
     $condition = '';
     if (!$this->input['channel_id']) {
         $sql = "SELECT id FROM " . DB_PREFIX . "channel WHERE 1 ORDER BY order_id DESC LIMIT 1";
         $f = $this->db->query_first($sql);
         if (!empty($f)) {
             $this->input['channel_id'] = $f['id'];
         } else {
             $this->errorOutput('暂未创建频道');
         }
     }
     $condition .= " AND channel_id=" . $this->input['channel_id'];
     $dates = $this->input['dates'] ? $this->input['dates'] : date("Y-m-d");
     $condition .= " AND FROM_UNIXTIME(start_time, '%Y-%m-%d')='" . $dates . "'";
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     //该频道的录播记录
     $sql = "select r.start_time,r.end_time,r.channel_id,r.week_num,p.item from " . DB_PREFIX . "program_record_relation r left join " . DB_PREFIX . "program_record p on p.id = r.record_id where r.channel_id=" . $this->input['channel_id'] . " and r.week_num=" . date('N', strtotime($dates));
     $q = $this->db->query($sql);
     $record = array();
     while ($r = $this->db->fetch_array($q)) {
         $record[$r['start_time'] . '-' . $r['end_time']] = $r['item'];
     }
     //所有频道信息
     $sql = "select id,logo_info,name from " . DB_PREFIX . "channel ORDER BY order_id DESC";
     $ch = $this->db->query($sql);
     $channel_info = array();
     while ($row = $this->db->fetch_array($ch)) {
         if (empty($channel_info)) {
             $channel_info['default'] = $row;
         }
         $logo_info = unserialize($row['logo_info']);
         if ($logo_info) {
             $row['logo_url'] = hg_material_link($this->settings['material_server']['img4']['host'], $this->settings['material_server']['img4']['dir'], $logo_info['filepath'], $logo_info['filename']);
         }
         unset($row['logo_info']);
         $channel_info[$row['id']] = $row;
     }
     $this->addItem_withkey('channel_info', $channel_info);
     $data_limit = " LIMIT " . $offset . " , " . $count;
     $sql = "select *,FROM_UNIXTIME(start_time, '%Y-%m-%d') as start,FROM_UNIXTIME(start_time, '%U') as week_set from " . DB_PREFIX . "program ";
     $sql .= ' where 1 ' . $condition . ' ORDER BY start_time ASC';
     $q = $this->db->query($sql);
     $this->addItem_withkey('date', $dates);
     $program = array();
     $start = strtotime($dates . " 00:00:00");
     $end = strtotime($dates . " 23:59:59");
     $com_time = 0;
     $program_plan = $this->getPlan($this->input['channel_id'], $dates);
     while ($row = $this->db->fetch_array($q)) {
         if (!$com_time && $row['start_time'] > $start) {
             $plan = $this->verify_plan($program_plan, $start, $row['start_time']);
             if ($plan) {
                 foreach ($plan as $k => $v) {
                     $program[] = $v;
                 }
             } else {
                 $program[] = $this->getInfo($start, $row['start_time'], $dates);
             }
         }
         if ($com_time && $com_time != $row['start_time']) {
             $plan = $this->verify_plan($program_plan, $com_time, $row['start_time']);
             if ($plan) {
                 foreach ($plan as $k => $v) {
                     $program[] = $v;
                 }
             } else {
                 $program[] = $this->getInfo($com_time, $row['start_time'], $dates);
             }
         }
         $row['start'] = date("H:i", $row['start_time']);
         $row['end'] = date("H:i", $row['start_time'] + $row['toff']);
         $record_verify = date("H:i:s", $row['start_time']) . '-' . date("H:i:s", $row['start_time'] + $row['toff']);
         $row['item'] = $record[$record_verify] ? $record[$record_verify] : 0;
         if ($row['start_time'] + $row['toff'] <= TIMENOW) {
             $row['outdate'] = 1;
         } else {
             $row['outdate'] = 0;
         }
         $com_time = $row['start_time'] + $row['toff'];
         $program[] = $row;
     }
     if ($com_time && $com_time < $end) {
         $plan = $this->verify_plan($program_plan, $com_time, $end);
         if ($plan) {
             foreach ($plan as $k => $v) {
                 $program[] = $v;
             }
         } else {
             $program[] = $this->getInfo($com_time, $end, $dates);
         }
     }
     if (empty($program)) {
         if (empty($program_plan)) {
             $program[] = $this->getInfo($start, strtotime($dates . " 08:00:00"), $dates, 0, 1);
             $program[] = $this->getInfo(strtotime($dates . " 08:00:00"), $end, $dates);
         } else {
             $program = array();
             $start = strtotime($dates . " 00:00:00");
             $end = strtotime($dates . " 23:59:59");
             $com_time = 0;
             foreach ($program_plan as $k => $v) {
                 if (!$com_time && $v['start_time'] > $start) {
                     $program[] = $this->getInfo($start, $v['start_time'], $dates);
                 }
                 if ($com_time && $com_time != $v['start_time']) {
                     $program[] = $this->getInfo($com_time, $v['start_time'], $dates);
                 }
                 $v['start'] = date("H:i", $v['start_time']);
                 $v['end'] = date("H:i", $v['start_time'] + $v['toff']);
                 if ($v['start_time'] + $v['toff'] <= TIMENOW) {
                     $v['outdate'] = 1;
                 } else {
                     $v['outdate'] = 0;
                 }
                 $com_time = $v['start_time'] + $v['toff'];
                 $program[] = $v;
             }
             if ($com_time && $com_time < $end) {
                 $program[] = $this->getInfo($com_time, $end, $dates);
             }
         }
     }
     //	hg_pre($program,0);
     $this->addItem_withkey('program', $program);
     $this->output();
 }
Пример #26
0
 /**
  * 取频道信息
  * $offset 分页参数
  * $count 分页参数
  * $is_audio 是否是音频 (1-音频 0-视频)
  * $server_id 直播服务器id
  * $node_id 直播频道分类id
  * Enter description here ...
  */
 public function get_channel_info()
 {
     $is_audio = intval($this->input['is_audio']);
     $server_id = intval($this->input['server_id']);
     $node_id = intval($this->input['node_id']);
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['counts'] ? intval($this->input['counts']) : 20;
     $channel_data = array('offset' => $offset, 'count' => $count, 'is_stream' => 0, 'is_audio' => $is_audio, 'node_id' => $node_id, 'field' => 'id, name, code, is_control, is_audio, is_mobile_phone, server_id, logo_rectangle, logo_square, client_logo');
     $channel = $this->mLive->getChannelInfo($channel_data);
     $return = array();
     if (!empty($channel)) {
         foreach ($channel as $v) {
             if ($v['snap']) {
                 $v['logo_rectangle'] = $v['snap'];
                 $v['logo_rectangle_url'] = hg_material_link($v['snap']['host'], $v['snap']['dir'], $v['snap']['filepath'], $v['snap']['filename']);
             }
             unset($v['snap']);
             $return[] = $v;
         }
     }
     $this->addItem($return);
     $this->output();
 }
Пример #27
0
 /**
  * 所有频道信息
  * @name channelsInfo
  * @access public
  * @author lijiaying
  * @category hogesoft
  * @copyright hogesoft
  * @param $condition 检索条件
  * @param $offset 分页参数
  * @param $count 分页显示记录数
  * @return $info array 所有频道内容信息
  */
 public function channelsInfo($condition, $offset, $count)
 {
     $data_limit = " LIMIT " . $offset . " , " . $count;
     $sql = "SELECT c.*,s.*,s.id as s_id,c.id as c_id,c.ch_id as c_ch_id,c.save_time as c_save_time, c.live_delay as c_live_delay, s.ch_id as s_ch_id,s.save_time as s_save_time, s.live_delay as s_live_delay FROM " . DB_PREFIX . "channel c LEFT JOIN " . DB_PREFIX . "stream s on c.stream_id=s.id ";
     $sql .= " WHERE 1 " . $condition . " ORDER BY c.order_id DESC " . $data_limit;
     $q = $this->db->query($sql);
     $info = $channel_stream = array();
     while ($row = $this->db->fetch_array($q)) {
         $row['id'] = $row['c_id'];
         $row['ch_id'] = $row['c_ch_id'];
         $row['save_time'] = $row['c_save_time'];
         $row['live_delay'] = $row['c_live_delay'];
         $row['logo_info'] = unserialize($row['logo_info']);
         if ($row['logo_info']) {
             $row['logo_url'] = hg_material_link($this->settings['material_server']['img4']['host'], $this->settings['material_server']['img4']['dir'], $row['logo_info']['filepath'], $row['logo_info']['filename']);
         }
         if (!$row['stream_state']) {
             //		$row['stream_state'] = "启动流输出";
             $row['stream_state_tag'] = 0;
         } else {
             //		$row['stream_state'] = "停止流输出";
             $row['stream_state_tag'] = 1;
         }
         $row['beibo'] = unserialize($row['beibo']);
         $row['uri'] = unserialize($row['uri']);
         $row['stream_info_all'] = unserialize($row['stream_info_all']);
         $row['other_info'] = unserialize($row['other_info']);
         $channel_streams = array();
         if ($row['other_info']) {
             foreach ($row['other_info'] as $k => $v) {
                 $channel_streams[$k]['id'] = $v['id'];
                 $channel_streams[$k]['name'] = $v['name'];
                 $channel_streams[$k]['code'] = $row['code'];
                 $channel_streams[$k]['bitrate'] = $v['bitrate'];
                 $channel_streams[$k]['open_ts'] = $row['open_ts'];
                 $channel_streams[$k]['stream_mark'] = $row['stream_mark'];
                 $channel_streams[$k]['out_stream_name'] = $v['out_stream_name'];
             }
         }
         $channel_stream[$row['id']] = $channel_streams;
         $info[$row['id']] = $row;
     }
     if ($info) {
         //基础流信息
         $stream = $this->channelStreams(array_keys($info));
         $stream_info = array();
         foreach ($stream as $k => $v) {
             foreach ($channel_stream as $kk => $vv) {
                 if ($k == $kk) {
                     if ($v['name'] == $vv['stream_name']) {
                         for ($i = 0; $i < count($v); $i++) {
                             $stream_info[$k]['streams'][$i]['id'] = $v[$i]['id'];
                             $stream_info[$k]['streams'][$i]['name'] = $v[$i]['stream_name'];
                             $stream_info[$k]['streams'][$i]['out_stream_name'] = $v[$i]['out_stream_name'];
                             $stream_info[$k]['streams'][$i]['uri'] = hg_get_stream_url($this->settings['tvie']['stream_server'], array('channel' => $vv[$i]['code'], 'stream_name' => $v[$i]['out_stream_name']));
                             $stream_info[$k]['streams'][$i]['stream_uri'] = hg_get_stream_url($this->settings['tvie']['up_stream_server'], array('channel' => $vv[$i]['stream_mark'], 'stream_name' => $v[$i]['stream_name']));
                             if ($vv[$i]['open_ts']) {
                                 $stream_info[$k]['streams'][$i]['m3u8'] = hg_get_stream_url($this->settings['tvie']['stream_server'], array('channel' => $vv[$i]['code'], 'stream_name' => $v[$i]['out_stream_name']), 'channels', 'http://', 'm3u8:');
                             }
                             $stream_info[$k]['streams'][$i]['is_main'] = $v[$i]['is_main'];
                             $stream_info[$k]['streams'][$i]['bitrate'] = $v[$i]['bitrate'];
                         }
                     }
                 }
             }
         }
     }
     //频道内容信息
     $channel_info = array();
     foreach ($info as $k => $v) {
         foreach ($stream_info as $kk => $vv) {
             if ($k == $kk) {
                 $channel_info[$k] = array_merge($v, $vv);
             }
         }
     }
     return $channel_info;
 }
Пример #28
0
 public function get_options($style_id)
 {
     if (!$style_id) {
         return false;
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "mood_option  WHERE style_id = '" . $style_id . "'  ORDER BY order_id ASC, id ASC";
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         if ($r['picture']) {
             $r['picture'] = @unserialize($r['picture']);
         }
         $option[] = array('id' => $r['id'], 'name' => $r['mood_name'], 'picture' => hg_material_link($r['picture']['host'], $r['picture']['dir'], $r['picture']['filepath'], $r['picture']['filename']), 'order_id' => $r['order_id']);
     }
     return $option;
 }
Пример #29
0
 function get_channel_info()
 {
     $field = $this->input['field'] ? urldecode($this->input['field']) : ' * ';
     $condition = $this->get_condition();
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 30;
     $limit = " LIMIT " . $offset . " , " . $count;
     $sql = "SELECT {$field} FROM " . DB_PREFIX . "channel ";
     $sql .= " WHERE 1 " . $condition . " ORDER BY order_id DESC " . $limit;
     $q = $this->db->query($sql);
     while ($row = $this->db->fetch_array($q)) {
         $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['logo_info'] = @unserialize($row['logo_info']);
         $row['column_id'] = @unserialize($row['column_id']);
         $row['column_url'] = @unserialize($row['column_url']);
         if ($row['logo_info']) {
             $row['logo_url'] = hg_material_link($row['logo_info']['host'], $row['logo_info']['dir'], $row['logo_info']['filepath'], $row['logo_info']['filename'], '112x43/');
         }
         $row['logo_mobile_info'] = @unserialize($row['logo_mobile_info']);
         if ($row['logo_mobile_info']) {
             $row['logo_mobile_url'] = hg_material_link($row['logo_mobile_info']['host'], $row['logo_mobile_info']['dir'], $row['logo_mobile_info']['filepath'], $row['logo_mobile_info']['filename'], '50x50/');
         }
         $row['beibo'] = @unserialize($row['beibo']);
         $row['stream_info_all'] = @unserialize($row['stream_info_all']);
         $this->addItem($row);
     }
     $this->output();
 }
Пример #30
0
 public function show()
 {
     $condition = $this->get_condition();
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $appid = intval($this->input['appid']);
     $info = $this->mChannel->show($condition, $offset, $count);
     if ($info) {
         foreach ($info as $v) {
             if ($v['client_logo'][$appid]) {
                 unset($v['client_logo'][$appid]['appid'], $v['client_logo'][$appid]['appname']);
                 $v['logo_rectangle'] = $v['client_logo'][$appid];
             }
             $v['square'] = $v['logo_rectangle'];
             unset($v['client_logo']);
             if ($v['logo_rectangle']) {
                 $v['logo_rectangle_url'] = hg_material_link($v['logo_rectangle']['host'], $v['logo_rectangle']['dir'], $v['logo_rectangle']['filepath'], $v['logo_rectangle']['filename'], '112x43/');
             }
             //频道截图
             if (!empty($v['snap'])) {
                 if (strstr($v['snap']['dir'], '{&#036;time}')) {
                     $v['snap']['dir'] = str_replace('{&#036;time}', TIMENOW . '000', $v['snap']['dir']);
                 }
             } else {
                 if (!$v['is_audio'] && $v['sys_id']) {
                     $v['snap'] = array('host' => $this->mImgUrl . LIVE_CONTROL_LIST_PREVIEWIMG_URL, 'dir' => '', 'filepath' => date('Y') . '/' . date('m') . '/', 'filename' => 'live_' . $v['sys_id'] . '.png?time=' . TIMENOW);
                 } else {
                     $v['snap'] = $v['logo_rectangle'];
                 }
             }
             $channel_stream = $record_stream = array();
             if (!empty($v['channel_stream'])) {
                 foreach ($v['channel_stream'] as $kk => $vv) {
                     if (!$v['is_sys']) {
                         if ($vv['output_url']) {
                             $vv['output_url'] = $vv['url'] . '/' . $vv['output_url'];
                         }
                         if ($vv['m3u8']) {
                             $vv['m3u8'] = $vv['url'] . '/' . $vv['m3u8'];
                         }
                         if ($vv['timeshift_url']) {
                             $vv['timeshift_url'] = $vv['url'] . '/' . $vv['timeshift_url'];
                         }
                     }
                     $vv['live_url'] = $vv['output_url'];
                     $vv['live_m3u8'] = $vv['m3u8'];
                     $vv['live_url_rtmp'] = $vv['output_url_rtmp'];
                     //	unset($vv['url'], $vv['timeshift_url']);
                     $channel_stream[] = $vv;
                     $record_stream[$kk]['output_url'] = $vv['output_url'];
                     $record_stream[$kk]['output_url_rtmp'] = $vv['output_url_rtmp'];
                     $record_stream[$kk]['m3u8'] = $vv['m3u8'];
                 }
                 $v['has_stream'] = 1;
             } else {
                 $v['has_stream'] = 0;
             }
             $v['channel_stream'] = $channel_stream;
             $v['record_stream'] = $record_stream;
             $this->addItem($v);
         }
     }
     $this->output();
 }