This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

652 lines
22 KiB
PHP

<?php
function testUploadLocalVideo($accessKeyId, $accessKeySecret, $filePath, $filename)
{
try {
$uploader = new AliyunVodUploader($accessKeyId, $accessKeySecret);
$uploadVideoRequest = new UploadVideoRequest($filePath, $filename);
//$uploadVideoRequest->setCateId(1);
//$uploadVideoRequest->setCoverURL("http://xxxx.jpg");
//$uploadVideoRequest->setTags('test1,test2');
//$uploadVideoRequest->setStorageLocation('outin-xx.oss-cn-beijing.aliyuncs.com');
//$uploadVideoRequest->setTemplateGroupId('6ae347b0140181ad371d197ebe289326');
$userData = array(
"MessageCallback"=>array("CallbackURL"=>"https://demo.sample.com/ProcessMessageCallback"),
"Extend"=>array("localId"=>"xxx", "test"=>"www")
);
$uploadVideoRequest->setUserData(json_encode($userData));
$res = $uploader->uploadLocalVideo($uploadVideoRequest);
//print_r("--".$res."--");
return($res);
} catch (Exception $e) {
printf("testUploadLocalVideo Failed, ErrorMessage: %s\n Location: %s %s\n Trace: %s\n",
$e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
}
}
//-------------------------------视频设置
header("Content-type: text/html; charset=utf-8");
if(THIS_IN!="edt_admin")
exit("错误的访问!");
//-------------------------------execute action
$uid=check_cookie();
$db=_mysql_connect();
$msg_login_user=get_db_msg("select * from ".$table_pre."user where id='".$uid."'");
//权限判断
$priv=return_priv($_m,$msg_login_user["priv"]);
$arr_column_video=array("vid_net"=>"阿里云视频id","vtitle"=>"视频标题","is_local"=>"是否为本地视频","local_path"=>"本地路径","khid"=>"款号","cate"=>"视频分类");
$accessKeyId = 'LTAI4Fha7Z3YTrEARrmxHEFK';
$accessKeySecret = 'PCuBxbWeMr8a2vPkfpopqdfmNOI4E0';
$json_data="{";
if($priv[0]=="n"){
//没有操作权限
$json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
}else{
switch($_a){
case "add" :
if($id){
$msg=get_db_msg("select * from ".$table_pre."video where id='".$id."'");
$json_data.="\"id\":\"".$id."\",";
$json_data.="\"is_local\":\"".$msg["is_local"]."\",";
$json_data.="\"vtitle\":\"".$msg["vtitle"]."\",";
$json_data.="\"vid_net\":\"".$msg["vid_net"]."\",";
$json_data.="\"local_path\":\"".$msg["local_path"]."\",";
$json_data.="\"cate\":\"".$msg["cate"]."\",";
if($msg["cate"]=="直播录像"){
$query="select * from ".$table_pre."video_kh where vid='".$id."'";
$r=$db->query($query);
$vk="";
while($m=$db->fetch_array($r)){
$vk.=$m["vtime"]."_".$m["kh"]."_".$m["remark"]."|";
}
$json_data.="\"fd\":\"".deel_end($vk)."\",";
}
if($msg["khid"]){
$json_data.="\"khid\":\"".$msg["khid"]."\",";
$kh=get_db_msg("select no from ".$table_pre."kh where id='".$msg["khid"]."'");
$json_data.="\"no\":\"".$kh["no"]."\",";
}else{
$json_data.="\"khid\":\"\",";
$json_data.="\"no\":\"\",";
}
if($msg["is_local"]=="n"){
$json_data.="\"source\":\"阿里云\",";
}else{
$json_data.="\"source\":\"本地\",";
}
}else{
$json_data.="\"id\":\"\",";
$json_data.="\"is_local\":\"\",";
$json_data.="\"vtitle\":\"\",";
$json_data.="\"cate\":\"\",";
$json_data.="\"vid_net\":\"\",";
$json_data.="\"local_path\":\"\",";
$json_data.="\"source\":\"\",";
}
break;
case "save_add" :
if($id){
if($cate!="直播录像"){
if($kh){
$tmp_kh=get_db_msg("select id from ".$table_pre."kh where no='".$kh."'");
$query="update ".$table_pre."video set vtitle='".$vtitle."',local_path='".$local_path."',khid='".$tmp_kh["id"]."',cate='单款视频' where id='".$id."'";
}else{
$query="update ".$table_pre."video set vtitle='".$vtitle."',local_path='".$local_path."',khid='',cate='其他视频' where id='".$id."'";
}
}else{
$query="update ".$table_pre."video set vtitle='".$vtitle."' where id='".$id."'";
$q="delete from ".$table_pre."video_kh where vid='".$id."'";
$db->query($q);
for($i=0,$num=count($vtime);$i<$num;$i++){
if($vtime[$i]!==""&&$vkh[$i]!==""){
$kha=get_db_msg("select id from web_kh where no='".$vkh[$i]."'");
$q="insert into ".$table_pre."video_kh (vid,vtime,khid,kh,remark) values ('".$id."','".$vtime[$i]."','".$kha["id"]."','".$vkh[$i]."','".$remark[$i]."')";
$db->query($q);
}
}
}
$json_data.="\"q\":\"".$query."\",";
$db->query($query);
$log_action="修改";
}else{
//$query="insert into ".$table_pre."video (vtitle,local_path,vid_net,is_local) values ('".$vtitle."','".$local_path."','".$vid_net."')";
//$json_data.="\"q\":\"".$query."\",";
//$db->query($query);
//$log_action="新增";
}
set_log($log_action."视频",$m1["_remark"]."|".$_v);
$json_data.="\"code\":1,";
break;
case "get_record_info":
require_once THIS_FILE_ROOT.'/include/live.php';
require_once '../tmpl/zbconfig.php';
$liveObj = new AliyunLive(); //实例化阿里云对象
//$AppName="edt";
$StreamName=get_set("streamName");
$StartTime=$t1;
$EndTime=$t2;
$PageSize=30;
//$PageNum=1;
//$DomainName="zb.mochtech.com";
for($i=1;$i<100;$i++){
$iofo=$liveObj ->get_record_info($AppName,$StreamName,$StartTime,$EndTime,$pull_cdn,$i,$PageSize);
$iofo=json_decode(json_encode($iofo),true);
//print_R($iofo);
foreach($iofo["RecordIndexInfoList"] as $k => $v){
foreach ($v as $k1=>$v1){
$tmparr=explode(".",$v1["OssObject"]);
if($tmparr[1]=="m3u8"){
$tmp_v=get_db_msg("select id from ".$table_pre."video where vid_net='".$v1["RecordUrl"]."'");
if(!$tmp_v["id"]){
$query="insert into ".$table_pre."video (vid_net,is_local,duration,cate) values ('".$v1["RecordUrl"]."','n','".$v1["Duration"]."','直播录像')";
$db->query($query);
}
}else{
$tmp_v=get_db_msg("select id from ".$table_pre."video_dl where vid_net='".$v1["RecordUrl"]."'");
if(!$tmp_v["id"]){
$query="insert into ".$table_pre."video_dl (vid_net) values ('".$v1["RecordUrl"]."')";
$db->query($query);
}
}
}
}
if(count($iofo["RecordIndexInfoList"]["RecordIndexInfo"]<$PageSize)){
break;
}
}
$json_data.="\"code\":1,";
break;
case "get_dllist":
$q="select * from ".$table_pre."video_dl order by id";
$r=$db->query($q);
$i=0;
$tmp="";
while($m=$db->fetch_array($r)){
$tmparr=explode("/",$m["vid_net"]);
$title=$tmparr[count($tmparr)-1];
$tmp.="{\"url\":\"".$m["vid_net"]."\",\"title\":\"".$title."\"},";
$i++;
}
$json_data.="\"dllist\":[".deel_end($tmp)."],";
break;
case "uploadVideo_aly":
$json_data.="\"code\":1,";
break;
case "save_uploadVideo_aly":
$up_image=$_FILES["file"];
//var_dump($up_image);
//exit;
$err="";
//$json_data.="\"ms\":\"".$ms."\",";
$support_ext="MP4|WebM|Ogg";
if($up_image["name"]){
if(!check_file_type($support_ext,get_file_ext($up_image["name"])))
$err="视频格式错误!(支持".$support_ext.")";
}
//echo "<".$vtitle.">";
if(!$err){
$tmpn=explode(".",$up_image["name"]);
//$path1="../video/aly";
//$new_file_name=$tmpn[0].".".get_file_ext($up_image["name"]);
//$json_data.="\"f\":\"".$new_file_name."\",";
//$json_data.="\"f1\":\"".$up_image["tmp_name"]."\",";
//upload_file($up_image["tmp_name"],$path1,$new_file_name);
$tmprn=explode(".",$up_image["tmp_name"]);
$tmprn1=$tmprn[0].".".$tmpn[1];
//echo $tmprn1;
rename($up_image["tmp_name"],$tmprn1);
//echo $tmprn1;
//exit;
require_once THIS_FILE_ROOT.'/include/voduploadsdk/Autoloader.php';
//$localFilePath=$path1."/".$new_file_name;
//$resup=testUploadLocalVideo($accessKeyId, $accessKeySecret, $localFilePath,$up_image["name"]);
$resup=testUploadLocalVideo($accessKeyId, $accessKeySecret, $tmprn1,$up_image["name"]);
//$json_data.="\"iofo\":\"".$resup."\",";
$tmp_kh=get_db_msg("select id from ".$table_pre."kh where no='".$tmpn[0]."'");
if($tmp_kh["id"]){
//$tmp_kh=get_db_msg("select id from ".$table_pre."kh where no='".$kh."'");
$query="insert into ".$table_pre."video (vid_net,vtitle,is_local,khid,cate) values ('".$resup."','".$tmpn[0]."','n','".$tmp_kh["id"]."','单款视频')";
}else{
$query="insert into ".$table_pre."video (vid_net,vtitle,is_local,cate) values ('".$resup."','".$vtitle."','n','其他视频')";
}
$json_data.="\"q\":\"".$query."\",";
$db->query($query);
$log_action="上传阿里云新增";
set_log($log_action."视频",$m1["_remark"]."|".$_v);
$json_data.="\"code\":1,";
unlink($tmprn1);
}else{
$json_data.="\"code\":0,\"msg\":\"".$err."\"";
}
break;
case "uploadVideo_aly_lb":
$json_data.="\"code\":1,";
break;
case "save_uploadVideo_aly_lb":
$up_image=$_FILES["file"];
//var_dump($up_image);
//exit;
$err="";
//$json_data.="\"ms\":\"".$ms."\",";
$support_ext="MP4|WebM|Ogg";
if($up_image["name"]){
if(!check_file_type($support_ext,get_file_ext($up_image["name"])))
$err="视频格式错误!(支持".$support_ext.")";
}
//echo "<".$vtitle.">";
if(!$err){
$tmpn=explode(".",$up_image["name"]);
//$path1="../video/aly";
//$new_file_name=$tmpn[0].".".get_file_ext($up_image["name"]);
//$json_data.="\"f\":\"".$new_file_name."\",";
//$json_data.="\"f1\":\"".$up_image["tmp_name"]."\",";
//upload_file($up_image["tmp_name"],$path1,$new_file_name);
$tmprn=explode(".",$up_image["tmp_name"]);
$tmprn1=$tmprn[0].".".$tmpn[1];
rename($up_image["tmp_name"],$tmprn1);
require_once THIS_FILE_ROOT.'/include/voduploadsdk/Autoloader.php';
//$localFilePath=$path1."/".$new_file_name;
//$resup=testUploadLocalVideo($accessKeyId, $accessKeySecret, $localFilePath,$up_image["name"]);
$resup=testUploadLocalVideo($accessKeyId, $accessKeySecret, $tmprn1,$up_image["name"]);
/*//获取视频时间
require_once THIS_FILE_ROOT.'/include/video.php';
$videoObj = new AliyunVideo(); //实例化阿里云对象
$iofo=$videoObj ->get_play_info($resup);
$iofo=json_decode( json_encode( $iofo),true);
$Duration=$iofo["PlayInfoList"]["PlayInfo"][0]["Duration"];*/
//$json_data.="\"iofo\":\"".$resup."\",";
//$tmp_kh=get_db_msg("select id from ".$table_pre."kh where no='".$tmpn[0]."'");
$query="insert into ".$table_pre."video (vid_net,vtitle,is_local,cate,duration) values ('".$resup."','".$tmpn[0]."','n','直播录像','".$Duration."')";
$json_data.="\"q\":\"".$query."\",";
$db->query($query);
$log_action="上传阿里云新增_录播";
set_log($log_action."视频",$m1["_remark"]."|".$_v);
$json_data.="\"code\":1,";
unlink($tmprn1);
}else{
$json_data.="\"code\":0,\"msg\":\"".$err."\"";
}
break;
case "uploadVideo_local":
$json_data.="\"code\":1,";
break;
case "save_uploadVideo_local":
$up_image=$_FILES["up_file"];
//var_dump($up_image);
$err="";
//$json_data.="\"ms\":\"".$ms."\",";
$support_ext="MP4|WebM|Ogg";
if($up_image["name"]){
if(!check_file_type($support_ext,get_file_ext($up_image["name"])))
$err="视频格式错误!(支持".$support_ext.")";
}
//echo "<".$vtitle.">";
if(!$err){
//$tmpn=explode(".",$up_image["name"]);
$path1="../video";
$new_file_name=$vtitle.".".get_file_ext($up_image["name"]);
//$json_data.="\"f\":\"".$new_file_name."\",";
//$json_data.="\"f1\":\"".$up_image["tmp_name"]."\",";
upload_file($up_image["tmp_name"],$path1,$new_file_name);
if($kh){
$tmp_kh=get_db_msg("select id from ".$table_pre."kh where no='".$kh."'");
$query="insert into ".$table_pre."video (vtitle,is_local,local_path,khid,cate) values ('".$vtitle."','y','".$new_file_name."','".$tmp_kh["id"]."','单款视频')";
}else{
$query="insert into ".$table_pre."video (vtitle,is_local,local_path,cate) values ('".$vtitle."','y','".$new_file_name."','其他视频')";
}
$json_data.="\"q\":\"".$query."\",";
$db->query($query);
$log_action="上传本地新增";
set_log($log_action."视频",$m1["_remark"]."|".$_v);
$json_data.="\"code\":1,";
}else{
$json_data.="\"code\":0,\"msg\":\"".$err."\"";
}
break;
//----------------------------------------------------------------------导入EXCEL
case "import":
//目录权限
$arr_path=array(
"cache"=>"admin/cache"
);
$json_data.="\"path_priv\":[";
$tmp="";
foreach($arr_path as $path_real => $path_title){
$tmp.="{\"title\":\"".$path_title."\",\"priv\":";
if(new_is_writeable($path_real)==1){
$tmp.="\"y\"";
}else{
$tmp.="\"n\"";
}
$tmp.="},";
}
$json_data.=substr($tmp,0,-1)."],";
break;
case "import_check":
$file1=$_FILES["up_file"];
//echo $file1["name"]."--";
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_video);
$msg="";
if(count($arr_column[0])==0){
$msg.="未检测到可导入字段,请返回检查EXCEL文件!";
del_tmp_file($tmp_file_name);
$json_data.="\"code\":0,\"msg\":\"".$msg."\",";
}else{
//
$column="";
foreach($arr_column_video as $k => $v){
$column.=$v.",";
}
if($column)
$column=substr($column,0,-1);
$msg1=array();
$msg1[0]=array("可导入正确字段",$column);
//
$column="";
for($i=0;$i<count($arr_thead);$i++){
if(in_array(get_main_key($arr_column_video,$arr_thead[$i]),$arr_column[1])){
$style=" style='font-weight:bold;color:#0000ff'";
}else{
$style=" style='color:#cccccc'";
}
$column.="<span".$style.">".$arr_thead[$i]."</span>,";
}
if($column)
$column=substr($column,0,-1);
//
$msg1[1]=array("检测到的有效字段",$column);
//
$total=count($arr_content)-1;
$msg1[2]=array("记录条数",$total);
$m1="";
for($i=0;$i<count($msg1);$i++){
$m1.="{\"col1\":\"".$msg1[$i][0]."\",\"col2\":\"".$msg1[$i][1]."\"},";
}
if($m1)
$m1=substr($m1,0,-1);
$json_data.="\"code\":1,\"tmp_file_name\":\"".$tmp_file_name."\",\"msg\":[".$m1."],";
$json_data.="\"input\":[{\"type\":\"radio\",\"title\":\"导入方式\",\"name\":\"import_type\",\"op\":\"清空导入|新增导入\",\"value\":\"清空导入\"}],";
}
break;
case "import_do":
$import_type=($import_type=="清空导入")?"y":"n";
$sign="y";
if($import_type=="y"){
$db->query("TRUNCATE TABLE ".$table_pre."video;");
}
if($sign=='y'){
//-------------------------------------------导入数据
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_video);
$insert_column="";
for($i=0;$i<count($arr_column[1]);$i++){
$insert_column.=$arr_column[1][$i].",";
}
$insert_column=substr($insert_column,0,-1);
//检查客户代码是否重复
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="vtitle"){
$arr_check[]=trim($tmp_arr[$ind]);
}
}
}
$arr1=array_count_values($arr_check);
$repeat_str="";
foreach($arr1 as $k1 => $v1){
if($v1>1)
$repeat_str.=$k1.",";
}
if($repeat_str){
$repeat_str=substr($repeat_str,0,-1);
$json_data.="\"code\":0,\"msg\":\"视频名称有重复,请检查(".$repeat_str.")!\",\"reload_type\":\"1\",";
}else{
$json_data.="\"code\":1,\"reload_type\":\"1\",";
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="khid"){
$kh=get_db_msg("select id from ".$table_pre."kh where no='".trim($tmp_arr[$ind])."'");
$insert_value.="'".mysql_escape_string($kh["id"])."',";
}else if($ititle=="face"){
$insert_value.="'".mysql_escape_string(get_main_key($arr_client_face,trim($tmp_arr[$ind])))."',";
}else if($ititle=="dp_price"){
$insert_value.="'".mysql_escape_string(get_main_key($sys_multi_price,trim($tmp_arr[$ind])))."',";
}else if($ititle=="zk"){
$zk=deel_num($tmp_arr[$ind]>0)?$tmp_arr[$ind]:1;
$insert_value.="'".mysql_escape_string($zk)."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$insert_value=substr($insert_value,0,-1);
$q="insert into ".$table_pre."video (".$insert_column.") values (".$insert_value.")";
$db->query($q);
}
del_tmp_file($tmp_file_name);
$log_remark=$import_flag;
set_log("导入 客户数据",$log_remark);
}
}else{
$json_data.="\"code\":0,\"msg\":\"对不起,不允许清空导入操作!\",\"reload_type\":\"1\",";
}
break;
//----------------------------------------------------------------------导出数据
case "export":
$column="";
foreach($arr_column_video as $k => $v){
$column.="{\"k\":\"".$k."\",\"t\":\"".$v."\"},";
}
if($column)
$column=substr($column,0,-1);
$json_data.="\"col\":[".$column."],";
break;
case "export_do":
//取得字段选择的值
foreach($arr_column_video as $k => $v){
$var="col_".$k;
if($$var=="on"){
$ex_col[]=$k;
}
}
$num=count($ex_col);
if($num==0)
alert_and_back("请至少选择一个要导出的字段");
for($i=0;$i<$num;$i++){
$data["col"][]='str';
$data["header"][0][]=get_main_value($arr_column_video,$ex_col[$i]);
}
$query="select * from ".$table_pre."video order by id";
$r=$db->query($query);
$row=0;
while($m=$db->fetch_array($r)){
for($i=0;$i<$num;$i++){
$k=$ex_col[$i];
if($k=="khid"){
$kh=get_db_msg("select no from ".$table_pre."kh where id='".$m[$k]."'");
$data["body"][$row][]=$kh["no"];
}else{
$data["body"][$row][]=$m[$k];
}
}
$row++;
}
$file_name="video_".date("Y-m-d-H-i");
output_excel($file_name,$data);
set_log("导出 视频信息");
exit;
break;
case "del":
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$tmp=get_db_msg("select * from ".$table_pre."video where id='".$id[$i]."'");
$lid.=$tmp["vtitle"]."|".$id[$i].", ";
$db->query("delete from ".$table_pre."video where id='".$id[$i]."'");
}
$lid=substr($lid,0,-2);
set_log("删除视频",$lid);
$json_data.="\"code\":1,";
break;
default :
require_once THIS_FILE_ROOT.'/include/video.php';
$videoObj = new AliyunVideo(); //实例化阿里云对象
//
//-----------------------tab
$s_cate=$s_cate?$s_cate:"单款视频";
$json_data.="\"s_cate\":\"".$s_cate."\",";
$tabarr=array("单款视频","直播录像","其他视频");
$str_tab="";
foreach($tabarr as $k => $v){
$str_tab.="{\"no\":\"".$v."\",\"title\":\"".$v."\"},";
}
$str_tab=deel_end($str_tab);
$json_data.="\"tab\":[".$str_tab."],";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
if($s_keyword)
$sql_con.="(vtitle like '%".$s_keyword."%' ) and ";
if($s_cate)
$sql_con.="cate='".$s_cate."' and ";
if($s_no){
$tmp=get_db_msg("select * from ".$table_pre."kh where no='".$s_no."'");
$sql_con.="khid='".$tmp["id"]."' and ";
}
if($s_is_local)
$sql_con.="is_local='".$s_is_local."' and ";
if($sql_con)
$sql_con="where ".substr($sql_con,0,-4);
//-----------------------/tab
//
$tmp=get_db_msg("select count(*) 'total' from ".$table_pre."video ".$sql_con);
$total_num=$tmp["total"];
$q="select * from ".$table_pre."video ".$sql_con." order by id limit ".$start.",".$end;
$r=$db->query($q);
$count=0;
$str_tmp=$str_tmp1="";
$json_data.="\"lang_keyword\":\"视频名称\",";
$json_data.="\"lang_kh\":\"款号\",";
$json_data.="\"s_keyword\":\"".$s_keyword."\",";
$json_data.="\"s_is_locale\":\"".$s_is_local."\",";
$json_data.="\"q\":\"".$q."\",";
$tmperr="";
while($msg=$db->fetch_array($r)){
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"is_local\":\"".$msg["is_local"]."\",";
if($msg["cate"]!="直播录像"){
if($msg["is_local"]=="n"){
$str_tmp.="\"source\":\"阿里云\",";
//$tmpifo=$videoObj ->get_video_info($msg["vid_net"]);
//print_r($tmpifo);
try {
$iofo=$videoObj ->get_play_info($msg["vid_net"]);
$iofo=json_decode( json_encode( $iofo),true);
//print_r($iofo);
//print_r($iofo["PlayInfoList"]["PlayInfo"][0]["PlayURL"]);
$vurl=$iofo["PlayInfoList"]["PlayInfo"][0]["PlayURL"];
} catch (Exception $e) {
$vurl="";
$tmperr.=$msg["vtitle"]."|";
}
}else{
$vurl="../video/".$msg["local_path"];
$str_tmp.="\"source\":\"本地\",";
}
}else{
if($msg["duration"]){
$str_tmp.="\"type\":\"aly\",";
$vurl=$msg["vid_net"];
$str_tmp.="\"vdid\":\"v".$count."\",";
}else{
$str_tmp.="\"type\":\"video\",";
try {
$iofo=$videoObj ->get_play_info($msg["vid_net"]);
$iofo=json_decode( json_encode( $iofo),true);
//print_r($iofo);
//print_r($iofo["PlayInfoList"]["PlayInfo"][0]["PlayURL"]);
$vurl=$iofo["PlayInfoList"]["PlayInfo"][0]["PlayURL"];
} catch (Exception $e) {
$vurl="";
$tmperr.=$msg["vtitle"]."|";
}
}
$str_tmp.="\"source\":\"阿里云\",";
}
$str_tmp.="\"vurl\":\"".$vurl."\",";
$str_tmp.="\"cate\":\"".$msg["cate"]."\",";
$str_tmp.="\"local_path\":\"".$msg["local_path"]."\",";
$str_tmp.="\"vtitle\":\"".$msg["vtitle"]."\",";
if($msg["khid"]){
$str_tmp.="\"khid\":\"".$msg["khid"]."\",";
$kh=get_db_msg("select no from ".$table_pre."kh where id='".$msg["khid"]."'");
$str_tmp.="\"no\":\"".$kh["no"]."\",";
}else{
$str_tmp.="\"khid\":\"\",";
$str_tmp.="\"no\":\"\",";
}
$str_tmp.="\"vtitle\":\"".$msg["vtitle"]."\",";
$str_tmp.="\"vid_net\":\"".$msg["vid_net"]."\"";
$str_tmp.="},";
$count++;
}
if($tmperr){
$tmperr=deel_end($tmperr);
}
$json_data.="\"err\":\"".$tmperr."\",";
$json_data.="\"ct\":\"".$count."\",";
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
$json_data.=substr($str_tmp,0,-1)."],";
break;
}
}
$json_data=substr($json_data,0,-1)."}";
echo $json_data;
?>