public function show($condition = array(), $offset, $count) { $arr = array(); $pagesize = $count; $currentpage = floor($offset / $count) + 1; $xml = $this->rdwd_xml($condition, $pagesize, $currentpage); //echo $xml;exit(); $cilentOptions = array('trace' => true, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE); $client = new SoapClient(WEB_URL, $cilentOptions); $ret_str = $client->SelectBMZXList(array('xmlWebInfo' => $xml)); $ret_str = $ret_str->SelectBMZXListResult; $ret_str = xml2Array($ret_str); //hg_pre($ret_str);exit(); if (!$ret_str['DATA']['ReturnInfo']['Status']) { return $arr; } $data = $ret_str['DATA']['UserArea']['InfoList']['WebInfo']; hg_pre($data); exit; //字段重新命名 if (!empty($data)) { foreach ($data as $val) { $arr[] = array('id' => $val['infoid'], 'create_time' => strtotime($val['infodate']), 'title' => $val['title']); } } return $arr; }
public function get_interactive_program() { $sql = "SELECT t1.*, t2.member_id, t2.member_id AS member_id, t3.member_id AS t3_member_id, t3.member_name, t3.nick_name , t3.plat_id, t3.plat_type, t3.plat_name, t3.plat_token, t3.plat_since_id FROM " . DB_PREFIX . "program t1 "; $sql .= " LEFT JOIN " . DB_PREFIX . "weibo_member t2 ON t1.id = t2.program_id "; $sql .= " LEFT JOIN " . DB_PREFIX . "interactive_member t3 ON t3.id = t2.member_id "; $sql .= " WHERE t1.dates = '" . date('Y-m-d') . "' "; $sql .= " AND t1.start_time <= " . TIMENOW . " AND t1.start_time + t1.toff >= " . TIMENOW; $sql .= " AND t3.status = 1 AND t3.plat_expired_time >= " . TIMENOW; $q = $this->db->query($sql); $program_info = array(); while ($row = $this->db->fetch_array($q)) { $row['plat_since_id'] = $row['plat_since_id'] ? unserialize($row['plat_since_id']) : array(); $program_info[] = $row; } if (empty($program_info)) { $this->errorOutput('当前时间未设置信息或已被删除'); } if ($this->input['debug']) { hg_pre($program_info); } foreach ($program_info as $program) { if ($program['member_id']) { $data = array('program_id' => $program['id'], 'channel_id' => $program['channel_id'], 'member_id' => $program['t3_member_id'], 'member_name' => $program['member_name'], 'nick_name' => $program['nick_name'], 'plat_id' => $program['plat_id'], 'plat_type' => $program['plat_type'], 'plat_name' => $program['plat_name'], 'plat_token' => $program['plat_token'], 'plat_since_id' => $program['plat_since_id'][$program['channel_id']] ? $program['plat_since_id'][$program['channel_id']] : 0, 'start_time' => $program['start_time'], 'end_time' => $program['start_time'] + $program['toff'], 'create_time' => TIMENOW); $this->mInteractiveMember->member_queue_add($data); } } $this->addItem('success'); $this->output(); }
public function interactive_add() { //取队列一条记录 $sql = "SELECT * FROM " . DB_PREFIX . "interactive_member_queue WHERE 1 ORDER BY create_time ASC LIMIT 0,1"; $member_queue = $this->db->query_first($sql); if (empty($member_queue)) { $this->errorOutput('队列没有内容'); } if ($this->input['debug']) { hg_pre($member_queue); } //取出微博账号信息 $sql = "SELECT * FROM " . DB_PREFIX . "interactive_member WHERE plat_id = " . $member_queue['plat_id'] . " AND member_id = '" . $member_queue['member_id'] . "' "; $member_info = $this->db->query_first($sql); if (empty($member_info)) { $this->errorOutput('微博账号不存在或已被删除'); } $member_info['plat_since_id'] = $member_info['plat_since_id'] ? @unserialize($member_info['plat_since_id']) : array(); $plat_since_id = $member_info['plat_since_id']; //获取@记录 $ret_plat = $this->mShare->get_mention($this->user['appid'], $member_queue['plat_id'], $member_queue['plat_token'], $plat_since_id[intval($member_queue['channel_id'])], 0, 200); if ($this->input['debug']) { hg_pre($ret_plat); } if (!empty($ret_plat) && !$ret_plat['error']) { $_plat = array(); foreach ($ret_plat as $k => $plat) { if ($plat['created_at'] > $member_queue['start_time'] && $plat['created_at'] < $member_queue['end_time']) { $_plat[] = $plat; $plat['text'] = trim(substr($plat['text'], strlen('@' . $member_queue['member_name']))); $content = $plat['retweeted_status']['text'] ? $plat['retweeted_status']['text'] : $plat['text']; //微博用户id $member_id = !$plat['retweeted_status']['screen_name'] ? $member_queue['member_id'] : ''; //微博用户名称 $member_name = $plat['screen_name'] ? $plat['screen_name'] : $member_queue['member_name']; //微博用户头像 $weibo_avatar = $plat['avatar']; $input_info[$k] = array('channel_id' => $member_queue['channel_id'], 'member_id' => $member_id, 'member_name' => $member_name, 'plat_id' => $member_queue['plat_id'], 'plat_name' => $member_queue['plat_name'], 'plat_member_id' => $member_id, 'plat_since_id' => $plat['id'], 'content' => $content, 'dates' => date('Y-m-d'), 'status' => $this->settings['default']['status'], 'type' => $this->settings['default']['type'], 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'create_time' => TIMENOW, 'ip' => hg_getip(), 'weibo_avatar' => $weibo_avatar); //入直播互动库 $ret_interactive = $this->mInteractive->interactive_add($input_info[$k]); //更新 plat_since_id if ($k == 0) { $plat_since_id[intval($member_queue['channel_id'])] = $plat['id']; // $sql = "UPDATE " . DB_PREFIX . "interactive_member SET plat_since_id = '" . $plat['id'] . "' WHERE plat_id = " . $member_queue['plat_id'] . " AND member_id = '" . $member_queue['member_id'] . "' "; $sql = "UPDATE " . DB_PREFIX . "interactive_member SET plat_since_id = '" . serialize($plat_since_id) . "' WHERE plat_id = " . $member_queue['plat_id'] . " AND member_id = '" . $member_queue['member_id'] . "' "; $this->db->query($sql); } } } } if ($this->input['debug']) { hg_pre($_plat); } //删除取出来的队列记录 $sql = "DELETE FROM " . DB_PREFIX . "interactive_member_queue WHERE program_id = " . $member_queue['program_id'] . " AND member_id = '" . $member_queue['member_id'] . "' "; $this->db->query($sql); $this->addItem($input_info); $this->output(); }
public function right() { $object_id = intval($this->input['object_id']) ? intval($this->input['object_id']) : 0; if (empty($object_id)) { return false; } $db = array('host' => '192.168.60.18', 'user' => 'forapp', 'pass' => 'Hoge@mysql', 'database' => 'm2o_mediaserver', 'charset' => 'utf8', 'pconnect' => '0'); include_once ROOT_PATH . 'lib/db/db_mysql.class.php'; $g_db = new db(); $g_db->connect($db['host'], $db['user'], $db['pass'], $db['database'], $db['charset'], $db['pconnect'], $db['dbprefix']); $sql = "select * from " . DB_PREFIX . "right_temp where obj_id=" . $object_id; $f = $g_db->query_first($sql); $right_info = json_decode($f['content'], 1); hg_pre($right_info); }
public function csv2array($file_name, $table_name) { if (!$file_name) { return false; } require_once CUR_CONF_PATH . 'lib/PHPExcel.php'; require_once CUR_CONF_PATH . 'lib/PHPExcel/IOFactory.php'; require_once CUR_CONF_PATH . 'lib/PHPExcel/Reader/CSV.php'; $objReader = PHPExcel_IOFactory::createReader('CSV'); //$objReader->setInputEncoding('GBK'); $objPHPExcel = $objReader->load($file_name); echo 321; exit; $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); //取得总行数 $highestColumn = $sheet->getHighestColumn(); //取得总列数 $highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); //将字符转为十进制 echo $highestColumn; exit; // $A1 = trim($objPHPExcel->getActiveSheet()->getCellByColumnAndRow(ord($currentColumn) - 65, 1)->getValue());//default 默认为表名,但是不用于 hg_pre($A1); exit; }
public function get() { $column_url = 'http://vapi.thmz.com/workbench/columns.php?fid=' . $this->input['fid']; $column_info = json_decode(file_get_contents($column_url), true); hg_pre($column_info); }
public function show() { $data = $this->obj->sysOrg(); hg_pre($data); }
function show() { $ftp_server = "10.232.55.164"; $ftp_port = 21; $ftp_user = "******"; $ftp_pass = "******"; $file_format = array("xml"); //连接FTP服务器 $conn_id = ftp_connect($ftp_server, $ftp_port); $f_dir = './XMLQIYI/'; // $g_dir = CUR_CONF_PATH . 'data/ftp_tian/'; $gf_dir = '/data/web/video.app.m2o/uploads/tianmai/'; $count = 10; $cache_file = CACHE_DIR . 'queue_tian'; if (file_exists($cache_file) && !$this->input['debug']) { $last_time = file_get_contents($cache_file); if ($this->input['queue']) { unlink($cache_file); } elseif (time() - $last_time > 600) { unlink($cache_file); } else { $this->errorOutput('当前有任务在执行。。。'); } } else { if (hg_mkdir($g_dir)) { // 登陆FTP $file_name = array(); if (ftp_login($conn_id, $ftp_user, $ftp_pass)) { $tmp_dir = opendir($g_dir); $i = 0; while ($file = readdir($tmp_dir)) { if ($file == '.' || $file == '..' || !in_array(substr(strrchr($file, '.'), 1), $file_format)) { continue; } if ($i <= $count) { $file_name[] = $file; } else { break; } $i++; } if (empty($file_name)) { $filelist = ftp_rawlist($conn_id, $f_dir); foreach ($filelist as $file) { $tmp_filename = preg_replace("/.+[:]*\\d+\\s/", "", $file); $tmp_name = mb_convert_encoding($tmp_filename, "GBK", "UTF-8"); if ($tmp_filename == '.' || $tmp_filename == '..' || !in_array(substr(strrchr($tmp_name, '.'), 1), $file_format)) { continue; } ftp_get($conn_id, $g_dir . $tmp_filename, $f_dir . $tmp_filename, FTP_BINARY); chmod($g_dir . $tmp_filename, 0777); } $tmp_dir = opendir($g_dir); $i = 0; while ($file = readdir($tmp_dir)) { if ($file == '.' || $file == '..' || !in_array(substr(strrchr($file, '.'), 1), $file_format)) { continue; } if ($i <= $count) { $file_name[] = $file; } else { break; } $i++; } } } // hg_pre($file_name);exit; if (!empty($file_name)) { file_put_contents($cache_file, time()); chmod($cache_file, 0777); $sql_ftp = "INSERT INTO " . DB_PREFIX . "ftp_source(vid,asset_id,parent_asset_id,name,tv_name,tv_id,index_num,create_time,update_time) VALUE "; $insert_ftp = $space = ''; foreach ($file_name as $key => $value) { echo $value . '<br/>'; $info = $data = array(); $filepath = $indexpic = ''; if (!file_exists($g_dir . $value)) { continue; } $xml_data = file_get_contents($g_dir . $value); if (!$this->xml_parser($xml_data)) { unlink($g_dir . $value); continue; } $array_data = xml2Array($xml_data); $adi_data = $this->xml_content($array_data); //处理xml内容 //hg_pre($adi_data);exit; $asset_id = $adi_data['asset_id']; $sql = "SELECT * FROM " . DB_PREFIX . "ftp_source WHERE asset_id='" . $asset_id . "'"; $f = $this->db->query_first($sql); $column_id = $sort_id = 0; $column_id = $adi_data['columnid']; // hg_pre($f);exit; if (empty($f)) { $info = array('title' => $adi_data['title'], 'subtitle' => '', 'keywords' => $adi_data['keywords'], 'comment' => $adi_data['newcontent'], 'author' => $adi_data['author'], 'vod_sort_id' => $adi_data['vod_sort_id'], 'column_id' => $adi_data['column_id'], 'start' => 0, 'duration' => '', 'audit_auto' => 2, 'create_time' => $adi_data['playTime'], 'appid' => APPID, 'appkey' => APPKEY, 'm2o_ckey' => M2OCKEY); $info['a'] = 'create'; $tmp_array = explode('/', $adi_data['video_filename']); $filename = $tmp_array[count($tmp_array) - 1]; $filepath = $adi_data['video_filename']; //mb_convert_encoding(, "GBK", "UTF-8"); // echo $g_dir . $filename;exit; if (!file_exists($gf_dir . $filename)) { @ftp_get($conn_id, $gf_dir . $filename, './' . $filepath, FTP_BINARY); // exit; if (!file_exists($gf_dir . $filename) || filesize($gf_dir . $filename) <= 0) { // unlink($gf_dir . $filename);//删除本地视频文件 unlink($g_dir . $value); //删除本地adi ftp_delete($conn_id, './' . $filepath); //删除ftp视频文件 ftp_delete($conn_id, $f_dir . $value); //删除ftp上adi continue; } else { chmod($gf_dir . $filename, 0777); } } // $info['videofile'] = '@' . $g_dir . $filename; $info['filepath'] = 'tianmai/' . $filename; // hg_pre($info);exit; $url = 'http://' . $this->settings['App_mediaserver']['host'] . '/' . $this->settings['App_mediaserver']['dir'] . 'admin/create.php?format=json'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $info); $rt = curl_exec($ch); curl_close($ch); $rt = json_decode($rt, 1); hg_pre($rt); $rt = $rt[0]; if ($rt['id']) { $insert_ftp = "(" . $rt['id'] . ",'" . $asset_id . "','','" . $title . "','',0,0," . TIMENOW . "," . TIMENOW . ")"; unlink($g_dir . $filename); //删除本地视频文件 // unlink($g_dir . $value);//删除本地adi ftp_delete($conn_id, './' . $filepath); //删除ftp视频文件 ftp_delete($conn_id, $f_dir . $value); //删除ftp上adi $this->db->query($sql_ftp . $insert_ftp); } hg_pre($rt); exit; } else { $tmp_array = explode('/', $adi_data['video_filename']); $filename = $tmp_array[count($tmp_array) - 1]; $filepath = $adi_data['video_filename']; //mb_convert_encoding(, "GBK", "UTF-8"); //unlink($g_dir . $value);//删除本地adi //@ftp_delete($conn_id, $f_dir . $value);//删除ftp上adi //no update operate } } //foreach unlink($cache_file); } //echo $file_name;exit; ftp_close($conn_id); //断开ftp服务器连接 } } }
public function get_program() { $channel_ids = $this->input['id']; $res = $this->mode->get_live($channel_ids); hg_pre($res, 0); }
public function personalMessageFormSelf($userId, $type) { if (!intval($userId)) { return false; } $sql = 'SELECT id, user_id, user_type,title, message, message_type, group_id, group_type, post_date FROM ' . DB_PREFIX . 'member_message_text WHERE user_id = ' . $userId . ' AND user_type = ' . $type; $query = $this->db->query($sql); $receiveIds = array(); $arr = array(); $receiveGroups = array(); while ($row = $this->db->fetch_array($query)) { if ($row['group_id']) { $receiveGroups[$row['group_type']][] = $row['group_id']; } $receiveIds[$row['message_type']][] = $row['id']; $arr[$row['id']] = $row; } $receiveMembers = array(); if (!empty($receiveIds)) { foreach ($receiveIds as $type => $mids) { //私信 if ($type == 1) { $messageIds = implode(',', $mids); $sql = 'SELECT message_id, receive_user_id, receive_user_type FROM ' . DB_PREFIX . 'member_message WHERE message_id IN (' . $messageIds . ')'; $query = $this->db->query($sql); $receiveUser = array(); $result = array(); while ($row = $this->db->fetch_array($query)) { $receiveUser[$row['receive_user_type']][] = $row['receive_user_id']; $aa[$row['message_id']][$row['receive_user_type']][] = $row['receive_user_id']; } //hg_pre($receiveUser);exit(); $userInfor = $this->userInfor($receiveUser); foreach ($aa as $mid => $userInfo) { foreach ($userInfo as $user_type => $uid) { foreach ($uid as $iid) { $receiveMembers[$mid][] = $userInfor[$user_type][$iid]; } } } //hg_pre($receiveMembers);exit(); } //公共信息,此处只显示组名 if ($type == 2) { $Groups = $this->getGroup($receiveGroups); //hg_pre($arr); //hg_pre($Groups);exit(); if (is_array($mids) && !empty($mids)) { foreach ($mids as $gid) { if ($arr[$gid]['group_id'] && is_string($arr[$gid]['group_id'])) { $groupIds = explode(',', $arr[$gid]['group_id']); foreach ($groupIds as $val) { $receiveMembers[$gid][] = $Groups[$arr[$gid]['group_type']][$val]; } } } } } //系统消息 if ($type == 3) { if (is_array($mids) && !empty($mids)) { foreach ($mids as $sid) { $receiveMembers[$sid][] = array('id' => -1, 'user_name' => '系统消息', 'avatar' => '', 'email' => ''); } } } } } if (!empty($arr)) { foreach ($arr as $key => $val) { $arr[$val['id']]['receive_user'] = $receiveMembers[$val['id']]; } } hg_pre($arr); exit; return $arr; }
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); }