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

217 lines
6.4 KiB
PHP

<?php
//-------------------------------管理员-界面
header("Content-type: text/html; charset=utf-8");
$json_data="{";
if(THIS_IN!="edt_ipad")
exit("错误的访问!");
$uid=check_cookie_jxs();
update_session($uid,$ip);
$json_data.="\"uid\":\"".$uid."\",";
switch($_a){
case "add":
$url1="http://".$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF];
if($id){
$msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'");
$add_date=date("Y-m-d H:i:s",$msg["add_date"]);
$xh=$msg["xh"];
//image
$add_pic=array();
if(trim($msg["color"])){
$tmp=explode(",",trim($msg["color"]));
$t=count($tmp);
}else{
$t=0;
}
$json_data.="\"urls\":\"".$url1."\",";
if($t>0){
$json_data.="\"code\":100,";
$str="";
for($i=0;$i<count($tmp);$i++){
$pic=get_kh_color_picture($msg["no"],$tmp[$i]);
$arr_pic_set=out_good_pic_set_arr($pic,188,188);
$str.="{";
$str.="\"pic_src\":\"".$pic."\",";
$str.="\"pic_w\":\"".$arr_pic_set[0]."\",";
$str.="\"pic_h\":\"".$arr_pic_set[1]."\",";
if(substr($pic,strlen($pic)-10,strlen($pic))!="no_pic.png"){
$str.="\"sign\":\"y\",";
}else{
$str.="\"sign\":\"n\",";
}
$str.="\"id\":\"".$msg["id"]."\",";
$str.="\"color\":\"".$tmp[$i]."\",";
$str.="\"colortitle\":\"".get_cate_title_no("color",$tmp[$i])."\",";
if($tmp[$i]!=$msg["main_pic"] && substr($pic,strlen($pic)-10,strlen($pic))!="no_pic.png"){
$str.="\"sign_z\":\"y\"";
}else{
$str.="\"sign_z\":\"n\"";
}
$str.="},";
}
$json_data.="\"data\":[".substr($str,0,-1)."],";
}else{
$json_data.="\"code\":101,\"msg\":\"请先设置颜色!\"";
}
}else{
$json_data.="\"code\":101,\"msg\":\"访问错误\"";
}
break;
case "save_add_image":
$att_dir=dir_cutb(THIS_FILE_ROOT,1);
//
$up_image=$_FILES["up_image"];
$msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'");
if($del_pic=="y"){
del_file("../attachments/design/big/".$msg["no"]."_".$c.".jpg");
del_file("../attachments/design/mini/".$msg["no"]."_".$c.".jpg");
$check=explode(",",$msg["color"]);
if($check[0]==$c && count($check)==1){
del_file("../attachments/design/mini/".$msg["no"].".jpg");
del_file("../attachments/design/big/".$msg["no"].".jpg");
}
}else{
//参考save_pic
}
$json_data.="\"code\":100,";
break;
case "set_main_pic" :
$query="update ".$table_pre."kh set main_pic='".$c."' where id='".$id."'";
$db->query($query);
set_log("设置主图",$c."|".$id);
$json_data.="\"code\":100,";
break;
case "getselect":
$json_data.="\"s_keyword\":\"".$s_keyword."\",";
$json_data.="\"check_pic\":\"".$check_pic."\",";
//
$str="";
$res1=$db->query("select * from ".$table_pre."keyword where cate='bc' order by no");
while($msg1=$db->fetch_array($res1)){
$str.="{\"no\":\"".$msg1["no"]."\",\"title\":\"".$msg1["title"]."\"},";
}
$str=deel_end($str);
$json_data.="\"select_bc\":{\"no\":\"s_bc\",\"title\":\"".get_cate_title_no("arr_select","bc")."\",\"value\":\"".$s_bc."\",\"op\":[".$str."]},";
//
$str="";
$res1=$db->query("select * from ".$table_pre."keyword where cate='category' order by no");
while($msg1=$db->fetch_array($res1)){
$str.="{\"no\":\"".$msg1["no"]."\",\"title\":\"".$msg1["title"]."\"},";
}
$str=deel_end($str);
$json_data.="\"select_category\":{\"no\":\"s_category\",\"title\":\"".get_cate_title_no("arr_select","category")."\",\"value\":\"".$s_category."\",\"op\":[".$str."]},";
break;
default:
//默认每页显示20
$page=$page?$page:"1";
$ord_num=12;
$start=($page-1)*$ord_num;
$end=$ord_num*$page;
$con1="";
if($s_keyword || $s_bc || $s_category){
$con1.="where ";
if($s_keyword){
$con1.=" (no like '%".$s_keyword."%' or xh like '%".$s_keyword."%') and ";
}
if($s_category){
$con1.=" category='".$s_category."' and ";
}
if($s_bc){
$con1.=" bc='".$s_bc."' and ";
}
$con1=substr($con1,0,-4);
}
//计算页数
$ct=0;
$sql="select * from web_kh ".$con1;
$res=$db->query($sql);
while($msg=$db->fetch_array($res)){
if($check_pic=="on"){
$arr_color2=explode(",",$msg["color"]);
for($j=0;$j<count($arr_color2);$j++){
$pic2=get_kh_color_picture($msg["no"],$arr_color2[$j]);
if($pic2=="images/no_pic.png"){
$ct++;
break;
}
}
}else{
$ct++;
}
}
$pages=ceil($ct/$ord_num);
$json_data.="\"pages\":\"".$pages."\",";
//
$count=0;
$arr_content=array();
$arr_content2=array();
$q="select * from web_kh ".$con1." order by no desc";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$pic=get_kh_picture($m["no"],$m["main_pic"],$m["color"],$flag_pad_offline);
$arr_pic_set=out_good_pic_set_arr($pic,188,188);
if($check_pic=="on"){
$str_sign="n";
$arr_color=explode(",",$m["color"]);
for($j=0;$j<count($arr_color);$j++){
$pic1=get_kh_color_picture($m["no"],$arr_color[$j]);
if($pic1=="images/no_pic.png"){
$str_sign="y";
break;
}
}
if($str_sign=="y"){
$arr_content[$count]["id"]=$m["id"];
$arr_content[$count]["kh"]=$m["no"];
$arr_content[$count]["yph"]=get_kh_xh($m);
$arr_content[$count]["pic_src"]=$pic;
$arr_content[$count]["pic_w"]=$arr_pic_set[0];
$arr_content[$count]["pic_h"]=$arr_pic_set[1];
$arr_content[$count]["price"]=$m["price"];
$arr_content2[]=$m["no"];
$count++;
}
}else{
$arr_content[$count]["id"]=$m["id"];
$arr_content[$count]["kh"]=$m["no"];
$arr_content[$count]["yph"]=get_kh_xh($m);
$arr_content[$count]["pic_src"]=$pic;
$arr_content[$count]["pic_w"]=$arr_pic_set[0];
$arr_content[$count]["pic_h"]=$arr_pic_set[1];
$arr_content[$count]["price"]=$m["price"];
$arr_content2[]=$m["no"];
$count++;
}
}
//
$content="";
if($count>0){
for($i=$start;$i<$end;$i++){
if(in_array($arr_content[$i]["kh"],$arr_content2)){
$content.="{";
$content.="\"id\":\"".$arr_content[$i]["id"]."\",";
$content.="\"kh\":\"".$arr_content[$i]["kh"]."\",";
$content.="\"yph\":\"".$arr_content[$i]["yph"]."\",";
$content.="\"pic_src\":\"".$arr_content[$i]["pic_src"]."\",";
$content.="\"pic_w\":\"".$arr_content[$i]["pic_w"]."\",";
$content.="\"pic_h\":\"".$arr_content[$i]["pic_h"]."\",";
$content.="\"price\":\"".$arr_content[$i]["price"]."\"";
$content.="},";
}
}
}
$json_data.="\"data\":[".substr($content,0,-1)."],";
break;
}
$json_data=substr($json_data,0,-1)."}";
echo $json_data;
?>