7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
635 lines
22 KiB
PHP
635 lines
22 KiB
PHP
<?php
|
|
header("Content-type: text/html; charset=utf-8");
|
|
//----------------------------------------------------------配码管理
|
|
if(THIS_IN!="edt_admin")
|
|
exit("错误的访问!");
|
|
$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_pm=array("qyid"=>"区域代码","dlid"=>"代理代码","uid"=>"店铺代码","khid"=>"款号","size_group_id"=>"尺码组名称","pm_dj"=>"配码等级","bx"=>"款型","title"=>"名称","gz"=>"配码");
|
|
//童装
|
|
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;
|
|
}
|
|
switch($_a){
|
|
case "add" :
|
|
//检查是否超过$sys_size_num
|
|
//$msg_group=get_db_msg("select * from ".$table_pre."keyword where id='".$s_iid."'");
|
|
//$op_no="";
|
|
//$content_size_title="<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#cccccc\">";
|
|
$username=$qyusername=$dlusername=$qyid=$dlid=$uid=$kh=$title=$size_group_id=$size_group_title=$gz=$pm_dj="";
|
|
if($id){
|
|
$msg=get_db_msg("select * from ".$table_pre."size_pm where id='".$id."'");
|
|
$qyid=$msg["qyid"];
|
|
$dlid=$msg["dlid"];
|
|
$uid=$msg["uid"];
|
|
$title=$msg["title"];
|
|
$gz=$msg["gz"];
|
|
$bx=$msg["bx"];
|
|
$pm_dj=$msg["pm_dj"];
|
|
$size_group_id=$msg["size_group_id"];
|
|
if($msg["uid"]>0){
|
|
$tmp=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
|
|
$username=$tmp["username"];
|
|
}
|
|
if($msg["qyid"]>0){
|
|
$tmp=get_db_msg("select username from ".$table_pre."client where id='".$msg["qyid"]."'");
|
|
$qyusername=$tmp["username"];
|
|
}
|
|
if($msg["dlid"]>0){
|
|
$tmp=get_db_msg("select username from ".$table_pre."client where id='".$msg["dlid"]."'");
|
|
$dlusername=$tmp["username"];
|
|
}
|
|
if($msg["khid"]>0){
|
|
$tmp=get_db_msg("select no from ".$table_pre."kh where id='".$msg["khid"]."'");
|
|
$kh=$tmp["no"];
|
|
}
|
|
if($msg["size_group_id"]>0){
|
|
$tmp=get_db_msg("select title from ".$table_pre."keyword where id='".$msg["size_group_id"]."'");
|
|
$size_group_title=$tmp["title"];
|
|
}
|
|
|
|
if($child_sizegroup_id==$size_group_id){
|
|
$json_data.="\"is_tz\":\"y\",";
|
|
$strcb="";
|
|
$tmpa="";
|
|
foreach($arr_child_bx as $bx1 => $arr_size1){
|
|
$tmpa.="{\"st\":\"".$bx1."\"},";
|
|
}
|
|
$tmpa=deel_end($tmpa);
|
|
$strcb.="{\"id\":\"".$size_group_id."\",\"size\":[".$tmpa."]},";
|
|
$str1="";
|
|
$tmparr=$arr_child_bx[$bx];
|
|
for($i=0;$i<count($tmparr);$i++){
|
|
$str1.=$tmparr[$i].":";
|
|
}
|
|
$str1=deel_end($str1);
|
|
$json_data.="\"bx_tz\":\"".$str1."\",";
|
|
$json_data.="\"bx\":\"".$bx."\",";
|
|
}else{
|
|
|
|
$tmp=get_db_msg("select count(*) js from ".$table_pre."size where iid='".$size_group_id."'");
|
|
$num_size_total=$tmp["js"];
|
|
//取得尺码表头内容
|
|
$r1=$db->query("select * from ".$table_pre."keyword where cate='size' and id='".$size_group_id."'");
|
|
$strcb="";
|
|
while($m1=$db->fetch_array($r1)){
|
|
$tmpa="";
|
|
for($i=1;$i<=$num_size_total;$i++){
|
|
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'");
|
|
$t=$tmp["title"]?$tmp["title"]:" ";
|
|
$tmpa.="{\"st\":\"".$t."\"},";
|
|
}
|
|
$tmpa=deel_end($tmpa);
|
|
$strcb.="{\"id\":\"".$m1["id"]."\",\"size\":[".$tmpa."]},";
|
|
}
|
|
}
|
|
}else{
|
|
$arr_size_merged=get_size_merged();
|
|
$num_size_total=count($arr_size_merged);
|
|
|
|
//取得尺码表头内容
|
|
$r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord");
|
|
$strcb="";
|
|
while($m1=$db->fetch_array($r1)){
|
|
$tmpa="";
|
|
for($i=1;$i<=$num_size_total;$i++){
|
|
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'");
|
|
$t=$tmp["title"]?$tmp["title"]:" ";
|
|
$tmpa.="{\"st\":\"".$t."\"},";
|
|
}
|
|
$tmpa=deel_end($tmpa);
|
|
$strcb.="{\"id\":\"".$m1["id"]."\",\"size\":[".$tmpa."]},";
|
|
}
|
|
}
|
|
$q="select pm_dj from ".$table_pre."kh group by pm_dj order by pm_dj";
|
|
$r=$db->query($q);
|
|
$strpmdj=$slt="";
|
|
while($m=$db->fetch_array($r)){
|
|
if($pm_dj==$m["pm_dj"]){
|
|
$slt="y";
|
|
}else{
|
|
$slt="n";
|
|
}
|
|
$strpmdj.="{\"v\":\"".$m["pm_dj"]."\",\"t\":\"".$m["pm_dj"]."\",\"is_select\":\"".$slt."\"},";
|
|
}
|
|
$strpmdj=deel_end($strpmdj);
|
|
|
|
|
|
$json_data.="\"id\":\"".$id."\",";
|
|
$json_data.="\"uid\":\"".$uid."\",";
|
|
$json_data.="\"qyid\":\"".$qyid."\",";
|
|
$json_data.="\"dlid\":\"".$dlid."\",";
|
|
$json_data.="\"username\":\"".$username."\",";
|
|
$json_data.="\"qyusername\":\"".$qyusername."\",";
|
|
$json_data.="\"dlusername\":\"".$dlusername."\",";
|
|
$json_data.="\"kh\":\"".$kh."\",";
|
|
$json_data.="\"size_group_id\":\"".$size_group_id."\",";
|
|
$json_data.="\"size_group_title\":\"".$size_group_title."\",";
|
|
$json_data.="\"title\":\"".$title."\",";
|
|
$json_data.="\"gz\":\"".$gz."\",";
|
|
$strcb=deel_end($strcb);
|
|
$json_data.="\"size_all\":[".$strcb."],";
|
|
$json_data.="\"pm_dj\":[".$strpmdj."],";
|
|
break;
|
|
case "save_add" :
|
|
//验证
|
|
//$c=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where title='".$title."' and id<>'".$id."'");
|
|
//if($c["num"]>0)
|
|
//alert_and_back("该记录已经存在,请重新输入一个!");
|
|
$errmsg=check_pm_gz($gz);
|
|
if($errmsg){
|
|
$json_data.="\"code\":0,\"msg\":\"".$errmsg."\",";
|
|
}else{
|
|
$gz=deel_pm_gz($gz);
|
|
$sql_uid="";
|
|
if($username){
|
|
$m1=get_db_msg("select id from ".$table_pre."client where username='".$username."'");
|
|
if($m1["id"]>0){
|
|
$sql_uid=",uid='".$m1["id"]."'";
|
|
$uid1=$m1["id"];
|
|
}
|
|
}
|
|
$sql_khid="";
|
|
$json_data.="\"bx\":\"".$bx."\",";
|
|
$json_data.="\"id\":\"".$id."\",";
|
|
if($kh){
|
|
$m1=get_db_msg("select id from ".$table_pre."kh where no='".$kh."'");
|
|
if($m1["id"]>0){
|
|
$sql_khid=",khid='".$m1["id"]."'";
|
|
$khid=$m1["id"];
|
|
}
|
|
if($khid>0){
|
|
//
|
|
$gz=recount_pm($khid,$bx,$gz);
|
|
}
|
|
}
|
|
$num=count_pm_num($gz);
|
|
if($id){
|
|
$query="update ".$table_pre."size_pm set qyid='".$qyid."',dlid='".$dlid."',size_group_id='".$size_group_id."',pm_dj='".$pm_dj."',bx='".$bx."',title='".$title."',gz='".$gz."',num='".$num."'".$sql_uid.$sql_khid." where id='".$id."'";
|
|
$db->query($query);
|
|
$log_action="修改";
|
|
}else{
|
|
$query="insert ".$table_pre."size_pm (title,qyid,dlid,uid,size_group_id,pm_dj,bx,khid,gz,num) values ('".$title."','".$qyid."','".$dlid."','".$uid1."','".$size_group_id."','".$pm_dj."','".$bx."','".$khid."','".$gz."','".$num."')";
|
|
$db->query($query);
|
|
$iid=$db->insert_id();
|
|
$log_action="新增";
|
|
}
|
|
$lid=$id?$id:$iid;
|
|
set_log($log_action."配码",$title."|".$lid);
|
|
$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 * from ".$table_pre."size_pm where id='".$id[$i]."'");
|
|
//删除款号表
|
|
$db->query("delete from ".$table_pre."size_pm where id='".$id[$i]."'");
|
|
$lid.=$tmp["title"]."|".$id[$i].", ";
|
|
}
|
|
$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_pm);
|
|
$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_pm 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_pm,$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_pm);
|
|
|
|
$error_msg="";
|
|
if($import_type=="y"){
|
|
//清空款号相关数据
|
|
$db->query("TRUNCATE TABLE ".$table_pre."size_pm;");
|
|
}
|
|
|
|
//
|
|
$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]);
|
|
$tmp_uid=$tmp_dlid=$tmp_qyid=$tmp_khid=$tmp_size_group_id=0;
|
|
$tmp_bx=$tmp_pm=$pmtitle="";
|
|
for($k=0;$k<count($arr_column[0]);$k++){
|
|
$ind=$arr_column[0][$k];
|
|
$ititle=$arr_column[1][$k];
|
|
if($ititle=="uid"){
|
|
if(trim($tmp_arr[$ind])){
|
|
$tmp=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
|
|
if($tmp["id"]>0){
|
|
$tmp_uid=$tmp["id"];
|
|
}
|
|
}
|
|
}else if($ititle=="dlid"){
|
|
if(trim($tmp_arr[$ind])){
|
|
$tmp=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
|
|
if($tmp["id"]>0){
|
|
$tmp_dlid=$tmp["id"];
|
|
}
|
|
}
|
|
}else if($ititle=="qyid"){
|
|
if(trim($tmp_arr[$ind])){
|
|
$tmp=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
|
|
if($tmp["id"]>0){
|
|
$tmp_qyid=$tmp["id"];
|
|
}
|
|
}
|
|
}else if($ititle=="khid"){
|
|
if(trim($tmp_arr[$ind])){
|
|
$tmp=get_db_msg("select id from ".$table_pre."kh where no='".trim($tmp_arr[$ind])."'");
|
|
if($tmp["id"]>0){
|
|
$tmp_khid=$tmp["id"];
|
|
}
|
|
}
|
|
}else if($ititle=="size_group_id"){
|
|
if(trim($tmp_arr[$ind])){
|
|
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".trim($tmp_arr[$ind])."'");
|
|
if($tmp["id"]>0){
|
|
$tmp_size_group_id=$tmp["id"];
|
|
}
|
|
}
|
|
}else if($ititle=="bx"){
|
|
$tmp_bx=$tmp_arr[$ind];
|
|
}else if($ititle=="gz"){
|
|
$tmp_pm=deel_pm_gz(trim($tmp_arr[$ind]));
|
|
}else if($ititle=="title"){
|
|
$pmtitle=trim($tmp_arr[$ind]);
|
|
}
|
|
}
|
|
//根据款号尺码,自动平铺配码
|
|
if($tmp_khid>0){
|
|
//
|
|
$tmp_pm=recount_pm($tmp_khid,$tmp_bx,$tmp_pm);
|
|
}
|
|
$num11=count_pm_num($tmp_pm);
|
|
//导入
|
|
$insert_value="";
|
|
for($k=0;$k<count($arr_column[0]);$k++){
|
|
$ind=$arr_column[0][$k];
|
|
$ititle=$arr_column[1][$k];
|
|
if($ititle=="uid" || $ititle=="dlid" || $ititle=="qyid"){
|
|
$tmp=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
|
|
$insert_value.=",'".$tmp["id"]."'";
|
|
}else if($ititle=="khid"){
|
|
$tmp=get_db_msg("select id from ".$table_pre."kh where no='".trim($tmp_arr[$ind])."'");
|
|
$insert_value.=",'".$tmp["id"]."'";
|
|
}else if($ititle=="size_group_id"){
|
|
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".trim($tmp_arr[$ind])."'");
|
|
$insert_value.=",'".$tmp["id"]."'";
|
|
}else if($ititle=="gz"){
|
|
$insert_value.=",'".mysql_escape_string($tmp_pm)."'";
|
|
}else{
|
|
$insert_value.=",'".mysql_escape_string(trim($tmp_arr[$ind]))."'";
|
|
}
|
|
}
|
|
//$check=get_db_msg("select id,gz from ".$table_pre."size_pm where uid='".$tmp_uid."' and dlid='".$tmp_dlid."' and qyid='".$tmp_qyid."' and khid='".$tmp_khid."' and size_group_id='".$tmp_size_group_id."' and bx='".$tmp_bx."' and title='".$pmtitle."'");
|
|
//if($check["id"]>0){
|
|
// $q="update ".$table_pre."size_pm set gz='".$tmp_pm."' where id='".$check["id"]."'";
|
|
//}else{
|
|
$q="insert into ".$table_pre."size_pm (num".$insert_column.") values ('".$num11."'".$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_pm 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_pm 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_pm,$ex_col[$i]);
|
|
}
|
|
//取得数据
|
|
$query="select * from ".$table_pre."size_pm order by id";
|
|
$r=$db->query($query);
|
|
$row=0;
|
|
while($m=$db->fetch_array($r)){
|
|
for($i=0;$i<$num;$i++){
|
|
$k=$ex_col[$i];
|
|
if($k=="qyid" || $k=="dlid" || $k=="uid"){
|
|
$tmp=get_db_msg("select username from ".$table_pre."client where id='".$m[$k]."'");
|
|
$data["body"][$row][]=$tmp["username"];
|
|
//$content[$row][$i]=$tmp["username"];
|
|
}else if($k=="khid"){
|
|
$tmp=get_db_msg("select no from ".$table_pre."kh where id='".$m[$k]."'");
|
|
$data["body"][$row][]=$tmp["no"];
|
|
//$content[$row][$i]=$tmp["no"];
|
|
}else if($k=="size_group_id"){
|
|
$tmp=get_db_msg("select * from ".$table_pre."keyword where id='".$m[$k]."'");
|
|
$data["body"][$row][]=$tmp["title"];
|
|
//$content[$row][$i]=$tmp["title"];
|
|
}else{
|
|
$data["body"][$row][]=$m[$k];
|
|
}
|
|
}
|
|
$row++;
|
|
|
|
|
|
/*for($i=0;$i<$num;$i++){
|
|
$k=$ex_col[$i];
|
|
$data["body"][$row][]=$m[$k];
|
|
}
|
|
$row++;*/
|
|
}
|
|
$file_name="size_pm_".date("Y-m-d-H-i");
|
|
//print_r($data);
|
|
//exit;
|
|
output_excel($file_name,$data);
|
|
set_log("导出配码信息");
|
|
exit;
|
|
break;
|
|
//----------------------------------------------------------------------/导出数据
|
|
|
|
case "cmz":
|
|
//
|
|
|
|
if($size_group_id=="all"){
|
|
$arr_size_merged=get_size_merged();
|
|
$num_size_total=count($arr_size_merged);
|
|
|
|
//取得尺码表头内容
|
|
$r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord");
|
|
$strcb="";
|
|
while($m1=$db->fetch_array($r1)){
|
|
$tmpa="";
|
|
for($i=1;$i<=$num_size_total;$i++){
|
|
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'");
|
|
$t=$tmp["title"]?$tmp["title"]:" ";
|
|
$tmpa.="{\"st\":\"".$t."\"},";
|
|
}
|
|
$tmpa=deel_end($tmpa);
|
|
$strcb.="{\"id\":\"".$m1["id"]."\",\"size\":[".$tmpa."]},";
|
|
}
|
|
}else{
|
|
if($child_sizegroup_id==$size_group_id){
|
|
$json_data.="\"is_tz\":\"y\",";
|
|
$strcb="";
|
|
$tmpa="";
|
|
foreach($arr_child_bx as $bx1 => $arr_size1){
|
|
$tmpa.="{\"st\":\"".$bx1."\"},";
|
|
}
|
|
$tmpa=deel_end($tmpa);
|
|
$strcb.="{\"id\":\"".$size_group_id."\",\"size\":[".$tmpa."]},";
|
|
}else{
|
|
$tmp=get_db_msg("select count(*) js from ".$table_pre."size where iid='".$size_group_id."'");
|
|
$num_size_total=$tmp["js"];
|
|
//取得尺码表头内容
|
|
$r1=$db->query("select * from ".$table_pre."keyword where cate='size' and id='".$size_group_id."'");
|
|
$strcb="";
|
|
while($m1=$db->fetch_array($r1)){
|
|
$tmpa="";
|
|
for($i=1;$i<=$num_size_total;$i++){
|
|
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'");
|
|
$t=$tmp["title"]?$tmp["title"]:" ";
|
|
$tmpa.="{\"st\":\"".$t."\"},";
|
|
}
|
|
$tmpa=deel_end($tmpa);
|
|
$strcb.="{\"id\":\"".$m1["id"]."\",\"size\":[".$tmpa."]},";
|
|
}
|
|
}
|
|
|
|
}
|
|
$strcb=deel_end($strcb);
|
|
$json_data.="\"size_all\":[".$strcb."],";
|
|
break;
|
|
case "check_bx_tz":
|
|
$str1="";
|
|
$tmparr=$arr_child_bx[$bx];
|
|
for($i=0;$i<count($tmparr);$i++){
|
|
$str1.=$tmparr[$i].":";
|
|
}
|
|
$str1=deel_end($str1);
|
|
$json_data.="\"bx_tz\":\"".$str1."\",";
|
|
break;
|
|
default :
|
|
$page=$page>0?$page:1;
|
|
$limit=$limit>0?$limit:10;
|
|
$start=($page-1)*$limit;
|
|
$end=$limit;
|
|
|
|
$order=$order?$order:"id";
|
|
$sql_con="";
|
|
if($s_username){
|
|
$tmp=get_db_msg("select id from ".$table_pre."client where username='".$s_username."'");
|
|
$sql_con.="uid='".$tmp["id"]."' and ";
|
|
}
|
|
if($sql_con)
|
|
$sql_con="where ".substr($sql_con,0,-4);
|
|
$sql_order=str_replace("!"," desc",$order);
|
|
$query="select count(*) 'total' from ".$table_pre."size_pm ".$sql_con;
|
|
$res=$db->query($query);
|
|
$msg=$db->fetch_array($res);
|
|
$total=$msg["total"];
|
|
|
|
$arr_size_merged=get_size_merged();
|
|
$num_size_total=count($arr_size_merged);
|
|
//取得尺码表头
|
|
$content_size_title="<table border='0' cellpadding='3' cellspacing='1' bgcolor='#cccccc'>";
|
|
$q="select * from ".$table_pre."keyword where cate='size' order by ord";
|
|
$r=$db->query($q);
|
|
while($m=$db->fetch_array($r)){
|
|
$content_size_title.="<tr bgcolor='#ffffff'>";
|
|
$q1="select * from ".$table_pre."size where iid='".$m["id"]."' order by no";
|
|
$r1=$db->query($q1);
|
|
$i=0;
|
|
while($m1=$db->fetch_array($r1)){
|
|
$content_size_title.="<td>".$m1["title"]."</td>";
|
|
$i++;
|
|
}
|
|
for($j=$i;$j<$num_size_total;$j++){
|
|
$content_size_title.="<td> </td>";
|
|
}
|
|
$content_size_title.="</tr>";
|
|
}
|
|
$content_size_title.="</table>";
|
|
|
|
//-----------------------search
|
|
//-----------------------/search
|
|
|
|
//$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$total.",\"cmbt\":".$content_size_title.",\"data\":[";
|
|
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$total.",\"data\":[";
|
|
//------------
|
|
$query="select * from ".$table_pre."size_pm ".$sql_con."order by qyid,uid,size_group_id limit ".$start.",".$end;
|
|
//echo $query."<br>";
|
|
$res=$db->query($query);
|
|
$count=0;
|
|
$str_tmp="";
|
|
while($msg=$db->fetch_array($res)){
|
|
$str_tmp.="{";
|
|
$str_tmp.="\"id\":\"".$msg["id"]."\",";
|
|
|
|
|
|
$list=$start+$count+1;
|
|
$str_tmp.="\"xh\":\"".$list."\",";
|
|
//区域
|
|
if($msg["qyid"]){
|
|
$tmp=get_db_msg("select title,username from ".$table_pre."client where id='".$msg["qyid"]."'");
|
|
$t1=$tmp["title"]."(".$tmp["username"].")";
|
|
}else{
|
|
$t1="";
|
|
}
|
|
$str_tmp.="\"qy\":\"".$t1."\",";
|
|
//代理
|
|
if($msg["dlid"]){
|
|
$tmp=get_db_msg("select title,username from ".$table_pre."client where id='".$msg["dlid"]."'");
|
|
$t1=$tmp["title"]."(".$tmp["username"].")";
|
|
}else{
|
|
$t1="";
|
|
}
|
|
$content[$count][]=$t1;
|
|
$str_tmp.="\"dl\":\"".$t1."\",";
|
|
//店铺
|
|
if($msg["uid"]){
|
|
$tmp=get_db_msg("select title,username from ".$table_pre."client where id='".$msg["uid"]."'");
|
|
$t1=$tmp["title"]."(".$tmp["username"].")";
|
|
}else{
|
|
$t1="";
|
|
}
|
|
$content[$count][]=$t1;
|
|
$str_tmp.="\"dp\":\"".$t1."\",";
|
|
$t1="";
|
|
if($msg["size_group_id"]){
|
|
$tmp=get_db_msg("select title from ".$table_pre."keyword where id='".$msg["size_group_id"]."'");
|
|
$t1.=$tmp["title"]."-";
|
|
}
|
|
if($msg["khid"]){
|
|
$tmp=get_db_msg("select no from ".$table_pre."kh where id='".$msg["khid"]."'");
|
|
$t1.=$tmp["no"]."-";
|
|
}
|
|
$t1.=$msg["title"];
|
|
$str_tmp.="\"mc\":\"".$t1."\",";
|
|
//$content[$count][]="<input type=\"checkbox\" id=\"cb".$count."\" name=\"id[]\" value=\"".$msg["id"]."\"><a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&_cid=".$_cid."&_a=add&id=".$msg["id"]."\">".$t1.$msg["title"]."</a>";
|
|
//$content[$count][]=$msg["gz"];
|
|
$str_tmp.="\"gz\":\"".$msg["gz"]."\",";
|
|
$str_tmp.="\"pm_dj\":\"".$msg["pm_dj"]."\"";
|
|
$str_tmp.="},";
|
|
$count++;
|
|
}
|
|
$json_data.=substr($str_tmp,0,-1)."],";
|
|
break;
|
|
}
|
|
}
|
|
$json_data=substr($json_data,0,-1)."}";
|
|
echo $json_data;
|
|
?>
|