0) { $duration .= (int) $day.'d'; } if ($hour > 0) { $duration .= (int) $hour.':'; } if ($minute > 0) { $duration .= (int) $minute.':'; } if ($second > 0) { $duration .= (int) $second; }else{ $duration .= '00'; } return $duration; } header("Content-type: text/html; charset=utf-8"); $json_data="{"; if(THIS_IN!="edt_ipad") exit("错误的访问!"); $uid=check_cookie_jxs(); $tmp_client=get_db_msg("select * from web_client where id='".$uid."'"); $tmp_issy=get_db_msg("select * from web_set where _k='is_sy'"); $json_data.="\"uid\":\"".$uid."\","; $json_data.="\"is_sy\":\"".$tmp_issy["_v"]."\","; $json_data.="\"username\":\"".$tmp_client["username"]."\","; $json_data.="\"face\":\"".$tmp_client["face"]."\","; $json_data.="\"appzbconfig\":\"".$Appzbconfig."\","; $strzd=""; foreach($arr_zbxs as $n => $t){ $strzd.="{\"no\":\"".$n."\",\"title\":\"".$t."\"},"; } $json_data.="\"arr_zbxs\":[".deel_end($strzd)."],"; switch($_a){ case "get_khlist": $title=""; $count=0; $str_kh=""; $sql="select * from web_kh_zblist where is_show='y' order by ord"; $res=$db->query($sql); while($msg=$db->fetch_array($res)){ $tmp2=get_db_msg("select * from web_kh where no='".$msg["kh"]."' limit 0,1"); $tmp_pj=get_db_msg("select * from web_client_pj where cid='".$uid."' and khid='".$tmp2["id"]."'"); $tmp_zpj=get_db_msg("select sum(race) race from web_client_pj where khid='".$tmp2["id"]."'"); if($msg["color"]){ $tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."' and color='".$msg["color"]."'"); $tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and color='".$msg["color"]."' and uid='".$uid."'"); $pic=get_kh_color_picture($tmp2["no"],$msg["color"],$flag_pad_offline); }else{ $tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."'"); $tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and uid='".$uid."'"); //图片获取规则 $pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"],$flag_pad_offline); } $ck=out_good_pic_set_arr($pic,120,120); $str_kh.="{\"khid\":\"".$tmp2["id"]."\",\"no\":\"".$tmp2["no"]."\",\"color\":\"".get_cate_title_no('color',$msg["color"])."\",\"colorno\":\"".$msg["color"]."\",\"imgurl\":\"".$pic."\",\"js\":\"".$tmp["js"]."\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"xj\":\"".$tmp_pj["race"]."\",\"zxj\":\"".$tmp_zpj["race"]."\",\"khs\":\"".$tmp_khs["khs"]."\",\"zjs\":\"".$tmp_khs["js"]."\"},"; $count++; $title=$msg["title"]; } if($str_kh) $str_kh=substr($str_kh,0,-1); $tmp_total=get_db_msg("select sum(num) 'js',sum(je) 'je' from web_order where uid='".$uid."' and ka<>'y'"); $json_data.="\"khlist\":[".$str_kh."],"; $wcl=deel_bfb1($tmp_total["je"],$tmp_client["zb"]*10000); $json_data.="\"code\":\"200\",\"msg\":\"\",\"is_living\":\"y\",\"ydjs\":\"".$tmp_total["js"]."\",\"ydje\":\"".$tmp_total["je"]."\",\"wcl\":\"".$wcl."\",\"khnum\":\"".$count."\",\"title\":\"".$title."\","; break; case "get_khlist1": $title=""; $count=0; $str_kh=""; $sql="select * from web_kh_zblist where is_show='y' order by ord"; $res=$db->query($sql); while($msg=$db->fetch_array($res)){ $tmp2=get_db_msg("select * from web_kh where no='".$msg["kh"]."' limit 0,1"); $tmp_pj=get_db_msg("select * from web_client_pj where cid='".$uid."' and khid='".$tmp2["id"]."'"); $tmp_zpj=get_db_msg("select sum(race) race from web_client_pj where khid='".$tmp2["id"]."'"); if($msg["color"]){ $tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."' and color='".$msg["color"]."'"); $tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and color='".$msg["color"]."' and uid='".$uid."'"); $pic=get_kh_color_picture($tmp2["no"],$msg["color"],$flag_pad_offline); }else{ $tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."'"); $tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and uid='".$uid."'"); //图片获取规则 $pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"],$flag_pad_offline); } $ck=out_good_pic_set_arr($pic,120,120); $str_kh.="{\"khid\":\"".$tmp2["id"]."\",\"colorno\":\"".$msg["color"]."\",\"js\":\"".$tmp["js"]."\",\"xj\":\"".$tmp_pj["race"]."\",\"zxj\":\"".$tmp_zpj["race"]."\",\"khs\":\"".$tmp_khs["khs"]."\",\"zjs\":\"".$tmp_khs["js"]."\"},"; $count++; $title=$msg["title"]; } if($str_kh) $str_kh=substr($str_kh,0,-1); $tmp_total=get_db_msg("select sum(num) 'js',sum(je) 'je' from web_order where uid='".$uid."' and ka<>'y'"); $json_data.="\"khlist\":[".$str_kh."],"; $wcl=deel_bfb1($tmp_total["je"],$tmp_client["zb"]*10000); $json_data.="\"ydjs\":\"".$tmp_total["js"]."\",\"ydje\":\"".$tmp_total["je"]."\",\"wcl\":\"".$wcl."\",\"khnum\":\"".$count."\","; break; case "get_userlist": /*** $str_userlist=""; $sql_userlist="select uid from web_session where action like 'zbuser|%' order by lastactivity desc"; $res_userlist=$db->query($sql_userlist); while($msg_userlist=$db->fetch_array($res_userlist)){ $tmp_uid=get_db_msg("select title from web_client where id='".$msg_userlist["uid"]."'"); $str_userlist.="{\"id\":\"".$msg_userlist["uid"]."\",\"title\":\"".$tmp_uid["title"]."\",\"icon\":\"\"},"; } if($str_userlist) $str_userlist=substr($str_userlist,0,-1); $json_data.="\"usersList\":[".$str_userlist."],"; $json_data.="\"code\":\"200\",\"msg\":\"\","; ***/ $tmp_userlist=get_db_msg("select count(distinct uid) 'num' from web_session where action like 'zbuser|%'"); $json_data.="\"usersListNum\":\"".$tmp_userlist["num"]."\","; $json_data.="\"code\":\"200\",\"msg\":\"\","; break; case "lookvideo": $tmp=get_db_msg("select * from web_video_num where vid='".$id."' and uid='".$uid."'"); if(!$tmp["id"]){ $db->query("insert into web_video_num(vid,uid) values('".$id."','".$uid."')"); } $json_data.="\"code\":\"200\",\"msg\":\"\","; break; case "get_pullurl": $tmp=get_db_msg("select * from web_zb where state='y' limit 0,1"); $arr_pull=explode("spanspan",$tmp["pull_url"]); if($tmp["id"]){ $json_data.="\"pull_url\":\"".$arr_pull[0]."\","; $json_data.="\"pull_url2\":\"".$arr_pull[1]."\","; $json_data.="\"pull_url3\":\"".$arr_pull[2]."\","; $json_data.="\"pull_url4\":\"".$arr_pull[3]."\","; }else{ $json_data.="\"pull_url\":\"".$sys_pull_url."\","; $json_data.="\"pull_url2\":\"".$sys_pull_url."\","; $json_data.="\"pull_url3\":\"".$sys_pull_url."\","; $json_data.="\"pull_url4\":\"".$sys_pull_url."\","; } $json_data.="\"code\":\"200\",\"msg\":\"\","; break; default: require_once '../admin/include/video.php'; $videoObj = new AliyunVideo(); //实例化阿里云对象 $tmp=get_db_msg("select * from web_zb where state='y' limit 0,1"); $arr_pull=explode("spanspan",$tmp["pull_url"]); if($tmp["id"]){ $json_data.="\"pull_url\":\"".$arr_pull[0]."\","; $json_data.="\"pull_url2\":\"".$arr_pull[1]."\","; $json_data.="\"pull_url3\":\"".$arr_pull[2]."\","; $json_data.="\"pull_url4\":\"".$arr_pull[3]."\","; }else{ $json_data.="\"pull_url\":\"".$sys_pull_url."\","; $json_data.="\"pull_url2\":\"".$sys_pull_url."\","; $json_data.="\"pull_url3\":\"".$sys_pull_url."\","; $json_data.="\"pull_url4\":\"".$sys_pull_url."\","; } //封面 $json_data.="\"cover_img\":\"".$tmp["cover_img"]."\","; //提示时间 if($tmp["zb_date"]>0){ $json_data.="\"cover_text\":\"".date("Y-m-d H:i:s",$tmp["zb_date"])."\","; $json_data.="\"cover_text_time\":\"".$tmp["zb_date"]."\","; }else{ $json_data.="\"cover_text\":\"\","; $json_data.="\"cover_text_time\":\"\","; } // /*** $str_userlist=""; $sql_userlist="select uid from web_session where action like 'zbuser|%' order by lastactivity desc"; $res_userlist=$db->query($sql_userlist); while($msg_userlist=$db->fetch_array($res_userlist)){ $tmp_uid=get_db_msg("select title from web_client where id='".$msg_userlist["uid"]."'"); $str_userlist.="{\"id\":\"".$msg_userlist["uid"]."\",\"title\":\"".$tmp_uid["title"]."\",\"icon\":\"\"},"; } if($str_userlist) $str_userlist=substr($str_userlist,0,-1); $json_data.="\"usersList\":[".$str_userlist."],"; ***/ // $count=0; $str_kh=""; $sql="select * from web_kh_zblist where is_show='y' order by ord"; $res=$db->query($sql); while($msg=$db->fetch_array($res)){ $tmp2=get_db_msg("select * from web_kh where no='".$msg["kh"]."' limit 0,1"); $tmp_pj=get_db_msg("select * from web_client_pj where cid='".$uid."' and khid='".$tmp2["id"]."'"); $tmp_zpj=get_db_msg("select sum(race) race from web_client_pj where khid='".$tmp2["id"]."'"); if($msg["color"]){ $tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."' and color='".$msg["color"]."'"); $tmp3=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and color='".$msg["color"]."' and uid='".$uid."'"); $pic=get_kh_color_picture($tmp2["no"],$msg["color"],$flag_pad_offline); }else{ $tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."'"); $tmp3=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and uid='".$uid."'"); //图片获取规则 $pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"],$flag_pad_offline); } $ck=out_good_pic_set_arr($pic,120,120); $str_kh.="{\"khid\":\"".$tmp2["id"]."\",\"no\":\"".$tmp2["no"]."\",\"color\":\"".get_cate_title_no('color',$msg["color"])."\",\"colorno\":\"".$msg["color"]."\",\"imgurl\":\"".$pic."\",\"js\":\"".$tmp3["js"]."\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"xj\":\"".$tmp_pj["race"]."\",\"zxj\":\"".$tmp_zpj["race"]."\",\"khs\":\"".$tmp_khs["khs"]."\",\"zjs\":\"".$tmp_khs["js"]."\"},"; $count++; } if($str_kh) $str_kh=substr($str_kh,0,-1); $json_data.="\"khlist\":[".$str_kh."],\"khnum\":\"".$count."\","; // $tmp_userlist=get_db_msg("select count(distinct uid) 'num' from web_session where action like 'zbuser|%'"); $json_data.="\"usersListNum\":\"".$tmp_userlist["num"]."\","; // $str_videoslist=""; $sql_videoslist="select * from web_video where cate='直播录像'"; $res_videoslist=$db->query($sql_videoslist); while($msg_videoslist=$db->fetch_array($res_videoslist)){ $tmp_videonum=get_db_msg("select count(*) 'num' from web_video_num where vid='".$msg_videoslist["id"]."'"); $video_time=second2duration($msg_videoslist["duration"]); if(substr($msg_videoslist["vid_net"],-5)==".m3u8"){ $video_url1=substr($msg_videoslist["vid_net"],0,-5).".m3u8"; $video_url2=substr($msg_videoslist["vid_net"],0,-5).".m3u8"; $str_videoslist.="{\"id\":\"".$msg_videoslist["id"]."\",\"video_url1\":\"".$video_url1."\",\"video_url2\":\"".$video_url2."\",\"pic\":\"http://47.99.153.58/edt/hcb/attachments/design/mini/12W0101_91.jpg\",\"title1\":\"".$msg_videoslist["vtitle"]."\",\"title2\":\"\",\"aliyun\":\"y\",\"duration\":\"".$video_time."\",\"views\":\"".$tmp_videonum["num"]."\"},"; }else{ if($msg_videoslist["vid_net"]!=""){ $iofo=$videoObj ->get_play_info($msg_videoslist["vid_net"]); $iofo=json_decode( json_encode($iofo),true); //print_r($iofo); $vurl=$iofo["PlayInfoList"]["PlayInfo"][0]["PlayURL"]; $vDuration=$iofo["PlayInfoList"]["PlayInfo"][0]["Duration"]; $str_videoslist.="{\"id\":\"".$msg_videoslist["id"]."\",\"video_url1\":\"".$vurl."\",\"video_url2\":\"".$vurl."\",\"pic\":\"http://47.99.153.58/edt/hcb/attachments/design/mini/12W0101_91.jpg\",\"title1\":\"".$msg_videoslist["vtitle"]."\",\"title2\":\"\",\"aliyun\":\"n\",\"duration\":\"".$vDuration."\",\"views\":\"".$tmp_videonum["num"]."\"},"; } } } if($str_videoslist) $str_videoslist=substr($str_videoslist,0,-1); $json_data.="\"videosList\":[".$str_videoslist."],"; $json_data.="\"code\":\"200\",\"msg\":\"\","; break; } $json_data=substr($json_data,0,-1)."}"; echo $json_data; ?>