query("INSERT INTO `web_set` (`id`, `_k`, `_remark`, `_v`, `_t`, `_t1`) VALUES ('1003', 'streamName', '直播命名', '', '2', '')"); } $json_data="{"; if($priv[0]=="n"){ //没有操作权限 $json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],"; }else{ $json_data.="\"uid\":".$uid.","; switch($_a){ //申请 case "save_ask": //$StreamName=$tmp_set["_v"]?$tmp_set["_v"]:"mochtech_".rand(1000,9999)."_".time(); $StreamName="mochtech_".rand(1000,9999)."_".time(); // $tbURL="http://47.99.153.58/edt/zbapi/create_zburl.php"; $data="cate=zbask&appzbconfig=".$Appzbconfig."&appName=".$AppName."&streamName=".$StreamName."&dhh_title=".$dhhtitle."&peopleNum=".$peopleNum."&ygts=".$ygts."&adddate=".strtotime($adddate)."&is_test=".$is_test; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $tbURL); //端口 //curl_setopt($ch, CURLOPT_PORT, 80); curl_setopt($ch, CURLOPT_HEADER, false); //设定请求后返回结果 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //声明使用POST方式来进行发送 curl_setopt($ch, CURLOPT_POST, 1); //发送什么数据 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //忽略证书 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //设置超时时间 curl_setopt($ch, CURLOPT_TIMEOUT, 30); $handles = curl_exec($ch); curl_close($ch); //print_r($handles); //申请则改变streamName $db->query("update web_set set _v='".$StreamName."' where _k='streamName'"); $tmp=get_db_msg("select id from web_zb order by id limit 0,1"); if($tmp["id"]){ $db->query("update web_zb set title='".$StreamName."' where id='".$tmp["id"]."'"); }else{ $db->query("insert into web_zb(title,push_url,pull_url,lb_url,add_date) values('".$StreamName."','','','','')"); } break; case "setZbDate": $datevalue=strtotime($datevalue); $db->query("update web_zb set zb_date='".$datevalue."' where id='".$zbid."'"); $json_data.="\"code\":\"200\",\"msg\":\"\","; break; case "save_add_pic": $up_image=$_FILES["up_file"]; make_mini_picture($up_image["tmp_name"],"images/cover_aliplayer.jpg",800); $db->query("update web_zb set cover_img='cover_aliplayer' where id='".$zbid."'"); $arr_pic_set=out_good_pic_set_arr("images/cover_aliplayer.jpg",300,300); $json_data.="\"code\":\"200\",\"msg\":\"\",\"pwidth\":\"".$arr_pic_set[0]."\",\"pheight\":\"".$arr_pic_set[1]."\","; break; default: $tmp=get_db_msg("select * from web_zb order by id limit 0,1"); //订货会标题 $tmp_get_title=get_db_msg("select _v from web_set where _k='sys_client_title'"); $StreamName=$tmp["title"]?$tmp["title"]:$tmp_set["_v"]; $tbURL="http://47.99.153.58/edt/zbapi/create_zburl.php"; $data="cate=get_zbinfo&appName=".$AppName."&streamName=".$StreamName; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $tbURL); //端口 //curl_setopt($ch, CURLOPT_PORT, 80); curl_setopt($ch, CURLOPT_HEADER, false); //设定请求后返回结果 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //声明使用POST方式来进行发送 curl_setopt($ch, CURLOPT_POST, 1); //发送什么数据 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //忽略证书 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //设置超时时间 curl_setopt($ch, CURLOPT_TIMEOUT, 30); $handles = curl_exec($ch); curl_close($ch); $return=(array)json_decode($handles,true); //print_r($return); if($return["code"]==200){ $db->query("update web_zb set push_url='".$return["push_url"]."',push_url2='".$return["push_url2"]."',pull_url='".$return["pull_url"]."',add_date='".$return["pull_date"]."' where id='".$tmp["id"]."'"); $this_ts=$return["ts"]; $this_rs=$return["rs"]; $this_test=($return["is_test"]=="y")?"测试":"正式"; }else{ $this_ts=0; $this_rs=0; $this_test=""; } $msg=get_db_msg("select * from web_zb order by id limit 0,1"); if(time()>$msg["add_date"]){ //$arr_pushUrl=explode("spanspan",$msg["push_url"]); if($Appzbconfig=="y"){ $pushUrl=$msg["push_url2"]; }else{ $pushUrl=$msg["push_url"]; } }else{ $pushUrl="timenoout"; } $json_data.="\"code\":200,\"msg\":\"\",\"data\":["; $str_tmp=""; $str_tmp.="{"; $str_tmp.="\"id\":\"".$msg["id"]."\","; $str_tmp.="\"xh\":\"".$list."\","; $str_tmp.="\"title\":\"".$msg["title"]."\","; $str_tmp.="\"dhhtitle\":\"".$tmp_get_title["_v"]."\","; $str_tmp.="\"rs\":\"".$this_rs."\","; $str_tmp.="\"is_test\":\"".$this_test."\","; $str_tmp.="\"push_url\":\"".$pushUrl."\","; $str_tmp.="\"pull_url\":\"".$msg["pull_url"]."\","; $str_tmp.="\"lb_url\":\"".$msg["lb_url"]."\","; $str_tmp.="\"state\":\"".$msg["state"]."\","; $enddate=$msg["add_date"]>0?date("Y-m-d",$msg["add_date"]+$this_ts*24*60*60):""; $str_tmp.="\"end_date\":\"".$enddate."\","; if($msg["zb_date"]>0){ $str_tmp.="\"zb_date\":\"".date("Y-m-d H:i:s",$msg["zb_date"])."\","; }else{ $str_tmp.="\"zb_date\":\"\","; } $endtime=$msg["add_date"]+$this_ts*24*60*60; if(time()>$endtime){ $str_tmp.="\"statue\":\"n\","; }else{ $str_tmp.="\"statue\":\"y\","; } if($msg["cover_img"]){ $arr_pic_set=out_good_pic_set_arr("images/cover_aliplayer.jpg",300,300); $str_tmp.="\"cover_aliplayer\":\"y\",\"pwidth\":\"".$arr_pic_set[0]."\",\"pheight\":\"".$arr_pic_set[1]."\","; }else{ $str_tmp.="\"cover_aliplayer\":\"n\","; } $adddate=$msg["add_date"]>0?date("Y-m-d",$msg["add_date"]):""; $str_tmp.="\"add_date\":\"".$adddate."\""; $str_tmp.="},"; $json_data.=substr($str_tmp,0,-1)."],"; break; } } $json_data=substr($json_data,0,-1)."}"; echo $json_data; ?>