7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
291 lines
12 KiB
PHP
291 lines
12 KiB
PHP
<?php
|
||
//-------------------------------自由搭配-界面
|
||
header("Content-type: text/html; charset=utf-8");
|
||
$json_data="{";
|
||
if(THIS_IN!="edt_ipad")
|
||
exit("错误的访问!");
|
||
$uid=check_cookie_jxs();
|
||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||
$upath=$msg_login["path"]."-".$uid;
|
||
$tmpl_dp_my_pic_width="110";
|
||
$tmpl_dp_my_pic_height="110";
|
||
$order_session=get_set("order_session");
|
||
$json_data.="\"uid\":\"".$uid."\",";
|
||
switch($_a){
|
||
case "save":
|
||
//----------------------------------------
|
||
$dph=trim($dph);
|
||
if($zsh>0){
|
||
//--------------------修改
|
||
//删除图片
|
||
$tmp=get_db_msg("select pic from ".$table_pre."kh_dp where zsh='".$zsh."' limit 0,1");
|
||
if($tmp["pic"]){
|
||
del_file("../attachments/dp/".$order_session."/big/".$tmp["pic"].".jpg");
|
||
del_file("../attachments/dp/".$order_session."/mini/".$tmp["pic"].".jpg");
|
||
}
|
||
//删除图片库
|
||
$db->query("delete from ".$table_pre."pic where pic_mod='zydp' and pic_name='".$tmp["pic"].".jpg'");
|
||
//删除数据
|
||
$db->query("delete from ".$table_pre."kh_dp where zsh='".$zsh."'");
|
||
}else{
|
||
//--------------------新增
|
||
//取得zsh
|
||
$tmp=get_db_msg("select max(zsh) 'zsh' from ".$table_pre."kh_dp");
|
||
$zsh=$tmp["zsh"]+1;
|
||
}
|
||
//----------------------------------------图片处理
|
||
$mt_pic="../attachments/zydp/".$sys_zydp_pic_path_mt;
|
||
$mt_zz_pic=get_zydp_mt_zz();
|
||
$target_img=Imagecreatefrompng($mt_pic);
|
||
$arr_yc=explode(",",$str_yc);
|
||
$arr_pic_my=array();
|
||
for($i=0;$i<count($arr_yc);$i++){
|
||
$arr_tmp=explode("|",$arr_yc[$i]);
|
||
if($i==count($arr_yc)-1)
|
||
$arr_pic_my[]="../attachments/zydp/".$mt_zz_pic;
|
||
$arr_pic_my[]="../attachments/zydp/".$sys_zydp_pic_path_big."/".$arr_tmp[2].".png";
|
||
}
|
||
$source= array();
|
||
foreach($arr_pic_my as $k=>$v){
|
||
$source[$k]['source']=Imagecreatefrompng($v);
|
||
$source[$k]['size']=getimagesize($v);
|
||
}
|
||
for($i=0;$i<count($arr_pic_my);$i++){
|
||
imagecopymerge_alpha($target_img,$source[$i]['source'],0,0,0,0,$source[$i]['size'][0],$source[$i]['size'][1]);
|
||
}
|
||
$pic=$msg_login["username"]."_".$zsh."_".get_rand(4);
|
||
$dest_big_name="../attachments/dp/".$order_session."/big/".$pic.".jpg";
|
||
$dest_mini_name="../attachments/dp/".$order_session."/mini/".$pic.".jpg";
|
||
Imagejpeg($target_img,$dest_big_name);
|
||
//复制图片
|
||
make_mini_picture($dest_big_name,$dest_big_name,800);
|
||
make_mini_picture($dest_big_name,$dest_mini_name,200);
|
||
//图片插入数据库
|
||
put_pic_to_mysql("zydp","big",$pic.".jpg",$dest_big_name);
|
||
put_pic_to_mysql("zydp","mini",$pic.".jpg",$dest_mini_name);
|
||
//插入数据
|
||
$ord=count($arr_yc);
|
||
for($i=0;$i<count($arr_yc);$i++){
|
||
$arr_tmp=explode("|",$arr_yc[$i]);
|
||
$arr_tmp2=explode("&",$arr_tmp[4]);
|
||
$kh=$arr_tmp2[0];
|
||
$color=$arr_tmp2[1];
|
||
$pic_my=$arr_tmp[2];
|
||
$q="insert into ".$table_pre."kh_dp (zsh,title,pic,kh,color,gz,ord,remark,zd1,zd2,zd3,zd4,zd5,upath,pic_my) values ('".$zsh."','".$dph."','".$pic."','".$kh."','".$color."','','".$ord."','".$remark."','".$zd1."','".$zd2."','".$zd3."','".$zd4."','".$zd5."','".$upath."','".$pic_my."')";
|
||
$ord--;
|
||
//echo $q."<br>";
|
||
$db->query($q);
|
||
}
|
||
$json_data.="\"cate\":\"saveback\",";
|
||
break;
|
||
case "copy":
|
||
//----------------------------------------复制
|
||
$upath=$msg_login["path"]."-".$msg_login["id"];
|
||
$m_old=get_db_msg("select * from ".$table_pre."kh_dp where zsh='".$zsh."' limit 0,1");
|
||
//取得new_zsh
|
||
$tmp=get_db_msg("select max(zsh) 'zsh' from ".$table_pre."kh_dp");
|
||
$new_zsh=$tmp["zsh"]+1;
|
||
//图片处理
|
||
$tmp=get_db_msg("select max(title) 'title' from ".$table_pre."kh_dp where upath='".$upath."'");
|
||
$new_dph=deel_multi_num($tmp["title"]+1,3);
|
||
$pic=$msg_login["username"]."_".$new_zsh."_".get_rand(4);
|
||
$old_pic="../attachments/dp/".$order_session."/big/".$m_old["pic"].".jpg";
|
||
$dest_big_name="../attachments/dp/".$order_session."/big/".$pic.".jpg";
|
||
$dest_mini_name="../attachments/dp/".$order_session."/mini/".$pic.".jpg";
|
||
make_mini_picture($old_pic,$dest_big_name,800);
|
||
make_mini_picture($old_pic,$dest_mini_name,200);
|
||
//图片插入数据库
|
||
put_pic_to_mysql("zydp","big",$pic.".jpg",$dest_big_name);
|
||
put_pic_to_mysql("zydp","mini",$pic.".jpg",$dest_mini_name);
|
||
//
|
||
$q="select * from ".$table_pre."kh_dp where zsh='".$zsh."'";
|
||
$r=$db->query($q);
|
||
while($m=$db->fetch_array($r)){
|
||
$q1="insert into ".$table_pre."kh_dp (zsh,title,pic,kh,color,gz,ord,remark,zd1,zd2,zd3,zd4,zd5,upath,pic_my) values ('".$new_zsh."','".$new_dph."','".$pic."','".$m["kh"]."','".$m["color"]."','".$m["remark"]."','".$m["ord"]."','".$m["remark"]."','".$m["zd1"]."','".$m["zd2"]."','".$m["zd3"]."','".$m["zd4"]."','".$m["zd5"]."','".$upath."','".$m["kh"]."_".$m["color"]."')";
|
||
//echo $q1."<br>";
|
||
$db->query($q1);
|
||
}
|
||
$url=$_SERVER[PHP_SELF]."?_m=dp_my&zsh=".$new_zsh."&rurl=".urlencode($rurl);
|
||
$json_data.="\"cate\":\"copyok\",";
|
||
break;
|
||
case "del":
|
||
//----------------------------------------删除
|
||
$m_old=get_db_msg("select * from ".$table_pre."kh_dp where zsh='".$zsh."' limit 0,1");
|
||
//删除图片
|
||
del_file("../attachments/dp/".$order_session."/big/".$m_old["pic"].".jpg");
|
||
del_file("../attachments/dp/".$order_session."/mini/".$m_old["pic"].".jpg");
|
||
//删除图片库
|
||
$db->query("delete from ".$table_pre."pic where pic_mod='zydp' and pic_name='".$m_old["pic"].".jpg'");
|
||
//删除数据
|
||
$db->query("delete from ".$table_pre."kh_dp where zsh='".$zsh."'");
|
||
//
|
||
$json_data.="\"cate\":\"delok\",";
|
||
break;
|
||
case "kh_list":
|
||
$sql_con="";
|
||
$page_size=12;
|
||
$offset=$offset?$offset:0;
|
||
$url_var="s_no=".$s_no."&s_xh=".$s_xh."&s_is_ordered=".$s_is_ordered;
|
||
if(is_array($sys_zydp_select)){
|
||
for($i=0;$i<count($sys_zydp_select);$i++){
|
||
$v1="s_".$sys_zydp_select[$i];
|
||
if($$v1){
|
||
$sql_con.=" and b.".$sys_zydp_select[$i]."='".$$v1."'";
|
||
$url_var.="&".$v1."=".$$v1;
|
||
}
|
||
}
|
||
}
|
||
if($s_no)
|
||
$sql_con.=" and a.kh like '%".$s_no."%'";
|
||
if($s_xh){
|
||
if($xh_ms=="2"){
|
||
$sql_con=" and c.xh='".$s_xh."' and c.kh=a.kh";
|
||
$t1=",".$table_pre."kh_xh c";
|
||
}else{
|
||
$sql_con=" and b.xh='".$s_xh."'";
|
||
$t1="";
|
||
}
|
||
}
|
||
if($s_is_ordered=="y"){
|
||
$query="select count(*) 'num' from ".$table_pre."kh_dp_pic a,".$table_pre."kh b".$t1.",".$table_pre."order o where o.uid='".$uid."' and o._key='".$_key."' and o.iid=b.id and a.kh=b.no and o.color=a.color".$sql_con;
|
||
}else{
|
||
$query="select count(*) 'num' from ".$table_pre."kh_dp_pic a,".$table_pre."kh b".$t1." where a.kh=b.no ".$sql_con;
|
||
}
|
||
//echo $query."<br>";
|
||
//计算上下组
|
||
$m1=get_db_msg($query);
|
||
$total_num=$m1["num"];
|
||
if($offset>0)
|
||
$url_pre_page="?_m=zydp&_a=kh_list&offset=".($offset-8)."&".$url_var;
|
||
else
|
||
$url_pre_page="javascript:alert('没有了')";
|
||
if($offset<$total_num-$page_size)
|
||
$url_next_page="?_m=zydp&_a=kh_list&offset=".($offset+8)."&".$url_var;
|
||
else
|
||
$url_next_page="javascript:alert('没有了')";
|
||
if($s_is_ordered=="y"){
|
||
$q="select a.kh 'kh',a.color 'color',a.pic 'pic',b.dress_level 'dress_level' from ".$table_pre."kh_dp_pic a,".$table_pre."kh b,".$table_pre."order o".$t1." where o.uid='".$uid."' and o._key='".$_key."' and o.iid=b.id and o.color=a.color and a.kh=b.no ".$sql_con." order by b.xh,a.color limit ".$offset.",".$page_size;
|
||
}else{
|
||
$q="select a.kh 'kh',a.color 'color',a.pic 'pic',b.dress_level 'dress_level' from ".$table_pre."kh_dp_pic a,".$table_pre."kh b".$t1." where a.kh=b.no ".$sql_con." order by b.xh,a.color limit ".$offset.",".$page_size;
|
||
}
|
||
$r=$db->query($q);
|
||
$content="<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"1\"><tr><td height=\"300\" width=\"25\" valign=\"middle\"><a href=\"".$url_pre_page."\"><img src=\"images/button_s_syz.png\" width=\"25\" height=\"100\" border=0></a></td><td><table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"1\">";
|
||
if($total_num>0){
|
||
for($i=0;$i<$page_size/4;$i++){
|
||
$content.="<tr height=\"110\">";
|
||
$line1="";
|
||
for($j=0;$j<4;$j++){
|
||
$m=$db->fetch_array($r);
|
||
$pic=get_zydp_pic(trim($m["pic"]),"mini");
|
||
$content.="<td width=\"25%\" align=\"center\" valign=\"middle\" style=\"cursor:pointer;\" onclick=\"window.parent.dress_up(".$m["dress_level"].",'".trim($m["pic"])."','".out_good_pic_set($pic,$tmpl_dp_my_pic_width,$tmpl_dp_my_pic_height)."','".$m["kh"]."&".$m["color"]."')\">";
|
||
if(trim($m["pic"])){
|
||
$content.=out_good_pic($pic,110,110);
|
||
//取得已订件数
|
||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and _key='".$_key."' and no='".$m["kh"]."' and color='".$m["color"]."' and ka<>'y'");
|
||
if($tmp["num"]>0)
|
||
$yd=",".$tmp["num"]."件";
|
||
else
|
||
$yd="";
|
||
$line1.="<td align=\"center\" bgcolor=\"#f0f0f0\">".$m["kh"].",".$m["color"].get_cate_title_no("color",$m["color"]).$yd."</td>";
|
||
}else{
|
||
$content.=" ";
|
||
$line1.="<td> </td>";
|
||
}
|
||
$content.="</td>";
|
||
}
|
||
$content.="</tr><tr height=\"20\">".$line1."</tr>";
|
||
}
|
||
}else{
|
||
$content.="<tr><td align=\"center\" height=\"50\">暂无记录!</td></tr>";
|
||
}
|
||
$content.="</table></td><td width=\"25\" valign=\"middle\"><a href=\"".$url_next_page."\"><img src=\"images/button_s_xyz.png\" width=\"25\" height=\"100\" border=0></a></td></tr></table>";
|
||
echo $content;
|
||
exit;
|
||
break;
|
||
default:
|
||
$json_data.="\"mt_pic\":\"".$sys_zydp_pic_path_mt."\",";
|
||
$json_data.="\"pic_path_big\":\"".$sys_zydp_pic_path_big."\",";
|
||
$json_data.="\"pic_path_mini\":\"".$sys_zydp_pic_path_mini."\",";
|
||
$json_data.="\"str_sp_dress_level\":\"".$sys_zydp_sp_dress_level."\",";
|
||
$json_data.="\"tmpl_dp_my_pic_width\":\"".$tmpl_dp_my_pic_width."\",";
|
||
$json_data.="\"tmpl_dp_my_pic_height\":\"".$tmpl_dp_my_pic_height."\",";
|
||
|
||
//款号筛选条件
|
||
if(is_array($sys_zydp_select)){
|
||
$select_dz="";
|
||
for($i=0;$i<count($sys_zydp_select);$i++){
|
||
$v1="s_".$sys_zydp_select[$i];
|
||
$strtmp="";
|
||
$r=$db->query("select no,title from ".$table_pre."keyword where cate='".$sys_zydp_select[$i]."' order by no");
|
||
while($m=$db->fetch_array($r)){
|
||
$strtmp.="{\"no\":\"".$m["no"]."\",\"title\":\"".$m["title"]."\"},";
|
||
}
|
||
$strtmp=deel_end($strtmp);
|
||
$select_dz.="{\"no\":\"".$v1."\",\"title\":\"".get_cate_title_no("arr_select",$sys_zydp_select[$i])."\",\"value\":\"".$$v1."\",\"op\":[".$strtmp."]},";
|
||
}
|
||
$select_dz=deel_end($select_dz);
|
||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||
}else{
|
||
$json_data.="\"select_dz\":[],";
|
||
}
|
||
|
||
if($zsh){
|
||
//修改
|
||
$msg_dp=get_db_msg("select * from ".$table_pre."kh_dp where zsh='".$zsh."' limit 0,1");
|
||
$dph=$msg_dp["title"];
|
||
//取得已穿的款色数组
|
||
$q="select * from ".$table_pre."kh_dp where zsh='".$zsh."' order by ord desc";
|
||
$r=$db->query($q);
|
||
$str_yc="";
|
||
$list=1;
|
||
while($m=$db->fetch_array($r)){
|
||
//取得dress_level
|
||
$tmp=get_db_msg("select dress_level from ".$table_pre."kh where no='".$m["kh"]."'");
|
||
$str_yc.=$list."|".$tmp["dress_level"]."|".$m["pic_my"]."|".out_good_pic_set(get_zydp_pic(trim($m["pic_my"]),"mini"),$tmpl_dp_my_pic_width,$tmpl_dp_my_pic_height)."|".$m["kh"]."&".$m["color"].",";
|
||
$list++;
|
||
}
|
||
if($str_yc)
|
||
$str_yc=substr($str_yc,0,-1);
|
||
$remark=trim(str_replace("\r\n","\\n",$msg_dp["remark"]));
|
||
}else{
|
||
//新增
|
||
$tmp=get_db_msg("select max(title) 'title' from ".$table_pre."kh_dp where upath='".$msg_login["path"]."-".$msg_login["id"]."'");
|
||
$zsh=0;
|
||
$dph=deel_multi_num($tmp["title"]+1,3);
|
||
$str_yc="";
|
||
$remark="";
|
||
}
|
||
|
||
//自定义
|
||
$num_dp_zd=0;
|
||
if(is_array($sys_dp_zd)){
|
||
$num=count($sys_dp_zd);
|
||
$num_dp_zd=($num<5)?$num:5;
|
||
}
|
||
$str_arr_select="";
|
||
for($i=0;$i<$num_dp_zd;$i++){
|
||
$v1="zd".($i+1);
|
||
$r=$db->query("select zd".($i+1)." from ".$table_pre."kh_dp where zd".($i+1)."<>'' group by zd".($i+1)." order by zd".($i+1));
|
||
$strtmp2="";
|
||
while($m=$db->fetch_array($r)){
|
||
$strtmp2.="{\"no\":\"".$m["zd".($i+1)]."\",\"title\":\"".$m["zd".($i+1)]."\"},";
|
||
}
|
||
$strtmp2=deel_end($strtmp2);
|
||
$str_arr_select.="{\"no\":\"".$v1."\",\"title\":\"".$sys_dp_zd[$i]."\",\"value\":\"".$msg_dp[$v1]."\",\"op\":[".$strtmp2."]},";
|
||
}
|
||
$str_arr_select=deel_end($str_arr_select);
|
||
$json_data.="\"select_zdy\":[".$str_arr_select."],";
|
||
|
||
|
||
|
||
$json_data.="\"dph\":\"".$dph."\",";
|
||
$json_data.="\"zsh\":\"".$zsh."\",";
|
||
$json_data.="\"str_yc\":\"".$str_yc."\",";
|
||
$json_data.="\"remark\":\"".$remark."\",";
|
||
$json_data.="\"cate\":\"other\",";
|
||
break;
|
||
}
|
||
$json_data=substr($json_data,0,-1)."}";
|
||
echo $json_data;
|
||
?>
|