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

680 lines
23 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
//----------------------------------------------------------不予下单尺码
function arr_to_str1($arr){
$r="";
if(is_array($arr)){
foreach($arr as $n => $t){
$r.=$t.",";
}
$r=substr($r,0,-1);
}else{
$r=$arr;
}
return $r;
}
header("Content-type: text/html; charset=utf-8");
if(THIS_IN!="edt_admin")
exit("错误的访问!");
//-------------------------------execute action
//require THIS_FILE_ROOT."/include/excel_class.php";
//require THIS_FILE_ROOT."/include/excel_fun.php";
$image_file_type="jpg|jpeg";
$uid=check_cookie();
$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{
$json_data.="\"uid\":".$uid.",";
$arr_column_size_not["kh"]="款号";
$arr_column_size_not["color"]="颜色代码";
if(trim($bx_sizegroup_title))
$arr_column_size_not["bx"]="杯型";
if(trim($child_sizegroup_title))
$arr_column_size_not["bx"]="款型";
if($is_gg=="y" || $is_gg=="b")
$arr_column_size_not["bx"]=d_translate("gg");
$arr_column_size_not["size"]="尺码";
//
$arr_kh_size=arr_select("size","title","title");
switch($_a){
case "add" :
//--------------------------新增
//$http_pre=$http_pre?$http_pre:$_SERVER['HTTP_REFERER'];
if($id){
$msg=get_db_msg("select * from ".$table_pre."size_not where id='".$id."'");
$msg_kh=get_db_msg("select * from ".$table_pre."kh where no='".$msg["kh"]."'");
$is_ggk=is_ggk($msg_kh["id"]);
$arr_color=explode(",",$msg_kh["color"]);
$arr_size=explode(",",$msg_kh["size"]);
//取得杯型
$arrBx=array();
$r1=$db->query("select * from ".$table_pre."size_bx where no='".$msg["kh"]."' order by bx");
$i1=0;
$strbx="";
while($m1=$db->fetch_array($r1)){
$arrBx[$i1][]=$m1["bx"];
$arrBx[$i1][]=$m1["size"];
$i1++;
}
$show_bx=($i1>0)?"y":"n";
if(count($arrBx)==0){
$arrBx[0][0]="";
$arrBx[0][1]=$msg_kh["size"];
}
$strcb="";
for($i=0;$i<count($arr_color);$i++){
if($is_ggk=="y" || $is_ggk=="b"){
//有规格
$q1="select * from ".$table_pre."kh_gg where iid='".$msg_kh["id"]."' and color='".$arr_color[$i]."'";
$r1=$db->query($q1);
while($m1=$db->fetch_array($r1)){
$check=get_db_msg("select count(*) 'num' from ".$table_pre."size_not where kh='".$msg["kh"]."' and color='".$arr_color[$i]."' and bx='".$m1["gg"]."'");
$ck1="";
if($check["num"]>0){
$ck1=" checked";
}
$tmpa="";
$arr_size=explode(",",$msg_kh["size"]);
for($j=0;$j<count($arr_size);$j++){
$check=get_db_msg("select size from ".$table_pre."size_not where kh='".$msg["kh"]."' and color='".$arr_color[$i]."' and bx='".$m1["gg"]."'");
$check=explode(",",$check["size"]);
$ck="";
if(in_array($arr_size[$j],$check)){
$ck=" checked";
}
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$msg_kh["size_group"]."' and no='".$arr_size[$j]."'");
$tmpa.="{\"name\":\"size_".$arr_color[$i]."_".$m1["gg"]."[]\",\"value\":\"".$arr_size[$j]."\",\"title\":\"".$tmp["title"]."\",\"check\":\"".$ck."\"},";
}
$tmpa=deel_end($tmpa);
$strcb.="{\"name\":\"color_bx[]\",\"value\":\"".$arr_color[$i]."_".$m1["gg"]."\",\"title\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."\",\"check\":\"".$ck1."\",\"size\":[".$tmpa."]},";
}
}else{
for($k=0;$k<count($arrBx);$k++){
$check=get_db_msg("select count(*) 'num' from ".$table_pre."size_not where kh='".$msg["kh"]."' and color='".$arr_color[$i]."' and bx='".$arrBx[$k][0]."'");
$ck1="";
if($check["num"]>0){
$ck1=" checked";
}
$sbx="";
if($show_bx=="y"){
$sbx=$arrBx[$k][0];
}
$arr_size=explode(",",$arrBx[$k][1]);
$tmpa="";
for($j=0;$j<count($arr_size);$j++){
$check=get_db_msg("select size from ".$table_pre."size_not where kh='".$msg["kh"]."' and color='".$arr_color[$i]."' and bx='".$arrBx[$k][0]."'");
$check=explode(",",$check["size"]);
$ck="";
if(in_array($arr_size[$j],$check)){
$ck=" checked";
}
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$msg_kh["size_group"]."' and no='".$arr_size[$j]."'");
$tmpa.="{\"name\":\"size_".$arr_color[$i]."_".$arrBx[$k][0]."[]\",\"value\":\"".$arr_size[$j]."\",\"title\":\"".$tmp["title"]."\",\"check\":\"".$ck."\"},";
}
$tmpa=deel_end($tmpa);
$strcb.="{\"name\":\"color_bx[]\",\"value\":\"".$arr_color[$i]."_".$arrBx[$k][0]."\",\"title\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."".$sbx."\",\"check\":\"".$ck1."\",\"size\":[".$tmpa."]},";
}
}
}
$strcb=deel_end($strcb);
$json_data.="\"kh\":\"".$msg["kh"]."\",";
$json_data.="\"color_size\":[".$strcb."],";
}else{
}
break;
case "save_add":
$error_msg="";
if($color_bx){
$color_bx=is_array($color_bx)?$color_bx:array($color_bx);
}else{
$error_msg="请选择颜色!";
}
//print_r($color_bx);
//echo "--<br>";
$kh=trim($kh);
$msg_kh=get_db_msg("select id,color,size,size_group from ".$table_pre."kh where no='".$kh."'");
if($msg_kh["id"]>0){
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
$arr_color_kh=explode(",",$msg_kh["color"]);
$arr_size_kh=explode(",",$msg_kh["size"]);
}else{
$error_msg="款号错误!";
}
if($error_msg){
$json_data.="\"code\":99,\"msg\":\"".$error_msg."\",";
}else{
if($msg_kh["size_group"]==$child_sizegroup_id){
//童装
//删除多余数据
$q="select * from ".$table_pre."size_not where kh='".$kh."'";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
if(!in_array($m["color"]."_".get_child_bx_ind($m["bx"]),$color_bx)){
$db->query("delete from ".$table_pre."size_not where id='".$m["id"]."'");
}
}
if(count($color_bx)>0){
foreach($color_bx as $k1 => $color_bx1){
$v1="size_".$color_bx1;
$size1=arr_to_str1($$v1);
$tmp=explode("_",$color_bx1);
$check=get_db_msg("select * from ".$table_pre."size_not where kh='".$kh."' and color='".$tmp[0]."' and bx='".get_child_bx_title($tmp[1])."'");
if($check["id"]>0){
$q="update ".$table_pre."size_not set size='".$size1."' where id='".$check["id"]."'";
}else{
$q="insert into ".$table_pre."size_not (kh,color,bx,size) values ('".$kh."','".$tmp[0]."','".get_child_bx_title($tmp[1])."','".$size1."')";
}
$db->query($q);
}
}
}else{
//非童装
//删除多余数据
$q="select * from ".$table_pre."size_not where kh='".$kh."'";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
if(!in_array($m["color"]."_".$m["bx"],$color_bx)){
$db->query("delete from ".$table_pre."size_not where id='".$m["id"]."'");
}
}
if(count($color_bx)>0){
foreach($color_bx as $k1 => $color_bx1){
$v1="size_".$color_bx1;
$size1=arr_to_str1($$v1);
$tmp=explode("_",$color_bx1);
$check=get_db_msg("select * from ".$table_pre."size_not where kh='".$kh."' and color='".$tmp[0]."' and bx='".$tmp[1]."'");
if($check["id"]>0){
$q="update ".$table_pre."size_not set size='".$size1."' where id='".$check["id"]."'";
}else{
$q="insert into ".$table_pre."size_not (kh,color,bx,size) values ('".$kh."','".$tmp[0]."','".$tmp[1]."','".$size1."')";
}
//echo $q."<br>";
$db->query($q);
}
}
}
set_log($log_action."不予下单尺码",$kh);
$json_data.="\"code\":1,";
}
//
break;
case "del" :
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$tmp=get_db_msg("select kh from ".$table_pre."size_not where id='".$id[$i]."'");
//删除款号表
$db->query("delete from ".$table_pre."size_not where id='".$id[$i]."'");
$lid.=$tmp["kh"].",";
}
$json_data.="\"code\":1,";
$lid=substr($lid,0,-1);
set_log("不予下单尺码",$lid);
break;
//----------------------------------------------------------------------导入EXCEL
case "import":
//目录权限
$arr_path=array(
"cache"=>"admin/cache"
);
$json_data.="\"path_priv\":[";
$tmp="";
foreach($arr_path as $path_real => $path_title){
$tmp.="{\"title\":\"".$path_title."\",\"priv\":";
if(new_is_writeable($path_real)==1){
$tmp.="\"y\"";
}else{
$tmp.="\"n\"";
}
$tmp.="},";
}
$json_data.=substr($tmp,0,-1)."],";
break;
case "import_check":
$file1=$_FILES["up_file"];
//echo $file1["name"]."--";
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_size_not);
$msg="";
if(count($arr_column[0])==0){
$msg.="未检测到可导入字段,请返回检查EXCEL文件!";
del_tmp_file($tmp_file_name);
$json_data.="\"code\":0,\"msg\":\"".$msg."\",";
}else{
//
$column="";
foreach($arr_column_size_not as $k => $v){
$column.=$v.",";
}
if($column)
$column=substr($column,0,-1);
$msg1=array();
$msg1[0]=array("可导入正确字段",$column);
//
$column="";
for($i=0;$i<count($arr_thead);$i++){
if(in_array(get_main_key($arr_column_size_not,$arr_thead[$i]),$arr_column[1])){
$style=" style='font-weight:bold;color:#0000ff'";
}else{
$style=" style='color:#cccccc'";
}
$column.="<span".$style.">".$arr_thead[$i]."</span>,";
}
if($column)
$column=substr($column,0,-1);
//
$msg1[1]=array("检测到的有效字段",$column);
//
$total=count($arr_content)-1;
$msg1[2]=array("记录条数",$total);
$m1="";
for($i=0;$i<count($msg1);$i++){
$m1.="{\"col1\":\"".$msg1[$i][0]."\",\"col2\":\"".$msg1[$i][1]."\"},";
}
if($m1)
$m1=substr($m1,0,-1);
$json_data.="\"code\":1,\"tmp_file_name\":\"".$tmp_file_name."\",\"msg\":[".$m1."],";
$json_data.="\"input\":[{\"type\":\"radio\",\"title\":\"款号导入方式\",\"name\":\"import_type\",\"op\":\"清空导入|新增导入\",\"value\":\"清空导入\"}],";
}
break;
case "import_do":
$import_type=($import_type=="清空导入")?"y":"n";
$import_select=($import_select=="清空导入")?"y":"n";
$error_msg="";
if($error_msg){
$json_data.="\"code\":0,\"msg\":\"".$error_msg."\",";
}else{
$json_data.="\"code\":1,\"reload_type\":\"1\",";
//-------------------------------------------导入数据
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_size_not);
$error_msg="";
if($import_type=="y"){
//清空款号相关数据
$db->query("TRUNCATE TABLE ".$table_pre."size_not;");
}
//
$insert_column="";
for($i=0;$i<count($arr_column[1]);$i++){
$insert_column.=",".$arr_column[1][$i];
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
//取得款号
$kh="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="kh"){
$kh=trim($tmp_arr[$ind]);
}
}
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$kh."'");
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="size"){
$v1="";
$tmp1=explode(",",trim($tmp_arr[$ind]));
for($k1=0;$k1<count($tmp1);$k1++){
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$m_kh["size_group"]."' and title='".$tmp1[$k1]."'");
$v1.=$tmp["no"].",";
}
if($v1)
$v1=substr($v1,0,-1);
$insert_value.=",'".mysql_escape_string($v1)."'";
}else{
if(($is_gg=="y" || $is_gg=="b") && $ititle=="size"){
$insert_value.=",'".mysql_escape_string(get_gg_id(trim($tmp_arr[$ind])))."'";
}else{
$insert_value.=",'".mysql_escape_string(trim($tmp_arr[$ind]))."'";
}
}
}
$q="insert into ".$table_pre."size_not (id".$insert_column.") values (''".$insert_value.")";
//echo $q."<br>";
$db->query($q);
}
//
del_tmp_file($tmp_file_name);
$log_remark=$import_flag;
set_log("导入不予下单尺码数据",$log_remark);
}
break;
//----------------------------------------------------------------------/导入EXCEL
//----------------------------------------------------------------------导出数据
case "export":
$column="";
foreach($arr_column_size_not as $k => $v){
$column.="{\"k\":\"".$k."\",\"t\":\"".$v."\"},";
}
if($column)
$column=substr($column,0,-1);
$json_data.="\"col\":[".$column."],";
//$json_data.="\"color_select\":[{\"k\":\"2\",\"t\":\"纵向\"},{\"k\":\"1\",\"t\":\"横向逗号隔开\"}],";
break;
case "export_do":
//取得字段选择的值
foreach($arr_column_size_not as $k => $v){
$var="col_".$k;
if($$var=="on"){
$ex_col[]=$k;
}
}
$num=count($ex_col);
if($num==0)
alert_and_back("请至少选择一个要导出的字段");
$show_bx=$show_gg="n";
$data=array();
//设置表头
for($i=0;$i<$num;$i++){
$data["header"][0][]=get_main_value($arr_column_size_not,$ex_col[$i]);
}
//取得数据
$query="select * from ".$table_pre."size_not order by kh";
$r=$db->query($query);
$row=0;
while($m=$db->fetch_array($r)){
for($i=0;$i<$num;$i++){
$k=$ex_col[$i];
if($k=="size"){
$m_kh=get_db_msg("select size_group from ".$table_pre."kh where no='".$m["kh"]."'");
$arr_size1=explode(",",$m[$k]);
$size_title1="";
for($j=0;$j<count($arr_size1);$j++){
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".$arr_size1[$j]."'");
$size_title1.=$tmp["title"].",";
}
$data["body"][$row][]=substr($size_title1,0,-1);
}else{
$data["body"][$row][]=$m[$k];
}
}
$row++;
}
$file_name="size_not_".date("Y-m-d-H-i");
//print_r($data);
//exit;
output_excel($file_name,$data);
set_log("导出不予下单尺码信息");
exit;
break;
//----------------------------------------------------------------------/导出数据
case "check":
$str="";
$q="select * from ".$table_pre."size_not order by kh,color";
$r=$db->query($q);
$i=0;
$content="";
//检查款号
$tmp="";
while($m=$db->fetch_array($r)){
$tmp1=get_db_msg("select * from ".$table_pre."kh where no='".$m["kh"]."'");
if(!$tmp1["id"]){
$tmp.="{\"kh\":\"".$m["kh"]."\",\"v\":\"".$m["kh"]."\"},";
$i++;
}
}
if($i>0){
$str.="{\"cate\":\"款号有误\",\"data\":[".deel_end($tmp)."]},";
}
//检查颜色
$error_color="";
$q="select * from ".$table_pre."size_not where color<>'' order by kh,color";
$r=$db->query($q);
$i=0;
$tmp="";
while($m=$db->fetch_array($r)){
$tmp1=get_db_msg("select * from ".$table_pre."kh where no='".$m["kh"]."'");
if($tmp1["id"]>0){
//检查颜色
$check_color=explode(",",$tmp1["color"]);
$color=trim($m["color"]);
if(!in_array($color,$check_color)){
$tmp.="{\"v\":\"".$m["id"]."-".$m["kh"]."-".$wrong_color."\",\"kh\":\"".$m["kh"]."\"},";
$i++;
}
}
}
if($i>0){
$str.="{\"cate\":\"颜色有误\",\"data\":[".deel_end($tmp)."]},";
}
//检查尺码
$error_size="";
$q="select * from ".$table_pre."size_not where size<>'' and color<>'' order by kh,color";
$r=$db->query($q);
$i=0;
$tmp="";
while($m=$db->fetch_array($r)){
$tmp1=get_db_msg("select * from ".$table_pre."kh where no='".$m["kh"]."'");
if($tmp1["id"]>0){
//检查尺码
$check_size=explode(",",$tmp1["size"]);
$arr_size=explode(",",trim($m["size"]));
for($j=0;$j<count($arr_size);$j++){
if(!in_array($arr_size[$j],$check_size)){
$tmp2=get_db_msg("select * from ".$table_pre."size where iid='".$tmp1["size_group"]."' and no='".$arr_size[$j]."'");
$tmp.="{\"v\":\"".$m["kh"]."-".$m["color"]."-".$tmp2["title"]."\",\"kh\":\"".$m["kh"]."\"},";
$i++;
}
}
}
}
if($i>0){
$str.="{\"cate\":\"尺码有误\",\"data\":[".deel_end($tmp)."]},";
}
$json_data.="\"error\":[".deel_end($str)."],";
break;
case "color_size" :
//
$msg_kh=get_db_msg("select * from ".$table_pre."kh where no='".$kh."'");
$is_ggk=is_ggk($msg_kh["id"]);
$arr_color=explode(",",$msg_kh["color"]);
$arr_size=explode(",",$msg_kh["size"]);
//取得杯型
$arrBx=array();
$r1=$db->query("select * from ".$table_pre."size_bx where no='".$kh."' order by bx");
$i1=0;
$strbx="";
while($m1=$db->fetch_array($r1)){
$arrBx[$i1][]=$m1["bx"];
$arrBx[$i1][]=$m1["size"];
$i1++;
}
$show_bx=($i1>0)?"y":"n";
if(count($arrBx)==0){
$arrBx[0][0]="";
$arrBx[0][1]=$msg_kh["size"];
}
$strcb="";
for($i=0;$i<count($arr_color);$i++){
if($is_ggk=="y" || $is_ggk=="b"){
//有规格
$q1="select * from ".$table_pre."kh_gg where iid='".$msg_kh["id"]."' and color='".$arr_color[$i]."'";
$r1=$db->query($q1);
while($m1=$db->fetch_array($r1)){
$check=get_db_msg("select count(*) 'num' from ".$table_pre."size_not where kh='".$kh."' and color='".$arr_color[$i]."' and bx='".$m1["gg"]."'");
$ck1="";
if($check["num"]>0){
$ck1=" checked";
}
$tmpa="";
$arr_size=explode(",",$msg_kh["size"]);
for($j=0;$j<count($arr_size);$j++){
$check=get_db_msg("select size from ".$table_pre."size_not where kh='".$kh."' and color='".$arr_color[$i]."' and bx='".$m1["gg"]."'");
$check=explode(",",$check["size"]);
$ck="";
if(in_array($arr_size[$j],$check)){
$ck=" checked";
}
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$msg_kh["size_group"]."' and no='".$arr_size[$j]."'");
$tmpa.="{\"name\":\"size_".$arr_color[$i]."_".$m1["gg"]."[]\",\"value\":\"".$arr_size[$j]."\",\"title\":\"".$tmp["title"]."\",\"check\":\"".$ck."\"},";
}
$tmpa=deel_end($tmpa);
$strcb.="{\"name\":\"color_bx[]\",\"value\":\"".$arr_color[$i]."_".$m1["gg"]."\",\"title\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."\",\"check\":\"".$ck1."\",\"size\":[".$tmpa."]},";
}
}else{
for($k=0;$k<count($arrBx);$k++){
$check=get_db_msg("select count(*) 'num' from ".$table_pre."size_not where kh='".$kh."' and color='".$arr_color[$i]."' and bx='".$arrBx[$k][0]."'");
$ck1="";
if($check["num"]>0){
$ck1=" checked";
}
$sbx="";
if($show_bx=="y"){
$sbx=$arrBx[$k][0];
}
$arr_size=explode(",",$arrBx[$k][1]);
$tmpa="";
for($j=0;$j<count($arr_size);$j++){
$check=get_db_msg("select size from ".$table_pre."size_not where kh='".$kh."' and color='".$arr_color[$i]."' and bx='".$arrBx[$k][0]."'");
$check=explode(",",$check["size"]);
$ck="";
if(in_array($arr_size[$j],$check)){
$ck=" checked";
}
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$msg_kh["size_group"]."' and no='".$arr_size[$j]."'");
$tmpa.="{\"name\":\"size_".$arr_color[$i]."_".$arrBx[$k][0]."[]\",\"value\":\"".$arr_size[$j]."\",\"title\":\"".$tmp["title"]."\",\"check\":\"".$ck."\"},";
}
$tmpa=deel_end($tmpa);
$strcb.="{\"name\":\"color_bx[]\",\"value\":\"".$arr_color[$i]."_".$arrBx[$k][0]."\",\"title\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."".$sbx."\",\"check\":\"".$ck1."\",\"size\":[".$tmpa."]},";
}
}
}
$strcb=deel_end($strcb);
$json_data.="\"color_size\":[".$strcb."],";
break;
default:
//
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
$sql_con="";
if($s_no){
if($s_no)
$sql_con.="kh like '%".$s_no."%' and ";
}
if($sql_con)
$sql_con="where ".substr($sql_con,0,-4);
$sql_order=str_replace("!"," desc",$order);
$query="select count(distinct kh) 'total' from ".$table_pre."size_not ".$sql_con;
$res=$db->query($query);
$msg=$db->fetch_array($res);
$total=$msg["total"];
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$total.",\"data\":[";
$query="select * from ".$table_pre."size_not ".$sql_con." group by kh order by kh limit ".$start.",".$end;
//echo $query."<br>";
$res=$db->query($query);
$count=0;
$str_tmp="";
while($msg=$db->fetch_array($res)){
$msg_kh=get_db_msg("select * from ".$table_pre."kh where no='".$msg["kh"]."'");
$is_ggk=is_ggk($msg_kh["id"]);
//取得杯型
$arrBx=array();
$r1=$db->query("select * from ".$table_pre."size_bx where no='".$msg["kh"]."' order by bx");
$i1=0;
while($m1=$db->fetch_array($r1)){
$arrBx[$i1][]=$m1["bx"];
$arrBx[$i1][]=$m1["size"];
$i1++;
}
$show_bx=($i1>0)?"y":"n";
if(count($arrBx)==0){
$arrBx[0][0]="";
$arrBx[0][1]=$msg["size"];
}
//
$list=$start+$count+1;
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"xh\":\"".$list."\",";
$str_tmp.="\"kh\":\"".$msg["kh"]."\",";
//颜色
$str=$str1=$str2="";
$q="select * from ".$table_pre."size_not where kh='".$msg["kh"]."' order by color";
$r=$db->query($q);
$tmpa="";
while($m=$db->fetch_array($r)){
if(trim($m["color"])){
$str.="<tr><td>".$m["color"]."-".get_cate_title_no("color",$m["color"])."</td>";
$str1.="{\"color\":\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\",";
$str2.=$m["color"]."-".get_cate_title_no("color",$m["color"])."|";
if($m["bx"]){
if($is_ggk=="y" || $is_ggk=="b"){
$str.="<td>".get_gg_title($m["bx"])."</td>";
$str1.="\"bx\":\"".get_gg_title($m["bx"])."\",";
}else{
$str.="<td>".$m["bx"]."</td>";
$str1.="\"bx\":\"".$m["bx"]."\",";
}
}else{
$str1.="\"bx\":\"\",";
}
//尺码
$str_size="";
if(trim($m["size"])){
$arr1=explode(",",$m["size"]);
for($j=0;$j<count($arr1);$j++){
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$msg_kh["size_group"]."' and no='".$arr1[$j]."'");
$str_size.=$tmp["title"].",";
}
}
if($str_size){
$str.="<td>".substr($str_size,0,-1);
$str1.="\"cm\":\"".substr($str_size,0,-1)."\"";
}else{
$str.="<td>&nbsp;";
$str1.="\"cm\":\"\"";
}
$str1.="},";
$str.="</td></tr>";
}
}
$str1=deel_end($str1);
$str="<table>".$str."</table>";
$str_tmp.="\"c_s\":[".$str1."]";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."],";
break;
}
}
$json_data=substr($json_data,0,-1)."}";
echo $json_data;
?>