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

167 lines
5.7 KiB
PHP

<?php
//-------------------------------3D场景
header("Content-type: text/html; charset=utf-8");
if(THIS_IN!="edt_admin")
exit("错误的访问!");
//-------------------------------execute action
$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"]);
$json_data="{";
if($priv[0]=="n"){
//没有操作权限
$json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
}else{
switch($_a){
case "add_scene":
if(!$sTitle){
$json_data.="\"code\":\"-1\",\"msg\":\"无效访问!\",";
break;
}
$tmp=get_db_msg("select sceneName from web_scene order by (sceneName + 1) desc limit 0,1");
if($tmp["sceneName"]){
$sceneName=$tmp["sceneName"]+1;
$db->query("insert into web_scene(sceneName,sceneTitle,scenePic) values('".$sceneName."','".$sTitle."','')");
}else{
$sceneName=1;
$db->query("insert into web_scene(sceneName,sceneTitle,scenePic,sceneDefault) values('".$sceneName."','".$sTitle."','','y')");
}
$json_data.="\"code\":\"0\",\"msg\":\"\",";
break;
case "search_scene":
$str="";
$sql="select * from web_scene order by (sceneName + 1)";
$res=$db->query($sql);
while($msg=$db->fetch_array($res)){
if(file_exists("../attachments/scene/".$msg["scenePic"].".jpg")){
$picState="y";
}else{
$picState="n";
}
$str.="{\"id\":\"".$msg["id"]."\",\"sceneName\":\"".$msg["sceneName"]."\",\"sceneTitle\":\"".$msg["sceneTitle"]."\",\"scenePic\":\"".$msg["scenePic"]."\",\"sceneState\":\"".$picState."\",\"sceneDefault\":\"".$msg["sceneDefault"]."\"},";
}
$json_data.="\"code\":\"0\",\"msg\":\"\",\"data\":[".substr($str,0,-1)."],";
break;
case "update_sceneDefault":
if($sid){
$db->query("update web_scene set sceneDefault='n' where sceneDefault='y'");
$db->query("update web_scene set sceneDefault='y' where id='".$sid."'");
$json_data.="\"code\":\"0\",\"msg\":\"\",";
}else{
$json_data.="\"code\":\"-1\",\"msg\":\"无效访问!\",";
}
break;
case "del_scene":
if($sid){
$tmp=get_db_msg("select * from web_scene where id='".$sid."'");
$db->query("delete from web_scene where id='".$sid."'");
//先删除图片
$pic="../attachments/scene/".$tmp["scenePic"].".jpg";
if(file_exists($pic)){
unlink($pic);
}
$json_data.="\"code\":\"0\",\"msg\":\"\",";
}else{
$json_data.="\"code\":\"-1\",\"msg\":\"无效访问!\",";
}
break;
//上传图片
case "save_scenePic":
$up_image=$_FILES["up_file"];
$tmp=get_db_msg("select * from web_scene where id='".$id."'");
if($tmp["id"]){
if($tmp["scenePic"]){
//先删除图片
$pic="../attachments/scene/".$tmp["scenePic"].".jpg";
if(file_exists($pic)){
unlink($pic);
}
}else{
$db->query("update web_scene set scenePic='".$tmp["sceneName"]."' where id='".$id."'");
}
move_uploaded_file($up_image["tmp_name"], "../attachments/scene/".$tmp["sceneName"].".jpg");
$json_data.="\"code\":0,\"msg\":\"\",";
}else{
$json_data.="\"code\":\"-1\",\"msg\":\"数据不存在!\",";
}
break;
case "get_sceneDetail":
$tmp=get_db_msg("select * from web_scene where id='".$id."'");
if($tmp["id"]){
$pic="../attachments/scene/".$tmp["scenePic"].".jpg";
$str='';
$sql="select * from web_scene_hotspots where sid='".$tmp["id"]."'";
$res=$db->query($sql);
while($msg=$db->fetch_array($res)){
if($msg["hot_type"]=="info"){
$str.='{"id":"'.$msg["id"].'","pitch": '.$msg["hot_pitch"].', "yaw": '.$msg["hot_yaw"].',"type": "'.$msg["hot_type"].'","text": "'.$msg["khno"].'","sceneId": ""},';
}else{
$str.='{"id":"'.$msg["id"].'","pitch": '.$msg["hot_pitch"].', "yaw": '.$msg["hot_yaw"].',"type": "'.$msg["hot_type"].'","text": "'.$msg["hot_title"].'","sceneId": ""},';
}
}
//场景列表
$str2='';
$sql2="select sceneName,sceneTitle from web_scene";
$res2=$db->query($sql2);
while($msg2=$db->fetch_array($res2)){
$str2.='{"sceneName":"'.$msg2["sceneName"].'","sceneTitle":"'.$msg2["sceneTitle"].'"},';
}
//款号列表
$str3='';
$sql3="select id,no from web_kh";
$res3=$db->query($sql3);
while($msg3=$db->fetch_array($res3)){
$str3.='{"id":"'.$msg3["id"].'","khno":"'.$msg3["no"].'"},';
}
$json_data.="\"code\":0,\"msg\":\"\",\"pic\":\"".$pic."\",\"data\":[".substr($str,0,-1)."],\"sceneList\":[".substr($str2,0,-1)."],\"khnoList\":[".substr($str3,0,-1)."],";
}else{
$json_data.="\"code\":\"-1\",\"msg\":\"数据不存在!\",";
}
break;
case "add_hotSpot":
if(!$sid || !$hot_type || !$khno){
$json_data.="\"code\":\"-1\",\"msg\":\"数据参数不足!\",";
}else{
$db->query("insert into web_scene_hotspots(sid,hot_type,hot_title,hot_sceneId,khno,hot_pitch,hot_yaw) values('".$sid."','".$hot_type."','','','".$khno."','".$hot_pitch."','".$hot_yaw."')");
$htid=$db->insert_id();
$json_data.="\"code\":0,\"msg\":\"\",\"htid\":\"".$htid."\",";
}
break;
case "add_hotSpot2":
if(!$sid || !$hot_type || !$title){
$json_data.="\"code\":\"-1\",\"msg\":\"数据参数不足!\",";
}else{
$db->query("insert into web_scene_hotspots(sid,hot_type,hot_title,hot_sceneId,khno,hot_pitch,hot_yaw) values('".$sid."','".$hot_type."','".$title."','".$sceneId."','','".$hot_pitch."','".$hot_yaw."')");
$htid=$db->insert_id();
$json_data.="\"code\":0,\"msg\":\"\",\"htid\":\"".$htid."\",";
}
break;
case "del_hotSpot":
if(!$htid){
$json_data.="\"code\":\"-1\",\"msg\":\"数据参数不足!\",";
}else{
$db->query("delete from web_scene_hotspots where id='".$htid."'");
$json_data.="\"code\":0,\"msg\":\"\",";
}
break;
}
}
$json_data=substr($json_data,0,-1)."}";
echo $json_data;
?>