<?php
header("content-type:text/html;charset=utf-8");
include "../hexin.php";
$ziliao=ziliao($zh);
$_SESSION["yhsl"]=$ziliao["yonghusl"];
$_SESSION["xxsl1"]=$ziliao["xiaoxisl"];
$xx=xiaoxi();
if($xx=="")
{
$_SESSION["xxsl"]="0";
echo json_encode(array("code"=>"3","msg"=>'<div style="text-align:center;margin-top:5rem;"><img src="../page/image/xx.png" width="140" height="140"></img></div>'),JSON_UNESCAPED_UNICODE);
}
else if($_SESSION["xx"]==$xx)
{
echo json_encode(array("code"=>"4","msg"=>"已经是最新消息！"),JSON_UNESCAPED_UNICODE);
}
else
{
$_SESSION["xx"]=$xx;
$xxsz=explode("\n",$xx);
foreach($xxsz as $flxx)
{
$xhsl++;
if($msg==""&&$_SESSION["xxsl"]>"15")
{
$msg='<div id="shua" style="display:none" class="kongbai">
<img src="../page/image/shuaxin.gif" width="40" height="40"></img></div>';
}
if($flxx==null)
{
}
else if($xhsl>($_SESSION["xxsl"]-14))
{
$_SESSION["zxxx"]=$flxx;
$json=json_decode($flxx,true);
$jxnr=json_decode($json["neirong"],true);
$rz=json_decode($json["renzheng"],true);
//时间
$sj=date("Y-m-d H:i:s");
$sj=str_replace("-","",$sj);
$sj=mb_substr($sj,0,8,"utf-8");
$sj1=str_replace("-","",$json["shijian"]);
$sj2=mb_substr($json["shijian"],5,11,"utf-8");
$sj3=mb_substr($sj1,0,8,"utf-8");
$sj4=mb_substr($sj1,9,14,"utf-8");
$sj5=mb_substr($sj4,0,2,"utf-8");
$sj6=mb_substr($sj4,3,5,"utf-8");
$sj12=mb_substr($sj4,0,5,"utf-8");
$sj13=mb_substr($json["shijian"],0,10,"utf-8");
if($sj=="")
{
$sj7=$sj3;
$sj8=$sj5;
$sj9=$sj6;
}
else
{
$sj10=($sj-$sj3);
if($sj10=="0")
{
if($sj5>$sj8)
{
$sj9=($sj10-60);
}
$sj11=($sj6-$sj9);
if($sj11>"10")
{
$msg=$msg.'<div class="kongbai">'.$sj12.'</div>';
}
}
else if($sj10>"10000")
{
if($sj7!=$sj3)
{
$msg=$msg.'<div class="kongbai">'.$sj13.'</div>';
}
}
else if($sj10=="1")
{
if($sj7!=$sj3)
{
$msg=$msg.'<div class="kongbai">昨天 '.$sj12.'</div>';
}
}
else if($sj10=="2")
{
if($sj7!=$sj3)
{
$msg=$msg.'<div class="kongbai">前天 '.$sj12.'</div>';
}
}
else if($sj10>"1")
{
if($sj7!=$sj3)
{
$msg=$msg.'<div class="kongbai">'.$sj2.'</div>';
}
}
$sj7=$sj3;
$sj8=$sj5;
$sj9=$sj6;
}
//旁白
if($jxnr["type"]=="旁白")
{
if($jxnr["zhanghao"]==null)
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$jxnr["neirong"].'</div>';
}
else
{
if($zh==$jxnr["zhanghao"])
{
$nc="你";
}
else
{
$nc=duqu("../shuoju/ziliao/".$jxnr["zhanghao"]."/nicheng.txt");
}
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$nc.''.$jxnr["neirong"].'</div>';
}
}
//禁言
else if($jxnr["type"]=="禁言")
{
$nc=duqu("../shuoju/ziliao/".$jxnr["zhanghao"]."/nicheng.txt");
$cznc=duqu("../shuoju/ziliao/".$jxnr["caozuozh"]."/nicheng.txt");
if($zh==$jxnr["zhanghao"]&&$zh==$jxnr["caozuozh"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">你被'.$jxnr["neirong"].'</div>';
}
else if($zh==$jxnr["zhanghao"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">你被'.$cznc.''.$jxnr["neirong"].'</div>';
}
else if($jxnr["zhanghao"]==$jxnr["caozuozh"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$cznc.'被自己'.$jxnr["neirong"].'</div>';
}
else if($zh==$jxnr["caozuozh"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$nc.'被你'.$jxnr["neirong"].'</div>';
}
else
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$nc.'被'.$cznc.''.$jxnr["neirong"].'</div>';
}
}
//撤回
else if($jxnr["type"]=="撤回")
{
$nc=duqu("../shuoju/ziliao/".$json["chehui"]."/nicheng.txt");
if($json["zhanghao"]==$json["chehui"])
{
if($zh==$json["zhanghao"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">你撤回了一条消息 <a onclick="alert(get(\'../cl.php?zh='.$zh.'&mm='.$mm.'&nr=还原消息'.$json["id"].'\'))">还原消息</a></div>';
}
else
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$json["nicheng"].'撤回了一条消息</div>';
}
}
else if($zh==$json["zhanghao"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">你被'.$nc.'撤回了一条消息</div>';
}
else if($zh==$json["chehui"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$json["nicheng"].'被你撤回了一条消息 <a onclick="alert(get(\'../cl.php?zh='.$zh.'&mm='.$mm.'&nr=还原消息'.$json["id"].'\'))">还原消息</a></div>';
}
else
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$json["nicheng"].'被'.$nc.'撤回了一条消息</div>';
}
}
//头衔
else if($jxnr["type"]=="头衔")
{
$nc=duqu("../shuoju/ziliao/".$jxnr["zhanghao"]."/nicheng.txt");
$cznc=duqu("../shuoju/ziliao/".$jxnr["caozuozh"]."/nicheng.txt");
if($zh==$jxnr["zhanghao"]&&$zh==$jxnr["caozuozh"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">你修改了头衔为'.$jxnr["neirong"].'</div>';
}
else if($zh==$jxnr["caozuozh"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">你修改了'.$nc.'的头衔为'.$jxnr["neirong"].'</div>';
}
else if($jxnr["zhanghao"]==$jxnr["caozuozh"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$cznc.'修改了自己的头衔为'.$jxnr["neirong"].'</div>';
}
else if($zh==$jxnr["zhanghao"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$cznc.'修改了你的头衔为'.$jxnr["neirong"].'</div>';
}
else
{
$msg=$msg.'<div id="'.$json["id"].'" class="kongbai">'.$cznc.'修改了'.$nc.'的头衔为'.$jxnr["neirong"].'</div>';
}
}
//其它
else if($jxnr["type"]=="其它")
{
$msg=$msg.'<div id="'.$json["id"].'" style="width:100%;overflow:hidden;">'.$jxnr["neirong"].'</div>
<div style="height:20px;" onclick="xxcz(\''.$json["id"].'\');tingxian(\''.$json["id"].'\',\'200\');"></div>';
}
//图文
else if($jxnr["type"]=="全屏图文")
{
$msg=$msg.'<div id="'.$json["id"].'" style="width:100%;overflow:hidden;padding-left:0.4rem;padding-right:0.4rem;">'.tuwen($json["neirong"],"180px","0.85rem").'</div>
<div style="height:20px;" onclick="xxcz(\''.$json["id"].'\');tingxian(\''.$json["id"].'\',\'200\');"></div>';
}
//新闻
else if($jxnr["type"]=="新闻")
{
$msg=$msg.'<div id="'.$json["id"].'" style="width:100%;overflow:hidden;padding-left:0.4rem;padding-right:0.4rem;">'.xinwen($jxnr["neirong"]).'</div>
<div style="height:20px;" onclick="xxcz(\''.$json["id"].'\');tingxian(\''.$json["id"].'\',\'200\');"></div>';
}
else
{
if($zh==$json["zhanghao"])
{
$msg=$msg.'<div id="'.$json["id"].'" class="aui-chat-item aui-chat-right">';
}
else
{
$msg=$msg.'<div id="'.$json["id"].'" class="aui-chat-item aui-chat-left">';
}
//头像
$msg=$msg.'<a href="./ziliao.php?zh='.$json["zhanghao"].'">
<div class="aui-chat-media">
<img src="../shuoju/ziliao/'.$json["zhanghao"].'/touxian.gif"></img></div>';
if($json["guajian"]!="0")
{
}
$msg=$msg.'</a>';
//昵称
$msg=$msg.'<div class="aui-chat-inner">
<div class="aui-chat-name">';
if($json["renzheng"]!="0"&&$rz["shijian"]>date("YmdHis"))
{
$msg=$msg.'<img src="'.$rz["img"].'" width="'.$rz["width"].'" height="'.$rz["height"].'"></img>';
}
else if($json["quanxian"]>"299")
{
$msg=$msg.'<span class="aui-label aui-label-danger">'.$json["touxian"].'</span>';
}
else if($json["quanxian"]>"199")
{
$msg=$msg.'<span class="aui-label aui-label-warning">'.$json["touxian"].'</span>';
}
else if($json["quanxian"]>"99")
{
$msg=$msg.'<span class="aui-label aui-label-success">'.$json["touxian"].'</span>';
}
else
{
$msg=$msg.'<span class="aui-label aui-label-info">'.$json["touxian"].'</span>';
}
$msg=$msg.' '.$json["nicheng"].'</div>';
//气泡
if($jxnr["type"]=="图片"||$jxnr["type"]=="视频"||$jxnr["type"]=="文件"||$jxnr["type"]=="商品"||$jxnr["type"]=="图文"||$jxnr["type"]=="公告")
{
$msg=$msg.'<div class="aui-chat-content" style="padding:0;background-color:transparent;">';
}
else if($jxnr["type"]=="音乐"||$jxnr["type"]=="新人"||$jxnr["type"]=="推送")
{
$msg=$msg.'<div class="aui-chat-content" style="padding:0.2rem;"><div class="aui-chat-arrow"></div>';
}
else
{
$msg=$msg.'<div class="aui-chat-content"><div class="aui-chat-arrow"></div>';
}
//文本
if($jxnr["type"]=="文本"||$jxnr["type"]=="自定义")
{
$msg=$msg.'<div style="-webkit-user-select:text;">'.$jxnr["neirong"].'</div>';
}
//艾特
else if($jxnr["type"]=="艾特")
{
if($zh==$jxnr["zhanghao"])
{
if($zh!=$json["zhanghao"]&&$_SESSION["lbid"]!=$json["id"]&&$json["id"]==$_SESSION["xxsl1"])
{
$_SESSION["lbid"]=$json["id"];
$msg=msg.'<div style="-webkit-user-select:text;" class="yuan">
<embed src="../page/audio/ts1.mp3" type="audio/ogg" hidden="true">'.$jxnr["neirong"].'</embed></div>';
}
else
{
$msg=$msg.'<div style="-webkit-user-select:text;" class="yuan">'.$jxnr["neirong"].'</div>';
}
}
else
{
$msg=$msg.'<div style="-webkit-user-select:text;">'.$jxnr["neirong"].'</div>';
}
}
//语音
else if($jxnr["type"]=="语音")
{
$msg=$msg.'<div onclick="bofang(\''.$jxnr["url"].'\');tingxian(\'yy'.$json["id"].'\',\'500\');"><img id="yy'.$json["id"].'" src="../page/image/yy.png" width="25" height="25" style="border-radius:50%;"></img>&nbsp;&nbsp;'.$jxnr["neirong"].'</div>';
}
//抖动
else if($jxnr["type"]=="抖动")
{
$msg=$msg.'<div class="doudong">'.$jxnr["neirong"].'</div>';
}
//公告
else if($jxnr["type"]=="公告")
{
$msg=$msg.'<div class="yuanj" style="width:200px;"><div style="font-size:0.9rem;color:#00aaff;"><img src="../page/image/gg.png" width="32" height="32"></img> 公告</div>
<div style="padding:0.5px;background:#eee;"></div>
<div style="-webkit-user-select:text;font-size:0.8rem;">'.$jxnr["neirong"].'</div></div>';
}
//图片
else if($jxnr["type"]=="图片")
{
$msg=$msg.'<a href="./tupian.php?id='.$json["id"].'"><img src="'.$jxnr["neirong"].'" style="max-width:150px;max-height:200px;border-radius:10px 10px 10px 10px;"></img></a>';
}
//音乐
else if($jxnr["type"]=="音乐")
{
$msg=$msg.'<audio style="width:220px;" controls="controls" src="'.$jxnr["neirong"].'" type="audio/ogg"></audio>';
}
//视频
else if($jxnr["type"]=="视频")
{
$msg=$msg.'
<video src="'.$jxnr["neirong"].'" type="video/mp4" controls="controls" style="width:200px;height:220px;background-color:#fff;border-radius:10px 10px 10px 10px;"></video>';
}
//文件
else if($jxnr["type"]=="文件")
{
$dx=round(filesize($jxnr["lianjie"])/1024,2);
if($dx<"1024")
{
$dx="".$dx."KB";
}
else
{
$dx="".round($dx/1024,2)."MB";
}
$msg=$msg.'<a href="../qita/file.php?msg='.$jxnr["mingcheng"].'&url='.$jxnr["lianjie"].'">
<div style="width:200px;">
<div class="aui-card-list-header" style="border-radius:10px 10px 0 0;"><div>
<div class="aui-card-list-user-avatar">';
if(file_exists("../page/image/".$jxnr["leixing"].".png"))
{
$msg=$msg.'<img src="../page/image/'.$jxnr["leixing"].'.png"></img>';
}
else
{
$msg=$msg.'<img src="../page/image/weizhi.png"></img>';
}
$msg=$msg.'</div><div style="padding-top:3px;font-size:0.75rem;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;">'.$jxnr["mingcheng"].'</div><div style="padding-top:5px;font-size:0.7rem;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;">'.$dx.'</div></div></div>
<div style="padding:0.5px;background:#eee;"></div>
<div class="kuang" style="border-radius:0 0 10px 10px;font-size:0.5rem;color:#555;">畅聊文件</div>
</div></a>';
}
//新人报道
else if($jxnr["type"]=="新人")
{
if($zh==$json["zhanghao"])
{
$msg=$msg.'<div style="padding:0.3rem;-webkit-user-select:text;">'.$jxnr["neirong"].'</div>';
}
else
{
$msg=$msg.'<div style="width:200px;padding:12px;font-size:0.8rem;">'.$jxnr["neirong"].'</div>
<div style="padding:0.5px;background:#eee;"></div>
<a href="?jqhy='.$json["zhanghao"].'"><div style="padding:6px;text-align:center;color:#ff0000;font-size:0.9rem;">欢迎</div></a>';
}
}
//推送
else if($jxnr["type"]=="推送")
{
$sl=preg_match_all("/".json_encode(array("biaoti"=>"(.*?)","neirong"=>"(.*?)"),JSON_UNESCAPED_UNICODE)."/",$jxnr["neirong"],$ts);
$msg=$msg.'<div style="width:200px;">
<div class="kuang" style="color:#000;padding:8px;font-size:0.8rem;">点击下面发送</div>';
for($xh=0;$xh<$sl;$xh++)
{
$msg=$msg.'<div style="padding:0.5px;background:#eee;"></div>
<div class="kuang" style="padding:7px;" onclick="fsxx(\''.$ts[2][$xh].'\');">
<div style="float:left;color:#6c6c6c;">●</div>
<div style="margin-left:0.2rem;float:left;width:150px;color:#ff0000;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;">'.$ts[1][$xh].'</div>
<div style="color:#000;" class="aui-iconfont aui-icon-right"></div>
</div>';
}
$msg=$msg.'</div>';
}
//图文
else if($jxnr["type"]=="图文")
{
$msg=$msg.'<div style="width:220px;">'.tuwen($json["neirong"],"120px","0.8rem").'</div>';
}
//商品
else if($jxnr["type"]=="商品")
{
$img=duqu("../shuoju/shangpin/".$jxnr["neirong"]."/img.txt");
$sjzh=duqu("../shuoju/shangpin/".$jxnr["neirong"]."/zhanghao.txt");
$kc=duqu("../shuoju/shangpin/".$jxnr["neirong"]."/kucun.txt");
$ye=duqu("../shuoju/shangpin/".$jxnr["neirong"]."/yue.txt");
$mc=duqu("../shuoju/shangpin/".$jxnr["neirong"]."/mingcheng.txt");
$js=duqu("../shuoju/shangpin/".$jxnr["neirong"]."/jieshao.txt");
if(is_dir("../shuoju/shangpin/".$jxnr["neirong"].""))
{
$msg=$msg.'<div style="width:220px;">
<img src="'.$img.'" style="width:220px;height:120px;border-radius:10px 10px 0 0;background:rgba(0,0,0,.5);"></img>
<div style="padding:0.5px;background:#eee;"></div>
<div id="js'.$json["id"].'" style="-webkit-user-select:text;background:#fff;color:#666;padding:3px;">商品价格：'.$ye.'<br>商品库存：'.$kc.'<br>商家账号：'.$sjzh.'<br>商品名称：'.$mc.'<br>商品介绍：'.$js.'<br>温馨提示：购买商品处理有挺迟！</div>
<div style="padding:0.5px;background:#eee;"></div>
<div id="gm'.$json["id"].'" style="padding:5px;font-size:0.8rem;background:#00aaff;text-align:center;border-radius:0 0 10px 10px;" onclick="document.getElementById(\'gm'.$json["id"].'\').style.display=\'none\';document.getElementById(\'gm1'.$json["id"].'\').style.display=\'\';">购买商品</div>
<div id="gm1'.$json["id"].'" style="display:none;padding:5px;font-size:0.8rem;background:#ff0000;text-align:center;border-radius:0 0 10px 10px;" onclick="alert(get(\'../cl.php?zh='.$zh.'&mm='.$mm.'&nr=购买商品'.$jxnr["neirong"].'\'));"">确定购买</div>
</div>';
}
else
{
$msg=$msg.'<div class="yuanj">暂无此商品！</div>';
}
}
//不支持
else if($jxnr["type"]==null)
{
$msg=$msg."[未知]不支持查看！";
}
else
{
$msg=$msg."[".$jxnr["type"]."]不支持查看！";
}
$msg=$msg.'</div>';
//撤回
if($zh==$json["zhanghao"])
{
$msg=$msg.'<div class="aui-chat-status aui-iconfont aui-icon-forward" onclick="xxcz(\''.$json["id"].'\');tingxian(\''.$json["id"].'\',\'200\');"></div>';
}
else
{
$msg=$msg.'<div class="aui-chat-status aui-iconfont aui-icon-back" onclick="xxcz(\''.$json["id"].'\');tingxian(\''.$json["id"].'\',\'200\');"></div>';
}
$msg=$msg.'</div></div>';
}
}
}
//消息提示
if($zh!=$json["zhanghao"])
{
$msg='<embed src="../page/audio/ts1.mp3" type="audio/ogg" hidden="true">'.$jxnr["neirong"].'</embed>'.$msg.'';
}
//全部消息
if($_SESSION["xlsx"]=="true")
{
$_SESSION["xlsx"]="";
echo json_encode(array("code"=>"2","id"=>"".($_SESSION["xxsl"]-5)."","msg"=>"".$msg.""),JSON_UNESCAPED_UNICODE);
}
else if($_COOKIE["gd"]=="true")
{
if(($_SESSION["xxsl1"]-$_SESSION["xxsl2"])>"0")
{
if(($_SESSION["xxsl1"]-$_SESSION["xxsl2"])>"99")
{
$xxsl="99+";
}
else
{
$xxsl=($_SESSION["xxsl1"]-$_SESSION["xxsl2"]);
}
}
echo json_encode(array("code"=>"1","id"=>"".$xxsl."","msg"=>"".$msg.""),JSON_UNESCAPED_UNICODE);
}
else 
{
$_SESSION["xxsl2"]=$_SESSION["xxsl1"];
if($_SESSION["xxdh"]!=$_SESSION["xxsl1"])
{
$_SESSION["xxdh"]=$_SESSION["xxsl1"];
$xxdh=$_SESSION["xxdh"];
}
echo json_encode(array("code"=>"0","id"=>"".$xxdh."","zxxx"=>"".$_SESSION["zxxx"]."","msg"=>"".$msg.""),JSON_UNESCAPED_UNICODE);
}
}
?>