chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
<?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;
|
||||
?>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$is_msg=get_set("is_msg");
|
||||
switch($cate){
|
||||
case "get_msg":
|
||||
if($is_msg=="y"){
|
||||
$msg_num=get_db_msg("select count(*) 'num' from ".$table_pre."msg where to_cid='".$uid."' and is_read='n' order by add_date");
|
||||
$json_data.="\"msgnum\":\"".$msg_num["num"]."\",";
|
||||
}else{
|
||||
$json_data.="\"msgnum\":0,";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
+2560
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,347 @@
|
||||
<?php
|
||||
//-------------------------------大屏-界面
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=check_cookie_jxs();
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
$hs=10; //显示行数
|
||||
switch($_a){
|
||||
case 'get_config': //获取参数 ALTER TABLE `web_client` ADD COLUMN `bigsrceen_set` int(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `jpty`;
|
||||
$tmp_c=get_db_msg("select * from web_client where id='".$uid."'");
|
||||
$json_data.="\"code\":0,";
|
||||
if($tmp_c["bigsrceen_set"]){
|
||||
$json_data.="\"set\":\"".$tmp_c["bigsrceen_set"]."\",";
|
||||
}else{
|
||||
$json_data.="\"set\":\"0,1,2,3,4,5,6,7,8,9,10\",";
|
||||
}
|
||||
break;
|
||||
case 'set_config': //设置参数
|
||||
$q="update web_client set bigsrceen_set='".$bigsrceen_set."' where id='".$uid."'";
|
||||
$db->query($q);
|
||||
$json_data.="\"code\":0,";
|
||||
break;
|
||||
case 'qst': //趋势图
|
||||
$sql_create_table="CREATE TABLE web_qst_temp (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`time` varchar(255) NOT NULL default '',
|
||||
`num` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
|
||||
if(check_table_exist("web_qst_temp")!="y"){
|
||||
$db->query($sql_create_table);
|
||||
}
|
||||
|
||||
|
||||
$time_now=date("Y-m-d H:i:s");
|
||||
$time_bigen=strtotime($time_now."-1 hour");
|
||||
//$json_data.="\"time_now\":\"".$time_now."\",";
|
||||
//$json_data.="\"time_bigen\":\"".$time_bigen."\",";
|
||||
$tmp2=date("Y-m-d H:i",$time_bigen);
|
||||
$tmp2=$tmp2.":00";
|
||||
$data_str="";
|
||||
$data_str1="";
|
||||
for($i=0;$i<360;$i++){
|
||||
$tmp1=$i*10;
|
||||
|
||||
$tmp_t=strtotime($tmp2."+".$tmp1." seconds");
|
||||
$tmp_time=date("H:i:s",$tmp_t);
|
||||
$tmp_time1=date("Y-m-d",$tmp_t);
|
||||
|
||||
$sqltime=$tmp_time1." ".$tmp_time;
|
||||
|
||||
$tmplog=get_db_msg("select * from web_qst_temp where time='".$sqltime."' ");
|
||||
|
||||
if($tmplog["id"]){
|
||||
$data_str.="\"".$tmp_time."\",";
|
||||
$data_str1.="\"".$tmplog["num"]."\",";
|
||||
}else{
|
||||
|
||||
$num_add=get_db_msg("select sum(num) num from web_log_hd where unix_timestamp(add_date)<".$tmp_t." and (action='21' or action='23') ");
|
||||
$num_subtract=get_db_msg("select sum(num) num from web_log_hd where unix_timestamp(add_date)<".$tmp_t." and (action='22' or action='24')");
|
||||
$num=$num_add["num"]-$num_subtract["num"];
|
||||
|
||||
$db->query("insert into web_qst_temp (time,num) values ('".$sqltime."','".$num."');");
|
||||
|
||||
//$data_str.="{";
|
||||
$data_str.="\"".$tmp_time."\",";
|
||||
//$data_str.="},";
|
||||
|
||||
//$data_str1.="{";
|
||||
$data_str1.="\"".$num."\",";
|
||||
//$data_str1.="},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"title\":[".deel_end($data_str)."],";
|
||||
$json_data.="\"js\":[".deel_end($data_str1)."],";
|
||||
|
||||
break;
|
||||
case 'ddgl': //订单概览
|
||||
$tmp_o=get_db_msg("select sum(num) num,sum(je) je,sum(jsje) jsje from web_order where ka<>'y'");
|
||||
$tmp_c=get_db_msg("select sum(zb_js) zb_js,sum(zb) zb from web_client where available='y' and face='4'");
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"ydjs\":\"".$tmp_o["num"]."\",";
|
||||
$je=keep_float(deel_cf($tmp_o["je"],10000),2);
|
||||
$json_data.="\"ydje\":\"".$je."\",";
|
||||
$jsje=keep_float(deel_cf($tmp_o["jsje"],10000),2);
|
||||
$json_data.="\"ydjsje\":\"".$jsje."\",";
|
||||
|
||||
$zb=$tmp_c["zb"]*10000;
|
||||
$json_data.="\"zbjs\":\"".$tmp_c["zb_js"]."\",";
|
||||
$json_data.="\"zb\":\"".keep_float($tmp_c["zb"],2)."\",";
|
||||
$wcl_js=keep_float((deel_cf($tmp_o["num"],$tmp_c["zb_js"])*100),2);
|
||||
$wcl_je=keep_float((deel_cf($tmp_o["jsje"],$zb)*100),2);
|
||||
$json_data.="\"wcl_js\":\"".$wcl_js."%\",";
|
||||
$json_data.="\"wcl_je\":\"".$wcl_je."%\",";
|
||||
break;
|
||||
case 'spgl': //商品概览
|
||||
$q="select * from web_kh";
|
||||
$r=$db->query($q);
|
||||
$sku=$skc=$sck=$scks=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_color=explode(",",$m["color"]);
|
||||
$arr_color_ka=explode(",",$m["color_ka"]);
|
||||
if($m["ka"]!="y"){
|
||||
$sku++;
|
||||
foreach($arr_color as $n=>$t){
|
||||
if(in_array($t,$arr_color_ka)){
|
||||
$scks++;
|
||||
}else{
|
||||
$skc++;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$sck++;
|
||||
foreach($arr_color as $n=>$t){
|
||||
$scks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tmp=get_db_msg("select count(DISTINCT no) ks from web_order where ka<>'y'");
|
||||
|
||||
$wdk=$sku-$tmp["ks"];
|
||||
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"sku\":\"".$sku."\",";
|
||||
$json_data.="\"skc\":\"".$skc."\",";
|
||||
$json_data.="\"sck\":\"".$sck."\",";
|
||||
$json_data.="\"scks\":\"".$scks."\",";
|
||||
$json_data.="\"wdk\":\"".$wdk."\",";
|
||||
break;
|
||||
case 'khgl': //客户概览
|
||||
$tmp_o=get_db_msg("select count(DISTINCT uid) dps from web_order where ka<>'y'");
|
||||
$tmp_c=get_db_msg("select count(*) dps from web_client where available='y' and face='4'");
|
||||
$tmp_zx=get_db_msg("select count(*) dps from web_session where uid in(select id from web_client where available='y' and face='4')");
|
||||
$tmp_jd=get_db_msg("select count(*) dps from web_client where available='y' and is_jd='y' and face='4'");
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"chdps\":\"".$tmp_c["dps"]."\",";
|
||||
$json_data.="\"xddps\":\"".$tmp_o["dps"]."\",";
|
||||
$json_data.="\"zxdps\":\"".$tmp_zx["dps"]."\",";
|
||||
$json_data.="\"jddps\":\"".$tmp_jd["dps"]."\",";
|
||||
break;
|
||||
case 'dqph': //大区排行
|
||||
$q="select * from web_client where face='9' and available='y'";
|
||||
$r=$db->query($q);
|
||||
$arr_dq=array();
|
||||
$arr_dq_path=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_dq[$m["id"]]=$m["title"];
|
||||
$path=$m["path"]."-".$m["id"];
|
||||
$arr_dq_path[$m["id"]]=$path;
|
||||
}
|
||||
$arr_ph_js=$arr_ph_je=$arr_ph_jsje=array();
|
||||
foreach($arr_dq as $n=>$t){
|
||||
$tmp_o=get_db_msg("select sum(num) num,sum(je) je,sum(jsje) jsje from web_order where ka<>'y' and (upath='".$arr_dq_path[$n]."' or upath like '".$arr_dq_path[$n]."-%')");
|
||||
$arr_ph_js[$n]=$tmp_o["num"];
|
||||
$arr_ph_je[$n]=$tmp_o["je"];
|
||||
$arr_ph_jsje[$n]=$tmp_o["jsje"];
|
||||
}
|
||||
|
||||
arsort($arr_ph_js);
|
||||
$json_data.="\"code\":0,";
|
||||
$data_str="";
|
||||
$px=1;
|
||||
foreach($arr_ph_js as $n=>$t){
|
||||
if($hs>=$px){
|
||||
$data_str.="{";
|
||||
$data_str.="\"px\":\"".$px++."\",";
|
||||
$data_str.="\"title\":\"".$arr_dq[$n]."\",";
|
||||
$data_str.="\"js\":\"".$t."\",";
|
||||
$je=keep_float(deel_cf($arr_ph_je[$n],10000),2);
|
||||
$data_str.="\"je\":\"".$je."\",";
|
||||
$jsje=keep_float(deel_cf($arr_ph_jsje[$n],10000),2);
|
||||
$data_str.="\"jsje\":\"".$jsje."\"";
|
||||
$data_str.="},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($data_str)."],";
|
||||
break;
|
||||
case 'dlph': //代理排行
|
||||
$q="select * from web_client where face='3' and available='y'";
|
||||
$r=$db->query($q);
|
||||
$arr_dl=array();
|
||||
$arr_dl_path=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_dl[$m["id"]]=$m["title"];
|
||||
$path=$m["path"]."-".$m["id"];
|
||||
$arr_dl_path[$m["id"]]=$path;
|
||||
}
|
||||
$arr_ph_js=$arr_ph_je=$arr_ph_jsje=array();
|
||||
foreach($arr_dl as $n=>$t){
|
||||
$tmp_o=get_db_msg("select sum(num) num,sum(je) je,sum(jsje) jsje from web_order where ka<>'y' and (upath='".$arr_dl_path[$n]."' or upath like '".$arr_dl_path[$n]."-%')");
|
||||
$arr_ph_js[$n]=$tmp_o["num"];
|
||||
$arr_ph_je[$n]=$tmp_o["je"];
|
||||
$arr_ph_jsje[$n]=$tmp_o["jsje"];
|
||||
}
|
||||
|
||||
arsort($arr_ph_js);
|
||||
$json_data.="\"code\":0,";
|
||||
$data_str="";
|
||||
$px=1;
|
||||
foreach($arr_ph_js as $n=>$t){
|
||||
if($hs>=$px){
|
||||
$data_str.="{";
|
||||
$data_str.="\"px\":\"".$px++."\",";
|
||||
$data_str.="\"title\":\"".$arr_dl[$n]."\",";
|
||||
$data_str.="\"js\":\"".$t."\",";
|
||||
$je=keep_float(deel_cf($arr_ph_je[$n],10000),2);
|
||||
$data_str.="\"je\":\"".$je."\",";
|
||||
$jsje=keep_float(deel_cf($arr_ph_jsje[$n],10000),2);
|
||||
$data_str.="\"jsje\":\"".$jsje."\"";
|
||||
$data_str.="},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($data_str)."],";
|
||||
break;
|
||||
case 'mdph': //门店排行
|
||||
$q="select * from web_client where face='4' and available='y'";
|
||||
$r=$db->query($q);
|
||||
$arr_dp=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_dp[$m["id"]]=$m["title"];
|
||||
}
|
||||
$arr_ph_js=$arr_ph_je=$arr_ph_jsje=array();
|
||||
foreach($arr_dp as $n=>$t){
|
||||
$tmp_o=get_db_msg("select sum(num) num,sum(je) je,sum(jsje) jsje from web_order where ka<>'y' and uid='".$n."'");
|
||||
$arr_ph_js[$n]=$tmp_o["num"];
|
||||
$arr_ph_je[$n]=$tmp_o["je"];
|
||||
$arr_ph_jsje[$n]=$tmp_o["jsje"];
|
||||
}
|
||||
|
||||
arsort($arr_ph_js);
|
||||
$json_data.="\"code\":0,";
|
||||
$data_str="";
|
||||
$px=1;
|
||||
foreach($arr_ph_js as $n=>$t){
|
||||
if($hs>=$px){
|
||||
$data_str.="{";
|
||||
$data_str.="\"px\":\"".$px++."\",";
|
||||
$data_str.="\"title\":\"".$arr_dp[$n]."\",";
|
||||
$data_str.="\"js\":\"".$t."\",";
|
||||
$je=keep_float(deel_cf($arr_ph_je[$n],10000),2);
|
||||
$data_str.="\"je\":\"".$je."\",";
|
||||
$jsje=keep_float(deel_cf($arr_ph_jsje[$n],10000),2);
|
||||
$data_str.="\"jsje\":\"".$jsje."\"";
|
||||
$data_str.="},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($data_str)."],";
|
||||
break;
|
||||
case 'dkph': //单款排行
|
||||
$q="select no,sum(num) num,sum(je) je,sum(jsje) jsje from web_order where ka<>'y' group by no order by num desc";
|
||||
$r=$db->query($q);
|
||||
$data_str="";
|
||||
$px=1;
|
||||
while($m=$db->fetch_array($r)){
|
||||
if($hs>=$px){
|
||||
$msg=get_db_msg("select * from web_kh where no='".$m["no"]."'");
|
||||
$pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline);
|
||||
$pic_b=get_kh_picture_big($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline);
|
||||
$data_str.="{";
|
||||
$data_str.="\"px\":\"".$px++."\",";
|
||||
$data_str.="\"no\":\"".$m["no"]."\",";
|
||||
$data_str.="\"pic\":\"".$pic."\",";
|
||||
$data_str.="\"pic_big\":\"".$pic_b."\",";
|
||||
$data_str.="\"js\":\"".$m["num"]."\",";
|
||||
$je=keep_float(deel_cf($m["je"],10000),2);
|
||||
$data_str.="\"je\":\"".$je."\",";
|
||||
$jsje=keep_float(deel_cf($m["jsje"],10000),2);
|
||||
$data_str.="\"jsje\":\"".$jsje."\"";
|
||||
$data_str.="},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"data\":[".deel_end($data_str)."],";
|
||||
break;
|
||||
case 'ksph': //单色排行
|
||||
$q="select no,color,sum(num) num,sum(je) je,sum(jsje) jsje from web_order where ka<>'y' group by no,color order by num desc";
|
||||
$r=$db->query($q);
|
||||
$data_str="";
|
||||
$px=1;
|
||||
while($m=$db->fetch_array($r)){
|
||||
if($hs>=$px){
|
||||
$pic=get_kh_color_picture($m["no"],$m["color"],$flag_pad_offline);
|
||||
$pic_b=get_kh_color_picture_big($m["no"],$m["color"],$flag_pad_offline);
|
||||
$data_str.="{";
|
||||
$data_str.="\"px\":\"".$px++."\",";
|
||||
$data_str.="\"no\":\"".$m["no"]."\",";
|
||||
$data_str.="\"color\":\"".$m["color"]."\",";
|
||||
$data_str.="\"color_title\":\"".get_cate_title_no("color",$m["color"])."\",";
|
||||
$data_str.="\"pic\":\"".$pic."\",";
|
||||
$data_str.="\"pic_big\":\"".$pic_b."\",";
|
||||
$data_str.="\"js\":\"".$m["num"]."\",";
|
||||
$je=keep_float(deel_cf($m["je"],10000),2);
|
||||
$data_str.="\"je\":\"".$je."\",";
|
||||
$jsje=keep_float(deel_cf($m["jsje"],10000),2);
|
||||
$data_str.="\"jsje\":\"".$jsje."\"";
|
||||
$data_str.="},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"data\":[".deel_end($data_str)."],";
|
||||
break;
|
||||
case 'ddzz': //大单追踪
|
||||
$zzl=100;
|
||||
$time_now=date("Y-m-d");
|
||||
|
||||
$t1=$time_now." 00:00:00";
|
||||
$t2=$time_now." 23:59:59";
|
||||
|
||||
|
||||
$q="select * from web_log_hd where num>".$zzl." and (add_date between '".$t1."' and '".$t2."' )";
|
||||
|
||||
|
||||
$r=$db->query($q);
|
||||
$data_str="";
|
||||
$px=1;
|
||||
while($m=$db->fetch_array($r)){
|
||||
if($hs>=$px){
|
||||
$msg=get_db_msg("select * from web_kh where id='".$m["iid"]."'");
|
||||
$dp=get_db_msg("select * from web_client where id='".$m["uid"]."'");
|
||||
$pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline);
|
||||
$pic_b=get_kh_picture_big($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline);
|
||||
$data_str.="{";
|
||||
$data_str.="\"px\":\"".$px++."\",";
|
||||
$data_str.="\"no\":\"".$msg["no"]."\",";
|
||||
$data_str.="\"pic\":\"".$pic."\",";
|
||||
$data_str.="\"pic_big\":\"".$pic_b."\",";
|
||||
$data_str.="\"js\":\"".$m["num"]."\",";
|
||||
$data_str.="\"dp\":\"".$dp["title"]."\",";
|
||||
$data_str.="\"time\":\"".$m["add_date"]."\"";
|
||||
$data_str.="},";
|
||||
}
|
||||
}
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"data\":[".deel_end($data_str)."],";
|
||||
break;
|
||||
default:
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
//-------------------------------订单概览-界面
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=check_cookie_jxs();
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
switch($_a){
|
||||
default:
|
||||
$json_data.="\"code\":100,";
|
||||
//客户详细
|
||||
$tmp_c1=get_db_msg("select count(*) 'rs' from web_client where face='4'");
|
||||
$tmp_c2=get_db_msg("select count(*) 'rs' from web_client where order_num=0 and face='4'");
|
||||
$tmp_c3=get_db_msg("select * from web_client where face='3' order by order_num desc limit 0,1");
|
||||
$json_data.="\"client_dt\":[\"".$tmp_c1["rs"]."\",\"".$tmp_c2["rs"]."\",\"".$tmp_c3["title"]."\",\"".$tmp_c3["order_num"]."\",\"".$tmp_c3["order_money"]."\"],";
|
||||
//款式详细
|
||||
$tmp_k1=get_db_msg("select count(*) 'ks' from web_kh");
|
||||
$tmp_k2=get_db_msg("select count(*) 'kska' from web_kh where ka='y'");
|
||||
//
|
||||
$count_ks=0;
|
||||
$count_kska=0;
|
||||
$sql_k3="select b.no 'color',a.color_ka from web_kh as a left join web_keyword as b on concat(',',a.color,',') like concat('%,',b.no,',%') and b.cate='color'";
|
||||
$res_k3=$db->query($sql_k3);
|
||||
while($msg_k3=$db->fetch_array($res_k3)){
|
||||
if($msg_k3["color_ka"]){
|
||||
$arr1=explode(',',$msg_k3["color_ka"]);
|
||||
if(in_array($msg_k3["color"],$arr1)){
|
||||
$count_kska++;
|
||||
}
|
||||
}
|
||||
$count_ks++;
|
||||
}
|
||||
$sql_k4=get_db_msg("select count(*) 'ks' from (select a.no,if( sum(b.num) >0, sum(b.num) ,0) 'js' from web_kh as a left join web_order as b on a.id=b.iid where b._key='".$_key."' group by a.id) as c where c.js=0");
|
||||
$json_data.="\"ks_dt\":[\"".$tmp_k1["ks"]."\",\"".$count_ks."\",\"".$tmp_k2["kska"]."\",\"".$sql_k4["ks"]."\",\"".$count_kska."\"],";
|
||||
|
||||
$s_con_time=$s_con_time?$s_con_time:"half_day";
|
||||
//取得数据
|
||||
if($s_con_time=="day"){
|
||||
$sql_time="substring(add_date,1,11)";
|
||||
}else if($s_con_time=="half_day"){
|
||||
$sql_time="concat(substring(add_date,1,11),' ',case when substring(add_date,12,2)<13 then '1' when substring(add_date,12,2)<19 then '2' else '3' end)";
|
||||
}
|
||||
|
||||
//内容
|
||||
$q="select sum(case when action in (21,23) then num when action in (22,24) then -num else 0 end) 'num_1',".$sql_time." '_d' from ".$table_pre."log_hd where action>20 and action<25 group by _d order by _d";
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
$total1=0;
|
||||
$arr1=$arr_label=array();
|
||||
$i=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_label[$i]=deel_date_format($s_con_time,$m["_d"]);
|
||||
$arr1[$i]=$m["num_1"];
|
||||
$total1+=$m["num_1"];
|
||||
$i++;
|
||||
}
|
||||
$tb_data_x="";
|
||||
$tb_data_y=",";
|
||||
for($i=0;$i<count($arr1);$i++){
|
||||
$tb_data_x.=$arr_label[$i].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($arr1[$i],$total1)).",";
|
||||
}
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$tb_data_x=deel_end($tb_data_x);
|
||||
$json_data.="\"chart_title\":\"订单量分布\",";
|
||||
$json_data.="\"chart_type\":\"pie\",";
|
||||
$json_data.="\"chart_data_x\":\"".$tb_data_x."\",";
|
||||
$json_data.="\"chart_data_y\":\"".$tb_data_y."\",";
|
||||
|
||||
//-----------------------------表二
|
||||
$arr_zd=array("1"=>"订单量");
|
||||
$s_con_time2=$s_con_time2?$s_con_time2:"day";
|
||||
//组合条件
|
||||
if($s_con_time2=="day"){
|
||||
$sql_time="substring(add_date,1,11)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else{
|
||||
$sql_time="concat(substring(add_date,1,11),' ',case when substring(add_date,12,2)<13 then '1' when substring(add_date,12,2)<19 then '2' else '3' end)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}
|
||||
|
||||
|
||||
//取得时间段数据
|
||||
$q="select ".$sql_time." as '_t' from ".$table_pre."log_hd".$con_hour." group by _t order by _t";
|
||||
$r=$db->query($q);
|
||||
$arr_sjd=array();
|
||||
$tb_data_x2="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_sjd[]=$m["_t"];
|
||||
$tb_data_x2.=deel_date_format($s_con_time,$m["_t"]).",";
|
||||
}
|
||||
$tb_data_x2=deel_end($tb_data_x2);
|
||||
|
||||
//取得数据
|
||||
$q="select b.iid 'iid',sum(case when b.action in (21,23) then b.num when b.action in (22,24) then -b.num else 0 end) 'num_1',count(distinct b.uid) 'num_2' from ".$table_pre."log_hd b where b.action>20 and b.action<25 group by b.iid order by num_1 desc";
|
||||
$r=$db->query($q);
|
||||
$i=0;
|
||||
$total_num=0;
|
||||
$arr_data_js=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
//
|
||||
$data_tb_v1="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$m1=get_db_msg("select sum(case when action in (21,23) then num when action in (22,24) then -num else 0 end) 'num_1',count(distinct uid) 'num_2' from ".$table_pre."log_hd where iid='".$m["iid"]."' and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
$data_tb_v1.=add_0($m1["num_1"]).",";
|
||||
}
|
||||
$arr_data_js[$m["iid"]]=deel_end($data_tb_v1);
|
||||
$i++;
|
||||
}
|
||||
|
||||
//计算标准差
|
||||
$arr_pc=array();
|
||||
$i=0;
|
||||
foreach($arr_data_js as $iid => $str_data_js){
|
||||
$arr_pc[$iid]=get_pc(explode(",",$str_data_js));
|
||||
$i++;
|
||||
}
|
||||
//内容
|
||||
$i=0;
|
||||
|
||||
foreach($arr_pc as $iid => $pc){
|
||||
$arr_tmp_js=explode(",",$arr_data_js[$iid]);
|
||||
for($i1=0;$i1<count($arr_tmp_js);$i1++){
|
||||
$num_1=$arr_tmp_js[$i1];
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$var="num_".$arr_s_zd[$j];
|
||||
}
|
||||
$v="hj_".$i1;
|
||||
$$v+=$num_1;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$data_tb_v1="";
|
||||
$content1="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$var="hj_".$i1;
|
||||
if($i1==0)
|
||||
$data_tb_v1.=get_main_value($arr_zd,"1").",";
|
||||
$data_tb_v1.=add_0($$var).",";
|
||||
}
|
||||
|
||||
//输出图表数据
|
||||
$data_tb_v1=deel_end($data_tb_v1);
|
||||
$tb_data_y2="";
|
||||
if($data_tb_v1)
|
||||
$tb_data_y2.=$data_tb_v1."|";
|
||||
$tb_data_y2=deel_end($tb_data_y2);
|
||||
$json_data.="\"chart_title2\":\"订单趋势图\",";
|
||||
$json_data.="\"chart_type2\":\"line\",";
|
||||
$json_data.="\"chart_data_x2\":\"".$tb_data_x2."\",";
|
||||
$json_data.="\"chart_data_y2\":\"".$tb_data_y2."\",";
|
||||
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,612 @@
|
||||
<?php
|
||||
//-------------------------------单款订货
|
||||
/*
|
||||
店铺和区经角色
|
||||
*/
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
|
||||
$uid=check_cookie_jxs();
|
||||
//$db=_mysql_connect();
|
||||
//系统变量
|
||||
$sys_close=get_set("sys_close");
|
||||
$sys_close_image=get_set("sys_close_image");
|
||||
$is_session=get_set("is_session");
|
||||
$zb_type=get_set("zb_type");
|
||||
$is_spk=get_set("is_spk");
|
||||
$zbxf=get_set("zbxf");
|
||||
$zbxf_type=get_set("zbxf_type");
|
||||
$sys_ms=get_set("sys_ms");
|
||||
$is_msg=get_set("is_msg");
|
||||
$is_ewm=get_set("is_ewm");
|
||||
$is_window="y";
|
||||
$zk_type=get_set("zk_type");
|
||||
$is_hd_log=get_set("is_hd_log");
|
||||
$xh_ms=get_set("xh_ms");
|
||||
$order_session=get_set("order_session");
|
||||
$sys_size_num=get_max_size_num();
|
||||
$theme_path=get_theme_path();
|
||||
$is_sy=get_set("is_sy");
|
||||
|
||||
$sys_ck_input=get_set("sys_ck_input");
|
||||
|
||||
$tmpl_m1_page_size=12;
|
||||
$tmpl_m1_lie=4;
|
||||
$tmpl_m1_pic_width=188;
|
||||
$tmpl_m1_pic_height=250;
|
||||
$tmpl_m1_search_con_num=5;
|
||||
$tmpl_m2_dp_pic_width=400;
|
||||
$tmpl_m2_dp_pic_height=300;
|
||||
$json_data.="\"sys_ver_hy\":\"".$sys_ver_hy."\",";
|
||||
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
if($msg_login["available"]!="y"){
|
||||
$json_data.="\"error\":\"用户已被禁用\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
|
||||
}else{
|
||||
$json_data.="\"face\":\"".$msg_login["face"]."\",";
|
||||
$json_data.="\"uid\":\"".$msg_login["id"]."\",";
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
$rurl=$rurl?$rurl:get_this_url();
|
||||
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
|
||||
$zb_client_show=get_set("zb_client_show");
|
||||
if($zb_client_show=="y")
|
||||
$arr_zb_type=explode(",",$zb_type);
|
||||
else
|
||||
$arr_zb_type=array();
|
||||
$is_brand=is_brand();
|
||||
$show_jd=get_set("show_jd");
|
||||
$is_dkds=get_set("is_dkds");
|
||||
$is_multi_price=get_set("is_multi_price");
|
||||
$order_close=get_set("order_close");
|
||||
$search_type=get_set("search_type");
|
||||
|
||||
|
||||
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
||||
$json_data.="\"is_dkds\":\"".$is_dkds."\",";
|
||||
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
||||
$json_data.="\"is_multi_price\":\"".$is_multi_price."\",";
|
||||
$json_data.="\"username\":\"".$msg_login["username"]."\",";
|
||||
$json_data.="\"is_sy\":\"".$is_sy."\",";
|
||||
|
||||
|
||||
if($is_brand=="y")
|
||||
$link_var_brand="&s_brand=".$s_brand;
|
||||
else
|
||||
$link_var_brand="";
|
||||
$title_brand=$con_brand="";
|
||||
if($s_brand){
|
||||
$arr_s_brand=explode(",",$s_brand);
|
||||
for($i=0;$i<count($arr_s_brand);$i++){
|
||||
$con_brand.="brand='".$arr_s_brand[$i]."' or ";
|
||||
$title_brand.=get_cate_title_no("brand",$arr_s_brand[$i]).",";
|
||||
}
|
||||
if($title_brand)
|
||||
$title_brand=substr($title_brand,0,-1);
|
||||
if($con_brand)
|
||||
$con_brand=" and (".substr($con_brand,0,-3).")";
|
||||
}
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
//文胸
|
||||
if($bx_sizegroup_title){
|
||||
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
|
||||
$bx_sizegroup_id=$tmp["id"];
|
||||
}else{
|
||||
$bx_sizegroup_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;
|
||||
}
|
||||
$con_spk=($is_spk=="y")?" and is_sp<>'y'":"";
|
||||
$flag_spk=($is_spk=="y")?"1":"";
|
||||
//------------------------------------包含定制模块,店铺界面,顶部已订数和完成率的显示
|
||||
//include_once $path_dz."/dp/wcl.php";
|
||||
//
|
||||
//--------------交单按钮
|
||||
$jd_password=get_set("jd_password");
|
||||
if($is_brand<>"y"){
|
||||
$tmp=$msg_login;
|
||||
$is_jd=$msg_login["is_jd"];
|
||||
$is_checked=$msg_login["is_checked"];
|
||||
}else{
|
||||
$tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_jd limit 0,1");
|
||||
$is_jd=$tmp["is_jd"];
|
||||
$tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_checked limit 0,1");
|
||||
$is_checked=$tmp["is_checked"];
|
||||
}
|
||||
if($show_jd=="y"){
|
||||
if($is_jd=="y")
|
||||
$jd_button="已交单|";
|
||||
if($is_checked=="y")
|
||||
$jd_button="已确认|";
|
||||
if($is_brand=="y"){
|
||||
$jd_button="交单|go_url('".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=o&s_tab=wcl')";
|
||||
}else{
|
||||
if($is_jd!="y" && $is_checked!="y")
|
||||
$jd_button="交单|do_jd('".$jd_password."','".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=jd".$link_var_brand."')";
|
||||
}
|
||||
}else{
|
||||
|
||||
$jd_button="|";
|
||||
}
|
||||
//计算订货规则按钮
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."gz where dj='' or dj='".$msg_login["dj"]."'");
|
||||
if($tmp["num"]>0)
|
||||
$menu_dhgz="订货规则";
|
||||
else
|
||||
$menu_dhgz="";
|
||||
|
||||
|
||||
switch($_a){
|
||||
case "single":
|
||||
$msg_err="";
|
||||
$msg_cc=get_db_msg("select * from ".$table_pre."kh_cc where zsh='".$zsh."'");
|
||||
/*if(!$msg_cc["id"]){
|
||||
//echo_wrong("数据不存在!");
|
||||
$msg_err="数据不存在!";
|
||||
}
|
||||
if($msg_err){
|
||||
$json_data.="\"error\":\"".$msg_err."\",";
|
||||
}else{*/
|
||||
$s_title=trim($s_title);
|
||||
if($s_title){
|
||||
$msg_dp=get_db_msg("select * from ".$table_pre."kh_cc where title like '%".$s_title."%' order by zsh,ord limit 0,1");
|
||||
$m1=get_db_msg("select count(distinct zsh) 'num' from ".$table_pre."kh_cc where title like '%".$s_title."%'");
|
||||
$q1="select * from ".$table_pre."kh_cc where title like '%".$s_title."%' group by zsh order by zsh";
|
||||
//
|
||||
$tmp=get_db_msg("select min(zsh) 'zsh' from ".$table_pre."kh_cc where title like '%".$s_title."%'");
|
||||
$zsh=$tmp["zsh"];
|
||||
}else{
|
||||
if($zsh){
|
||||
$msg_dp=get_db_msg("select * from ".$table_pre."kh_cc where zsh='".$zsh."' order by ord");
|
||||
}else{
|
||||
$tmp=get_db_msg("select min(zsh) 'zsh' from ".$table_pre."kh_cc");
|
||||
$zsh=$tmp["zsh"];
|
||||
$msg_dp=get_db_msg("select * from ".$table_pre."kh_cc where zsh='".$zsh."' order by ord");
|
||||
}
|
||||
$m1=get_db_msg("select count(distinct zsh) 'num' from ".$table_pre."kh_cc where zsh='".$zsh."'");
|
||||
$q1="select * from ".$table_pre."kh_cc where zsh='".$zsh."' group by zsh order by zsh";
|
||||
}
|
||||
//if(!$msg_dp["id"])
|
||||
//echo_wrong("记录不存在!");
|
||||
$str_title="";
|
||||
if($m1["num"]>1){
|
||||
$r2=$db->query($q1);
|
||||
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
//$str_title.="<a href=\"?_m=dp_single&zsh=".$m2["zsh"]."&rurl=".urlencode($back_url)."\">".$m2["zsh"]."#".$m2["title"]."</a> ";
|
||||
$msg_err.=$m2["zsh"]."#".$m2["title"]."|";
|
||||
$str_title.="{\"zsh\":\"".$m2["zsh"]."\",\"title\":\"".$m2["zsh"]."#".$m2["title"]."\"},";
|
||||
}
|
||||
if($msg_err){
|
||||
$str_title=deel_end($str_title);
|
||||
$msg_err="存在以下符合条件的多个款:".$msg_err;
|
||||
}
|
||||
//echo_wrong("<div width=\"100%\" align=\"left\" style=\"line-height:25px;\">找到以下符合条件的多项,请选择:<br>".$str_title."<div>");
|
||||
}
|
||||
if(!$msg_dp["id"]){
|
||||
$msg_err="记录不存在";
|
||||
}
|
||||
if($msg_err){
|
||||
if($str_title){
|
||||
$json_data.="\"code\":101,";
|
||||
$json_data.="\"msg\":[".$str_title."],";
|
||||
}else{
|
||||
$json_data.="\"code\":102,";
|
||||
$json_data.="\"msg\":\"".$msg_err."\",";
|
||||
}
|
||||
}else{
|
||||
$json_data.="\"code\":100,";
|
||||
$json_data.="\"sys_ck_input\":\"".$sys_ck_input."\",";
|
||||
//橱窗选项
|
||||
$q="select * from ".$table_pre."kh_cc group by zsh order by zsh";
|
||||
$r=$db->query($q);
|
||||
$op_cc="";
|
||||
$select_dz="";
|
||||
$tmp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_cc.="<option value=\"".$m["zsh"]."\"";
|
||||
if($zsh==$m["zsh"]){
|
||||
$op_cc.=" selected";
|
||||
}
|
||||
$op_cc.=">".$m["title"]."</option>";
|
||||
$tmp.="{\"no\":\"".$m["zsh"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$select_dz="{\"no\":\"cc\",\"title\":\"橱窗\",\"value\":\"".$zsh."\",\"op\":[".$tmp."]},";
|
||||
$select_dz=deel_end($select_dz);
|
||||
$json_data.="\"select_cc\":[".$select_dz."],";
|
||||
//
|
||||
$dis="";
|
||||
if($msg_login["is_jd"]=="y" || $msg_login["is_checked"]=="y")
|
||||
$dis=" disabled";
|
||||
$json_data.="\"btn_dis\":\"".$dis."\",";
|
||||
$json_data.="\"zsh\":\"".$zsh."\",";
|
||||
//取得内容
|
||||
$content="<div id='content' style='background-color:#ffffff;color:#000000;padding:10px;' width='100%'>";
|
||||
$content.="<div align=\"left\" style='padding:4px;'>批量<input type=\"number\" name=\"pl_num\" id=\"pl_num\" value=\"\" style=\"width:40px;height:25px;\"".$dis."> <input type=\"button\" value=\" 应 用 \" onclick=\"set_cc_pl()\"".$dis."><input type=\"reset\" value=\" 还 原 \"".$dis."></div>";
|
||||
$content.="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"#333333\">";
|
||||
$content.="<tr bgcolor=\"#cccccc\"><td>图片</td><td>款号信息</td><td>尺码明细</td></tr>";
|
||||
$q="select * from ".$table_pre."kh_cc where zsh='".$zsh."' order by ord";
|
||||
$r=$db->query($q);
|
||||
$str_js_arr="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
//验证款号,颜色是否存在
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m["kh"]."' and ka<>'y'");
|
||||
$msg_pj=get_db_msg("select * from ".$table_pre."client_pj where khid='".$m_kh["id"]."' and cid='".$uid."'");
|
||||
if($msg_pj["id"]>0){
|
||||
$pj_remark=dhtmlchars($msg_pj["remark"]);
|
||||
$race=$msg_pj["race"];
|
||||
|
||||
}else{
|
||||
$pj_remark="";
|
||||
$race=0;
|
||||
}
|
||||
$arr_color=explode(",",$m_kh["color"]);
|
||||
$arr_color_ka=explode(",",$m_kh["color_ka"]);
|
||||
if(in_array($m["color"],$arr_color,true) && !in_array($m["color"],$arr_color_ka,true)){
|
||||
//款号颜色存在,且没有被设置删除
|
||||
$arr_size=explode(",",$m["size"]);
|
||||
$arr_size_check=explode(",",$m_kh["size"]);
|
||||
$tmp1="";
|
||||
$str_size="<table><tr>";
|
||||
$js_str_size="";
|
||||
for($k=0;$k<count($arr_size);$k++){
|
||||
//
|
||||
$m_size=get_db_msg("select * from ".$table_pre."size where iid='".$m_kh["size_group"]."' and title='".$arr_size[$k]."'");
|
||||
if(in_array($m_size["no"],$arr_size_check)){
|
||||
//取得已订数量
|
||||
$tmp=get_db_msg("select * from ".$table_pre."order where uid='".$uid."' and iid='".$m_kh["id"]."' and color='".$m["color"]."' and _key='".$_key."'");
|
||||
$str_size.="<td>".$arr_size[$k]."</td><td><input type=\"number\" style=\"width:30px;height:20px;\" name=\"num_".$m_kh["id"]."_".$m["color"]."_".$m_size["no"]."\" id=\"num_".$m_kh["id"]."_".$m["color"]."_".$m_size["no"]."\" value=\"".deel_0($tmp["num_".$m_size["no"]])."\"".$dis."> </td>";
|
||||
//$js_str_size.=$m_size["no"].",";
|
||||
$js_str_size.="{\"id\":\"num_".$m_kh["id"]."_".$m["color"]."_".$m_size["no"]."\",\"no\":\"".$m_size["no"]."\",\"cm\":\"".$arr_size[$k]."\",\"value\":\"".deel_0($tmp["num_".$m_size["no"]])."\"},";
|
||||
}
|
||||
}
|
||||
$js_str_size=deel_end($js_str_size);
|
||||
$str_size.="</tr></table>";
|
||||
$pic=get_kh_picture($m["kh"],$m_kh["main_pic"],$m["color"]);
|
||||
$content.="<tr bgcolor=\"#ffffff\"><td width=\"110\" align=\"center\" style=\"cursor:pointer;\" onclick=\"window.location.href='?_m=order_single&id=".$m_kh["id"]."&color=".$m["color"]."&rurl=".urlencode("?_m=".$_m."&zsh=".$zsh)."'\">".out_good_pic($pic,60,60)."</td>";
|
||||
$content.="<td>".get_kh_xh($m_kh,$m["color"])."#".$m["kh"]."<br>".$m["color"]."-".get_cate_title_no("color",$m["color"])."</span></td><td>".$str_size."</td>";
|
||||
$content.="</tr>";
|
||||
//$str_js_arr.="".$m_kh["id"].",";
|
||||
//$str_js_arr.="\"".$m["color"]."\",";
|
||||
//$str_js_arr.="[".$js_str_size."],";
|
||||
$ck=out_good_pic_set_arr($pic,60,60);
|
||||
$str_js_arr.="{\"khid\":".$m_kh["id"].",\"color\":\"".$m["color"]."\",\"colort\":\"".get_cate_title_no("color",$m["color"])."\",\"xj\":\"".$race."\",\"pjwz\":\"".$pj_remark."\",\"xh\":\"".get_kh_xh($m_kh,$m["color"])."\",\"kh\":\"".$m["kh"]."\",\"pic\":\"".$pic."\",\"pic_w\":".$ck[0].",\"pic_h\":".$ck[1].",\"data\":[".$js_str_size."]},";
|
||||
}
|
||||
}
|
||||
$str_js_arr=deel_end($str_js_arr);
|
||||
$json_data.="\"ccs\":[".$str_js_arr."],";
|
||||
|
||||
$content.="</table><div align=\"center\" style=\"padding:4px;\"><input type=\"submit\" id=\"save1\" value=\" 保 存 订 单 \"".$dis."></div>";
|
||||
$content.="</div>";
|
||||
$content.="</div>";
|
||||
/*//橱窗选项
|
||||
$q="select zsh,title from ".$table_pre."kh_cc group by zsh order by zsh";
|
||||
$r=$db->query($q);
|
||||
$op_cc="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$t=trim($m["title"])?$m["zsh"].".".$m["title"]:$m["zsh"];
|
||||
$op_cc.="<option value=\"".$m["zsh"]."\"";
|
||||
if($m["zsh"]==$zsh)
|
||||
$op_cc.=" selected";
|
||||
$op_cc.=">".$t."</option>";
|
||||
}*/
|
||||
//上一组、下一组
|
||||
$pre_xh=get_db_msg("select zsh from ".$table_pre."kh_cc where zsh<'".$zsh."' order by zsh desc limit 0,1");
|
||||
$tmp_click=($pre_xh["zsh"])>0?"window.location.href='".$_SERVER[PHP_SELF]."?_m=".$_m."&zsh=".$pre_xh["zsh"]."&rurl=".urlencode($rurl)."'":"alert('已经是第一组了!')";
|
||||
$button_syz="<input type=\"button\" class=\"order_single_button\" style=\"background:url(".$theme_path."/images/order_single_button_bg.png) center center no-repeat;\" value=\"上一组\" onclick=\"".$tmp_click."\">";
|
||||
$next_xh=get_db_msg("select zsh from ".$table_pre."kh_cc where zsh>'".$zsh."' order by zsh limit 0,1");
|
||||
$tmp_click=($next_xh["zsh"])>0?"window.location.href='".$_SERVER[PHP_SELF]."?_m=".$_m."&zsh=".$next_xh["zsh"]."&rurl=".urlencode($rurl)."'":"alert('已经是最后一组了!')";
|
||||
$button_xyz="<input type=\"button\" class=\"order_single_button\" style=\"background:url(".$theme_path."/images/order_single_button_bg.png) center center no-repeat;\" value=\"下一组\" onclick=\"".$tmp_click."\">";
|
||||
$json_data.="\"prev\":\"".$pre_xh["zsh"]."\",";
|
||||
$json_data.="\"next\":\"".$next_xh["zsh"]."\",";
|
||||
//include template("cc_single");
|
||||
$ccpic=get_kh_cc_big($msg_cc["pic"],$flag_pad_offline);
|
||||
$tmppic=out_good_pic_set_arr($ccpic,400,300);
|
||||
$json_data.="\"pic_big\":\"".$ccpic."\",";
|
||||
$json_data.="\"pic_big_w\":\"".$tmppic[0]."\",";
|
||||
$json_data.="\"pic_big_h\":\"".$tmppic[1]."\",";
|
||||
}
|
||||
break;
|
||||
case "save":
|
||||
$msg_err="";
|
||||
if($order_close=="y"){
|
||||
//alert_and_back("订单保存失败,原因是系统订单已经关闭!");
|
||||
$msg_err="订单保存失败,原因是系统订单已经关闭!";
|
||||
}
|
||||
if($msg_login["is_checked"]=="y" && !$msg_err){
|
||||
//alert_and_back("订单保存失败,原因是本用户订单已经确认!");
|
||||
$msg_err="订单保存失败,原因是本用户订单已经确认!";
|
||||
}
|
||||
if($msg_login["is_jd"]=="y" && !$msg_err){
|
||||
//alert_and_back("订单保存失败,原因是本用户订单已经提交!");
|
||||
$msg_err="订单保存失败,原因是本用户订单已经提交!";
|
||||
}
|
||||
//判断代理
|
||||
$dl_uid=get_dl_id($msg_login["path"]);
|
||||
if($dl_uid>0){
|
||||
$msg_dl=get_db_msg("select * from ".$table_pre."client where id='".$dl_uid."'");
|
||||
if($msg_dl["is_jd"]=="y" && !$msg_err){
|
||||
//alert_and_back("订单保存失败,原因是您的代理已经提交!");
|
||||
$msg_err="订单保存失败,原因是您的代理已经提交!";
|
||||
}
|
||||
if($msg_dl["is_checked"]=="y" && !$msg_err){
|
||||
//alert_and_back("订单保存失败,原因是您的代理订单已经确认!");
|
||||
$msg_err="订单保存失败,原因是您的代理订单已经确认!";
|
||||
}
|
||||
}
|
||||
|
||||
/*//---------------判断订货规则
|
||||
$errm="";
|
||||
$q="select * from ".$table_pre."kh_cc where zsh='".$zsh."' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
//验证款号,颜色是否存在
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m["kh"]."' and ka<>'y'");
|
||||
$arr_color=explode(",",$m_kh["color"]);
|
||||
$arr_color_ka=explode(",",$m_kh["color_ka"]);
|
||||
$arr_size_check=explode(",",$m_kh["size"]);
|
||||
if(in_array($m["color"],$arr_color,true) && !in_array($m["color"],$arr_color_ka,true)){
|
||||
$num1=0;
|
||||
for($k=0;$k<count($arr_size_check);$k++){
|
||||
$var="num_".$m_kh["id"]."_".$m["color"]."_".$arr_size_check[$k];
|
||||
$num1+=$$var;
|
||||
}
|
||||
$errm.=check_dhgz_bdks($m_kh,$m["color"],$num1);
|
||||
$errm.=check_dhgz_qdl($m_kh,$m["color"],$num1);
|
||||
//检查款号规则
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and no='".$m["kh"]."' and color<>'".$m["color"]."' and _key='".$_key."'");
|
||||
$tmp_kh_num=$tmp["num"]+$num1;
|
||||
$errm.=check_dhgz_bdk($m_kh,$tmp_kh_num);
|
||||
$errm.=check_dhgz_qdl($m_kh,"",$tmp_kh_num);
|
||||
$errm.=check_dhgz_glk($m_kh["no"],$tmp_kh_num,$str_kh_num);
|
||||
}
|
||||
}
|
||||
for($i=0;$i<count($arr_ks_bx_num);$i++){
|
||||
$v_khid="khid_".$i;
|
||||
$v_color="color_".$i;
|
||||
$msg=get_db_msg("select * from ".$table_pre."kh where id='".$$v_khid."'");
|
||||
$num1=0;
|
||||
for($j=0;$j<$arr_ks_bx_num[$i];$j++){
|
||||
for($s1=1;$s1<=$sys_size_num;$s1++){
|
||||
$var1="num".$k."_".$s1;
|
||||
$num1+=$$var1;
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
$errm.=check_dhgz_bdks($msg,$$v_color,$num1);
|
||||
$errm.=check_dhgz_qdl($msg,$$v_color,$num1);
|
||||
//检查款号规则
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$$v_khid."' and color<>'".$$v_color."' and _key='".$_key."'");
|
||||
$tmp_kh_num=$tmp["num"]+$num1;
|
||||
$errm.=check_dhgz_bdk($msg,$tmp_kh_num);
|
||||
$errm.=check_dhgz_qdl($msg,"",$tmp_kh_num);
|
||||
$errm.=check_dhgz_glk($msg["no"],$tmp_kh_num,$str_kh_num);
|
||||
}
|
||||
if(!$msg_err){
|
||||
$msg_err=$errm;
|
||||
}*/
|
||||
|
||||
if($msg_err){
|
||||
//echo $msg_err;
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg_err."\",";
|
||||
}else{
|
||||
|
||||
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$q1="select no from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_select_no[]=$m1["no"];
|
||||
}
|
||||
//保存订单
|
||||
$q="select * from ".$table_pre."kh_cc where zsh='".$zsh."' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
//验证款号,颜色是否存在
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m["kh"]."' and ka<>'y'");
|
||||
$arr_color=explode(",",$m_kh["color"]);
|
||||
$arr_color_ka=explode(",",$m_kh["color_ka"]);
|
||||
if(in_array($m["color"],$arr_color,true) && !in_array($m["color"],$arr_color_ka,true)){
|
||||
//
|
||||
$tmp_total_num=0;
|
||||
//款号颜色存在,且没有被设置删除
|
||||
$arr_size=explode(",",$m["size"]);
|
||||
$arr_size_check=explode(",",$m_kh["size"]);
|
||||
//
|
||||
$sql1=$sql2="";
|
||||
for($i1=0;$i1<count($arr_select_no);$i1++){
|
||||
$sql1.=$arr_select_no[$i1].",";
|
||||
$sql2.="'".$m_kh[$arr_select_no[$i1]]."',";
|
||||
}
|
||||
//
|
||||
$sql_size2=$sql_size3="";
|
||||
for($k=0;$k<count($arr_size_check);$k++){
|
||||
$var="num_".$m_kh["id"]."_".$m["color"]."_".$arr_size_check[$k];
|
||||
$sql_size2.=",'".deel_num($$var)."'";
|
||||
$tmp_total_num+=$$var;
|
||||
$sql_size3.=",num_".$arr_size_check[$k];
|
||||
}
|
||||
$tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$m_kh["id"]."' and _key='".$_key."'");
|
||||
$log_hd_old_num1=$tmp_old["num"];
|
||||
$log_hd_old_num=0;
|
||||
for($k=0;$k<count($arr_size);$k++){
|
||||
//
|
||||
$m_size=get_db_msg("select * from ".$table_pre."size where iid='".$m_kh["size_group"]."' and title='".$arr_size[$k]."'");
|
||||
$check=get_db_msg("select id from ".$table_pre."order where uid='".$uid."' and iid='".$m_kh["id"]."' and color='".$m["color"]."' and _key='".$_key."'");
|
||||
if(in_array($m_size["no"],$arr_size_check)){
|
||||
|
||||
$tmp=get_db_msg("select num_".$m_size["no"]." from ".$table_pre."order where uid='".$uid."' and iid='".$m_kh["id"]."' and _key='".$_key."'");
|
||||
$log_hd_old_num+=$tmp["num_".$m_size["no"]];
|
||||
//
|
||||
$var="num_".$m_kh["id"]."_".$m["color"]."_".$m_size["no"];
|
||||
if($check["id"]>0){
|
||||
$q1="update ".$table_pre."order set num_".$m_size["no"]."='".$$var."' where id='".$check["id"]."'";
|
||||
$db->query($q1);
|
||||
update_order_log($uid,"update ".$table_pre."order set num_".$m_size["no"]."='".$$var."' where uid='".$uid."' and iid='".$m_kh["id"]."' and color='".$m["color"]."' and _key='".$_key."'");
|
||||
}else{
|
||||
if($$var>0){
|
||||
$q1="insert into ".$table_pre."order (uid,upath,iid,no,".$sql1."jgd,color,bx,is_sp,size_group_id".$sql_size3.",_key,sx,add_date) values ('".$uid."','".$upath."','".$m_kh["id"]."','".$m_kh["no"]."',".$sql2."'".get_jgd($m_kh["price"])."','".$m["color"]."','','".$m_kh["is_sp"]."','".$m_kh["size_group"]."'".$sql_size2.",'".$_key."','".get_sx($m["color"])."','".time()."')";
|
||||
$db->query($q1);
|
||||
update_order_log($uid,"insert into ".$table_pre."order (uid,upath,iid,no,".$sql1."jgd,color,bx,is_sp,size_group_id".$sql_size3.",_key,sx,add_date) values ('".$uid."','".$upath."','".$m_kh["id"]."','".$m_kh["no"]."',".$sql2."'".get_jgd($m_kh["price"])."','".$m["color"]."','','".$m_kh["is_sp"]."','".$m_kh["size_group"]."'".$sql_size2.",'".$_key."','".get_sx($m["color"])."','".time()."')");
|
||||
}
|
||||
}
|
||||
//echo $q1."<br>";
|
||||
}
|
||||
}
|
||||
$flag_action="";
|
||||
$khid=$m_kh["id"];
|
||||
$log_hd_num=$tmp_total_num-$log_hd_old_num;
|
||||
if($log_hd_num!=0){
|
||||
if($log_hd_num>0){
|
||||
if($log_hd_old_num1==0)
|
||||
$flag_action="21";
|
||||
else
|
||||
$flag_action="23";
|
||||
}else{
|
||||
$flag_action="22";
|
||||
}
|
||||
//删除为0的数据
|
||||
if($check["id"]>0){
|
||||
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$m_kh["id"]."' and color='".$m["color"]."' and _key='".$_key."'");
|
||||
if($tmp["num"]==0){
|
||||
$db->query("delete from ".$table_pre."order where id='".$check["id"]."'");
|
||||
update_order_log($uid,"delete from ".$table_pre."order where uid='".$uid."' and iid='".$m_kh["id"]."' and color='".$m["color"]."'");
|
||||
$flag_action="24";
|
||||
}
|
||||
}
|
||||
update_log_hd();
|
||||
}
|
||||
cache_order($uid,$m_kh["id"],$m["color"],'');
|
||||
count_ph($uid,$m_kh["id"],$m["color"]);
|
||||
}
|
||||
}
|
||||
set_order_total($uid);
|
||||
$json_data.="\"code\":101,";
|
||||
}
|
||||
//$url=$_SERVER[PHP_SELF]."?_m=cc_single&zsh=".$zsh;
|
||||
//alert_and_redirect("订单保存成功!",$url);
|
||||
break;
|
||||
default:
|
||||
//----------------------------------------------橱窗模式
|
||||
$page=$page>0?$page:1;
|
||||
$limit=$limit>0?$limit:6;
|
||||
$start=($page-1)*$limit;
|
||||
$end=$limit;
|
||||
$query="select count(distinct zsh) 'total' from ".$table_pre."kh_cc ";
|
||||
$res=$db->query($query);
|
||||
$msg=$db->fetch_array($res);
|
||||
$total=$msg["total"];
|
||||
//定制条件
|
||||
$query="select * from ".$table_pre."kh_cc group by zsh order by zsh";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$pic_background=get_set("pic_background");
|
||||
$pic_background=$pic_background?$pic_background:"#ffffff";
|
||||
$content_set="[\"".$pic_background."\"]";
|
||||
$json_data.="\"content_set\":\"".$pic_background."\",";
|
||||
$count=0;
|
||||
$rnum=0;
|
||||
$content_list="";
|
||||
$cc_yd=$cc_zj=0;
|
||||
$json_data.="\"content_list\":[";
|
||||
$data_str="";
|
||||
while($msg=$db->fetch_array($res)){
|
||||
//取得已订套数
|
||||
$arr_num=array();
|
||||
$q1="select * from ".$table_pre."kh_cc where zsh='".$msg["zsh"]."'";
|
||||
$r1=$db->query($q1);
|
||||
$j=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$m2=get_db_msg("select id,size_group,category,category1 from ".$table_pre."kh where no='".$m1["kh"]."'");
|
||||
//if($m2["category"]!="50"){//排除某个大类
|
||||
$arr_size=explode(",",$m1["size"]);
|
||||
$sql_size="";
|
||||
for($k=0;$k<count($arr_size);$k++){
|
||||
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$m2["size_group"]."' and title='".$arr_size[$k]."'");
|
||||
if($tmp["id"]>0)
|
||||
$sql_size.="num_".$tmp["no"]."+";
|
||||
}
|
||||
if($sql_size){
|
||||
$sql_size=substr($sql_size,0,-1);
|
||||
$tmp=get_db_msg("select sum(".$sql_size.") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$m2["id"]."' and color='".$m1["color"]."' and _key='".$_key."'");
|
||||
$arr_num[$j]=$tmp["num"];
|
||||
$j++;
|
||||
}
|
||||
//}
|
||||
}
|
||||
if(count($arr_num)>0){
|
||||
$n1=min($arr_num);
|
||||
}else{
|
||||
$n1=0;
|
||||
}
|
||||
if($n1>0)
|
||||
$cc_yd++;
|
||||
//图片获取规则
|
||||
$pic=get_kh_cc_mini($msg["pic"]);
|
||||
$content_list.=$msg["zsh"].",\"".$msg["title"]."\",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$tmpl_m1_pic_width,$tmpl_m1_pic_height))."\",".$n1.",";
|
||||
$ck=out_good_pic_set_arr($pic,$tmpl_m1_pic_width,$tmpl_m1_pic_height);
|
||||
$data_str.="{\"zsh\":".$msg["zsh"].",\"title\":\"".$msg["title"]."\",\"pic\":\"".$pic."\",\"pic_w\":".$ck[0].",\"pic_h\":".$ck[1].",\"n1\":".deel_num($n1)."},";
|
||||
$rnum++;
|
||||
$count++;
|
||||
$cc_zj++;
|
||||
}
|
||||
$json_data.=substr($data_str,0,-1)."],";
|
||||
$json_data.="\"rnum\":\"".$rnum."\",";
|
||||
$json_data.="\"cc_zj\":\"".$cc_zj."\",";
|
||||
$json_data.="\"count\":\"".$count."\",";
|
||||
|
||||
$total_page=ceil($total/$limit);
|
||||
$json_data.="\"total_page\":".$total_page.",";
|
||||
$json_data.="\"page\":".$page.",";
|
||||
//$content_list.="]";
|
||||
break;
|
||||
}
|
||||
}
|
||||
//取得图片长宽参数
|
||||
function out_good_pic_set1($pic,$width,$height){
|
||||
if(is_file($pic)){
|
||||
$wh=GetImageSize($pic);
|
||||
}else{
|
||||
$pic1=str_replace("content://com.muchuang.edt/","../",$pic).".jpg";
|
||||
if(is_file($pic1))
|
||||
$wh=GetImageSize($pic1);
|
||||
}
|
||||
$tmp=array();
|
||||
if(($width>0 && $width<$wh[0]) || ($height>0 && $height<$wh[1])){
|
||||
if(($wh[0]/$width)>($wh[1]/$height)){
|
||||
//$tmp=" ".$width.",".round($wh[1]*$width/$wh[0]);
|
||||
$tmp[0]=$width;
|
||||
$tmp[1]=round($wh[1]*$width/$wh[0]);
|
||||
}else{
|
||||
//$tmp="".round($wh[0]*$height/$wh[1]).",".$height;
|
||||
$tmp[0]=round($wh[0]*$height/$wh[1]);
|
||||
$tmp[1]=$height;
|
||||
}
|
||||
}else{
|
||||
//$tmp="".$wh[0].",".$wh[1];
|
||||
$tmp[0]=$wh[0];
|
||||
$tmp[1]=$wh[1];
|
||||
}
|
||||
//print_r($tmp);
|
||||
return $tmp;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,496 @@
|
||||
<?php
|
||||
//-------------------------------单款订货
|
||||
/*
|
||||
店铺和区经角色
|
||||
*/
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
|
||||
$uid=check_cookie_jxs();
|
||||
//系统变量
|
||||
$sys_close=get_set("sys_close");
|
||||
$sys_close_image=get_set("sys_close_image");
|
||||
$is_session=get_set("is_session");
|
||||
$zb_type=get_set("zb_type");
|
||||
$is_spk=get_set("is_spk");
|
||||
$zbxf=get_set("zbxf");
|
||||
$zbxf_type=get_set("zbxf_type");
|
||||
$sys_ms=get_set("sys_ms");
|
||||
$is_msg=get_set("is_msg");
|
||||
$is_ewm=get_set("is_ewm");
|
||||
$is_window="y";
|
||||
$zk_type=get_set("zk_type");
|
||||
$is_hd_log=get_set("is_hd_log");
|
||||
$xh_ms=get_set("xh_ms");
|
||||
$order_session=get_set("order_session");
|
||||
$sys_size_num=get_max_size_num();
|
||||
$theme_path=get_theme_path();
|
||||
|
||||
$is_sy=get_set("is_sy");
|
||||
|
||||
$bs_kh_dj=get_set("bs_kh_dj");
|
||||
$json_data.="\"bs_kh_dj\":\"".$bs_kh_dj."\",";
|
||||
|
||||
$tmpl_m3_lie=6;
|
||||
$tmpl_m3_pic_width=100;
|
||||
$tmpl_m3_pic_height=100;
|
||||
$tmpl_m3_cl_pic_width=400;
|
||||
$tmpl_m3_cl_pic_height=300;
|
||||
$json_data.="\"sys_ver_hy\":\"".$sys_ver_hy."\",";
|
||||
|
||||
//$db=_mysql_connect();
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
if($msg_login["available"]!="y"){
|
||||
$json_data.="\"error\":\"用户已被禁用\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
|
||||
}else{
|
||||
$json_data.="\"face\":\"".$msg_login["face"]."\",";
|
||||
$json_data.="\"uid\":\"".$msg_login["id"]."\",";
|
||||
$json_data.="\"username\":\"".$msg_login["username"]."\",";
|
||||
$json_data.="\"is_sy\":\"".$is_sy."\",";
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
$rurl=$rurl?$rurl:get_this_url();
|
||||
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
|
||||
$zb_client_show=get_set("zb_client_show");
|
||||
if($zb_client_show=="y")
|
||||
$arr_zb_type=explode(",",$zb_type);
|
||||
else
|
||||
$arr_zb_type=array();
|
||||
$is_brand=is_brand();
|
||||
$show_jd=get_set("show_jd");
|
||||
$is_dkds=get_set("is_dkds");
|
||||
$is_multi_price=get_set("is_multi_price");
|
||||
$order_close=get_set("order_close");
|
||||
$search_type=get_set("search_type");
|
||||
|
||||
|
||||
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
||||
$json_data.="\"is_dkds\":\"".$is_dkds."\",";
|
||||
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
||||
$json_data.="\"is_multi_price\":\"".$is_multi_price."\",";
|
||||
|
||||
|
||||
if($is_brand=="y")
|
||||
$link_var_brand="&s_brand=".$s_brand;
|
||||
else
|
||||
$link_var_brand="";
|
||||
$title_brand=$con_brand="";
|
||||
if($s_brand){
|
||||
$arr_s_brand=explode(",",$s_brand);
|
||||
for($i=0;$i<count($arr_s_brand);$i++){
|
||||
$con_brand.="brand='".$arr_s_brand[$i]."' or ";
|
||||
$title_brand.=get_cate_title_no("brand",$arr_s_brand[$i]).",";
|
||||
}
|
||||
if($title_brand)
|
||||
$title_brand=substr($title_brand,0,-1);
|
||||
if($con_brand)
|
||||
$con_brand=" and (".substr($con_brand,0,-3).")";
|
||||
}
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
//文胸
|
||||
if($bx_sizegroup_title){
|
||||
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
|
||||
$bx_sizegroup_id=$tmp["id"];
|
||||
}else{
|
||||
$bx_sizegroup_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;
|
||||
}
|
||||
$con_spk=($is_spk=="y")?" and is_sp<>'y'":"";
|
||||
$flag_spk=($is_spk=="y")?"1":"";
|
||||
//------------------------------------包含定制模块,店铺界面,顶部已订数和完成率的显示
|
||||
//include_once $path_dz."/dp/wcl.php";
|
||||
//
|
||||
//--------------交单按钮
|
||||
$jd_password=get_set("jd_password");
|
||||
if($is_brand<>"y"){
|
||||
$tmp=$msg_login;
|
||||
$is_jd=$msg_login["is_jd"];
|
||||
$is_checked=$msg_login["is_checked"];
|
||||
}else{
|
||||
$tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_jd limit 0,1");
|
||||
$is_jd=$tmp["is_jd"];
|
||||
$tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_checked limit 0,1");
|
||||
$is_checked=$tmp["is_checked"];
|
||||
}
|
||||
if($show_jd=="y"){
|
||||
if($is_jd=="y")
|
||||
$jd_button="已交单|";
|
||||
if($is_checked=="y")
|
||||
$jd_button="已确认|";
|
||||
if($is_brand=="y"){
|
||||
$jd_button="交单|go_url('".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=o&s_tab=wcl')";
|
||||
}else{
|
||||
if($is_jd!="y" && $is_checked!="y")
|
||||
$jd_button="交单|do_jd('".$jd_password."','".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=jd".$link_var_brand."')";
|
||||
}
|
||||
}else{
|
||||
|
||||
$jd_button="|";
|
||||
}
|
||||
//计算订货规则按钮
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."gz where dj='' or dj='".$msg_login["dj"]."'");
|
||||
if($tmp["num"]>0)
|
||||
$menu_dhgz="订货规则";
|
||||
else
|
||||
$menu_dhgz="";
|
||||
|
||||
|
||||
switch($_a){
|
||||
case "single":
|
||||
$w2=$tmpl_m3_pic_width;
|
||||
$h2=$tmpl_m3_pic_height;
|
||||
$cl_lie=$tmpl_m3_lie;
|
||||
$s_con=$s_con?$s_con:$s_con_default;
|
||||
$rurl=$rurl?$rurl:get_this_url();
|
||||
$json_data.="\"w2\":\"".$w2."\",";
|
||||
$json_data.="\"h2\":\"".$h2."\",";
|
||||
$json_data.="\"cl_lie\":\"".$cl_lie."\",";
|
||||
//$json_data.="\"rurl\":\"".$rurl."\",";
|
||||
if($zsh){
|
||||
$s_zsh=$zsh;
|
||||
}
|
||||
$msg_err="";
|
||||
$kl=strlen($s_title);
|
||||
if($kl<=3 && $s_title && is_numeric($s_title)){
|
||||
$sql_con="where xh='".$s_title."'";
|
||||
}
|
||||
if($kl>=3){
|
||||
if(is_numeric($s_title)){
|
||||
$sql_con="where xh='".$s_title."' or no like '%".$s_title."%'";
|
||||
}else{
|
||||
$sql_con="where no like '%".$s_title."%'";
|
||||
}
|
||||
}
|
||||
if($s_title){
|
||||
$msg=get_db_msg("select * from ".$table_pre."kh ".$sql_con);
|
||||
$m1=get_db_msg("select count(*) 'num' from ".$table_pre."kh ".$sql_con);
|
||||
$json_data.="\"khid\":\"".$msg["id"]."\",";
|
||||
$json_data.="\"s_title\":\"".$s_title."\",";
|
||||
$id=$msg["id"];
|
||||
$str_title="";
|
||||
if($m1["num"]>1){
|
||||
$q2="select * from ".$table_pre."kh ".$sql_con;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$str_title.="{\"khid\":\"".$m2["id"]."\",\"title\":\"".$m2["xh"]."#".$m2["no"]."\"},";
|
||||
}
|
||||
if($msg_err){
|
||||
$str_title=deel_end($str_title);
|
||||
$msg_err="存在以下符合条件的多个款:".$msg_err;
|
||||
}
|
||||
}
|
||||
//
|
||||
if(!$id){
|
||||
$msg_err="记录不存在";
|
||||
}
|
||||
}
|
||||
if($msg_err){
|
||||
if($str_title){
|
||||
$json_data.="\"code\":101,";
|
||||
$json_data.="\"msg\":[".$str_title."],";
|
||||
}else{
|
||||
$json_data.="\"code\":102,";
|
||||
$json_data.="\"msg\":\"".$msg_err."\",";
|
||||
}
|
||||
}else{
|
||||
$json_data.="\"code\":100,";
|
||||
if($s_zsh){
|
||||
$sql_con.=" where zsh='".$s_zsh."' and ";
|
||||
$s_no="";
|
||||
}
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
//取得总设计款数
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'y'");
|
||||
$total_ks=$tmp["num"];
|
||||
//取得已订总款数
|
||||
if($msg_login["face"]=="4"){
|
||||
$tmp=get_db_msg("select count(distinct(iid)) 'num' from ".$table_pre."order where uid='".$uid."' and _key='".$_key."'");
|
||||
}
|
||||
if($msg_login["face"]=="2"){
|
||||
$tmp=get_db_msg("select count(distinct(iid)) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],""));
|
||||
}
|
||||
$total_yd_ks=$tmp["num"];
|
||||
//定制条件
|
||||
$query="select * from ".$table_pre."kh_cl where zsh='".$s_zsh."' group by kh,color order by ord";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
$pic_background=get_set("pic_background");
|
||||
$pic_background=$pic_background?$pic_background:"#ffffff";
|
||||
$content_set="[\"".$pic_background."\"]";
|
||||
|
||||
$json_data.="\"content_set\":\"".$pic_background."\",";
|
||||
$json_data.="\"style_title_color\":\"".$style_title_color."\",";
|
||||
$json_data.="\"ka_color\":\"".$ka_color."\",";
|
||||
$num_arr="";
|
||||
$strarr="";
|
||||
|
||||
$count=0;
|
||||
$rnum=0;
|
||||
$zks=$ydjs=$ydks=0;
|
||||
$content_list="";
|
||||
$title=$cljs="";
|
||||
$clp="";
|
||||
while($msg1=$db->fetch_array($res)){
|
||||
$clp=$msg1["pic"];
|
||||
$title=$msg1["title"];
|
||||
$cljs=htmlspecialchars($msg1["remark"]);
|
||||
$msg=get_db_msg("select * from ".$table_pre."kh where no='".$msg1["kh"]."'");
|
||||
if($msg["id"]>0){
|
||||
if($msg["ka"]=="y"){
|
||||
$c=get_set("ka_color");
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$msg["kh_dj"]);
|
||||
}
|
||||
//图片获取规则
|
||||
$pic=get_kh_color_picture($msg["no"],$msg1["color"],$flag_pad_offline);
|
||||
if($msg_login["face"]=="4"){
|
||||
$n1=deel_num(get_order_num_kh_color($msg["id"],$msg1["color"]));
|
||||
}
|
||||
if($msg_login["face"]=="2"){
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$msg["id"]."' and color='".$msg1["color"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],""));
|
||||
$n1=deel_num($tmp["num"]);
|
||||
}
|
||||
//$content_list.="".$msg["id"].",".$msg1["ord"].",\"".get_kh_xh($msg,$msg1["color"])."\",\"".$msg["no"]."\",\"".$msg1["color"]."\",\"".get_cate_title_no("color",$msg1["color"])."\",".deel_num(get_price_dp($uid,$msg["id"])).",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",";
|
||||
$tmppic=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$content_list.="{\"id\":\"".$msg["id"]."\",\"kh_dj\":\"".get_cate_title_no("kh_dj",$msg["kh_dj"])."\",\"ord\":\"".$msg1["ord"]."\",\"yph\":\"".get_kh_xh($msg,$msg1["color"])."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$msg1["color"]."\",\"color_title\":\"".get_cate_title_no("color",$msg1["color"])."\",\"price\":\"".deel_num(get_price_dp($uid,$msg["id"]))."\",\"pic\":\"".$pic."\",\"pic_w\":".$tmppic[0].",\"pic_h\":".$tmppic[1].",\"ydj\":".$n1.",\"c\":\"".$c."\"},";
|
||||
$rnum++;
|
||||
$count++;
|
||||
//计算已订款数
|
||||
if($msg_login["face"]=="4"){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$msg["id"]."' and color='".$msg1["color"]."' and ka<>'y' and _key='".$_key."'");
|
||||
if($tmp["num"]>0)
|
||||
$ydks++;
|
||||
}
|
||||
if($msg_login["face"]=="2"){
|
||||
if($n1>0)
|
||||
$ydks++;
|
||||
}
|
||||
|
||||
//计算总款数
|
||||
$zks++;
|
||||
//计算已订件数
|
||||
if($msg_login["face"]=="4"){
|
||||
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$msg["id"]."' and color='".$msg1["color"]."' and ka<>'y' and _key='".$_key."'");
|
||||
$ydjs+=$tmp["num"];
|
||||
}
|
||||
if($msg_login["face"]=="2"){
|
||||
$ydjs+=$n1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$content_list=substr($content_list,0,-1);
|
||||
$json_data.="\"cls\":[".$content_list."],";
|
||||
$json_data.="\"title\":\"".$title."\",";
|
||||
$json_data.="\"cljs\":\"".$cljs."\",";
|
||||
$json_data.="\"zk\":\"".$total_ks."\",";
|
||||
$json_data.="\"zydk\":\"".$total_yd_ks."\",";
|
||||
$json_data.="\"bzk\":\"".$zks."\",";
|
||||
$json_data.="\"bzydk\":\"".$ydks."\",";
|
||||
$json_data.="\"bzydj\":\"".$ydjs."\",";
|
||||
$json_data.="\"total\":\"".add_0($count)."\",";
|
||||
//上一组、下一组
|
||||
$pre_xh=get_db_msg("select zsh from ".$table_pre."kh_cl where zsh<'".$s_zsh."' order by zsh desc limit 0,1");
|
||||
$next_xh=get_db_msg("select zsh from ".$table_pre."kh_cl where zsh>'".$s_zsh."' order by zsh limit 0,1");
|
||||
$str_sxk="[\"".$pre_xh["zsh"]."\",\"".$next_xh["zsh"]."\"]";
|
||||
$json_data.="\"prev\":\"".$pre_xh["zsh"]."\",";
|
||||
$json_data.="\"next\":\"".$next_xh["zsh"]."\",";
|
||||
|
||||
$clpic=get_kh_cl_big($clp,$flag_pad_offline);
|
||||
$tmppic=out_good_pic_set_arr($clpic,$tmpl_m3_cl_pic_width,$tmpl_m3_cl_pic_height);
|
||||
$json_data.="\"pic_big\":\"".$clpic."\",";
|
||||
$json_data.="\"pic_big_w\":\"".$tmppic[0]."\",";
|
||||
$json_data.="\"pic_big_h\":\"".$tmppic[1]."\",";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//----------------------------------------------陈列模式
|
||||
if($sys_zycl=="y"){
|
||||
$s_type=$s_type?$s_type:"1";
|
||||
}
|
||||
$num_cl_zd=0;
|
||||
if(is_array($sys_cl_zd)){
|
||||
$num=count($sys_cl_zd);
|
||||
$num_cl_zd=($num<5)?$num:5;
|
||||
}
|
||||
$json_data.="\"sys_zycl\":\"".$sys_zycl."\",";
|
||||
//require THIS_FILE_ROOT."/include/page_js.class.php";
|
||||
$w2=$tmpl_m3_cl_pic_width;
|
||||
$h2=$tmpl_m3_cl_pic_height;
|
||||
$page_size=$tmpl_m1_page_size;
|
||||
$page_size=$tmpl_m1_page_size;
|
||||
|
||||
$page=$page>0?$page:1;
|
||||
$limit=$limit>0?$limit:6;
|
||||
$start=($page-1)*$limit;
|
||||
$end=$limit;
|
||||
|
||||
//
|
||||
|
||||
$sql_con=" where zsh>0 and ";
|
||||
if($s_type){
|
||||
$sql_con.=get_sql_client_type($s_type);
|
||||
}
|
||||
/*if($s_no){
|
||||
$sql_con.="kh like '%".$s_no."%' and ";
|
||||
$s_zsh="";
|
||||
}*/
|
||||
$kl=strlen($s_keyword);
|
||||
if($kl<=3 && $s_keyword && is_numeric($s_keyword)){
|
||||
if($xh_ms=="2"){
|
||||
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
||||
}else{
|
||||
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
||||
}
|
||||
$sql_con.=" kh='".$tmp["no"]."' and";
|
||||
for($i=0;$i<$num_dp_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$$v="";
|
||||
}
|
||||
$s_zsh="";
|
||||
$s_title="";
|
||||
}
|
||||
if($kl>=3){
|
||||
if(is_numeric($s_keyword)){
|
||||
if($xh_ms=="2"){
|
||||
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
||||
}else{
|
||||
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
||||
}
|
||||
$sql_con.=" (kh='".$tmp["no"]."' or kh like '%".$s_keyword."%') and";
|
||||
}else{
|
||||
$sql_con.=" (kh like '%".$s_keyword."%') and";
|
||||
}
|
||||
for($i=0;$i<$num_dp_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$$v="";
|
||||
}
|
||||
$s_zsh="";
|
||||
$s_title="";
|
||||
}
|
||||
if($s_title){
|
||||
$sql_con.="title like '%".$s_title."%' and ";
|
||||
$s_keyword="";
|
||||
$s_zsh="";
|
||||
}
|
||||
for($i=0;$i<$num_cl_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
if($$v1)
|
||||
$sql_con.="zd".($i+1)."='".$$v1."' and ";
|
||||
}
|
||||
if($sql_con)
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
//$sql_order=str_replace("!"," desc",$order);
|
||||
|
||||
$json_data.="\"s_keyword\":\"".$s_keyword."\",";
|
||||
$json_data.="\"s_zsh\":\"".$s_zsh."\",";
|
||||
$json_data.="\"s_title\":\"".$s_title."\",";
|
||||
|
||||
|
||||
$query="select count(distinct zsh) 'total' from ".$table_pre."kh_cl ".$sql_con;
|
||||
$res=$db->query($query);
|
||||
$msg=$db->fetch_array($res);
|
||||
$total=$msg["total"];
|
||||
|
||||
|
||||
//定制条件
|
||||
$query="select * from ".$table_pre."kh_cl ".$sql_con." group by zsh order by zsh limit ".$start.",".$end;
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$rnum=0;
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
$pic_background=get_set("pic_background");
|
||||
$pic_background=$pic_background?$pic_background:"#ffffff";
|
||||
$content_set="[\"".$pic_background."\"]";
|
||||
|
||||
$json_data.="\"style_title_color\":\"".$style_title_color."\",";
|
||||
$json_data.="\"ka_color\":\"".$ka_color."\",";
|
||||
$json_data.="\"content_set\":\"".$pic_background."\",";
|
||||
|
||||
$json_data.="\"count\":".$total.",\"content_list\":[";
|
||||
$data_str="";
|
||||
|
||||
$content_list="[";
|
||||
for($count=0;$count<$end;$count++){
|
||||
$msg=$db->fetch_array($res);
|
||||
if($msg["id"]>0){
|
||||
//图片获取规则
|
||||
$pic=get_kh_cl_mini($msg["pic"],$flag_pad_offline);
|
||||
if(($msg_login["path"]."-".$msg_login["id"])==$msg["upath"])
|
||||
$is_my_cl="y";
|
||||
else
|
||||
$is_my_cl="n";
|
||||
$content_list.=$msg["zsh"].",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",\"".$msg["title"]."\",\"".$is_my_cl."\",";
|
||||
$ck=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$data_str.="{\"zsh\":".$msg["zsh"].",\"title\":\"".$msg["title"]."\",\"is_my_cl\":\"".$is_my_cl."\",\"pic\":\"".$pic."\",\"pic_w\":".$ck[0].",\"pic_h\":".$ck[1]."},";
|
||||
//
|
||||
$rnum++;
|
||||
}
|
||||
}
|
||||
$json_data.=substr($data_str,0,-1)."],";
|
||||
$content_list.="]";
|
||||
|
||||
//自定义筛选条件
|
||||
$str_arr_zy="";
|
||||
$select_dz="";
|
||||
if($sys_zycl=="y"){
|
||||
$tmp1=explode(",",$sys_zycl_client_type);
|
||||
foreach($tmp1 as $k1 => $v1){
|
||||
$tmp2=explode("|",$v1);
|
||||
$str_arr_zy.="{\"no\":\"".$tmp2[0]."\",\"title\":\"".$tmp2[1]."\"},";
|
||||
/*foreach($tmp2 as $k2 => $v2){
|
||||
$str_arr_zy.="{\"no\":\"".$k2."\",\"title\":\"".$v2."\"},";
|
||||
}*/
|
||||
}
|
||||
$str_arr_zy=deel_end($str_arr_zy);
|
||||
$select_dz.="{\"no\":\"s_type\",\"title\":\"陈列类型\",\"value\":\"".$s_type."\",\"op\":[".$str_arr_zy."]},";
|
||||
}
|
||||
|
||||
$str_arr_select="";
|
||||
|
||||
for($i=0;$i<$num_cl_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$str_arr_select.="\"".$v1."\",\"".$sys_cl_zd[$i]."\",\"".$$v1."\",";
|
||||
$r=$db->query("select zd".($i+1)." from ".$table_pre."kh_cl group by zd".($i+1)." order by zd".($i+1));
|
||||
$op="[";
|
||||
$tmp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="\"".$m["zd".($i+1)]."|".$m["zd".($i+1)]."\",";
|
||||
$tmp.="{\"no\":\"".$m["zd".($i+1)]."\",\"title\":\"".$m["zd".($i+1)]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$select_dz.="{\"no\":\"".$v1."\",\"title\":\"".$sys_cl_zd[$i]."\",\"value\":\"".$$v1."\",\"op\":[".$tmp."]},";
|
||||
$op.="],";
|
||||
$str_arr_select.=$op;
|
||||
}
|
||||
$select_dz=deel_end($select_dz);
|
||||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||||
|
||||
$total_page=ceil($total/$limit);
|
||||
$json_data.="\"total_page\":".$total_page.",";
|
||||
$json_data.="\"page\":".$page.",";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$upath=$msg_login["path"]."-".$uid;
|
||||
header("Content-type: text/html;charset=utf-8");
|
||||
$json_data="{";
|
||||
$json_data.="\"uid\":\"".$msg_login["id"]."\",";
|
||||
switch($_a){
|
||||
case "save_pj":
|
||||
$check=get_db_msg("select * from ".$table_pre."client_pj where cid='".$uid."' and khid='".$khid."'");
|
||||
$remark=trim($remark);
|
||||
if($check["id"]>0){
|
||||
$sql_up="";
|
||||
if($remark)
|
||||
$sql_up.=" remark='".$remark."',";
|
||||
if($race>0)
|
||||
$sql_up.=" race='".$race."',";
|
||||
$q="update ".$table_pre."client_pj set ".$sql_up."add_date='".time()."' where cid='".$uid."' and khid='".$khid."'";
|
||||
}else{
|
||||
$q="insert into ".$table_pre."client_pj (cid,khid,race,remark,add_date) values ('".$uid."','".$khid."','".$race."','".$remark."','".time()."')";
|
||||
}
|
||||
$db->query($q);
|
||||
$db->query("delete from ".$table_pre."client_pj where race=0 and remark=''");
|
||||
$json_data.="\"code\":1,";
|
||||
$log_hd_num=$race;
|
||||
break;
|
||||
case "del_pj":
|
||||
//删除评价
|
||||
$tmp=get_db_msg("select race from ".$table_pre."client_pj where khid='".$khid."' and cid='".$uid."'");
|
||||
$log_hd_num=$tmp["race"];
|
||||
$q="delete from ".$table_pre."client_pj where khid='".$khid."' and cid='".$uid."'";
|
||||
$db->query($q);
|
||||
$json_data.="\"code\":1,";
|
||||
break;
|
||||
case "del_pj_race":
|
||||
//删除评分
|
||||
$tmp=get_db_msg("select race from ".$table_pre."client_pj where khid='".$khid."' and cid='".$uid."'");
|
||||
$log_hd_num=$tmp["race"];
|
||||
update_log_hd();
|
||||
$q="update ".$table_pre."client_pj set race=0 where khid='".$khid."' and cid='".$uid."'";
|
||||
$db->query($q);
|
||||
$db->query("delete from ".$table_pre."client_pj where race=0 and remark=''");
|
||||
$json_data.="\"code\":1,";
|
||||
break;
|
||||
default:
|
||||
//
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
//-------------------------------设计师-界面
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=check_cookie_jxs();
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
switch($_a){
|
||||
case "tb_pre":
|
||||
//取得上一组展示号
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' and zsh<'".$s_zsh."' group by zsh order by zsh desc limit 0,1");
|
||||
if($tmp["zsh"]){
|
||||
$json_data.="\"code\":100,";
|
||||
$json_data.="\"zsh\":\"".$tmp["zsh"]."\",";
|
||||
$json_data.="\"tid\":\"".$tid."\",";
|
||||
}else{
|
||||
$json_data.="\"code\":0,\"msg\":\"数据准备中,请稍后......\",";
|
||||
}
|
||||
break;
|
||||
case "tb_next":
|
||||
//取得上一组展示号
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' and zsh>'".$s_zsh."' group by zsh order by zsh limit 0,1");
|
||||
if($tmp["zsh"]){
|
||||
$json_data.="\"code\":100,";
|
||||
$json_data.="\"zsh\":\"".$tmp["zsh"]."\",";
|
||||
$json_data.="\"tid\":\"".$tid."\",";
|
||||
}else{
|
||||
$json_data.="\"code\":0,\"msg\":\"数据准备中,请稍后......\",";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//取得默认展厅
|
||||
if(!$s_tid){
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_tb_t limit 0,1");
|
||||
$s_tid=$tmp["id"];
|
||||
}
|
||||
$s_tid=$s_tid>0?$s_tid:0;
|
||||
if($s_tid){
|
||||
$tid_con="and tid='".$s_tid."'";
|
||||
}else{
|
||||
$tid_con='';
|
||||
}
|
||||
|
||||
//取得展厅选项信息
|
||||
$tmp_tid="";
|
||||
$tid_ct=0;
|
||||
$q="select * from ".$table_pre."kh_tb_t";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tmp_tid.="{\"no\":\"".$m["id"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
$tid_ct++;
|
||||
}
|
||||
$tmp_tid=deel_end($tmp_tid);
|
||||
$json_data.="\"select_tid_ct\":\"".$tid_ct."\",\"select_tid\":{\"no\":\"s_tid\",\"title\":\"选择展厅\",\"value\":\"".$s_tid."\",\"op\":[".$tmp_tid."]},";
|
||||
|
||||
//展示号选项
|
||||
$tmp_zsh="";
|
||||
$q="select zsh from ".$table_pre."kh_tb where tid=".$s_tid." group by zsh order by zsh";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tmp_zsh.="{\"no\":\"".$m["zsh"]."\",\"title\":\"".$m["zsh"]."\"},";
|
||||
}
|
||||
$tmp_zsh=deel_end($tmp_zsh);
|
||||
$json_data.="\"select_zsh\":{\"no\":\"s_zsh\",\"title\":\"选择展示号\",\"value\":\"".$s_zsh."\",\"op\":[".$tmp_zsh."]},";
|
||||
|
||||
//是否启用设计师
|
||||
if($sys_enable_tb=="y"){
|
||||
$json_data.="\"code_enable\":\"y\",";
|
||||
if($s_zsh){
|
||||
$m=get_db_msg("select zsh,pic from ".$table_pre."kh_tb where zsh='".$s_zsh."' ".$tid_con." group by zsh order by zsh desc limit 0,1");
|
||||
}else{
|
||||
$m=get_db_msg("select zsh,pic from ".$table_pre."kh_tb where is_show='y' ".$tid_con." group by zsh order by zsh desc limit 0,1");
|
||||
$s_zsh=0;
|
||||
}
|
||||
|
||||
//当前展示号
|
||||
$this_zsh=$m["zsh"]>0?$m["zsh"]:0;
|
||||
$json_data.="\"this_zsh\":\"".$this_zsh."\",";
|
||||
$json_data.="\"this_tid\":\"".$s_tid."\",";
|
||||
|
||||
$str="";
|
||||
if($m["zsh"]>0){
|
||||
$query="select iid,color from ".$table_pre."kh_tb where zsh='".$m["zsh"]."' ".$tid_con." order by ord";
|
||||
$res=$db->query($query);
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$msg["iid"]."'");
|
||||
if($m_kh["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$m_kh["kh_dj"]);
|
||||
}
|
||||
if($msg["iid"]>0){
|
||||
//图片获取规则
|
||||
if($msg["color"]){
|
||||
$pic=get_kh_color_picture($m_kh["no"],$msg["color"]);
|
||||
$con_color_tmp=" and color='".$msg["color"]."'";
|
||||
$color_str=$msg["color"]."-".get_cate_title_no("color",$msg["color"]);
|
||||
}else{
|
||||
$pic=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"],$flag_pad_offline);
|
||||
$con_color_tmp="";
|
||||
$color_str="";
|
||||
}
|
||||
if($pic){
|
||||
$arr_pic_set=out_good_pic_set_arr($pic,140,140);
|
||||
$pic_w=$arr_pic_set[0];
|
||||
$pic_h=$arr_pic_set[1];
|
||||
}else{
|
||||
$pic_w=$pic_h=0;
|
||||
}
|
||||
$n1=0;
|
||||
//----取得评价
|
||||
$tmp=get_db_msg("select sum(race) 'num' from ".$table_pre."client_pj where khid='".$msg["iid"]."' ");
|
||||
$pj_num=add_0($tmp["num"]);
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client_pj where khid='".$msg["iid"]."' ");
|
||||
$pj_clients=add_0($tmp["num"]);
|
||||
//----取得订单
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where iid='".$msg["iid"]."' and _key='".$_key."'".$con_color_tmp);
|
||||
$order_num=add_0($tmp["num"]);
|
||||
$tmp=get_db_msg("select count(distinct uid) 'num' from ".$table_pre."order where iid='".$msg["iid"]."' and _key='".$_key."'".$con_color_tmp);
|
||||
$order_clients=add_0($tmp["num"]);
|
||||
//
|
||||
$ppf=$pj_clients>0?keep_float($pj_num/$pj_clients,1):0;
|
||||
$str.="{\"id\":\"".$m_kh["id"]."\",\"xh\":\"".get_kh_xh($m_kh,$msg["color"])."\",\"kh\":\"".$m_kh["no"]."\",\"color\":\"".$color_str."\",\"price\":\"".deel_num($m_kh["price"])."\",\"picsrc\":\"".$pic."\",\"pic_w\":\"".$pic_w."\",\"pic_h\":\"".$pic_h."\",\"fontcolor\":\"".$c."\",\"js\":\"".$order_num."\",\"jsrs\":\"".$order_clients."\",\"ppf\":\"".$ppf."\",\"ppfrs\":\"".$pj_clients."\"},";
|
||||
}
|
||||
}
|
||||
if($str)
|
||||
$str=substr($str,0,-1);
|
||||
}
|
||||
$json_data.="\"all_kh\":[".$str."],";
|
||||
|
||||
//
|
||||
$arr_zsh1=array();
|
||||
$q1="select zsh from ".$table_pre."kh_tb where tid='".$s_tid."' and zsh<".$this_zsh." group by zsh order by zsh desc limit 0,2";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zsh1[]=$m1["zsh"];
|
||||
}
|
||||
$arr_zsh2=array();
|
||||
$q1="select zsh from ".$table_pre."kh_tb where tid='".$s_tid."' and zsh>".$this_zsh." group by zsh order by zsh limit 0,2";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zsh2[]=$m1["zsh"];
|
||||
}
|
||||
if(count($arr_zsh1)<2 && count($arr_zsh2)<2){
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$s_tid."' group by zsh order by zsh";
|
||||
}else if(count($arr_zsh1)<2){
|
||||
if($arr_zsh1[0]>0)
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$s_tid."' and zsh>='".$arr_zsh1[0]."' group by zsh order by zsh limit 0,5";
|
||||
else
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$s_tid."' group by zsh order by zsh limit 0,5";
|
||||
}else if(count($arr_zsh2)<2){
|
||||
if($arr_zsh2[0]>0)
|
||||
$q1="select count(distinct zsh) 'num' from ".$table_pre."kh_tb where tid='".$s_tid."' and zsh<='".$arr_zsh2[0]."'";
|
||||
else
|
||||
$q1="select count(distinct zsh) 'num' from ".$table_pre."kh_tb where tid='".$s_tid."'";
|
||||
$m1=get_db_msg($q1);
|
||||
$limit_s=($m1["num"]-5)>0?($m1["num"]-5):0;
|
||||
if($arr_zsh2[0]>0)
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$s_tid."' and zsh<='".$arr_zsh2[0]."' group by zsh order by zsh limit ".$limit_s.",5";
|
||||
else
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$s_tid."' group by zsh order by zsh limit ".$limit_s.",5";
|
||||
}else{
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$s_tid."' and zsh>='".$arr_zsh1[1]."' group by zsh order by zsh limit 0,5";
|
||||
}
|
||||
//
|
||||
$strzsh="";
|
||||
$count=0;
|
||||
$re=$db->query($query);
|
||||
while ($rows=$db->fetch_array($re)) {
|
||||
$arr_tmp=array();
|
||||
$tmp=get_db_msg("select count(distinct iid,color) 'num' from ".$table_pre."kh_tb where zsh=".$rows['zsh']." and tid=".$s_tid);
|
||||
$r=$db->query("select * from ".$table_pre."kh_tb where zsh=".$rows['zsh']." and tid=".$s_tid);
|
||||
$i=0;
|
||||
while ($m1=$db->fetch_array($r)) {
|
||||
$arr_tmp[$i]['titile']=$m1['titile'];
|
||||
$arr_tmp[$i]['pic']=$m1['pic'];
|
||||
$arr_tmp[$i]['iid']=$m1['iid'];
|
||||
$arr_tmp[$i]['color']=$m1['color'];
|
||||
$i++;
|
||||
}
|
||||
$tmp2=get_db_msg("select * from ".$table_pre."kh where id='".$arr_tmp[0]["iid"]."' limit 0,1");
|
||||
if($rows['pic']!=""){
|
||||
$pic2="../attachments/".$rows['pic'];
|
||||
}
|
||||
if($tmp['num']==1 && $rows['pic']==""){
|
||||
if($arr_tmp[0]["color"]){
|
||||
$pic2=get_kh_color_picture($tmp2["no"],$arr_tmp[0]["color"]);
|
||||
}else{
|
||||
$pic2=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$info="";
|
||||
foreach ($arr_tmp as $key => $value) {
|
||||
$tmp=get_db_msg("select no from ".$table_pre."kh where id=".$value["iid"]);
|
||||
$info.=$tmp['no'];
|
||||
if ($value['color']) {
|
||||
$info.=",".get_cate_title_no("color",$value['color']);
|
||||
}else{
|
||||
$info.="";
|
||||
}
|
||||
$info.="|";
|
||||
}
|
||||
if($info)
|
||||
$info=substr($info,0,-1);
|
||||
|
||||
if($pic2){
|
||||
$arr_pic_set2=out_good_pic_set_arr($pic2,120,120);
|
||||
$pic_w2=$arr_pic_set2[0];
|
||||
$pic_h2=$arr_pic_set2[1];
|
||||
}else{
|
||||
$pic_w2=$pic_h2=0;
|
||||
}
|
||||
$strzsh.="{\"zsh\":\"".$rows['zsh']."\",\"picsrc\":\"".$pic2."\",\"pic_w\":\"".$pic_w2."\",\"pic_h\":\"".$pic_h2."\",\"kh_detail\":\"".$info."\"},";
|
||||
$count++;
|
||||
}
|
||||
$json_data.="\"zshcount\":\"".$count."\",\"all_zsh\":[".substr($strzsh,0,-1)."],";
|
||||
$json_data.="\"code\":100,";
|
||||
}else{
|
||||
$json_data.="\"code\":\"0\",\"msg\":\"对不起,目前只有IPAD支持该功能!\",";
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
switch($_a){
|
||||
case "jd_button":
|
||||
//取得交单状态
|
||||
$json_data.="\"code\":99,";
|
||||
$is_brand=is_brand();
|
||||
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
||||
$show_jd=get_set("show_jd");
|
||||
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
||||
//is_jd
|
||||
$json_data.="\"is_jd\":\"".$msg_client["is_jd"]."\",";
|
||||
//is_qr
|
||||
$json_data.="\"is_qr\":\"".$msg_client["is_checked"]."\",";
|
||||
break;
|
||||
default:
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,317 @@
|
||||
<?php
|
||||
//-------------------------------订单明细
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
//
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$p=$msg_login["path"]."-".$msg_login["id"];
|
||||
$face=$msg_client["face"];
|
||||
$ph_ms=get_set("ph_ms");
|
||||
$arr_ph_ms=explode(",",$ph_ms);
|
||||
$sys_size_num=get_max_size_num();
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//取得选项
|
||||
$arr_upath=explode(",",$msg_login["charge_path"]);
|
||||
$cou_u_all=get_qj_ucon_all($msg_login["charge_path_real"]);
|
||||
$is_spk=get_set("is_spk");
|
||||
if($face=="1") $cou_u_all="";
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
|
||||
$is_sy=get_set("is_sy");
|
||||
$json_data.="\"username\":\"".$msg_client["username"]."\",";
|
||||
$json_data.="\"is_sy\":\"".$is_sy."\",";
|
||||
|
||||
|
||||
$s_uid=$s_uid?$s_uid:$uid;
|
||||
$s_ka=$s_ka?$s_ka:"n";
|
||||
$con="";
|
||||
$con_u="";
|
||||
if($s_uid){
|
||||
if($s_uid=="_ALL_"){
|
||||
$con.=$cou_u_all;
|
||||
$con_u.=$cou_u_all;
|
||||
}else{
|
||||
$m1=get_db_msg("select * from ".$table_pre."client where id='".$s_uid."'");
|
||||
if($m1["face"]=="4"){
|
||||
$con.=" and uid='".$s_uid."'";
|
||||
$con_u.=" and uid='".$s_uid."'";
|
||||
}else{
|
||||
$con.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')";
|
||||
$con_u.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$con.=" and uid=0";
|
||||
$con_u.=" and uid=0";
|
||||
}
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
if($$v)
|
||||
$con.=" and ".$arr_select_no[$i]."='".$$v."'";
|
||||
}
|
||||
if($s_tab=="ph"){
|
||||
if($s_qy && $s_qy!="-all-")
|
||||
$con.=" and qy='".$s_qy."'";
|
||||
}else{
|
||||
if($s_ka=="n")
|
||||
$con.=" and ka<>'y'";
|
||||
else if($s_ka=="y")
|
||||
$con.=" and ka='y'";
|
||||
}
|
||||
$con1=" and ka<>'y'";
|
||||
//饰品款条件
|
||||
if($s_is_sp=="n"){
|
||||
$con1.=" and is_sp<>'y'";
|
||||
$con.=" and is_sp<>'y'";
|
||||
}else if($s_is_sp=="y"){
|
||||
$con1.=" and is_sp='y'";
|
||||
$con.=" and is_sp='y'";
|
||||
}
|
||||
if($s_brand)
|
||||
$con1.=" and brand='".$s_brand."'";
|
||||
if($s_season)
|
||||
$con1.=" and season='".$s_season."'";
|
||||
//饰品款条件
|
||||
//$s_is_sp="n";
|
||||
if($s_is_sp=="n"){
|
||||
$con1.=" and is_sp<>'y'";
|
||||
$con.=" and is_sp<>'y'";
|
||||
}else if($s_is_sp=="y"){
|
||||
$con1.=" and is_sp='y'";
|
||||
$con.=" and is_sp='y'";
|
||||
}
|
||||
$json_data.="\"face\":\"".$face."\",";
|
||||
//$search_select_no=$search_select_op=array();
|
||||
//if($face==2) $face=3;
|
||||
switch($face){
|
||||
case "1":
|
||||
$op_client="";
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_uid";
|
||||
$search_select_op[$i1][]="-请选择客户-";
|
||||
$search_select_op[$i1]["_ALL_"]="所有客户";
|
||||
$r=$db->query("select * from ".$table_pre."client where face='4' order by concat(path,'-',id)");
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_client.="<option value=\"".$m["id"]."\"";
|
||||
if($s_uid==$m["id"])
|
||||
$op_client.=" selected";
|
||||
$op_client.=">".$m["title"]."(".$m["username"].")-".$m["order_num"]."件</option>";
|
||||
$search_select_op[$i1][$m["id"]]="".$m["title"]."(".$m["username"].")-".$m["order_num"]."件";
|
||||
}
|
||||
$i1++;
|
||||
//删除款过滤
|
||||
$search_select_no[$i1]="s_ka";
|
||||
$search_select_op[$i1]=array("n"=>"非删除款","y"=>"删除款");
|
||||
$i1++;
|
||||
//选项过滤
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no");
|
||||
$search_select_no[$i1]=$v;
|
||||
$search_select_op[$i1][""]=$arr_select_title[$i]."过滤";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$search_select_op[$i1][$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
$i++;
|
||||
//排序
|
||||
|
||||
$search_select_no[$i1]="s_order";
|
||||
$search_select_op[$i1]=array("num"=>"数量排序","no"=>"款号排序","je"=>"金额排序");
|
||||
//选项前面
|
||||
$select_qm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_qm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_qm=deel_end($select_qm);
|
||||
$json_data.="\"select_qm\":[".$select_qm."],";
|
||||
//$content_search.=" <input type=\"button\" value=\"打 印\" onclick=\"window.print();\">";
|
||||
//----------------------------------------------取得订单记录
|
||||
|
||||
break;
|
||||
case "2":
|
||||
//-------------------------------------------------------------------------区经
|
||||
$op_client="";
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_uid";
|
||||
$search_select_op[$i1][]="-请选择客户-";
|
||||
$search_select_op[$i1]["_ALL_"]="所有客户";
|
||||
for($i=0;$i<count($arr_upath);$i++){
|
||||
$v=get_parent_id($arr_upath[$i]);
|
||||
$m1=get_db_msg("select id,path,title,username,face,order_num from ".$table_pre."client where id='".$v."'");
|
||||
if($m1["face"]=="4" || ($m1["face"]!="4" && check_qj_priv_all($m1["id"])=="y")){
|
||||
$op_client.="<option value=\"".$v."\"";
|
||||
if($s_uid==$v)
|
||||
$op_client.=" selected";
|
||||
$this_js="";
|
||||
if($m1["order_num"]>0)
|
||||
$this_js="-".$m1["order_num"]."件";
|
||||
$op_client.=">".$m1["title"]."(".$m1["username"].")".$this_js."</option>";
|
||||
$search_select_op[$i1][$v]="".$m1["title"]."(".$m1["username"].")".$this_js."";
|
||||
}
|
||||
}
|
||||
$i1++;
|
||||
//删除款过滤
|
||||
$search_select_no[$i1]="s_ka";
|
||||
$search_select_op[$i1]=array("n"=>"非删除款","y"=>"删除款");
|
||||
$i1++;
|
||||
//选项过滤
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no");
|
||||
$search_select_no[$i1]=$v;
|
||||
$search_select_op[$i1][""]=$arr_select_title[$i]."过滤";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$search_select_op[$i1][$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
$i++;
|
||||
//排序
|
||||
|
||||
$search_select_no[$i1]="s_order";
|
||||
$search_select_op[$i1]=array("num"=>"数量排序","no"=>"款号排序","je"=>"金额排序");
|
||||
//选项前面
|
||||
$select_qm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_qm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_qm=deel_end($select_qm);
|
||||
$json_data.="\"select_qm\":[".$select_qm."],";
|
||||
//$content_search.=" <input type=\"button\" value=\"打 印\" onclick=\"window.print();\">";
|
||||
//----------------------------------------------取得订单记录
|
||||
break;
|
||||
case "3":
|
||||
//-------------------------------------------------------------------------代理
|
||||
$op_client="";
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_uid";
|
||||
$search_select_op[$i1][]="-请选择客户-";
|
||||
$r=$db->query("select id,title,username,order_num from ".$table_pre."client where path='".$p."' or path like '".$p."-%' order by path,ord");
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_client.="<option value=\"".$m["id"]."\"";
|
||||
if($s_uid==$m["id"])
|
||||
$op_client.=" selected";
|
||||
$op_client.=">".$m["title"]."(".$m["username"].")-".$m["order_num"]."件</option>";
|
||||
$search_select_op[$i1][$m["id"]]="".$m["title"]."(".$m["username"].")-".$m["order_num"]."件";
|
||||
}
|
||||
$i1++;
|
||||
//删除款过滤
|
||||
$search_select_no[$i1]="s_ka";
|
||||
$search_select_op[$i1]=array("n"=>"非删除款","y"=>"删除款");
|
||||
$i1++;
|
||||
//选项过滤
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no");
|
||||
$search_select_no[$i1]=$v;
|
||||
$search_select_op[$i1][""]=$arr_select_title[$i]."过滤";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$search_select_op[$i1][$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
$i++;
|
||||
//排序
|
||||
$search_select_no[$i1]="s_order";
|
||||
$search_select_op[$i1]=array("num"=>"数量排序","no"=>"款号排序","je"=>"金额排序");
|
||||
//选项前面
|
||||
$select_qm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_qm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_qm=deel_end($select_qm);
|
||||
$json_data.="\"select_qm\":[".$select_qm."],";
|
||||
//$content_search.=" <input type=\"button\" value=\"打 印\" onclick=\"window.print();\">";
|
||||
//----------------------------------------------取得订单记录
|
||||
break;
|
||||
case "4":
|
||||
//-------------------------------------------------------------------------店铺角色
|
||||
//包含定制模块
|
||||
//删除款过滤
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_ka";
|
||||
$search_select_op[$i1]=array("n"=>"非删除款","y"=>"删除款");
|
||||
$i1++;
|
||||
//饰品款过滤
|
||||
if($is_spk=="y"){
|
||||
$search_select_no[$i1]="s_is_sp";
|
||||
$search_select_op[$i1]=array(""=>"含".d_translate("spk"),"n"=>"不含".d_translate("spk"),"y"=>"仅".d_translate("spk"));
|
||||
$i1++;
|
||||
}
|
||||
//选项过滤
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no");
|
||||
$search_select_no[$i1]=$v;
|
||||
$search_select_op[$i1][""]=$arr_select_title[$i]."过滤";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$search_select_op[$i1][$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
//排序
|
||||
$search_select_no[$i1]="s_order";
|
||||
$search_select_op[$i1]=array("date"=>"时间排序","num"=>"数量排序");
|
||||
//选项前面
|
||||
$select_qm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_qm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_qm=deel_end($select_qm);
|
||||
$json_data.="\"select_qm\":[".$select_qm."],";
|
||||
break;
|
||||
}
|
||||
if($sys_ver_hy=="tz"){
|
||||
include_once $path_dz."/dp/detail_tz.php";
|
||||
}elseif($sys_ver_hy=="xz"){
|
||||
include_once $path_dz."/dp/detail_xz.php";
|
||||
}else{
|
||||
include_once $path_dz."/dp/detail.php";
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
//-------------------------------订单明细
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
//
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$p=$msg_login["path"]."-".$msg_login["id"];
|
||||
$face=$msg_client["face"];
|
||||
$sys_size_num=get_max_size_num();
|
||||
$is_spk=get_set("is_spk");
|
||||
|
||||
//订货规则
|
||||
$arr_gz=$arr_gz1=array();
|
||||
$q="select * from ".$table_pre."keyword where (cate='dhgz') and no<>'zgdl' and no<>'dhbs' and no<>'qdl' and no<>'glk' and no<>'zxs' and flag_ka='y' order by ord";
|
||||
$r=$db->query($q);
|
||||
$i=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$check=get_db_msg("select count(*) 'num' from ".$table_pre."gz where cate='".$m["no"]."' and (dj='' or dj='".$msg_login["dj"]."')");
|
||||
if($check["num"]>0){
|
||||
$arr_gz[$m["no"]]=$m["title"];
|
||||
$arr_gz1[$i]=$m["no"];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$my_gz_type=$my_gz_type?$my_gz_type:$arr_gz1[0];
|
||||
|
||||
$json_data.="\"gz\":\"".$my_gz_type."\",";
|
||||
//tab
|
||||
$content_tab="";
|
||||
$strgz="";
|
||||
$i=0;
|
||||
foreach($arr_gz as $k => $v){
|
||||
$strgz.="{\"xh\":\"".$i."\",\"k\":\"".$k."\",\"v\":\"".$v."\"},";
|
||||
$i++;
|
||||
$s=($my_gz_type==$k)?"y":"";
|
||||
$content_tab.="?_m=".$_m."&_a=".$_a."&s_tab=".$s_tab."&my_gz_type=".$k."|".$v."|".$s.",";
|
||||
}
|
||||
$json_data.="\"arr_gz\":[".deel_end($strgz)."],";
|
||||
if($content_tab)
|
||||
$content_tab=substr($content_tab,0,-1);
|
||||
//取得客户等级
|
||||
$client_dj=trim($msg_login["dj"]);
|
||||
$con_dj=$client_dj?" and (dj='".$client_dj."' or dj='')":" and dj=''";
|
||||
$strhead=$strbody="";
|
||||
if($my_gz_type=="bdk"){
|
||||
//必订款
|
||||
$strhead.="{\"v\":\"款号\"},{\"v\":\"必订数量\"},{\"v\":\"实际数量\"},";
|
||||
|
||||
//$content="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"table_bb\"><thead><tr>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>款号</strong></th>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>必订数量</strong></th><th align=\"center\" class=\"thead\"><strong>实际数量</strong></th>";
|
||||
//$content.="</tr></thead>";
|
||||
$q1="select * from ".$table_pre."gz where cate='".$my_gz_type."'".$con_dj." order by kh";
|
||||
$r1=$db->query($q1);
|
||||
$count=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$sty1=($count%2)?"#f5f5f5":"white";
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m1["kh"]."'");
|
||||
//取得实际数量
|
||||
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where no='".$m1["kh"]."' and uid='".$uid."' and _key='".$_key."'");
|
||||
if($tmp["num"]<$m1["num"])
|
||||
$bg_hilight=" style='color:#ffffff;background-color:#ff0000;'";
|
||||
else
|
||||
$bg_hilight="";
|
||||
$tmpb="";
|
||||
$strbody.="{";
|
||||
$strbody.="\"sty\":\"".$sty1."\",";
|
||||
$strbody.="\"khid\":\"".$m_kh["id"]."\",";
|
||||
$tmpb.="{\"s\":\"\",\"v\":\"".$m_kh["no"]."\"},{\"s\":\"\",\"v\":\"".$m1["num"]."\"},{\"s\":\"".$bg_hilight."\",\"v\":\"".add_0($tmp["num"])."\"}";
|
||||
$strbody.="\"body\":[".$tmpb."]";
|
||||
$strbody.="},";
|
||||
//$content.="<tr class=\"".$sty1."\"><td><a href=\"".$_SERVER[PHP_SELF]."?_m=order_single&id=".$m_kh["id"]."&rurl=".urlencode($rurl)."\" title=\"".$m_kh["no"]."的订单\">".$m_kh["no"]."</a></td><td>".$m1["num"]."</td><td".$bg_hilight.">".add_0($tmp["num"])."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}else if($my_gz_type=="bdks"){
|
||||
//必订款色
|
||||
$strhead.="{\"v\":\"款号\"},{\"v\":\"颜色\"},{\"v\":\"必订数量\"},{\"v\":\"实际数量\"},";
|
||||
//$content="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"table_bb\"><thead><tr>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>款号</strong></th><th align=\"center\" class=\"thead\"><strong>颜色</strong></th>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>必订数量</strong></th><th align=\"center\" class=\"thead\"><strong>实际数量</strong></th>";
|
||||
//$content.="</tr></thead>";
|
||||
$q1="select * from ".$table_pre."gz where cate='".$my_gz_type."'".$con_dj." order by kh,color";
|
||||
$r1=$db->query($q1);
|
||||
$count=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$sty1=($count%2)?"#f5f5f5":"white";
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m1["kh"]."'");
|
||||
//取得实际数量
|
||||
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where no='".$m1["kh"]."' and color='".$m1["color"]."' and uid='".$uid."' and _key='".$_key."'");
|
||||
if($tmp["num"]<$m1["num"])
|
||||
$bg_hilight=" style='color:#ffffff;background-color:#ff0000;'";
|
||||
else
|
||||
$bg_hilight="";
|
||||
|
||||
$tmpb="";
|
||||
$strbody.="{";
|
||||
$strbody.="\"sty\":\"".$sty1."\",";
|
||||
$strbody.="\"khid\":\"".$m_kh["id"]."\",";
|
||||
$tmpb.="{\"s\":\"\",\"v\":\"".$m_kh["no"]."\"},{\"s\":\"\",\"v\":\"".$m1["color"]."-".get_cate_title_no("color",$m1["color"])."\"},{\"s\":\"\",\"v\":\"".$m1["num"]."\"},{\"s\":\"".$bg_hilight."\",\"v\":\"".add_0($tmp["num"])."\"}";
|
||||
$strbody.="\"body\":[".$tmpb."]";
|
||||
$strbody.="},";
|
||||
|
||||
//$content.="<tr class=\"".$sty1."\"><td><a href=\"".$_SERVER[PHP_SELF]."?_m=order_single&id=".$m_kh["id"]."&rurl=".urlencode($rurl)."\" title=\"".$m_kh["no"]."的订单\">".$m_kh["no"]."</a></td><td><a href=\"".$_SERVER[PHP_SELF]."?_m=order_single&id=".$m_kh["id"]."&rurl=".urlencode($rurl)."\" title=\"".$m_kh["no"]."的订单\">".$m1["color"]."-".get_cate_title_no("color",$m1["color"])."</a></td><td>".$m1["num"]."</td><td".$bg_hilight.">".add_0($tmp["num"])."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}else if($my_gz_type=="bdgg"){
|
||||
//必订规格
|
||||
$strhead.="{\"v\":\"款号\"},{\"v\":\"颜色\"},{\"v\":\"".d_translate("gg")."\"},{\"v\":\"必订数量\"},{\"v\":\"实际数量\"},";
|
||||
//$content="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"table_bb\"><thead><tr>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>款号</strong></th><th align=\"center\" class=\"thead\"><strong>颜色</strong></th><th align=\"center\" class=\"thead\"><strong>".d_translate("gg")."</strong></th><th align=\"center\" class=\"thead\"><strong>必订数量</strong></th><th align=\"center\" class=\"thead\"><strong>实际数量</strong></th>";
|
||||
//$content.="</tr></thead>";
|
||||
$q1="select * from ".$table_pre."gz where cate='".$my_gz_type."'".$con_dj." order by kh,color,bc";
|
||||
$r1=$db->query($q1);
|
||||
$count=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$sty1=($count%2)?"#f5f5f5":"white";
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m1["kh"]."'");
|
||||
//取得实际数量
|
||||
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where no='".$m1["kh"]."' and color='".$m1["color"]."' and bx='".$m1["bc"]."' and uid='".$uid."' and _key='".$_key."'");
|
||||
if($tmp["num"]<$m1["num"])
|
||||
$bg_hilight=" style='color:#ffffff;background-color:#ff0000;'";
|
||||
else
|
||||
$bg_hilight="";
|
||||
|
||||
$tmpb="";
|
||||
$strbody.="{";
|
||||
$strbody.="\"sty\":\"".$sty1."\",";
|
||||
$strbody.="\"khid\":\"".$m_kh["id"]."\",";
|
||||
$tmpb.="{\"s\":\"\",\"v\":\"".$m_kh["no"]."\"},{\"s\":\"\",\"v\":\"".$m1["color"]."-".get_cate_title_no("color",$m1["color"])."\"},{\"s\":\"\",\"v\":\"".get_gg_title($m1["bc"])."\"},{\"s\":\"\",\"v\":\"".$m1["num"]."\"},{\"s\":\"".$bg_hilight."\",\"v\":\"".add_0($tmp["num"])."\"}";
|
||||
$strbody.="\"body\":[".$tmpb."]";
|
||||
$strbody.="},";
|
||||
|
||||
//$content.="<tr class=\"".$sty1."\"><td><a href=\"".$_SERVER[PHP_SELF]."?_m=order_single&id=".$m_kh["id"]."&rurl=".urlencode($rurl)."\" title=\"".$m_kh["no"]."的订单\">".$m_kh["no"]."</a></td><td>".$m1["color"]."-".get_cate_title_no("color",$m1["color"])."</td><td><a href=\"".$_SERVER[PHP_SELF]."?_m=order_single&id=".$m_kh["id"]."&rurl=".urlencode($rurl)."\" title=\"".$m_kh["no"]."的订单\">".get_gg_title($m1["bc"])."</a></td><td>".$m1["num"]."</td><td".$bg_hilight.">".add_0($tmp["num"])."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}else if($my_gz_type=="bds"){
|
||||
//必订色
|
||||
$strhead.="{\"v\":\"波段\"},{\"v\":\"颜色\"},{\"v\":\"必订数量\"},{\"v\":\"实际数量\"},";
|
||||
//$content="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"table_bb\"><thead><tr>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>波段</strong></th><th align=\"center\" class=\"thead\"><strong>颜色</strong></th>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>必订数量</strong></th><th align=\"center\" class=\"thead\"><strong>实际数量</strong></th>";
|
||||
//$content.="</tr></thead>";
|
||||
$q1="select * from ".$table_pre."gz where cate='".$my_gz_type."'".$con_dj." order by kh,color";
|
||||
$r1=$db->query($q1);
|
||||
$count=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$sty1=($count%2)?"#f5f5f5":"white";
|
||||
$bg=($count%2)?"#a8a8a8":"#c8c8c8";
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m1["kh"]."'");
|
||||
//取得实际数量
|
||||
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where bc='".$m1["bc"]."' and color='".$m1["color"]."' and uid='".$uid."' and _key='".$_key."'");
|
||||
if($tmp["num"]<$m1["num"])
|
||||
$bg_hilight=" style='color:#ffffff;background-color:#ff0000;'";
|
||||
else
|
||||
$bg_hilight="";
|
||||
|
||||
$tmpb="";
|
||||
$strbody.="{";
|
||||
$strbody.="\"sty\":\"".$sty1."\",";
|
||||
$strbody.="\"bc\":\"".$m1["bc"]."\",";
|
||||
$strbody.="\"color\":\"".$m1["color"]."\",";
|
||||
$tmpb.="{\"s\":\"\",\"v\":\"".get_cate_title_no("bc",$m1["bc"])."\"},{\"s\":\"\",\"v\":\"".$m1["color"]."-".get_cate_title_no("color",$m1["color"])."\"},{\"s\":\"\",\"v\":\"".$m1["num"]."\"},{\"s\":\"".$bg_hilight."\",\"v\":\"".add_0($tmp["num"])."\"}";
|
||||
$strbody.="\"body\":[".$tmpb."]";
|
||||
$strbody.="},";
|
||||
|
||||
//$content.="<tr class=\"".$sty1."\"><td><a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&s_bc=".$m1["bc"]."\">".get_cate_title_no("bc",$m1["bc"])."</a></td><td><a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&s_bc=".$m1["bc"]."&s_color=".$m1["color"]."\">".$m1["color"]."-".get_cate_title_no("color",$m1["color"])."</a></td><td>".add_0($m1["num"])."</td><td".$bg_hilight.">".add_0($tmp["num"])."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}else if($my_gz_type=="byxdk"){
|
||||
//不予下单款
|
||||
$strhead.="{\"v\":\"款号\"},";
|
||||
//$content="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"table_bb\"><thead><tr>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>款号</strong></th>";
|
||||
//$content.="</tr></thead>";
|
||||
$q1="select * from ".$table_pre."gz where cate='".$my_gz_type."'".$con_dj." order by kh";
|
||||
$r1=$db->query($q1);
|
||||
$count=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$sty1=($count%2)?"#f5f5f5":"white";
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$m1["kh"]."'");
|
||||
//取得实际数量
|
||||
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where no='".$m1["kh"]."' and uid='".$uid."' and _key='".$_key."'");
|
||||
|
||||
$tmpb="";
|
||||
$strbody.="{";
|
||||
$strbody.="\"sty\":\"".$sty1."\",";
|
||||
$strbody.="\"khid\":\"".$m_kh["id"]."\",";
|
||||
$tmpb.="{\"s\":\"\",\"v\":\"".$m_kh["no"]."\"}";
|
||||
$strbody.="\"body\":[".$tmpb."]";
|
||||
$strbody.="},";
|
||||
//$content.="<tr class=\"".$sty1."\"><td><a href=\"".$_SERVER[PHP_SELF]."?_m=order_single&id=".$m_kh["id"]."&rurl=".urlencode($rurl)."\" title=\"".$m_kh["no"]."的订单\">".$m_kh["no"]."</a></td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}else if($my_gz_type=="jebl"){
|
||||
//金额比例
|
||||
$strhead.="{\"v\":\"".get_cate_title_no("arr_select","kh_dj")."\"},{\"v\":\"要求占比\"},{\"v\":\"实际占比\"},";
|
||||
//$content="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"table_bb\"><thead><tr>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>".get_cate_title_no("arr_select","kh_dj")."</strong></th><th align=\"center\" class=\"thead\"><strong>要求占比</strong></th><th align=\"center\" class=\"thead\"><strong>实际占比</strong></th>";
|
||||
//订单总金额
|
||||
if($is_spk=="y"){
|
||||
$total_money=$msg_login["order_money1"];
|
||||
$con_sp=" and is_sp='y'";
|
||||
}else{
|
||||
$total_money=$msg_login["order_money"];
|
||||
$con_sp="";
|
||||
}
|
||||
$q1="select * from ".$table_pre."keyword where cate='kh_dj' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$count=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$m2=get_db_msg("select * from ".$table_pre."gz where cate='".$my_gz_type."'".$con_dj." and kh='".$m1["no"]."'");
|
||||
$sty1=($count%2)?"#f5f5f5":"white";
|
||||
$bg=($count%2)?"#a8a8a8":"#c8c8c8";
|
||||
//取得实际金额
|
||||
$q2="select sum((".get_size_sql("sum").")*price) 'je' from ".$table_pre."order where kh_dj='".$m1["no"]."' and uid='".$uid."' and _key='".$_key."'".$con_sp;
|
||||
$tmp=get_db_msg($q2);
|
||||
if($m2["id"]>0){
|
||||
$c1=$m2["color"].deel_num($m2["num"])."%";
|
||||
if($total_money>0){
|
||||
$bl=($tmp["je"]/$total_money)*100;
|
||||
}else{
|
||||
$bl=0;
|
||||
}
|
||||
$gs=$bl.$m2["color"].$m2["num"];
|
||||
eval("\$r=$gs;");
|
||||
$bg1=($r==false)?"#ff0000":$bg;
|
||||
}else{
|
||||
$c1=" ";
|
||||
$bg1=$bg;
|
||||
}
|
||||
|
||||
$tmpb="";
|
||||
$strbody.="{";
|
||||
$strbody.="\"sty\":\"".$sty1."\",";
|
||||
$strbody.="\"kh_dj\":\"".$m1["no"]."\",";
|
||||
$tmpb.="{\"s\":\"\",\"v\":\"".$m1["title"]."\"},{\"s\":\"\",\"v\":\"".$c1."\"},{\"s\":\"".$bg_hilight."\",\"v\":\"".deel_bfb1($tmp["je"],$total_money)."\"}";
|
||||
$strbody.="\"body\":[".$tmpb."]";
|
||||
$strbody.="},";
|
||||
//$content.="<tr class=\"".$sty1."\"><td><a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&s_kh_dj=".$m1["no"]."\">".$m1["title"]."</a></td><td>".$c1."</td><td>".deel_bfb1($tmp["je"],$total_money)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
$content.="</tr></thead>";
|
||||
}else if($my_gz_type=="bdkshi"){
|
||||
//必订款式
|
||||
$strhead.="{\"v\":\"款号\"},{\"v\":\"必订款数\"},{\"v\":\"实际款数\"},";
|
||||
//$content="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" id=\"table_bb\"><thead><tr>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>款号</strong></th>";
|
||||
//$content.="<th align=\"center\" class=\"thead\"><strong>必订款数</strong></th><th align=\"center\" class=\"thead\"><strong>实际款数</strong></th>";
|
||||
//$content.="</tr></thead>";
|
||||
$q1="select bc,num from ".$table_pre."gz where cate='".$my_gz_type."'".$con_dj." group by bc";
|
||||
$r1=$db->query($q1);
|
||||
$count=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$sty1=($count%2)?"td2":"td1";
|
||||
//取得款号
|
||||
$str_kh="";
|
||||
$q2="select * from ".$table_pre."gz where cate='".$my_gz_type."' and bc='".$m1["bc"]."' order by kh";
|
||||
$r2=$db->query($q2);
|
||||
$sj_ydkss=0;
|
||||
$tmpbb="";
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$m_kh=get_db_msg("select id,no from ".$table_pre."kh where no='".$m2["kh"]."'");
|
||||
if($m_kh["id"]>0){
|
||||
//$str_kh.="<a href=\"".$_SERVER[PHP_SELF]."?_m=order_single&id=".$m_kh["id"]."&rurl=".urlencode($rurl)."\" title=\"".$m_kh["no"]."的订单\">".$m2["kh"]."</a>, ";
|
||||
$tmpbb.="{\"khid\":\"".$m_kh["id"]."\",\"kh\":\"".$m2["kh"]."\"},";
|
||||
}
|
||||
$c=get_db_msg("select id from ".$table_pre."order where no='".$m2["kh"]."' and uid='".$uid."' and _key='".$_key."'");
|
||||
if($c["id"]>0)
|
||||
$sj_ydkss++;
|
||||
}
|
||||
if($str_kh)
|
||||
$str_kh=substr($str_kh,0,-1);
|
||||
//取得实际数量
|
||||
if($sj_ydkss<$m1["num"])
|
||||
$bg_hilight=" style='color:#ffffff;background-color:#ff0000;'";
|
||||
else
|
||||
$bg_hilight="";
|
||||
|
||||
$tmpb="";
|
||||
$strbody.="{";
|
||||
$strbody.="\"sty\":\"".$sty1."\",";
|
||||
$strbody.="\"kh\":[".deel_end($tmpbb)."],";
|
||||
$tmpb.="{\"s\":\"\",\"v\":\"".$m1["num"]."\"},{\"s\":\"".$bg_hilight."\",\"v\":\"".add_0($sj_ydkss)."\"}";
|
||||
$strbody.="\"body\":[".$tmpb."]";
|
||||
$strbody.="},";
|
||||
|
||||
//$content.="<tr class=\"".$sty1."\"><td>".$str_kh."</td><td>".$m1["num"]."</td><td".$bg_hilight.">".add_0($sj_ydkss)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$json_data.="\"head\":[".deel_end($strhead)."],";
|
||||
$json_data.="\"body\":[".deel_end($strbody)."],";
|
||||
//$content.="</table>";
|
||||
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
//-------------------------------订货须知-界面
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=check_cookie_jxs();
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
switch($_a){
|
||||
case "menu_icon_survey":
|
||||
$json_data.="\"_a\":\"".$_a."\",";
|
||||
if(is_array($sys_menu_other)){
|
||||
$ct=0;
|
||||
for($i=0;$i<count($sys_menu_other);$i++){
|
||||
$arr1=$sys_menu_other[$i];
|
||||
if($arr1[2]==$_a){
|
||||
$json_data.="\"title\":\"".$arr1[0]."\",";
|
||||
$json_data.="\"url\":\"".$arr1[1]."\",";
|
||||
$ct++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($ct>0){
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$json_data.="\"code\":0,\"msg\":\"模块错误.请确认config文件wjdc设置路径正确\",";
|
||||
}
|
||||
}else{
|
||||
$json_data.="\"code\":0,\"msg\":\"请先开启问卷调查.\",";
|
||||
}
|
||||
break;
|
||||
case "menu_icon_ppt":
|
||||
case "menu_icon_dhxz":
|
||||
$json_data.="\"_a\":\"".$_a."\",";
|
||||
if(is_array($sys_menu_other)){
|
||||
$ct=0;
|
||||
for($i=0;$i<count($sys_menu_other);$i++){
|
||||
$arr1=$sys_menu_other[$i];
|
||||
if($arr1[2]==$_a){
|
||||
$json_data.="\"title\":\"".$arr1[0]."\",";
|
||||
$json_data.="\"url\":\"".$arr1[1]."\",";
|
||||
$ct++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($ct>0){
|
||||
$json_data.="\"code\":100,";
|
||||
}else{
|
||||
$json_data.="\"code\":0,\"msg\":\"模块错误.请确认config文件dhxz设置路径正确\",";
|
||||
}
|
||||
}else{
|
||||
$json_data.="\"code\":0,\"msg\":\"请先开启订货须知.\",";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
+5210
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1172
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
<?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."'");
|
||||
|
||||
include THIS_FILE_ROOT.'/include/phpqrcode/phpqrcode.php';
|
||||
//$value = $_COOKIE["edt_default_username"]; //二维码内容
|
||||
$value = $msg_login["username"];
|
||||
$errorCorrectionLevel = 'L';//容错级别
|
||||
$matrixPointSize = 16;//生成图片大小
|
||||
//$str = str_replace(PHP_EOL, '', $str);
|
||||
//生成二维码图片
|
||||
//QRcode::png($value, "qrcode.png", $errorCorrectionLevel, $matrixPointSize, 2);
|
||||
|
||||
$QRcode = new \QRcode();
|
||||
ob_start();
|
||||
$QRcode->png($value,false,$errorCorrectionLevel,$matrixPointSize);
|
||||
$imageString = base64_encode(ob_get_contents());
|
||||
ob_end_clean();
|
||||
$json_data.="\"img_base64\":\"".$imageString."\",";
|
||||
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
//-------------------------------用户登陆
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
switch($_a){
|
||||
case "kick_out":
|
||||
$m_c=get_db_msg("select username,password from ".$table_pre."client where id='".$id."'");
|
||||
$q="delete from ".$table_pre."session where uid='".$id."'";
|
||||
$db->query($q);
|
||||
url_redirect("./?_m=".$_m."&_a=login&reload=y&username=".$m_c["username"]."&password=".$m_c["password"]);
|
||||
break;
|
||||
case "door_out":
|
||||
$ip=$_SERVER["REMOTE_ADDR"];
|
||||
$db->query("delete from ".$table_pre."plugin_session_ewm where ip='".$ip."'");
|
||||
setcookie("ip",0,0,"/");
|
||||
$json_data.="\"code\":101,";
|
||||
break;
|
||||
case "login":
|
||||
//检查
|
||||
if($username && $password){
|
||||
//echo $username."|".$password;
|
||||
$m=get_db_msg("select id,available,title,username,face from ".$table_pre."client where username='".trim($username)."' and password='".trim($password)."' limit 0,1");
|
||||
//check session
|
||||
if($m["id"]>0){
|
||||
if($m["available"]=="n"){
|
||||
$msg_error="对不起,该用户已经被禁用!";
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg_error."\",";
|
||||
}else{
|
||||
$login_state="n";
|
||||
|
||||
if($is_session=="y" && $m["face"]==4){
|
||||
$login_sid=$_COOKIE[LOGIN_COOKIE];
|
||||
$c=get_db_msg("select id,ip,sid from ".$table_pre."session where uid='".$m["id"]."'");
|
||||
//if(($c["id"]>0 && $c["ip"]!=$ip)){
|
||||
if(($c["id"]>0 && $c["sid"]!=$login_sid)){
|
||||
$msg_error="对不起,".$m["title"]."(".$m["username"].")已经在使用(".$c["ip"]."|".$c["sid"].")!";
|
||||
$json_data.="\"code\":0.1,\"uid\":".$m["id"].",\"msg\":\"".$msg_error."\",";
|
||||
$login_state="n";
|
||||
}else{
|
||||
$login_state="y";
|
||||
}
|
||||
}else{
|
||||
$login_state="y";
|
||||
}
|
||||
if($login_state=="y"){
|
||||
//设置cookie
|
||||
//$t=time()+365*24*3600;
|
||||
if($m["face"]=="9"){
|
||||
$msg_error="该用户不允许登录(error:9)";
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg_error."\",";
|
||||
}else{
|
||||
$t=0;
|
||||
setcookie(THIS_COOKIE,$m["id"],$t,"/");
|
||||
//默认用户名
|
||||
$t=time()+365*24*3600;
|
||||
setcookie("edt_default_username",$m["username"],$t,"/");
|
||||
$uid=$m["id"];
|
||||
update_log_hd();
|
||||
//更新用户最新登录
|
||||
$db->query("update ".$table_pre."client set is_loged='y',lastactivity='".time()."' where id='".$m["id"]."'");
|
||||
update_session($m["id"],$ip);
|
||||
//自动设置登陆界面
|
||||
$json_data.="\"code\":100,";
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$msg_error="对不起,客户代码或者密码有误!";
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg_error."\",";
|
||||
}
|
||||
}else{
|
||||
$msg_error="请输入密码!";
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg_error."\",";
|
||||
}
|
||||
if($reload=="y"){
|
||||
url_redirect("./");
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$json_data.="\"code\":100,";
|
||||
$json_data.="\"ver\":\"".$sys_ver."\",";
|
||||
$edt_default_username=$username?$username:$_COOKIE["edt_default_username"];
|
||||
$json_data.="\"default_username\":\"".$edt_default_username."\",";
|
||||
$login_by_select=get_set("login_by_select");
|
||||
$sys_close_pc=get_set("sys_close_pc");
|
||||
if($login_by_select=="y"){
|
||||
$json_data.="\"username_select\":\"y\",";
|
||||
//采用选择用户登陆方式
|
||||
$q="select username,title,concat(path,'-',id) 'abspath' from ".$table_pre."client where available='y' and face<>'9' order by abspath";
|
||||
$r=$db->query($q);
|
||||
$op="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="{\"username\":\"".$m["username"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
$json_data.="\"username_op\":[".deel_end($op)."],";
|
||||
}else{
|
||||
$json_data.="\"username_select\":\"n\",";
|
||||
}
|
||||
if($debug=="y" || $sys_close_pc=="n"){
|
||||
$is_login="y";
|
||||
}else{
|
||||
$is_login="n";
|
||||
}
|
||||
$json_data.="\"is_login\":\"".$is_login."\",";
|
||||
//登录背景
|
||||
$img_set=get_set("sys_login_bg");
|
||||
if($img_set){
|
||||
$login_bg_img=$img_set;
|
||||
}else{
|
||||
$login_bg_img="n";
|
||||
}
|
||||
$json_data.="\"login_bg_img\":\"".$login_bg_img."\",";
|
||||
//订货会抬头
|
||||
$json_data.="\"dhh_title\":\"".get_set("sys_client_title")."\",";
|
||||
//多品牌入口定义
|
||||
$str="";
|
||||
if(is_array($sys_login_rk)){
|
||||
$is_dpp_rk="y";
|
||||
foreach($sys_login_rk as $t => $dir){
|
||||
$str.="{\"title\":\"".$t."\",\"dir\":\"".$dir."\"},";
|
||||
}
|
||||
}else{
|
||||
$is_dpp_rk="n";
|
||||
}
|
||||
$json_data.="\"is_dpp_rk\":\"".$is_dpp_rk."\",\"dpp_title\":[".deel_end($str)."],";
|
||||
//扫描登陆
|
||||
$is_ewm=get_set("is_ewm");
|
||||
$json_data.="\"is_ewm\":\"".$is_ewm."\",";
|
||||
//扫描入场
|
||||
$is_sm=get_set("is_sm");
|
||||
$json_data.="\"is_sm\":\"".$is_sm."\",";
|
||||
if($is_sm=="y"){
|
||||
$ip=$_SERVER["REMOTE_ADDR"];
|
||||
//echo $ip;
|
||||
$json_data.="\"ip\":\"".$ip."\",";
|
||||
$show_ewm="n";
|
||||
$client_ip=get_db_msg("select id from ".$table_pre."plugin_session_ewm where ip='".$ip."'");
|
||||
$flag_client=$client_ip["id"];
|
||||
if($flag_client){
|
||||
//客户端存在标记
|
||||
$q="select id from ".$table_pre."plugin_session_ewm where ip='".$ip."'";
|
||||
$m=get_db_msg($q);
|
||||
if($m["id"]>0){
|
||||
$show_ewm="n";
|
||||
}else{
|
||||
$show_ewm="y";
|
||||
}
|
||||
}else{
|
||||
$show_ewm="y";
|
||||
}
|
||||
$json_data.="\"show_ewm\":\"".$show_ewm."\",";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
//-------------------------------扫描登陆
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
switch($_a){
|
||||
default:
|
||||
$arr=explode(",",$_d);
|
||||
$username=$arr[0];
|
||||
$password=$arr[1];
|
||||
//检查
|
||||
if($username && $password){
|
||||
//echo $username."|".$password;
|
||||
$m=get_db_msg("select * from ".$table_pre."client where username='".trim($username)."' and password='".trim($password)."' limit 0,1");
|
||||
//check session
|
||||
if($is_session=="y" && $m["face"]==4){
|
||||
$c=get_db_msg("select * from ".$table_pre."session where uid='".$m["id"]."'");
|
||||
if(($c["id"]>0 && $c["ip"]!=$ip)){
|
||||
$msg_error="对不起,该用户已经登录(".$c["ip"]."),请联系管理员!";
|
||||
url_redirect("login.htm?error_msg=".$msg_error);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($m["id"]>0){
|
||||
if($m["available"]=="n"){
|
||||
$msg_error="对不起,该用户已经被禁用!";
|
||||
url_redirect("login.htm?error_msg=".$msg_error);
|
||||
}else{
|
||||
//设置cookie
|
||||
//$t=time()+365*24*3600;
|
||||
if($m["face"]=="9"){
|
||||
$msg_error="该用户不允许登录(error:9)!";
|
||||
url_redirect("login.htm?error_msg=".$msg_error);
|
||||
}
|
||||
$t=0;
|
||||
setcookie(THIS_COOKIE,$m["id"],$t,"/");
|
||||
//默认用户名
|
||||
$t=time()+365*24*3600;
|
||||
setcookie("edt_default_username",$m["username"],$t,"/");
|
||||
$uid=$m["id"];
|
||||
//update_log_hd();
|
||||
//更新用户最新登录
|
||||
$db->query("update ".$table_pre."client set is_loged='y',lastactivity='".time()."' where id='".$m["id"]."'");
|
||||
$_m=go_face($m["face"]);
|
||||
update_session($m["id"],$ip);
|
||||
//自动设置登陆界面
|
||||
url_redirect("main.htm");
|
||||
}
|
||||
}else{
|
||||
$msg_error="对不起,用户名或密码有误!";
|
||||
url_redirect("login.htm?error_msg=".$msg_error);
|
||||
}
|
||||
}else{
|
||||
$msg_error="对不起,数据格式有误!";
|
||||
url_redirect("login.htm?error_msg=".$msg_error);
|
||||
}
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=$_COOKIE[THIS_COOKIE];
|
||||
delete_session($uid);
|
||||
setcookie(THIS_COOKIE,0,0,"/");
|
||||
url_redirect("./");
|
||||
?>
|
||||
@@ -0,0 +1,495 @@
|
||||
<?php
|
||||
//-------------------------------主页面
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
//
|
||||
$face=$msg_client["face"];
|
||||
$json_data.="\"face\":\"".$face."\",";
|
||||
//代理商和店铺角色显示订货须知
|
||||
$show_dhxz="n";
|
||||
if($msg_client["flag_dhxz"]!="1" && $msg_client["id"]>0 && ($msg_client["face"]=="4" || $msg_client["face"]=="3")){
|
||||
$show_dhxz="y";
|
||||
}
|
||||
$json_data.="\"show_dhxz\":\"".$show_dhxz."\",";
|
||||
//license信息
|
||||
$json_data.="\"lic_title\":\"慕创科技\",";
|
||||
//订货会抬头
|
||||
$json_data.="\"dhh_title\":\"".get_set("sys_client_title")."\",";
|
||||
//账号信息
|
||||
$json_data.="\"user_title\":\"".$msg_client["title"]."\",\"user_name\":\"".$msg_client["username"]."\",";
|
||||
//多品牌
|
||||
$is_brand=is_brand();
|
||||
$show_jd=get_set("show_jd");
|
||||
$zb_client_show=get_set("zb_client_show");
|
||||
$ph_ms=get_set("ph_ms");
|
||||
$is_spk=get_set("is_spk");
|
||||
$is_msg=get_set("is_msg");
|
||||
$show_zzdy=get_set("show_zzdy");
|
||||
$json_data.="\"zb_client_show\":\"".$zb_client_show."\",";
|
||||
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
||||
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
||||
$json_data.="\"show_ismsg\":\"".$is_msg."\",";
|
||||
$json_data.="\"appzbconfig\":\"".$Appzbconfig."\",";
|
||||
|
||||
$con_spk=($is_spk=="y")?" and is_sp<>'y'":"";
|
||||
//
|
||||
$menu_arr_sys=array("1"=>"dk.htm","2"=>"dp.htm","3"=>"cl.htm","4"=>"cc.htm","5"=>"ts.htm","6"=>"ty.htm","7"=>"spdh.htm","8"=>"zbuser.htm","9"=>"zdb.htm","10"=>"scene3d.htm");
|
||||
switch($face){
|
||||
case "1":
|
||||
//-------------------------------------------------------------------------总经理角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
//菜单
|
||||
$json_data.="\"menu\":[";
|
||||
//固定菜单
|
||||
if($ph_ms){
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"订货概览\",\"icon\":\"menu_icon_bb\",\"link\":\"daping.htm\"},{\"title\":\"客户分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=client\"},{\"title\":\"款式分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=ks\"},{\"title\":\"全国排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph.htm\"}]},";
|
||||
}else{
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"订货概览\",\"icon\":\"menu_icon_bb\",\"link\":\"daping.htm\"},{\"title\":\"客户分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=client\"},{\"title\":\"款式分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=ks\"},{\"title\":\"全国排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph.htm\"}]},";
|
||||
}
|
||||
//订货行为报表类菜单
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"客户行为分析\",\"icon\":\"menu_icon_bb\",\"link\":\"xw.htm?cate=client\"},{\"title\":\"款式行为分析\",\"icon\":\"menu_icon_bb\",\"link\":\"xw.htm?cate=kh\"},{\"title\":\"订货模式分析\",\"icon\":\"menu_icon_bb\",\"link\":\"xw.htm?cate=ms\"}]},";
|
||||
//定制报表类菜单
|
||||
$ts_bb_arr=array("size"=>"尺码","color"=>"颜色","ks_size"=>"款色深度");
|
||||
$menu_gd_bb="";
|
||||
for($i=0;$i<count($sys_bb_cate);$i++){
|
||||
$bb_arr=explode("&",$sys_bb_cate[$i]);
|
||||
if(count($bb_arr)==1){
|
||||
if($bb_arr[0]=="size" || $bb_arr[0]=="color" || $bb_arr[0]=="ks_size"){
|
||||
$bbtitle=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
$bb_cate=$bb_arr[0];
|
||||
}else{
|
||||
if($bb_arr[0]=="color"){
|
||||
$bbtitle2=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle2=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
if($bb_arr[1]=="size" || $bb_arr[1]=="ks_size" || $bb_arr[1]=="color"){
|
||||
$bbtitle3=$ts_bb_arr[$bb_arr[1]];
|
||||
}else{
|
||||
$bbtitle3=get_cate_title_no("arr_select",$bb_arr[1]);
|
||||
}
|
||||
$bbtitle=$bbtitle2."-".$bbtitle3;
|
||||
$bb_cate=$bb_arr[0]."%26".$bb_arr[1];
|
||||
}
|
||||
$menu_gd_bb.="{\"title\":\"".$bbtitle."分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=".$bb_cate."\"},";
|
||||
}
|
||||
$sql="select * from ".$table_pre."plugin where available='y' and cate='client_bb' and (face='".$face."' or face='')";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$id=$msg["id"];
|
||||
$icon=get_plugin_set("icon","menu_icon_bb");
|
||||
$menu_gd_bb.="{\"title\":\"".$msg["title"]."\",\"icon\":\"".$icon."\",\"link\":\"plugin.htm?id=".$msg["id"]."&file_name=".$msg["file_name"]."&cate=".$msg["cate"]."\"},";
|
||||
}
|
||||
|
||||
$json_data.="{\"menu_sub\":[".deel_end($menu_gd_bb)."]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"daping.htm\",";
|
||||
break;
|
||||
case "2":
|
||||
//-------------------------------------------------------------------------区经角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
//菜单
|
||||
$json_data.="\"menu\":[";
|
||||
//订货模式
|
||||
//计算订货模式
|
||||
$home="";
|
||||
//区经允许订货
|
||||
if($msg_client["qyjl_order"]=="y" || $msg_client["qyjl_order"]=="b"){
|
||||
if($tmpl_is_multi_ms=="y"){
|
||||
$tmp=get_db_msg("select * from ".$table_pre."set where _k='sys_ms'");
|
||||
$arr_tmp=explode(",",$tmp["_t1"]);
|
||||
for($i=0;$i<count($arr_tmp);$i++){
|
||||
$arr_tmp1=explode("|",$arr_tmp[$i]);
|
||||
$arr_ms_title[$arr_tmp1[0]]=$arr_tmp1[1];
|
||||
}
|
||||
$sys_ms=$tmp["_v"]?$tmp["_v"]:1;
|
||||
$arr_ms=explode(",",$sys_ms);
|
||||
}else{
|
||||
$arr_ms=array("1");
|
||||
$arr_ms_title["1"]="单款";
|
||||
|
||||
}
|
||||
$js_str_ms="";
|
||||
for($i=0;$i<count($arr_ms);$i++){
|
||||
if($i==0){
|
||||
$home=$menu_arr_sys[$arr_ms[$i]];
|
||||
}
|
||||
if($arr_ms[$i]!=6 && $arr_ms[$i]!=4){
|
||||
$js_str_ms.="{\"title\":\"".get_main_value($arr_ms_title,$arr_ms[$i])."\",\"icon\":\"menu_icon_ms_".$arr_ms[$i]."\",\"link\":\"".$menu_arr_sys[$arr_ms[$i]]."\"},";
|
||||
}
|
||||
|
||||
}
|
||||
$json_data.="{\"menu_sub\":[".deel_end($js_str_ms)."]},";
|
||||
}
|
||||
//固定菜单
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"我的客户\",\"icon\":\"menu_icon_my_client\",\"link\":\"my_client.htm\"}]},";
|
||||
if($ph_ms){
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"订单明细\",\"icon\":\"menu_icon_detail\",\"link\":\"detail.htm\"},{\"title\":\"我的排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph_my_dl.htm\"},{\"title\":\"全国排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph.htm\"}]},";
|
||||
}else{
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"订单明细\",\"icon\":\"menu_icon_detail\",\"link\":\"detail.htm\"},{\"title\":\"我的排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph_my_dl.htm\"}]},";
|
||||
}
|
||||
//报表类菜单,含定制
|
||||
$ts_bb_arr=array("size"=>"尺码","color"=>"颜色","ks_size"=>"款色深度");
|
||||
$menu_gd_bb="";
|
||||
for($i=0;$i<count($sys_bb_cate);$i++){
|
||||
$bb_arr=explode("&",$sys_bb_cate[$i]);
|
||||
if(count($bb_arr)==1){
|
||||
if($bb_arr[0]=="size" || $bb_arr[0]=="color" || $bb_arr[0]=="ks_size"){
|
||||
$bbtitle=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
$bb_cate=$bb_arr[0];
|
||||
}else{
|
||||
if($bb_arr[0]=="color"){
|
||||
$bbtitle2=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle2=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
if($bb_arr[1]=="size" || $bb_arr[1]=="ks_size" || $bb_arr[1]=="color"){
|
||||
$bbtitle3=$ts_bb_arr[$bb_arr[1]];
|
||||
}else{
|
||||
$bbtitle3=get_cate_title_no("arr_select",$bb_arr[1]);
|
||||
}
|
||||
$bbtitle=$bbtitle2."-".$bbtitle3;
|
||||
$bb_cate=$bb_arr[0]."%26".$bb_arr[1];
|
||||
}
|
||||
$menu_gd_bb.="{\"title\":\"".$bbtitle."分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=".$bb_cate."\"},";
|
||||
}
|
||||
$sql="select * from ".$table_pre."plugin where available='y' and cate='client_bb' and (face='".$face."' or face='')";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$id=$msg["id"];
|
||||
$icon=get_plugin_set("icon","menu_icon_bb");
|
||||
$menu_gd_bb.="{\"title\":\"".$msg["title"]."\",\"icon\":\"".$icon."\",\"link\":\"plugin.htm?id=".$msg["id"]."&file_name=".$msg["file_name"]."&cate=".$msg["cate"]."\"},";
|
||||
}
|
||||
$json_data.="{\"menu_sub\":[".deel_end($menu_gd_bb)."]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$home=$home?$home:"my_client.htm";
|
||||
$json_data.="\"home\":\"".$home."\",";
|
||||
break;
|
||||
case "3":
|
||||
//-------------------------------------------------------------------------代理商角色
|
||||
set_order_total($msg_client["id"]);
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"".deel_num($msg_client["order_num"])."\",\"order_je\":\"".deel_num($msg_client["order_money"])."\",\"order_jsje\":\"".deel_num($msg_client["order_money_zk"])."\",";
|
||||
//指标信息
|
||||
if($is_brand=="y"){
|
||||
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$msg_client["id"]."'");
|
||||
$zb1=$tmp["zb"]*10000;
|
||||
$zb=deel_num($tmp["zb"]);
|
||||
$zb_js=$tmp["zb_js"];
|
||||
}else{
|
||||
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client where id='".$msg_client["id"]."'");
|
||||
$zb1=$tmp["zb"]*10000;
|
||||
$zb=deel_num($tmp["zb"]);
|
||||
$zb_js=$tmp["zb_js"];
|
||||
}
|
||||
//完成率
|
||||
$zb_je_wcl=deel_bfb1($msg_client["order_money_zk"],$zb*10000,1);
|
||||
$zb_js_wcl=deel_bfb1($msg_client["order_num"],$zb_js,1);
|
||||
$json_data.="\"zb_je\":\"".deel_num(keep_float($zb,2))."\",\"wcl_je\":\"".$zb_je_wcl."\",\"zb_js\":\"".deel_num($zb_js)."\",\"wcl_js\":\"".$zb_js_wcl."\",";
|
||||
//交单信息
|
||||
$json_data.="\"is_jd\":\"".$msg_client["is_jd"]."\",";
|
||||
//订单确认信息
|
||||
$json_data.="\"is_qr\":\"".$msg_client["is_checked"]."\",";
|
||||
//菜单
|
||||
$json_data.="\"menu\":[";
|
||||
//固定菜单
|
||||
$menu_gd_ms="";
|
||||
//if($show_dhxz=="y"){
|
||||
for($i=0;$i<count($sys_menu_other);$i++){
|
||||
$dhxz_arr=$sys_menu_other[$i];
|
||||
$menu_gd_ms.=",{\"title\":\"".$dhxz_arr[0]."\",\"icon\":\"".$dhxz_arr[2]."\",\"link\":\"dhxz.htm?_a=".$dhxz_arr[2]."\"}";
|
||||
}
|
||||
//}
|
||||
$str_dxx="";
|
||||
if($is_msg=="y"){
|
||||
$str_dxx=",{\"title\":\"短消息\",\"icon\":\"menu_icon_dhxz\",\"link\":\"msg.htm\"}";
|
||||
}
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"我的客户\",\"icon\":\"menu_icon_my_client\",\"link\":\"my_client.htm\"}".$str_dxx.$menu_gd_ms."]},";
|
||||
$str_menu_brand="";
|
||||
if($is_brand=="y"){
|
||||
$str_menu_brand="{\"title\":\"完成率\",\"icon\":\"menu_icon_wcl\",\"link\":\"ppwcl.htm\"},";
|
||||
}
|
||||
if($ph_ms){
|
||||
$json_data.="{\"menu_sub\":[".$str_menu_brand."{\"title\":\"订单明细\",\"icon\":\"menu_icon_detail\",\"link\":\"detail.htm\"},{\"title\":\"我的排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph_my_dl.htm\"},{\"title\":\"全国排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph.htm\"}]},";
|
||||
}else{
|
||||
$json_data.="{\"menu_sub\":[".$str_menu_brand."{\"title\":\"订单明细\",\"icon\":\"menu_icon_detail\",\"link\":\"detail.htm\"},{\"title\":\"我的排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph_my_dl.htm\"}]},";
|
||||
}
|
||||
//报表类菜单,含定制
|
||||
$ts_bb_arr=array("size"=>"尺码","color"=>"颜色","ks_size"=>"款色深度");
|
||||
$menu_gd_bb="";
|
||||
for($i=0;$i<count($sys_bb_cate);$i++){
|
||||
$bb_arr=explode("&",$sys_bb_cate[$i]);
|
||||
if(count($bb_arr)==1){
|
||||
if($bb_arr[0]=="size" || $bb_arr[0]=="color" || $bb_arr[0]=="ks_size"){
|
||||
$bbtitle=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
$bb_cate=$bb_arr[0];
|
||||
}else{
|
||||
if($bb_arr[0]=="color"){
|
||||
$bbtitle2=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle2=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
if($bb_arr[1]=="size" || $bb_arr[1]=="ks_size" || $bb_arr[1]=="color"){
|
||||
$bbtitle3=$ts_bb_arr[$bb_arr[1]];
|
||||
}else{
|
||||
$bbtitle3=get_cate_title_no("arr_select",$bb_arr[1]);
|
||||
}
|
||||
$bbtitle=$bbtitle2."-".$bbtitle3;
|
||||
$bb_cate=$bb_arr[0]."%26".$bb_arr[1];
|
||||
}
|
||||
$menu_gd_bb.="{\"title\":\"".$bbtitle."分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=".$bb_cate."\"},";
|
||||
}
|
||||
$sql="select * from ".$table_pre."plugin where available='y' and cate='client_bb' and (face='".$face."' or face='')";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$id=$msg["id"];
|
||||
$icon=get_plugin_set("icon","menu_icon_bb");
|
||||
$menu_gd_bb.="{\"title\":\"".$msg["title"]."\",\"icon\":\"".$icon."\",\"link\":\"plugin.htm?id=".$msg["id"]."&file_name=".$msg["file_name"]."&cate=".$msg["cate"]."\"},";
|
||||
}
|
||||
$json_data.="{\"menu_sub\":[".deel_end($menu_gd_bb)."]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"my_client.htm\",";
|
||||
break;
|
||||
case "4":
|
||||
//-------------------------------------------------------------------------店铺角色
|
||||
//-------------计算订货信息
|
||||
$tmp_o=get_db_msg("select sum(num) 'js',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y'".$con_spk." and uid='".$msg_client["id"]."' and _key='".$_key."'");
|
||||
$q="select sum(num) 'js',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y'".$con_spk." and uid='".$msg_client["id"]."' and _key='".$_key."'";
|
||||
$json_data.="\"q\":\"".$q."\",";
|
||||
if($is_brand=="y"){
|
||||
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$msg_client["id"]."'");
|
||||
$zb1=$tmp["zb"]*10000;
|
||||
$zb=deel_num($tmp["zb"]);
|
||||
$zb_js=$tmp["zb_js"];
|
||||
}else{
|
||||
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client where id='".$msg_client["id"]."'");
|
||||
$zb1=$tmp["zb"]*10000;
|
||||
$zb=deel_num($tmp["zb"]);
|
||||
$zb_js=$tmp["zb_js"];
|
||||
}
|
||||
//金额指标
|
||||
$zb_je=$zb;
|
||||
$zb_je_wcl=deel_bfb1($tmp_o["jsje"],$zb_je*10000,1);
|
||||
//件数指标
|
||||
//$zb_js=$msg_client["zb_js"];
|
||||
$zb_js_wcl=deel_bfb1($tmp_o["js"],$zb_js,1);
|
||||
//-------------/计算订货信息
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"".deel_num($tmp_o["js"])."\",\"order_je\":\"".deel_num(keep_float($tmp_o["je"],0))."\",\"order_jsje\":\"".deel_num(keep_float($tmp_o["jsje"],0))."\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"".deel_num(keep_float($zb_je,2))."\",\"wcl_je\":\"".$zb_je_wcl."\",\"zb_js\":\"".deel_num($zb_js)."\",\"wcl_js\":\"".$zb_js_wcl."\",";
|
||||
//$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"80%\",\"zb_js\":\"0\",\"wcl_js\":\"90%\",";
|
||||
//交单信息
|
||||
$json_data.="\"is_jd\":\"".$msg_client["is_jd"]."\",";
|
||||
//订单确认信息
|
||||
$json_data.="\"is_qr\":\"".$msg_client["is_checked"]."\",";
|
||||
//菜单
|
||||
|
||||
//计算订货模式
|
||||
if($tmpl_is_multi_ms=="y"){
|
||||
$tmp=get_db_msg("select * from ".$table_pre."set where _k='sys_ms'");
|
||||
$arr_tmp=explode(",",$tmp["_t1"]);
|
||||
for($i=0;$i<count($arr_tmp);$i++){
|
||||
$arr_tmp1=explode("|",$arr_tmp[$i]);
|
||||
$arr_ms_title[$arr_tmp1[0]]=$arr_tmp1[1];
|
||||
}
|
||||
$sys_ms=$tmp["_v"]?$tmp["_v"]:1;
|
||||
$arr_ms=explode(",",$sys_ms);
|
||||
}else{
|
||||
$arr_ms=array("1");
|
||||
$arr_ms_title["1"]="单款";
|
||||
|
||||
}
|
||||
$js_str_ms="";
|
||||
$home="";
|
||||
for($i=0;$i<count($arr_ms);$i++){
|
||||
if($i==0){
|
||||
$home=$menu_arr_sys[$arr_ms[$i]];
|
||||
}
|
||||
$js_str_ms.="{\"title\":\"".get_main_value($arr_ms_title,$arr_ms[$i])."\",\"icon\":\"menu_icon_ms_".$arr_ms[$i]."\",\"link\":\"".$menu_arr_sys[$arr_ms[$i]]."\"},";
|
||||
|
||||
}
|
||||
$home=$home?$home:"dk.htm";
|
||||
$json_data.="\"menu\":[";
|
||||
//订货模式
|
||||
$json_data.="{\"menu_sub\":[".deel_end($js_str_ms)."]},";
|
||||
|
||||
//固定菜单
|
||||
$menu_gd_ms="";
|
||||
//if($show_dhxz=="y"){
|
||||
for($i=0;$i<count($sys_menu_other);$i++){
|
||||
$dhxz_arr=$sys_menu_other[$i];
|
||||
$menu_gd_ms.=",{\"title\":\"".$dhxz_arr[0]."\",\"icon\":\"".$dhxz_arr[2]."\",\"link\":\"dhxz.htm?_a=".$dhxz_arr[2]."\"}";
|
||||
}
|
||||
//}
|
||||
$str_menu_brand="";
|
||||
if($is_brand=="y"){
|
||||
$str_menu_brand.="{\"title\":\"品牌完成率\",\"icon\":\"menu_icon_wcl\",\"link\":\"ppwcl.htm\"},";
|
||||
}
|
||||
if($show_zzdy=="y"){
|
||||
$str_menu_brand.="{\"title\":\"客户二维码\",\"icon\":\"menu_icon_ewm\",\"link\":\"ewm.htm\"},";
|
||||
}
|
||||
$tmpgz=get_db_msg("select count(*) num from ".$table_pre."keyword where (cate='dhgz') and no<>'zgdl' and no<>'dhbs' and no<>'qdl' and no<>'glk' and no<>'zxs' and flag_ka='y'");
|
||||
|
||||
//
|
||||
|
||||
$json_data.="{\"menu_sub\":[".$str_menu_brand."{\"title\":\"订单明细\",\"icon\":\"menu_icon_detail\",\"link\":\"detail.htm\"}";
|
||||
//$json_data.=",{\"title\":\"智订宝\",\"icon\":\"menu_icon_zdb\",\"link\":\"zdb.htm\"}";
|
||||
if($ph_ms){
|
||||
$json_data.=",{\"title\":\"全国排行\",\"icon\":\"menu_icon_ph\",\"link\":\"ph.htm\"}";
|
||||
}
|
||||
if($is_msg=="y"){
|
||||
$json_data.=",{\"title\":\"短消息\",\"icon\":\"menu_icon_dhxz\",\"link\":\"msg.htm\"}";
|
||||
}
|
||||
if($tmpgz["num"]){
|
||||
$json_data.=",{\"title\":\"订货规则\",\"icon\":\"menu_icon_dhgz\",\"link\":\"dhgz.htm\"}";
|
||||
}
|
||||
$json_data.="".$menu_gd_ms."]},";
|
||||
//报表类菜单,含定制
|
||||
$ts_bb_arr=array("size"=>"尺码","color"=>"颜色","ks_size"=>"款色深度");
|
||||
$menu_gd_bb="";
|
||||
for($i=0;$i<count($sys_bb_cate);$i++){
|
||||
$bb_arr=explode("&",$sys_bb_cate[$i]);
|
||||
if(count($bb_arr)==1){
|
||||
if($bb_arr[0]=="size" || $bb_arr[0]=="color" || $bb_arr[0]=="ks_size"){
|
||||
$bbtitle=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
$bb_cate=$bb_arr[0];
|
||||
}else{
|
||||
if($bb_arr[0]=="color"){
|
||||
$bbtitle2=$ts_bb_arr[$bb_arr[0]];
|
||||
}else{
|
||||
$bbtitle2=get_cate_title_no("arr_select",$bb_arr[0]);
|
||||
}
|
||||
if($bb_arr[1]=="size" || $bb_arr[1]=="ks_size" || $bb_arr[1]=="color"){
|
||||
$bbtitle3=$ts_bb_arr[$bb_arr[1]];
|
||||
}else{
|
||||
$bbtitle3=get_cate_title_no("arr_select",$bb_arr[1]);
|
||||
}
|
||||
$bbtitle=$bbtitle2."-".$bbtitle3;
|
||||
$bb_cate=$bb_arr[0]."%26".$bb_arr[1];
|
||||
}
|
||||
$menu_gd_bb.="{\"title\":\"".$bbtitle."分析\",\"icon\":\"menu_icon_bb\",\"link\":\"bb.htm?cate=".$bb_cate."\"},";
|
||||
}
|
||||
$sql="select * from ".$table_pre."plugin where available='y' and cate='client_bb' and (face='".$face."' or face='')";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$id=$msg["id"];
|
||||
$icon=get_plugin_set("icon","menu_icon_bb");
|
||||
$menu_gd_bb.="{\"title\":\"".$msg["title"]."\",\"icon\":\"".$icon."\",\"link\":\"plugin.htm?id=".$msg["id"]."&file_name=".$msg["file_name"]."&cate=".$msg["cate"]."\"},";
|
||||
}
|
||||
$json_data.="{\"menu_sub\":[".deel_end($menu_gd_bb)."]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"".$home."\",";
|
||||
break;
|
||||
case "5":
|
||||
//-------------------------------------------------------------------------陈列师角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
$json_data.="\"menu\":[";
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"首页\",\"icon\":\"menu_icon_ms_3\",\"link\":\"cls.htm\"}]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"cls.htm\",";
|
||||
break;
|
||||
case "6":
|
||||
//-------------------------------------------------------------------------设计师角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
$json_data.="\"menu\":[";
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"首页\",\"icon\":\"menu_icon_ms_5\",\"link\":\"sjs.htm\"}]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"sjs.htm\",";
|
||||
break;
|
||||
case "7":
|
||||
//-------------------------------------------------------------------------推送主讲角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
$json_data.="\"menu\":[";
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"首页\",\"icon\":\"menu_icon_ms_5\",\"link\":\"ts_zj.htm\"}]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"ts_zj.htm\",";
|
||||
break;
|
||||
case "8":
|
||||
//-------------------------------------------------------------------------app拍照上传角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
$json_data.="\"menu\":[";
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"首页\",\"icon\":\"menu_icon_ms_5\",\"link\":\"admin.htm\"}]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"admin.htm\",";
|
||||
break;
|
||||
case "10":
|
||||
//-------------------------------------------------------------------------推演师角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
$json_data.="\"menu\":[";
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"首页\",\"icon\":\"menu_icon_ms_5\",\"link\":\"tys.htm\"}]},";
|
||||
|
||||
$sql="select * from ".$table_pre."plugin where available='y' and cate='client_bb' and (face='".$face."' or face='')";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$id=$msg["id"];
|
||||
$icon=get_plugin_set("icon","menu_icon_bb");
|
||||
$menu_gd_bb.="{\"title\":\"".$msg["title"]."\",\"icon\":\"".$icon."\",\"link\":\"plugin.htm?id=".$msg["id"]."&file_name=".$msg["file_name"]."&cate=".$msg["cate"]."\"},";
|
||||
}
|
||||
$json_data.="{\"menu_sub\":[".deel_end($menu_gd_bb)."]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"tys.htm\",";
|
||||
break;
|
||||
case "11":
|
||||
//-------------------------------------------------------------------------直播主讲角色
|
||||
//订货信息
|
||||
$json_data.="\"order_num\":\"0\",\"order_je\":\"0\",\"order_jsje\":\"0\",";
|
||||
//指标信息
|
||||
$json_data.="\"zb_je\":\"0\",\"wcl_je\":\"0%\",\"zb_js\":\"0\",\"wcl_js\":\"0%\",";
|
||||
$json_data.="\"menu\":[";
|
||||
$json_data.="{\"menu_sub\":[{\"title\":\"首页\",\"icon\":\"menu_icon_ms_5\",\"link\":\"zb_zj.htm\"},{\"title\":\"在线概览\",\"icon\":\"menu_icon_detail\",\"link\":\"zb_zj_zxmx.htm\"},{\"title\":\"在线明细\",\"icon\":\"menu_icon_my_client\",\"link\":\"zb_zj_client.htm\"}]}";
|
||||
//$json_data.="{\"menu_sub\":[{\"title\":\"客户列表\",\"icon\":\"menu_icon_my_client\",\"link\":\"zb_zj_client.htm\"}]}";
|
||||
$json_data.="],";
|
||||
//首次进入页面
|
||||
$json_data.="\"home\":\"zb_zj.htm\",";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,197 @@
|
||||
<?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."'");
|
||||
|
||||
$arr_report=array("new"=>"新消息","all"=>"历史信息","send_box"=>"发件箱","js"=>"发送消息");
|
||||
|
||||
$_a=$_a?$_a:"new";
|
||||
|
||||
if($_a=="new" || $_a=="all" || $_a=="send_box" || $_a=="js"){
|
||||
$json_data.="\"s_a\":\"".$_a."\",";
|
||||
$str_tab="";
|
||||
foreach($arr_report as $k1=>$v1){
|
||||
$str_tab.="{\"_a\":\"".$k1."\",\"title\":\"".$v1."\"},";
|
||||
}
|
||||
$str_tab=deel_end($str_tab);
|
||||
$json_data.="\"tab\":[".$str_tab."],";
|
||||
}
|
||||
switch($_a){
|
||||
case "all":
|
||||
$return_msg="";
|
||||
$count=0;
|
||||
$sql="select * from ".$table_pre."msg where to_cid='".$uid."' order by add_date";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$msg_from=get_db_msg("select * from ".$table_pre."client where id='".$msg["from_cid"]."'");
|
||||
$return_msg.="{";
|
||||
$return_msg.="\"msgid\":\"".$msg["id"]."\",";
|
||||
$return_msg.="\"msguser\":\"".$msg_from["username"]."\",";
|
||||
$return_msg.="\"msgdate\":\"".date("d日 H时i分s秒",$msg["add_date"])."\",";
|
||||
$return_msg.="\"msgfrom\":\"".$msg_from["title"]."\",";
|
||||
$return_msg.="\"msgtext\":\"".dhtmlchars($msg["text"])."\"";
|
||||
$return_msg.="},";
|
||||
$count++;
|
||||
}
|
||||
if($return_msg){
|
||||
$json_data.="\"msgcount\":\"".$count."\",\"msgcontent\":[".substr($return_msg,0,-1)."],";
|
||||
}else{
|
||||
$json_data.="\"msgcount\":\"0\",\"msgcontent\":[],";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "new":
|
||||
$return_msg="";
|
||||
$count=0;
|
||||
$sql="select * from ".$table_pre."msg where to_cid='".$uid."' and is_read='n' order by add_date";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$msg_from=get_db_msg("select * from ".$table_pre."client where id='".$msg["from_cid"]."'");
|
||||
$return_msg.="{";
|
||||
$return_msg.="\"msgid\":\"".$msg["id"]."\",";
|
||||
$return_msg.="\"msguser\":\"".$msg_from["username"]."\",";
|
||||
$return_msg.="\"msgdate\":\"".date("d日 H时i分s秒",$msg["add_date"])."\",";
|
||||
$return_msg.="\"msgfrom\":\"".$msg_from["title"]."\",";
|
||||
$return_msg.="\"msgtext\":\"".dhtmlchars($msg["text"])."\"";
|
||||
$return_msg.="},";
|
||||
$count++;
|
||||
if($init=="y"){
|
||||
$db->query("update ".$table_pre."msg set is_read='y' where id='".$msg["id"]."'");
|
||||
}
|
||||
}
|
||||
if($return_msg){
|
||||
$json_data.="\"msgcount\":\"".$count."\",\"msgcontent\":[".substr($return_msg,0,-1)."],";
|
||||
}else{
|
||||
$json_data.="\"msgcount\":\"0\",\"msgcontent\":[],";
|
||||
}
|
||||
break;
|
||||
|
||||
case "send_box":
|
||||
$return_msg="";
|
||||
$count=0;
|
||||
$sql="select * from ".$table_pre."msg where from_cid='".$uid."' order by add_date";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$msg_from=get_db_msg("select * from ".$table_pre."client where id='".$msg["to_cid"]."'");
|
||||
$return_msg.="{";
|
||||
$return_msg.="\"msgid\":\"".$msg["id"]."\",";
|
||||
$return_msg.="\"msguser\":\"".$msg_from["username"]."\",";
|
||||
$return_msg.="\"msgdate\":\"".date("d日 H时i分s秒",$msg["add_date"])."\",";
|
||||
$return_msg.="\"msgto\":\"".$msg_from["title"]."\",";
|
||||
$return_msg.="\"msgtext\":\"".dhtmlchars($msg["text"])."\"";
|
||||
$return_msg.="},";
|
||||
$count++;
|
||||
}
|
||||
if($return_msg){
|
||||
$json_data.="\"msgcount\":\"".$count."\",\"msgcontent\":[".substr($return_msg,0,-1)."],";
|
||||
}else{
|
||||
$json_data.="\"msgcount\":\"0\",\"msgcontent\":[],";
|
||||
}
|
||||
break;
|
||||
|
||||
case "js":
|
||||
$op_auto_username="";
|
||||
//根据uid判断可以发送给谁
|
||||
if($msg_login["face"]=="4"){
|
||||
//店铺
|
||||
//总经理
|
||||
$q="select * from ".$table_pre."client where face='1'";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"总经理-".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
//区域经理
|
||||
$q="select * from ".$table_pre."client where face='2'";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$c1=explode(",",$m["charge_path"]);
|
||||
if(in_array($upath,$c1)){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"区域经理-".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
}
|
||||
//上级代理商
|
||||
$m=get_db_msg("select * from ".$table_pre."client where face='3' and id='".get_parent_id($msg_login["path"])."'");
|
||||
if($m["id"]>0)
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"上级代理-".$m["title"]."(".$m["username"].")\"},";
|
||||
//软件反馈
|
||||
$q="select * from ".$table_pre."client where face='8'";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"软件反馈-".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
|
||||
}else if($msg_login["face"]=="2"){
|
||||
//区域经理
|
||||
//所属客户
|
||||
$arr1=explode(",",$msg_login["charge_path"]);
|
||||
for($i=0;$i<count($arr1);$i++){
|
||||
$m=get_db_msg("select * from ".$table_pre."client where id='".get_parent_id($arr1[$i])."'");
|
||||
if($m["id"]!=$uid){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
}
|
||||
//软件反馈
|
||||
$q="select * from ".$table_pre."client where face='8'";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"软件反馈-".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
}else if($msg_login["face"]=="3"){//代理商
|
||||
//下级客户
|
||||
$q="select id,title,username,path,CONCAT(path,'-',id) 'abs_path' from ".$table_pre."client where path='".$upath."' or path like '".$upath."-%' order by abs_path";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
//软件反馈
|
||||
$q="select * from ".$table_pre."client where face='8'";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"软件反馈-".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
}else{
|
||||
//所有客户
|
||||
$q="select id,title,username,path,CONCAT(path,'-',id) 'abs_path' from ".$table_pre."client where id<>'".$uid."' order by abs_path";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op_auto_username.="{\"no\":\"".$m["username"]."\",\"title\":\"".$m["title"]."(".$m["username"].")\"},";
|
||||
}
|
||||
}
|
||||
|
||||
$op_auto_username=deel_end($op_auto_username);
|
||||
$json_data.="\"username_to\":\"".$auto_username."\",";
|
||||
$json_data.="\"select_group_by\":{\"no\":\"auto_username\",\"title\":\"用户组\",\"value\":\"".$auto_username."\",\"op\":[".$op_auto_username."]},";
|
||||
break;
|
||||
case "save":
|
||||
$check=get_db_msg("select * from ".$table_pre."client where username='".$username_to."' limit 0,1");
|
||||
if($check["id"]>0){
|
||||
$query="insert into ".$table_pre."msg (from_cid,to_cid,text,add_date) values ('".$uid."','".$check["id"]."','".mysql_escape_string($text)."','".time()."')";
|
||||
$db->query($query);
|
||||
$str="发送成功";
|
||||
$json_data.="\"code\":\"1\",\"msgerror\":\"".$msgerror."\",";
|
||||
}else{
|
||||
$msgerror="发送失败,用户不存在!";
|
||||
$json_data.="\"code\":\"0\",\"msgerror\":\"".$msgerror."\",";
|
||||
}
|
||||
break;
|
||||
|
||||
case "queren":
|
||||
if($id){
|
||||
$msg=get_db_msg("select * from ".$table_pre."msg where id='".$id."'");
|
||||
$db->query("update ".$table_pre."msg set is_read='y' where id='".$msg["id"]."'");
|
||||
$json_data.="\"code\":\"1\",";
|
||||
}else{
|
||||
$msgerror="发送失败,用户不存在!";
|
||||
$json_data.="\"code\":\"0\",";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,801 @@
|
||||
<?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."'");
|
||||
$sys_size_num=get_max_size_num();
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
$arr_upath=explode(",",$msg_login["charge_path"]);
|
||||
$is_brand=is_brand();
|
||||
$sd_ms=get_set("sd_ms");
|
||||
$dzqm=get_set("dzqm");
|
||||
$zk_type=get_set("zk_type");
|
||||
$con_brand="";
|
||||
if($is_brand=="y"){
|
||||
if($s_brand)
|
||||
$con_brand=" and brand='".$s_brand."'";
|
||||
}
|
||||
|
||||
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
|
||||
$zb_type=get_set("zb_type");
|
||||
$arr_zb_type=explode(",",$zb_type);
|
||||
$is_spk=get_set("is_spk");
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
//是否显示结算金额
|
||||
if($zk_type || $check_md["num"]>0)
|
||||
$show_jsje="y";
|
||||
else
|
||||
$show_jsje="n";
|
||||
$is_multi_price=get_set("is_multi_price");
|
||||
$qr_not_jd=get_set("qr_not_jd");
|
||||
$cou_u_all=get_qj_ucon_all($msg_login["charge_path_real"]);
|
||||
$face=$msg_login["face"];
|
||||
if($msg_login["rfid"]=="y" && $face==2)
|
||||
$json_data.="\"glkh\":\"".$msg_login["rfid"]."\",";
|
||||
switch($_a){
|
||||
case "mod_client":
|
||||
//管理客户
|
||||
$_title_="管理客户";
|
||||
$content="<div style='padding:4px;line-height:200%;'><input type='button' value=' >返回 ' onclick=\"window.location.href='index.php?_m=main_2&s_tab=c'\"> 请输入完整的登陆账号<input type='text' name='s_dp_username' id='s_dp_username' style='width:100px;height:25px;'> 请输入登陆密码<input type='password' name='s_dp_password' id='s_dp_password' style='width:100px;height:25px;'> <input type='button' value=' 添加 ' onclick=\"mod_client_add(document.getElementById('s_dp_username').value,document.getElementById('s_dp_password').value)\"></div>";
|
||||
$content.="<form name=\"form1\" action=\"".$_SERVER["PHP_SELF"]."\"><input type=\"hidden\" name=\"_m\" value=\"".$_m."\"><input type=\"hidden\" name=\"_cid\" value=\"".$_cid."\"><input type=\"hidden\" name=\"_a\" value=\"save_mod_client\"><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#ffffff\"><tr bgcolor=\"#cccccc\" height='25'><td align=\"center\">店铺名</td><td align=\"center\">登陆账号</td><td align=\"center\">操作</td></tr>";
|
||||
$list=0;
|
||||
for($count=0;$count<count($arr_upath);$count++){
|
||||
$bgcolor=($list%2==0)?"#ffffff":"#e0e0e0";
|
||||
$q="select id,username,title,face from ".$table_pre."client where id='".get_parent_id($arr_upath[$count])."'";
|
||||
//echo $q."<Br>";
|
||||
$m=get_db_msg($q);
|
||||
if($m["face"]=="4"){
|
||||
$content.="<tr bgcolor=\"".$bgcolor."\"><td align=\"left\">".$m["title"]."</td><td align=\"center\">".$m["username"]."</td><td align=\"center\"><input type='button' value='移除' onclick=\"mod_client_del('".$m["id"]."','".$m["title"]."')\"></td></tr>";
|
||||
$list++;
|
||||
$json_data1.="[\"".$m["title"]."\",\"".$m["username"]."\",\"caozuo|'".$m["id"]."','".$m["title"]."'\"],";
|
||||
}
|
||||
}
|
||||
echo $json_data.="\"tab_mid\":[".substr($json_data1,0,-1)."]}";
|
||||
$content.="</table>";
|
||||
exit;
|
||||
break;
|
||||
case "add_client":
|
||||
//新增店铺权限
|
||||
$json_data="";
|
||||
$username=trim($username);
|
||||
$password=trim($password);
|
||||
if($username!="" && $password!=""){
|
||||
$check=get_db_msg("select id from ".$table_pre."client where username='".$username."' and password='".$password."' and face='4'");
|
||||
if($check["id"]>0){
|
||||
//
|
||||
if(trim($msg_login["charge_uid"])!="")
|
||||
$arr_uid=explode(",",trim($msg_login["charge_uid"]));
|
||||
else
|
||||
$arr_uid=array();
|
||||
if(in_array($check["id"],$arr_uid)){
|
||||
echo "该用户已添加!";
|
||||
}else{
|
||||
$arr_uid[]=$check["id"];
|
||||
$str_uid=arr_to_str($arr_uid);
|
||||
$arr1=get_qj_charge($arr_uid);
|
||||
$q="update ".$table_pre."client set charge_path='".$arr1[0]."',charge_path_real='".$arr1[1]."',charge_uid='".$str_uid."' where id='".$uid."'";
|
||||
//echo $q."<br>";
|
||||
$db->query($q);
|
||||
echo "y";
|
||||
}
|
||||
}else{
|
||||
echo "账号或者密码有误,请检查!";
|
||||
}
|
||||
}else{
|
||||
echo "请输入完整的登录账号和登陆密码!";
|
||||
}
|
||||
break;
|
||||
case "del_client":
|
||||
//移除店铺权限
|
||||
$json_data="";
|
||||
$arr_uid=explode(",",$msg_login["charge_uid"]);
|
||||
$arr_uid1=array();
|
||||
for($i=0;$i<count($arr_uid);$i++){
|
||||
if($arr_uid[$i]!=$id)
|
||||
$arr_uid1[]=$arr_uid[$i];
|
||||
}
|
||||
$str_uid=arr_to_str($arr_uid1);
|
||||
$arr1=get_qj_charge($arr_uid1);
|
||||
$q="update ".$table_pre."client set charge_path='".$arr1[0]."',charge_path_real='".$arr1[1]."',charge_uid='".$str_uid."' where id='".$uid."'";
|
||||
//echo $q."<br>";
|
||||
$db->query($q);
|
||||
echo "y";
|
||||
break;
|
||||
case "confirm":
|
||||
if($msg_login["face"]==2 && $msg_login["qyjl_confirm"]=="n"){
|
||||
echo "n|该区经没有确认权限";
|
||||
exit;
|
||||
}
|
||||
$str="y|";
|
||||
//---------确认客户订单
|
||||
$m=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
|
||||
if($m["face"]=="4" && $m["is_checked"]!="y"){
|
||||
$tmp_gz=get_db_msg("select count(*) 'num' from web_keyword where cate='dhgz' and flag_ka='y'");
|
||||
if($tmp_gz["num"]){
|
||||
//检查订货规则
|
||||
$c1=check_dhgz_client($id,"y");
|
||||
if($c1!="y"){
|
||||
echo "n|请检查订货规则:".$c1;
|
||||
exit;
|
||||
}
|
||||
//检查最高订量
|
||||
$c1=check_zgdl($id,"y");
|
||||
if($c1!="y"){
|
||||
echo "n|请检查订货规则:".$c1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($is_brand=="y"){
|
||||
//----启用多品牌
|
||||
$m1=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$id."'".$con_brand." order by is_jd limit 0,1");
|
||||
if($qr_not_jd=="n" && $m1["is_jd"]!="y"){
|
||||
echo "n|客户未交单,不允许确认。";
|
||||
exit;
|
||||
}
|
||||
$m1=get_db_msg("select id,is_checked from ".$table_pre."client_brand where cid='".$id."'".$con_brand." order by is_checked limit 0,1");
|
||||
if($m1["id"]){
|
||||
$db->query("update ".$table_pre."client_brand set is_checked='y' where cid='".$id."'".$con_brand);
|
||||
$str.="<span style=\"font-size:14px;font-weight:bold;\">√</span>|<input type=\"button\" id='b_qxconfirm_".$m["id"]."' value=\"取消确认\" onclick=\"ajax_qj_action('确定执行取消确认订单吗?','qxconfirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
|
||||
}else{
|
||||
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
|
||||
}
|
||||
|
||||
}else{
|
||||
//----不启用多品牌
|
||||
if($qr_not_jd=="n" && $m["is_jd"]!="y"){
|
||||
$str="";
|
||||
echo "n|客户未交单,不允许确认。";
|
||||
exit;
|
||||
}
|
||||
//如果是代理商则先检查下属店铺是否审核
|
||||
if($m["face"]=="3" && $m["is_checked"]=="n"){
|
||||
$t1=get_db_msg("select count(*) 'num' from ".$table_pre."client where face='4' and is_checked='n' and (path='".$m["path"]."-".$m["id"]."' or path like '".$m["path"]."-".$m["id"]."-%')");
|
||||
if($t1["num"]>0){
|
||||
echo "n|对不起,该代理商尚有未审核店铺!";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($m["face"]=="4" && $m["is_checked"]=="y"){
|
||||
//检查上级代理商是否确认
|
||||
$dl_uid=get_dl_id($m["path"]);
|
||||
if($dl_uid>0){
|
||||
$t1=get_db_msg("select * from ".$table_pre."client where id='".$dl_uid."'");
|
||||
if($t1["is_checked"]=="y"){
|
||||
echo "n|对不起,该店铺的上级代理已经确认订单!";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
$db->query("update ".$table_pre."client set is_checked='y' where id='".$id."'");
|
||||
$str.="<span style=\"font-size:14px;font-weight:bold;\">√</span>|<input type=\"button\" id='b_qxconfirm_".$m["id"]."' value=\"取消确认\" onclick=\"ajax_qj_action('确定执行取消确认订单吗?','qxconfirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
|
||||
}
|
||||
echo $str;
|
||||
exit;
|
||||
break;
|
||||
case "qxconfirm":
|
||||
if($msg_login["face"]==2 && $msg_login["qyjl_confirm"]=="n"){
|
||||
echo "n|该区经没有确认权限";
|
||||
exit;
|
||||
}
|
||||
$str="y|";
|
||||
$m=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
|
||||
if($is_brand=="y"){
|
||||
$m1=get_db_msg("select id,is_checked from ".$table_pre."client_brand where cid='".$id."'".$con_brand." order by is_checked limit 0,1");
|
||||
if($m1["id"]){
|
||||
$db->query("update ".$table_pre."client_brand set is_checked='n' where cid='".$id."'".$con_brand);
|
||||
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
|
||||
}else{
|
||||
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
|
||||
}
|
||||
}else{
|
||||
$db->query("update ".$table_pre."client set is_checked='n' where id='".$id."'");
|
||||
$str.="11|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
|
||||
}
|
||||
echo $str;
|
||||
exit;
|
||||
break;
|
||||
case "jd":
|
||||
//---------退回交单
|
||||
$str="y|";
|
||||
$m=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
|
||||
if($is_brand=="y"){
|
||||
$db->query("update ".$table_pre."client_brand set is_jd='n',is_checked='n' where cid='".$id."'".$con_brand);
|
||||
}else{
|
||||
$db->query("update ".$table_pre."client set is_jd='n',is_checked='n' where id='".$id."'");
|
||||
}
|
||||
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
|
||||
update_order_state($uid,$id,"退回交单","");
|
||||
echo $str;
|
||||
exit;
|
||||
break;
|
||||
default:
|
||||
//取得代理下面所属店铺的数组
|
||||
$tmp="";
|
||||
$q1="select * from ".$table_pre."client where face='3'";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tmp.="[\"".$m1["path"]."-".$m1["id"]."\"";
|
||||
$q2="select * from ".$table_pre."client where face='4' and path='".$m1["path"]."-".$m1["id"]."'";
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$tmp.=",\"".$m2["path"]."-".$m2["id"]."\"";
|
||||
}
|
||||
$tmp.="],";
|
||||
}
|
||||
if($tmp)
|
||||
$json_data.="\"arr_dl\":[".substr($tmp,0,-1)."],";
|
||||
//--
|
||||
$s_split_spfs=$s_split_spfs?$s_split_spfs:"n";
|
||||
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
||||
$json_data.="\"s_username\":\"".$s_username."\",";
|
||||
$json_data.="\"s_split_spfs\":\"".$s_split_spfs."\",";
|
||||
$json_data.="\"s_is_checked\":\"".$s_is_checked."\",";
|
||||
$json_data.="\"s_is_jd\":\"".$s_is_jd."\",";
|
||||
|
||||
//品牌选项
|
||||
if($is_brand=="y"){
|
||||
$select_dz="";
|
||||
//取得选项
|
||||
$tmp="";
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='brand' order by no");
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$select_dz.="{\"no\":\"brand\",\"title\":\"".get_cate_title_no("arr_select","brand")."\",\"value\":\"".$s_brand."\",\"op\":[".$tmp."]}";
|
||||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||||
}
|
||||
|
||||
//订货会标记选项
|
||||
$con_f="";
|
||||
if(count($arr_sys_order_flag)>1){
|
||||
$show_key="y";
|
||||
$json_data.="\"show_key\":\"".$show_key."\",";
|
||||
//
|
||||
$tmp_order_flag="";
|
||||
foreach($arr_sys_order_flag as $k => $v){
|
||||
$tmp_order_flag.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$tmp_order_flag.="{\"no\":\"all\",\"title\":\"所有订单\"},";
|
||||
$tmp_order_flag=deel_end($tmp_order_flag);
|
||||
|
||||
if($s_key){
|
||||
$selectf=$s_key;
|
||||
}else{
|
||||
$selectf=$_key;
|
||||
}
|
||||
$str_json="\"select_order_flag\":{\"no\":\"s_key\",\"title\":\"订货会标记\",\"value\":\"".$selectf."\",\"op\":[".$tmp_order_flag."]},";
|
||||
$json_data.=$str_json;
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con_f="";
|
||||
}else{
|
||||
$con_f=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$show_key="n";
|
||||
$json_data.="\"show_key\":\"".$show_key."\",";
|
||||
}
|
||||
|
||||
//-----------表头
|
||||
$table_top="\"客户\",";
|
||||
if($s_split_spfs=="y"){
|
||||
$table_top.="\"".d_translate("cyk")."|订量\",\"".d_translate("cyk")."|".d_translate("dpje")."\",";
|
||||
if($show_jsje=="y"){
|
||||
$table_top.="\"".d_translate("cyk")."|结算金额\",";
|
||||
}
|
||||
$table_top.="\"".d_translate("spk")."|订量\",\"".d_translate("spk")."|".d_translate("dpje")."\",";
|
||||
if($show_jsje=="y")
|
||||
$table_top.="\"".d_translate("spk")."|结算金额\",";
|
||||
}
|
||||
$table_top.="\"小计|数量\",\"小计|".d_translate("dpje")."\",";
|
||||
if($show_jsje=="y")
|
||||
$table_top.="\"小计|结算金额\",";
|
||||
if(in_array("js",$arr_zb_type)){
|
||||
$table_top.="\"件数指标\",\"件数完成率\",";
|
||||
}
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
$table_top.="\"金额指标\",\"金额完成率\",";
|
||||
}
|
||||
$json_data.="\"table_top\":[".substr($table_top,0,-1)."],";
|
||||
if($face==2){
|
||||
if($dzqm=="y" && $sd_ms=="1"){
|
||||
$json_data.="\"dzqm\":\"y\",";
|
||||
}else{
|
||||
$json_data.="\"dzqm\":\"n\",";
|
||||
}
|
||||
}
|
||||
if($face==3){
|
||||
if($dzqm=="y" && $sd_ms=="2"){
|
||||
$json_data.="\"dzqm\":\"y\",";
|
||||
}else{
|
||||
$json_data.="\"dzqm\":\"n\",";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------表头end
|
||||
if($face==2){
|
||||
//区域经理
|
||||
$total_cy_num=$total_cy_je=$total_cy_jsje=0;
|
||||
$total_all_num=$total_all_je=$total_all_jsje=0;
|
||||
$total_zbjs=$total_zbje=0;
|
||||
$total_dlzbjs=$total_dlzbje=0;
|
||||
|
||||
$tab_mid="";
|
||||
for($count=0;$count<count($arr_upath);$count++){
|
||||
$tmp_client=get_db_msg("select * from ".$table_pre."client where id='".get_parent_id($arr_upath[$count])."'");
|
||||
$show_order_num=($tmp_client["face"]==4)?"y":check_qj_priv_all($tmp_client["id"]);
|
||||
if($tmp_client["id"]>0){
|
||||
//
|
||||
$is_jd=$is_checked="null";
|
||||
if($is_brand=="y"){
|
||||
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
|
||||
$m_tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_jd limit 0,1");
|
||||
$is_jd=$m_tmp["is_jd"];
|
||||
$m_tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_checked limit 0,1");
|
||||
$is_checked=$m_tmp["is_checked"];
|
||||
}
|
||||
}else{
|
||||
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
|
||||
$is_jd=$tmp_client["is_jd"];
|
||||
$is_checked=$tmp_client["is_checked"];
|
||||
}
|
||||
}
|
||||
|
||||
if((!$s_username || ($s_username && preg_match("/".$s_username."/i",$tmp_client["username"]))) && (!$s_is_checked || ($s_is_checked && $s_is_checked==$is_checked)) && (!$s_is_jd || ($s_is_jd && $s_is_jd==$is_jd))){
|
||||
|
||||
if($tmp_client["face"]=="4"){
|
||||
$con_tmp=" and uid='".$tmp_client["id"]."'";
|
||||
}else{
|
||||
$con_tmp=" and (upath like '".$tmp_client["path"]."-".$tmp_client["id"]."-%')";
|
||||
}
|
||||
if($is_brand=="y"){
|
||||
$con_tmp.=$con_brand;
|
||||
}
|
||||
|
||||
//总金额
|
||||
if($show_order_num=="y"){
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' ".$con_tmp.$con_f);
|
||||
$tmp_num=$tmp["num"];
|
||||
$tmp_money=$tmp["je"];
|
||||
$tmp_money_zk=$tmp["jsje"];
|
||||
}else{
|
||||
$tmp_num=0;
|
||||
$tmp_money=0;
|
||||
$tmp_money_zk=0;
|
||||
}
|
||||
|
||||
//
|
||||
if($tmp_client["face"]=="4"){
|
||||
$total_all_num+=$tmp_num;
|
||||
$total_all_je+=$tmp_money;
|
||||
$total_all_jsje+=$tmp_money_zk;
|
||||
}
|
||||
//成衣
|
||||
|
||||
if($show_order_num=="y"){
|
||||
$tmp_cy=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' and is_sp<>'y' ".$con_tmp.$con_f);
|
||||
$tmp_num1=$tmp_cy["num"];
|
||||
$tmp_money1=$tmp_cy["je"];
|
||||
$tmp_money1_zk=$tmp_cy["jsje"];
|
||||
}else{
|
||||
$tmp_num1=0;
|
||||
$tmp_money1=0;
|
||||
$tmp_money1_zk=0;
|
||||
}
|
||||
|
||||
if($tmp_client["face"]=="4"){
|
||||
$total_cy_num+=$tmp_num1;
|
||||
$total_cy_je+=$tmp_money1;
|
||||
$total_cy_jsje+=$tmp_money1_zk;
|
||||
}
|
||||
|
||||
//指标
|
||||
if($show_order_num=="y"){
|
||||
if($is_brand=="y"){
|
||||
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand);
|
||||
$tmp_zb_je=$tmp["zb"]*10000;
|
||||
$tmp_zb_js=$tmp["zb_js"];
|
||||
}else{
|
||||
$tmp_zb_je=$tmp_client["zb"]*10000;
|
||||
$tmp_zb_js=$tmp_client["zb_js"];
|
||||
}
|
||||
}else{
|
||||
$tmp_zb_je=0;
|
||||
$tmp_zb_js=0;
|
||||
}
|
||||
if($tmp_client["face"]=="4"){
|
||||
$total_zbjs+=$tmp_zb_js;
|
||||
$total_zbje+=$tmp_zb_je;
|
||||
}else if($tmp_client["face"]=="3"){
|
||||
$total_dlzbjs+=$tmp_zb_js;
|
||||
$total_dlzbje+=$tmp_zb_je;
|
||||
}
|
||||
|
||||
$cz1="";
|
||||
if($msg_login["face"]==2 && $msg_login["qyjl_confirm"]=="n"){
|
||||
$cz1.="&&4||";
|
||||
}else{
|
||||
if($sd_ms=="1" && ($tmp_client["face"]==3 || $tmp_client["face"]==4)){
|
||||
if($is_checked=="y"){
|
||||
$cz1.="&&1&&取消确认&&确定执行取消确认订单吗?&&qxconfirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
|
||||
}else{
|
||||
$cz1.="&&1&&确认订单&&执行确认订单吗?&&confirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
|
||||
}
|
||||
if($is_jd=="y"){
|
||||
$cz1.="||&&2&&退回交单&&确认退回交单吗?&&jd&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
|
||||
}else{
|
||||
$cz1.="||";
|
||||
}
|
||||
}else{
|
||||
$cz1.="&&4||";
|
||||
}
|
||||
}
|
||||
|
||||
if($tmp_client["face"]==3){
|
||||
$cz1.="||y&&".$tmp_client["path"]."-".$tmp_client["id"];
|
||||
}else{
|
||||
$cz1.="||n";
|
||||
}
|
||||
|
||||
$tab_mid.="{\"tb_id\":\"".$tmp_client["path"]."-".$tmp_client["id"]."\",";
|
||||
|
||||
|
||||
|
||||
if($tmp_client["face"]=="9"){
|
||||
$tab_mid.="\"tbdata\":[\" ".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
|
||||
}else if($tmp_client["face"]=="3"){
|
||||
$tab_mid.="\"tbdata\":[\" ".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
|
||||
}else{
|
||||
$tab_mid.="\"tbdata\":[\" ".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
|
||||
}
|
||||
if($s_split_spfs=="y"){
|
||||
$tab_mid.="\"".deel_td($tmp_num1)."\",\"".deel_td(deel_je_show($tmp_money1))."\",";
|
||||
if($show_jsje=="y"){
|
||||
$tab_mid.="\"".deel_td(deel_je_show($tmp_money1_zk))."\",";
|
||||
}
|
||||
$tab_mid.="\"".deel_td($tmp_num-$tmp_num1)."\",\"".deel_td(deel_je_show($tmp_money-$tmp_money1))."\",";
|
||||
if($show_jsje=="y"){
|
||||
$tab_mid.="\"".deel_td(deel_je_show($tmp_money_zk-$tmp_money1_zk))."\",";
|
||||
}
|
||||
}
|
||||
|
||||
$tab_mid.="\"".deel_td($tmp_num)."\",\"".deel_td(deel_je_show($tmp_money))."\",";
|
||||
if($show_jsje=="y")
|
||||
$tab_mid.="\"".deel_td(deel_je_show($tmp_money_zk))."\",";
|
||||
if(in_array("js",$arr_zb_type)){
|
||||
if($is_spk=="y")
|
||||
$wcl=deel_bfb1($tmp_num1,$tmp_zb_js,1);
|
||||
else
|
||||
$wcl=deel_bfb1($tmp_num,$tmp_zb_js,1);
|
||||
$tab_mid.="\"".deel_td($tmp_zb_js)."\",\"".deel_0($wcl)."\",";
|
||||
}
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
if($is_spk=="y"){
|
||||
$tmp1=($show_jsje=="y")?$tmp_money1_zk:$tmp_money1;
|
||||
}else{
|
||||
$tmp1=($show_jsje=="y")?$tmp_money_zk:$tmp_money;
|
||||
}
|
||||
$wcl=deel_bfb1($tmp1,$tmp_zb_je,1);
|
||||
$tab_mid.="\"".deel_td(deel_je_show($tmp_zb_je))."\",\"".deel_0($wcl)."\",";
|
||||
}
|
||||
$tab_mid=substr($tab_mid,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"tab_mid\":[".substr($tab_mid,0,-1)."],";
|
||||
|
||||
//------------------店铺合计
|
||||
$dp_hj="\"店铺合计\",";
|
||||
if($s_split_spfs=="y"){
|
||||
$dp_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dp_hj.="\"".deel_je_show($total_cy_jsje)."\",";
|
||||
}
|
||||
$dp_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dp_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
|
||||
}
|
||||
}
|
||||
$dp_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
|
||||
if($show_jsje=="y")
|
||||
$dp_hj.="\"".deel_je_show($total_all_jsje)."\",";
|
||||
|
||||
if(in_array("js",$arr_zb_type)){
|
||||
if($is_spk=="y")
|
||||
$wcl=deel_bfb1($total_cy_num,$total_zbjs,1);
|
||||
else
|
||||
$wcl=deel_bfb1($total_all_num,$total_zbjs,1);
|
||||
$dp_hj.="\"".$total_zbjs."\",\"".$wcl."\",";
|
||||
}
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
if($is_spk=="y"){
|
||||
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
|
||||
}else{
|
||||
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
|
||||
}
|
||||
$wcl=deel_bfb1($tmp1,$total_zbje,1);
|
||||
$dp_hj.="\"".deel_je_show($total_zbje)."\",\"".$wcl."\",";
|
||||
}
|
||||
$json_data.="\"dp_hj\":[".substr($dp_hj,0,-1)."],";
|
||||
//------------------店铺合计end
|
||||
//------------------代理合计
|
||||
$dl_hj="\"代理合计\",";
|
||||
if($s_split_spfs=="y"){
|
||||
$dl_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dl_hj.="\"".deel_je_show($total_cy_jsje)."\",";
|
||||
}
|
||||
$dl_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dl_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
|
||||
}
|
||||
}
|
||||
$dl_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
|
||||
if($show_jsje=="y")
|
||||
$dl_hj.="\"".deel_je_show($total_all_jsje)."\",";
|
||||
|
||||
if(in_array("js",$arr_zb_type)){
|
||||
if($is_spk=="y")
|
||||
$wcl=deel_bfb1($total_cy_num,$total_dlzbjs,1);
|
||||
else
|
||||
$wcl=deel_bfb1($total_all_num,$total_dlzbjs,1);
|
||||
$dl_hj.="\"".$total_dlzbjs."\",\"".$wcl."\",";
|
||||
}
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
if($is_spk=="y"){
|
||||
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
|
||||
}else{
|
||||
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
|
||||
}
|
||||
$wcl=deel_bfb1($tmp1,$total_dlzbje,1);
|
||||
$dl_hj.="\"".deel_je_show($total_dlzbje)."\",\"".$wcl."\",";
|
||||
}
|
||||
//$json_data.="\"dl_hj\":[".substr($dl_hj,0,-1)."],";
|
||||
$json_data.="\"dl_hj\":[],";
|
||||
//------------------代理合计end
|
||||
}else if($face==3){
|
||||
//代理商
|
||||
$arr_upath=array();
|
||||
$p=$msg_login["path"]."-".$msg_login["id"];
|
||||
$q="select *,concat(path,'-',id) 'abspath' from ".$table_pre."client where (path='".$p."' or path like '".$p."-%') order by abspath";
|
||||
$r=$db->query($q);
|
||||
$li=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_upath[$li]=$m["id"];
|
||||
$li++;
|
||||
}
|
||||
//
|
||||
|
||||
$total_cy_num=$total_cy_je=$total_cy_jsje=0;
|
||||
$total_all_num=$total_all_je=$total_all_jsje=0;
|
||||
$total_zbjs=$total_zbje=0;
|
||||
|
||||
$tab_mid="";
|
||||
for($count=0;$count<count($arr_upath);$count++){
|
||||
$tmp_client=get_db_msg("select * from ".$table_pre."client where id='".$arr_upath[$count]."'");
|
||||
if($tmp_client["id"]>0){
|
||||
//
|
||||
$is_jd=$is_checked="null";
|
||||
if($is_brand=="y"){
|
||||
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
|
||||
$m_tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_jd limit 0,1");
|
||||
$is_jd=$m_tmp["is_jd"];
|
||||
$m_tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_checked limit 0,1");
|
||||
$is_checked=$m_tmp["is_checked"];
|
||||
}
|
||||
}else{
|
||||
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
|
||||
$is_jd=$tmp_client["is_jd"];
|
||||
$is_checked=$tmp_client["is_checked"];
|
||||
}
|
||||
}
|
||||
|
||||
if((!$s_username || ($s_username && preg_match("/".$s_username."/i",$tmp_client["username"]))) && (!$s_is_checked || ($s_is_checked && $s_is_checked==$is_checked)) && (!$s_is_jd || ($s_is_jd && $s_is_jd==$is_jd))){
|
||||
|
||||
if($tmp_client["face"]=="4"){
|
||||
$con_tmp=" and uid='".$tmp_client["id"]."'";
|
||||
}else{
|
||||
$con_tmp=" and (upath like '".$tmp_client["path"]."-".$tmp_client["id"]."-%')";
|
||||
}
|
||||
if($is_brand=="y"){
|
||||
$con_tmp.=$con_brand;
|
||||
}
|
||||
|
||||
//总金额
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' ".$con_tmp.$con_f);
|
||||
$tmp_num=$tmp["num"];
|
||||
$tmp_money=$tmp["je"];
|
||||
$tmp_money_zk=$tmp["jsje"];
|
||||
|
||||
//
|
||||
if($tmp_client["face"]=="4"){
|
||||
$total_all_num+=$tmp_num;
|
||||
$total_all_je+=$tmp_money;
|
||||
$total_all_jsje+=$tmp_money_zk;
|
||||
}
|
||||
//成衣
|
||||
|
||||
$tmp_cy=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' and is_sp<>'y' ".$con_tmp.$con_f);
|
||||
$tmp_num1=$tmp_cy["num"];
|
||||
$tmp_money1=$tmp_cy["je"];
|
||||
$tmp_money1_zk=$tmp_cy["jsje"];
|
||||
if($tmp_client["face"]=="4"){
|
||||
$total_cy_num+=$tmp_num1;
|
||||
$total_cy_je+=$tmp_money1;
|
||||
$total_cy_jsje+=$tmp_money1_zk;
|
||||
}
|
||||
//指标
|
||||
if($is_brand=="y"){
|
||||
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand);
|
||||
$tmp_zb_je=$tmp["zb"]*10000;
|
||||
$tmp_zb_js=$tmp["zb_js"];
|
||||
}else{
|
||||
$tmp_zb_je=$tmp_client["zb"]*10000;
|
||||
$tmp_zb_js=$tmp_client["zb_js"];
|
||||
}
|
||||
if($tmp_client["face"]=="4"){
|
||||
$total_zbjs+=$tmp_zb_js;
|
||||
$total_zbje+=$tmp_zb_je;
|
||||
}
|
||||
$cz1="";
|
||||
if($sd_ms=="2"){
|
||||
if($is_checked=="y"){
|
||||
$cz1.="&&1&&取消确认&&确定执行取消确认订单吗?&&qxconfirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
|
||||
}else{
|
||||
$cz1.="&&1&&确认订单&&执行确认订单吗?&&confirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
|
||||
}
|
||||
if($is_jd=="y"){
|
||||
$cz1.="||&&2&&退回交单&&确认退回交单吗?&&jd&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
|
||||
}else{
|
||||
$cz1.="||";
|
||||
}
|
||||
}else{
|
||||
$cz1.="&&4||";
|
||||
}
|
||||
$cz1.="||n";
|
||||
|
||||
$tab_mid.="{\"tb_id\":\"".$tmp_client["path"]."-".$tmp_client["id"]."\",";
|
||||
$tab_mid.="\"tbdata\":[\" ".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
|
||||
if($s_split_spfs=="y"){
|
||||
$tab_mid.="\"".$tmp_num1."\",\"".deel_je_show($tmp_money1)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$tab_mid.="\"".deel_je_show($tmp_money1_zk)."\",";
|
||||
}
|
||||
$tab_mid.="\"".($tmp_num-$tmp_num1)."\",\"".deel_je_show($tmp_money-$tmp_money1)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$tab_mid.="\"".deel_je_show($tmp_money_zk-$tmp_money1_zk)."\",";
|
||||
}
|
||||
}
|
||||
|
||||
$tab_mid.="\"".$tmp_num."\",\"".deel_je_show($tmp_money)."\",";
|
||||
if($show_jsje=="y")
|
||||
$tab_mid.="\"".deel_je_show($tmp_money_zk)."\",";
|
||||
if(in_array("js",$arr_zb_type)){
|
||||
if($is_spk=="y")
|
||||
$wcl=deel_bfb1($tmp_num1,$tmp_zb_js,1);
|
||||
else
|
||||
$wcl=deel_bfb1($tmp_num,$tmp_zb_js,1);
|
||||
$tab_mid.="\"".$tmp_zb_js."\",\"".$wcl."\",";
|
||||
}
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
if($is_spk=="y"){
|
||||
$tmp1=($show_jsje=="y")?$tmp_money1_zk:$tmp_money1;
|
||||
}else{
|
||||
$tmp1=($show_jsje=="y")?$tmp_money_zk:$tmp_money;
|
||||
}
|
||||
$wcl=deel_bfb1($tmp1,$tmp_zb_je,1);
|
||||
$tab_mid.="\"".deel_je_show($tmp_zb_je)."\",\"".$wcl."\",";
|
||||
}
|
||||
$tab_mid=substr($tab_mid,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"tab_mid\":[".substr($tab_mid,0,-1)."],";
|
||||
|
||||
//------------------店铺合计
|
||||
$dp_hj="\"店铺合计\",";
|
||||
if($s_split_spfs=="y"){
|
||||
$dp_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dp_hj.="\"".deel_je_show($total_cy_jsje)."\",";
|
||||
}
|
||||
$dp_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dp_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
|
||||
}
|
||||
}
|
||||
$dp_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
|
||||
if($show_jsje=="y")
|
||||
$dp_hj.="\"".deel_je_show($total_all_jsje)."\",";
|
||||
|
||||
if(in_array("js",$arr_zb_type)){
|
||||
if($is_spk=="y")
|
||||
$wcl=deel_bfb1($total_cy_num,$total_zbjs,1);
|
||||
else
|
||||
$wcl=deel_bfb1($total_all_num,$total_zbjs,1);
|
||||
$dp_hj.="\"".$total_zbjs."\",\"".$wcl."\",";
|
||||
}
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
if($is_spk=="y"){
|
||||
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
|
||||
}else{
|
||||
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
|
||||
}
|
||||
$wcl=deel_bfb1($tmp1,$total_zbje,1);
|
||||
$dp_hj.="\"".deel_je_show($total_zbje)."\",\"".$wcl."\",";
|
||||
}
|
||||
$json_data.="\"dp_hj\":[".substr($dp_hj,0,-1)."],";
|
||||
//------------------店铺合计end
|
||||
//------------------代理合计
|
||||
$dl_hj="\"代理合计\",";
|
||||
if($s_split_spfs=="y"){
|
||||
$dl_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dl_hj.="\"".deel_je_show($total_cy_jsje)."\",";
|
||||
}
|
||||
$dl_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
|
||||
if($show_jsje=="y"){
|
||||
$dl_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
|
||||
}
|
||||
}
|
||||
$dl_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
|
||||
if($show_jsje=="y")
|
||||
$dl_hj.="\"".deel_je_show($total_all_jsje)."\",";
|
||||
|
||||
//指标
|
||||
if($is_brand=="y"){
|
||||
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$msg_login["id"]."'".$con_brand);
|
||||
$tmp_zb_je=$tmp["zb"]*10000;
|
||||
$tmp_zb_js=$tmp["zb_js"];
|
||||
}else{
|
||||
$tmp_zb_je=$msg_login["zb"]*10000;
|
||||
$tmp_zb_js=$msg_login["zb_js"];
|
||||
}
|
||||
|
||||
if(in_array("js",$arr_zb_type)){
|
||||
if($is_spk=="y")
|
||||
$wcl=deel_bfb1($total_cy_num,$tmp_zb_js,1);
|
||||
else
|
||||
$wcl=deel_bfb1($total_all_num,$tmp_zb_js,1);
|
||||
$dl_hj.="\"".$tmp_zb_js."\",\"".$wcl."\",";
|
||||
}
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
if($is_spk=="y"){
|
||||
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
|
||||
}else{
|
||||
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
|
||||
}
|
||||
$wcl=deel_bfb1($tmp1,$tmp_zb_je,1);
|
||||
$dl_hj.="\"".deel_je_show($tmp_zb_je)."\",\"".$wcl."\",";
|
||||
}
|
||||
$json_data.="\"dl_hj\":[".substr($dl_hj,0,-1)."],";
|
||||
//------------------代理合计end
|
||||
}else{
|
||||
$json_data.="\"tab_mid\":[],";
|
||||
$json_data.="\"dp_hj\":[],";
|
||||
$json_data.="\"dl_hj\":[],";
|
||||
}
|
||||
break;
|
||||
}
|
||||
if($json_data)
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
+1269
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,467 @@
|
||||
<?php
|
||||
//-------------------------------排行榜
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$page_num=10;
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
//
|
||||
$face=$msg_client["face"];
|
||||
$ph_ms=get_set("ph_ms");
|
||||
$arr_ph_ms=explode(",",$ph_ms);
|
||||
$sys_size_num=get_max_size_num();
|
||||
$arr_upath=explode(",",$msg_client["charge_path"]);
|
||||
$p=$msg_client["path"]."-".$msg_client["id"];
|
||||
$cou_u_all=get_qj_ucon_all($msg_client["charge_path_real"]);
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
$con="";
|
||||
if($s_ka){
|
||||
if($s_ka=="n")
|
||||
$con.=" and ka<>'y'";
|
||||
else
|
||||
$con.=" and ka='".$s_ka."'";
|
||||
}
|
||||
$con_u="";
|
||||
if($s_uid){
|
||||
if($s_uid=="_ALL_"){
|
||||
$con.=$cou_u_all;
|
||||
$con_u.=$cou_u_all;
|
||||
}else{
|
||||
$m1=get_db_msg("select * from ".$table_pre."client where id='".$s_uid."'");
|
||||
if($m1["face"]=="4"){
|
||||
$con.=" and uid='".$s_uid."'";
|
||||
$con_u.=" and uid='".$s_uid."'";
|
||||
}else{
|
||||
$con.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')";
|
||||
$con_u.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$con.=" and uid=0";
|
||||
$con_u.=" and uid=0";
|
||||
}
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
if($$v)
|
||||
$con.=" and ".$arr_select_no[$i]."='".$$v."'";
|
||||
}
|
||||
if($s_qy && $s_qy!="-all-")
|
||||
$con.=" and qy='".$s_qy."'";
|
||||
//饰品款条件
|
||||
if($s_is_sp=="n"){
|
||||
$con1.=" and is_sp<>'y'";
|
||||
$con.=" and is_sp<>'y'";
|
||||
}else if($s_is_sp=="y"){
|
||||
$con1.=" and is_sp='y'";
|
||||
$con.=" and is_sp='y'";
|
||||
}
|
||||
$json_data.="\"face\":\"".$face."\",";
|
||||
|
||||
$is_sy=get_set("is_sy");
|
||||
$json_data.="\"username\":\"".$msg_client["username"]."\",";
|
||||
$json_data.="\"is_sy\":\"".$is_sy."\",";
|
||||
|
||||
//订货会标记选项
|
||||
$tmp_order_flag="";
|
||||
foreach($arr_sys_order_flag as $k => $v){
|
||||
$tmp_order_flag.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$show_key="";
|
||||
if(count($arr_sys_order_flag)>1){
|
||||
$tmp_order_flag.="{\"no\":\"all\",\"title\":\"所有订单\"},";
|
||||
$show_key="y";
|
||||
$json_data.="\"show_key\":\"".$show_key."\",";
|
||||
|
||||
$tmp_order_flag=deel_end($tmp_order_flag);
|
||||
if($s_key){
|
||||
$selectf=$s_key;
|
||||
}else{
|
||||
$selectf=$_key;
|
||||
}
|
||||
$str_json="\"select_order_flag\":{\"no\":\"s_key\",\"title\":\"订货会标记\",\"value\":\"".$selectf."\",\"op\":[".$tmp_order_flag."]},";
|
||||
|
||||
$json_data.=$str_json;
|
||||
$con_f="";
|
||||
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con_f="";
|
||||
}else{
|
||||
$con_f=" and _key='".$s_key."'";
|
||||
}
|
||||
$json_data.="\"s_key\":\"".$s_key."\",";
|
||||
}
|
||||
}
|
||||
$json_data.="\"con_f\":\"".$con_f."\",";
|
||||
|
||||
switch($face){
|
||||
case "1":
|
||||
|
||||
break;
|
||||
case "2":
|
||||
$s_ph_ms=$s_ph_ms?$s_ph_ms:"ph_dk";
|
||||
$arr_op_ph_ms=array("ph_dk"=>d_translate("ph_dk"),"ph_ds"=>d_translate("ph_ds"));
|
||||
if($s_ph_ms=="ph_ds"){
|
||||
$con_group_by="no,color";
|
||||
$hj_colspan=5;
|
||||
}else{
|
||||
$con_group_by="no";
|
||||
$hj_colspan=4;
|
||||
}
|
||||
$s_order=$s_order?$s_order:"num";
|
||||
//
|
||||
//排行模式
|
||||
if(count($arr_ph_ms)>1){
|
||||
$content_search.="<select name=\"s_ph_ms\" onchange=\"tj.submit();\" style=\"height:30px;\">".get_main_op($arr_op_ph_ms,$s_ph_ms)."</select> ";
|
||||
}
|
||||
$op_client="";
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_ph_ms";
|
||||
$search_select_op[$i1]["ph_dk"]="到款";
|
||||
$search_select_op[$i1]["ph_ds"]="到色";
|
||||
$i1++;
|
||||
$search_select_no[$i1]="s_uid";
|
||||
$search_select_op[$i1][""]="选择客户";
|
||||
$search_select_op[$i1]["_ALL_"]="所有客户";
|
||||
for($i=0;$i<count($arr_upath);$i++){
|
||||
$v=get_parent_id($arr_upath[$i]);
|
||||
$m1=get_db_msg("select id,path,title,username,face,order_num from ".$table_pre."client where id='".$v."'");
|
||||
if($m1["face"]=="4" || ($m1["face"]!="4" && check_qj_priv_all($m1["id"])=="y")){
|
||||
$op_client.="<option value=\"".$v."\"";
|
||||
if($s_uid==$v)
|
||||
$op_client.=" selected";
|
||||
$this_js="";
|
||||
if($m1["order_num"]>0)
|
||||
$this_js="-".$m1["order_num"]."件";
|
||||
$op_client.=">".$m1["title"]."(".$m1["username"].")".$this_js."</option>";
|
||||
$search_select_op[$i1][$v]="".$m1["title"]."(".$m1["username"].")".$this_js."";
|
||||
}
|
||||
}
|
||||
//选项前面
|
||||
$select_qm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_qm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_qm=deel_end($select_qm);
|
||||
//取得定制选项
|
||||
$select_dz="";
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
//取得选项
|
||||
$tmp="";
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no");
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var="s_".$arr_select_no[$i];
|
||||
$select_dz.="{\"no\":\"".$arr_select_no[$i]."\",\"title\":\"".$arr_select_title[$i]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_dz=deel_end($select_dz);
|
||||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||||
$search_select_op=$search_select_no=array();
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_order";
|
||||
$search_select_op[$i1]=array("num"=>"数量排序","je"=>"金额排序");
|
||||
$i1++;
|
||||
//选项后
|
||||
$select_hm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_hm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_hm=deel_end($select_hm);
|
||||
$json_data.="\"s_kh\":\"".$s_kh."\",\"select_qm\":[".$select_qm."],\"select_hm\":[".$select_hm."],";
|
||||
$json_data.="\"table_top\":[\"排名\",\"this|款号\",";
|
||||
if($s_ph_ms=="ph_ds")
|
||||
$json_data.="\"颜色\",";
|
||||
$json_data.="\"".d_translate("dpj")."\",\"件数\",\"".d_translate("dpje")."\"],";
|
||||
//
|
||||
//取得我的排名数组
|
||||
$arr_ph=array();
|
||||
$q1="select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0'".$con_u.$con_f." group by ".$con_group_by." order by ".$s_order." desc ";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_ph[]=$m1[$s_order];
|
||||
}
|
||||
if($s_kh){
|
||||
$con.=" and no like '%".$s_kh."%'";
|
||||
}
|
||||
$q1="select iid,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0' and ka<>'y'".$con.$con_f." group by ".$con_group_by." order by ".$s_order." desc ";
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$page_total_num++;
|
||||
}
|
||||
$pages=ceil($page_total_num/$page_num);
|
||||
$limit_con=($page-1)*$page_num;
|
||||
$q="select iid,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0' and ka<>'y'".$con.$con_f." group by ".$con_group_by." order by ".$s_order." desc limit ".$limit_con.",".$page_num."";
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
$total_num=$total_money=$count=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$c1=($count%2)?"td1":"td2";
|
||||
$list=$count+1;
|
||||
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
|
||||
$num=$m["num"];
|
||||
$total_num+=$num;
|
||||
$money=$m["je"];
|
||||
$total_money+=$money;
|
||||
//图片获取规则
|
||||
if($s_ph_ms=="ph_ds")
|
||||
$pic=get_kh_color_picture($m1["no"],$m["color"],$flag_pad_offline);
|
||||
else
|
||||
$pic=get_kh_picture($m1["no"],$m1["main_pic"],$m1["color"],$flag_pad_offline);
|
||||
$pic="'".$pic."' ".str_replace("\"","'",out_good_pic_set($pic,80,80))." border=0";
|
||||
$pm=(get_main_key($arr_ph,$m[$s_order])+1);
|
||||
if($s_ph_ms=="ph_ds"){
|
||||
$td_color="\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\",";
|
||||
$href_color="&color=".$m["color"];
|
||||
if($msg_login["qyjl_order"]!="n"){
|
||||
$link1="<a href=\"".$_SERVER["PHP_SELF"]."?_m=order_single&_a=qj_list&id=".$m["iid"].$href_color."&rurl=".urlencode($rurl)."\">";
|
||||
}else{
|
||||
$link1="<a href=\"javascript:show_kh_pic('".$m1["no"]."','".$pic."')\" onmouseover=\"show_kh_pic('".$m1["no"]."','".$pic."')\">";
|
||||
}
|
||||
}else{
|
||||
$td_color=$href_color="";
|
||||
if($msg_login["qyjl_order"]!="n"){
|
||||
$link1="<a href=\"".$_SERVER["PHP_SELF"]."?_m=order_single&id=".$m["iid"]."&rurl=".urlencode($rurl)."\">";
|
||||
}else{
|
||||
$link1="<a href=\"javascript:show_kh_pic('".$m1["no"]."','".$pic."')\" onmouseover=\"show_kh_pic('".$m1["no"]."','".$pic."')\">";
|
||||
}
|
||||
}
|
||||
$content.="<tr><td height=\"25\" class=\"".$c1."\">".$pm."</td><td class=\"".$c1."\">".get_kh_xh($m1,$m["color"])."</td><td height=\"25\" class=\"".$c1."\">".$link1.$m1["no"]."</a></td>".$td_color;
|
||||
$json_data1.="[\"pma|".$pm."\",\"this|".get_kh_xh($m1,$m["color"])."|".$m1["id"]."|".$pic."|".$m1["no"]."\",".$td_color."";
|
||||
if($s_ph_ms=="ph_ds")
|
||||
$colors=$m["color"];
|
||||
else
|
||||
$colors="";
|
||||
$json_data1.="\"".get_price_dp($uid,$m1["id"])."\",\"jianshu2|".$num."|".$m1["no"]."|".$colors."\",\"".deel_num($money)."\"],";
|
||||
$content.="<td height=\"25\" class=\"".$c1."\" align=\"center\">".get_price_dp($uid,$m1["id"])."</td><td height=\"25\" class=\"".$c1."\" align=\"right\"><a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=view_order&s_uid=".$s_uid."&id=".$m1["id"].$href_color."&window=new\" target=\"_blank\"><span class='bb_link'>".$num."</span></a></td><td height=\"25\" class=\"".$c1."\" align=\"right\">".deel_num($money)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
$json_data.="\"table_mid\":[".substr($json_data1,0,-1)."],";
|
||||
$content.="<tr><td height=\"25\" colspan=\"".$hj_colspan."\" align=\"right\" class=\"td3\">合计</td><td height=\"25\" class=\"td3\" align=\"right\">".$total_num."</td><td height=\"25\" class=\"td3\" align=\"right\">".deel_num($total_money)."</td></tr></table></td></tr></table>";
|
||||
$json_data.="\"pages\":\"".$pages."\",";
|
||||
|
||||
break;
|
||||
case "3":
|
||||
$con="";
|
||||
if($s_ka){
|
||||
if($s_ka=="n")
|
||||
$con.=" and ka<>'y'";
|
||||
else
|
||||
$con.=" and ka='".$s_ka."'";
|
||||
}
|
||||
$con_u="";
|
||||
if($s_uid){
|
||||
$m1=get_db_msg("select * from ".$table_pre."client where id='".$s_uid."'");
|
||||
if($m1["face"]=="4"){
|
||||
$con.=" and uid='".$s_uid."'";
|
||||
$con_u.=" and uid='".$s_uid."'";
|
||||
}else{
|
||||
$con.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')";
|
||||
$con_u.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')";
|
||||
}
|
||||
}else{
|
||||
$con.=" and (upath='".$p."' or upath like '".$p."-%')";
|
||||
$con_u.=" and (upath='".$p."' or upath like '".$p."-%')";
|
||||
}
|
||||
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
if($$v)
|
||||
$con.=" and ".$arr_select_no[$i]."='".$$v."'";
|
||||
}
|
||||
if($s_qy && $s_qy!="-all-")
|
||||
$con.=" and qy='".$s_qy."'";
|
||||
//饰品款条件
|
||||
if($s_is_sp=="n"){
|
||||
$con1.=" and is_sp<>'y'";
|
||||
$con.=" and is_sp<>'y'";
|
||||
}else if($s_is_sp=="y"){
|
||||
$con1.=" and is_sp='y'";
|
||||
$con.=" and is_sp='y'";
|
||||
}
|
||||
|
||||
$s_ph_ms=$s_ph_ms?$s_ph_ms:"ph_dk";
|
||||
$arr_op_ph_ms=array("ph_dk"=>d_translate("ph_dk"),"ph_ds"=>d_translate("ph_ds"));
|
||||
if($s_ph_ms=="ph_ds"){
|
||||
$con_group_by="no,color";
|
||||
$hj_colspan=5;
|
||||
}else{
|
||||
$con_group_by="no";
|
||||
$hj_colspan=4;
|
||||
}
|
||||
$s_order=$s_order?$s_order:"num";
|
||||
//
|
||||
//排行模式
|
||||
if(count($arr_ph_ms)>1){
|
||||
$content_search.="<select name=\"s_ph_ms\" onchange=\"tj.submit();\" style=\"height:30px;\">".get_main_op($arr_op_ph_ms,$s_ph_ms)."</select> ";
|
||||
}
|
||||
$op_client="";
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_ph_ms";
|
||||
$search_select_op[$i1]["ph_dk"]="到款";
|
||||
$search_select_op[$i1]["ph_ds"]="到色";
|
||||
$i1++;
|
||||
$search_select_no[$i1]="s_uid";
|
||||
$search_select_op[$i1][""]="选择客户";
|
||||
//$search_select_op[$i1]["_ALL_"]="所有客户";
|
||||
$op_client="";
|
||||
$r=$db->query("select id,title,username,order_num from ".$table_pre."client where path='".$p."' or path like '".$p."-%' order by path,ord");
|
||||
while($m=$db->fetch_array($r)){
|
||||
$v=$m["id"];
|
||||
$op_client.="<option value=\"".$m["id"]."\"";
|
||||
if($s_uid==$m["id"])
|
||||
$op_client.=" selected";
|
||||
$op_client.=">".$m["title"]."(".$m["username"].")-".$m["order_num"]."件</option>";
|
||||
$search_select_op[$i1][$v]="".$m["title"]."(".$m["username"].")-".$m["order_num"]."件";
|
||||
}
|
||||
//选项前面
|
||||
$select_qm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_qm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_qm=deel_end($select_qm);
|
||||
//取得定制选项
|
||||
$select_dz="";
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
//取得选项
|
||||
$tmp="";
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no");
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var="s_".$arr_select_no[$i];
|
||||
$select_dz.="{\"no\":\"".$arr_select_no[$i]."\",\"title\":\"".$arr_select_title[$i]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_dz=deel_end($select_dz);
|
||||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||||
$search_select_op=$search_select_no=array();
|
||||
$i1=0;
|
||||
$search_select_no[$i1]="s_order";
|
||||
$search_select_op[$i1]=array("num"=>"数量排序","je"=>"金额排序");
|
||||
$i1++;
|
||||
//选项后
|
||||
$select_hm="";
|
||||
$arr_sz=array();
|
||||
for($i=0;$i<count($search_select_no);$i++){
|
||||
$tmp="";
|
||||
foreach($search_select_op[$i] as $key=>$value){
|
||||
$tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},";
|
||||
$arr_sz[$i]=$value;
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var=$search_select_no[$i];
|
||||
$select_hm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_hm=deel_end($select_hm);
|
||||
$json_data.="\"s_kh\":\"".$s_kh."\",\"select_qm\":[".$select_qm."],\"select_hm\":[".$select_hm."],";
|
||||
$json_data.="\"table_top\":[\"排名\",\"this|款号\",";
|
||||
if($s_ph_ms=="ph_ds")
|
||||
$json_data.="\"颜色\",";
|
||||
$json_data.="\"".d_translate("dpj")."\",\"件数\",\"".d_translate("dpje")."\"],";
|
||||
//取得我的排名数组
|
||||
$arr_ph=array();
|
||||
$q1="select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0'".$con_u.$con_f." group by ".$con_group_by." order by ".$s_order." desc ";
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_ph[]=$m1[$s_order];
|
||||
}
|
||||
if($s_kh){
|
||||
$con.=" and no like '%".$s_kh."%'";
|
||||
}
|
||||
$q2="select iid,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0' and ka<>'y'".$con.$con_f." group by ".$con_group_by." order by ".$s_order." desc ";
|
||||
//echo $q."<br>";
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$page_total_num++;
|
||||
}
|
||||
$pages=ceil($page_total_num/$page_num);
|
||||
$limit_con=($page-1)*$page_num;
|
||||
$q="select price,iid,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0' and ka<>'y'".$con.$con_f." group by ".$con_group_by." order by ".$s_order." desc limit ".$limit_con.",".$page_num."";
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
$total_num=$total_money=$count=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$bg=($count%2)?"#a8a8a8":"#c8c8c8";
|
||||
$list=$count+1;
|
||||
$m1=get_db_msg("select id,no,main_pic,color,xh from ".$table_pre."kh where id='".$m["iid"]."'");
|
||||
$num=$m["num"];
|
||||
$total_num+=$num;
|
||||
$money=$m["je"];
|
||||
$total_money+=$money;
|
||||
//图片获取规则
|
||||
if($ph_ms=="2")
|
||||
$pic=get_kh_color_picture($m1["no"],$m["color"],$flag_pad_offline);
|
||||
else
|
||||
$pic=get_kh_picture($m1["no"],$m1["main_pic"],$m1["color"],$flag_pad_offline);
|
||||
$pic="'".$pic."' ".str_replace("\"","'",out_good_pic_set($pic,80,80))." border=0";
|
||||
$pm=(get_main_key($arr_ph,$m[$s_order])+1);
|
||||
if($s_ph_ms=="ph_ds"){
|
||||
$tmp_arr=explode(",",$m1["color"]);
|
||||
$color_flag="";
|
||||
if(count($tmp_arr)>1){
|
||||
for($i1=0;$i1<count($tmp_arr);$i1++){
|
||||
$cls1=($tmp_arr[$i1]==$m["color"])?"color:red;font-weight:bold;":"";
|
||||
$color_flag.="<span style=\"".$cls1."\">".$tmp_arr[$i1]."-".get_cate_title_no("color",$tmp_arr[$i1])."</span>,";
|
||||
}
|
||||
if($color_flag)
|
||||
$color_flag=" (".substr($color_flag,0,-1).")";
|
||||
}
|
||||
$content.="<tr><td height=\"25\" bgcolor=\"".$bg."\">".$pm."</td><td bgcolor=\"".$bg."\">".get_kh_xh($m1,$m["color"])."</td><td height=\"25\" bgcolor=\"".$bg."\"><a href=\"javascript:show_kh_pic('".$m1["no"]."','".$pic."')\" onmouseover=\"show_kh_pic('".$m1["no"]."','".$pic."')\">".$m1["no"].$color_flag."</a></td>";
|
||||
$json_data1.="[\"pma|".$pm."\",\"this|".get_kh_xh($m1,$m["color"])."|".$m1["id"]."|".$pic."|".$m1["no"]."\",";
|
||||
$json_data1.="\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\",";
|
||||
$content.="<td bgcolor=\"".$bg."\">".$m["color"]."-".get_cate_title_no("color",$m["color"])."</td>";
|
||||
$href_color="&color=".$m["color"];
|
||||
$content.="<td height=\"25\" bgcolor=\"".$bg."\" align=\"center\">".$m["price"]."</td><td height=\"25\" bgcolor=\"".$bg."\" align=\"right\"><a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=view_order&s_uid=".$s_uid."&id=".$m1["id"].$href_color."&window=new\" target=\"_blank\"><span class='bb_link'>".$num."</span></a></td><td height=\"25\" bgcolor=\"".$bg."\" align=\"right\">".deel_num($money)."</td></tr>";
|
||||
$json_data1.="\"".$m["price"]."\",\"jianshu3|".$m["num"]."|".$m1["no"]."|".$m["color"]."\",\"".deel_num($money)."\"],";
|
||||
}else{
|
||||
$content.="<tr><td height=\"25\" bgcolor=\"".$bg."\">".$pm."</td><td bgcolor=\"".$bg."\">".get_kh_xh($m1)."</td><td height=\"25\" bgcolor=\"".$bg."\"><a href=\"javascript:show_kh_pic('".$m1["no"]."','".$pic."')\" onmouseover=\"show_kh_pic('".$m1["no"]."','".$pic."')\">".$m1["no"]."</a></td>";
|
||||
$href_color="";
|
||||
$content.="<td height=\"25\" bgcolor=\"".$bg."\" align=\"center\">".$m["price"]."</td><td height=\"25\" bgcolor=\"".$bg."\" align=\"right\"><a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=view_order&s_uid=".$s_uid."&id=".$m1["id"].$href_color."&window=new\" target=\"_blank\"><span class='bb_link'>".$num."</span></a></td><td height=\"25\" bgcolor=\"".$bg."\" align=\"right\">".deel_num($money)."</td></tr>";
|
||||
$json_data1.="[\"pma|".$pm."\",\"this|".get_kh_xh($m1,$m["color"])."|".$m1["id"]."|".$pic."|".$m1["no"]."\",";
|
||||
$json_data1.="\"".$m["price"]."\",\"jianshu3|".$m["num"]."|".$m1["no"]."|\",\"".deel_num($money)."\"],";
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
$json_data.="\"pages\":\"".$pages."\",\"table_mid\":[".substr($json_data1,0,-1)."],";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
//-------------------------------插件
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$uid=check_cookie_jxs();
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$json_data="{";
|
||||
$msg=get_db_msg("select * from ".$table_pre."plugin where id='".$id."'");
|
||||
//记录访问日志
|
||||
if($filename)
|
||||
$db->query("insert into ".$table_pre."bb_log(username,bb,add_date) values ('".$msg_client["username"]."','".$msg["file_name"]."',now())");
|
||||
//定制目录
|
||||
$path_plugin=dir_cutb(THIS_FILE_ROOT,1)."/plugin";
|
||||
//包含插件
|
||||
if($file_name){
|
||||
include $path_plugin."/".$cate."/".$file_name.".php";
|
||||
}else{
|
||||
include $path_plugin."/".$cate."/".$msg["file_name"].".php";
|
||||
}
|
||||
$code=($code==0)?$code:99;
|
||||
$json_data.="\"code\":".$code.",";
|
||||
$json_data.="\"msg\":\"".$error_msg."\",";
|
||||
$json_data.="\"id\":\"".$id."\",";
|
||||
$json_data.="\"file_name\":\"".$msg["file_name"]."\",";
|
||||
$json_data.="\"file_title\":\"".$msg["title"]."\",";
|
||||
$json_data.="\"face\":\"".$msg_client["face"]."\",";
|
||||
$json_data.="\"cate\":\"".$cate."\",";
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
$json_data.="\"use_layui\":\"".$use_layui_datatable."\",";
|
||||
if($select_client_type){
|
||||
//取得可筛选店铺
|
||||
$face=$msg_client["face"];
|
||||
$op="";
|
||||
if($face=="4"){
|
||||
//店铺,不用筛选
|
||||
$s_username=$msg_client["username"];
|
||||
}else if($face=="3"){
|
||||
//代理
|
||||
$this_upath=$msg_client["path"]."-".$msg_client["id"];
|
||||
$q="select username,title from ".$table_pre."client where (face='4' or face='3' or face='9') and (path='".$this_upath."' or path like '".$this_upath."-%') order by username";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="{\"no\":\"".$m["username"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
|
||||
}else if($face=="2"){
|
||||
//区经
|
||||
$arr_upath=explode(",",$msg_client["charge_path"]);
|
||||
for($i=0;$i<count($arr_upath);$i++){
|
||||
$v=get_parent_id($arr_upath[$i]);
|
||||
$m1=get_db_msg("select id,path,title,username,face,order_num from ".$table_pre."client where id='".$v."'");
|
||||
if($m1["id"]>0){
|
||||
if($m1["face"]=="4" || ($m1["face"]=="3" && check_qj_priv_all($m1["id"])=="y") || ($m1["face"]=="9" && check_qj_priv_all($m1["id"])=="y")){
|
||||
$op.="{\"id\":\"".$m1["id"]."\",\"no\":\"".$m1["username"]."\",\"title\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if($face=="1"){
|
||||
//总经理
|
||||
$q="select username,title,concat(path,'-',id) 'abspath' from ".$table_pre."client where (face='4' or face='3' or face='9') order by abspath";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="{\"no\":\"".$m["username"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
}
|
||||
if($op)
|
||||
$select.="{\"name\":\"s_username\",\"title\":\"店铺\",\"value\":\"".$s_username."\",\"op\":[".deel_end($op)."]},";
|
||||
}
|
||||
$json_data.="\"select\":[".deel_end($select)."],";
|
||||
$json_data.="\"s_username\":\"".$s_username."\",";
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
//-------------------------------插件
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
//记录访问日志
|
||||
if($_filename)
|
||||
$db->query("insert into ".$table_pre."bb_log(username,bb,add_date) values ('".$msg_client["username"]."','".$file_name."',now())");
|
||||
$msg=get_db_msg("select * from ".$table_pre."plugin where file_name='".$file_name."' and cate='".$cate."'");
|
||||
//定制目录
|
||||
$path_plugin=dir_cutb(THIS_FILE_ROOT,1)."/plugin";
|
||||
//包含插件
|
||||
include $path_plugin."/".$cate."/".$file_name.".php";
|
||||
$code=($code==0)?$code:99;
|
||||
$json_data.="\"code\":".$code.",";
|
||||
$json_data.="\"error_msg\":\"".$error_msg."\",";
|
||||
$json_data.="\"file_name\":\"".$file_name."\",";
|
||||
$json_data.="\"file_title\":\"".$msg["title"]."\",";
|
||||
$json_data.="\"face\":\"".$msg_client["face"]."\",";
|
||||
$json_data.="\"cate\":\"".$cate."\",";
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
$json_data.="\"use_layui\":\"".$use_layui_datatable."\",";
|
||||
if($select_client_type){
|
||||
//取得可筛选店铺
|
||||
$face=$msg_client["face"];
|
||||
$op="";
|
||||
if($face=="4"){
|
||||
//店铺,不用筛选
|
||||
$s_username=$msg_client["username"];
|
||||
}else if($face=="3"){
|
||||
//代理
|
||||
$this_upath=$msg_client["path"]."-".$msg_client["path"];
|
||||
$q="select username,title from ".$table_pre."client where (face='4' or face='3' or face='9') and (path='".$this_upath."' or path like '".$this_upath."-%') order by username";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="{\"no\":\"".$m["username"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
}else if($face=="2"){
|
||||
//区经
|
||||
$arr_upath=explode(",",$msg_client["charge_path"]);
|
||||
for($i=0;$i<count($arr_upath);$i++){
|
||||
$v=get_parent_id($arr_upath[$i]);
|
||||
$m1=get_db_msg("select id,path,title,username,face,order_num from ".$table_pre."client where id='".$v."'");
|
||||
if($m1["id"]>0){
|
||||
if($m1["face"]=="4" || ($m1["face"]=="3" && check_qj_priv_all($m1["id"])=="y") || ($m1["face"]=="9" && check_qj_priv_all($m1["id"])=="y")){
|
||||
$op.="{\"id\":\"".$m1["id"]."\",\"no\":\"".$m1["username"]."\",\"title\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if($face=="1"){
|
||||
//总经理
|
||||
$q="select username,title,concat(path,'-',id) 'abspath' from ".$table_pre."client where (face='4' or face='3' or face='9') order by abspath";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="{\"no\":\"".$m["username"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
}
|
||||
if($op)
|
||||
$select.="{\"name\":\"s_username\",\"title\":\"店铺\",\"value\":\"".$s_username."\",\"op\":[".deel_end($op)."]},";
|
||||
}
|
||||
$json_data.="\"select\":[".deel_end($select)."],";
|
||||
$json_data.="\"s_username\":\"".$s_username."\",";
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
|
||||
|
||||
$m_kh=get_db_msg("select no,pm_dj,size,size_group from ".$table_pre."kh where id='".$iid."'");
|
||||
$m_client=get_db_msg("select path,username from ".$table_pre."client where id='".$dpid."'");
|
||||
$json_data.="\"uid\":\"".$dpid."\",";
|
||||
$json_data.="\"iid\":\"".$iid."\",";
|
||||
$json_data.="\"_m\":\"".$_m."\",";
|
||||
switch($_a){
|
||||
case "add":
|
||||
if($id){
|
||||
$msg=get_db_msg("select * from ".$table_pre."size_pm where id='".$id."'");
|
||||
$title=$msg["title"];
|
||||
$gz=$msg["gz"];
|
||||
$arr_gz=explode(":",$gz);
|
||||
$hj=$msg["num"];
|
||||
}else{
|
||||
$id="";
|
||||
$gz="";
|
||||
$title="";
|
||||
$arr_gz=array();
|
||||
$hj=0;
|
||||
}
|
||||
//取得尺码
|
||||
$str_size="";
|
||||
$arr_size=explode(",",$m_kh["size"]);
|
||||
//计算尺码框宽度
|
||||
$size_w=floor(200/count($arr_size));
|
||||
$size_w=$size_w>30?30:$size_w;
|
||||
$arr_size_title=array();
|
||||
$tr_size_title=$tr_size_input="";
|
||||
$str_s="";
|
||||
for($j=0;$j<count($arr_size);$j++){
|
||||
$m1=get_db_msg("select title from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".$arr_size[$j]."'");
|
||||
$arr_size_title[$j]=$m1["title"];
|
||||
$tr_size_title.="<td width='".$size_w."'>".$m1["title"]."</td>";
|
||||
$tr_size_input.="<td><input type='number' id='gz_".$arr_size[$j]."' name='gz_".$arr_size[$j]."' value='".$arr_gz[$j]."' style='width:".$size_w."px;font-size:9pt;' onchange=\"this.value=Math.abs(this.value.replace(/\D/g,'0'));count_hj();\"></td>";
|
||||
$str_size.=$m1["title"].":";
|
||||
$str_s.="{\"title\":\"".$m1["title"]."\",\"id\":\"gz_".$arr_size[$j]."\",\"value\":\"".$arr_gz[$j]."\"},";
|
||||
}
|
||||
if($str_s){
|
||||
$str_s=deel_end($str_s);
|
||||
}
|
||||
if($str_size)
|
||||
$str_size=substr($str_size,0,-1);
|
||||
//取得装箱数
|
||||
$arr_zxs=array();
|
||||
$q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$m_client["username"]."' or dj='') and kh='".$m_kh["no"]."' order by num";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zxs[]=$m1["num"];
|
||||
}
|
||||
if($arr_zxs){
|
||||
$str_zxs=arr_to_str($arr_zxs);
|
||||
$zxs=$arr_zxs[0];
|
||||
}else{
|
||||
$str_zxs="";
|
||||
$zxs=0;
|
||||
}
|
||||
$content="<script>
|
||||
function count_hj(){
|
||||
//计算合计
|
||||
var str_size=\"".$m_kh["size"]."\";
|
||||
var arr_size=str_size.split(',');
|
||||
var hj=0;
|
||||
for(var i=0;i<arr_size.length;i++){
|
||||
var obj1=document.getElementById('gz_'+arr_size[i]);
|
||||
if(obj1){
|
||||
if(obj1.value){
|
||||
hj+=parseInt(obj1.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.getElementById('hj').innerHTML=hj;
|
||||
//自动填充最后一格
|
||||
var zxs=".$zxs.";
|
||||
if(zxs>0){
|
||||
var last_null_id='';
|
||||
var null_num=0;
|
||||
var hj1=0;
|
||||
for(var i=0;i<arr_size.length;i++){
|
||||
var obj1=document.getElementById('gz_'+arr_size[i]);
|
||||
if(obj1){
|
||||
if(obj1.value){
|
||||
hj1+=parseInt(obj1.value);
|
||||
}else{
|
||||
last_id='gz_'+arr_size[i];
|
||||
null_num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(null_num==1){
|
||||
if(zxs-hj1>0){
|
||||
document.getElementById(last_id).value=zxs-hj1;
|
||||
document.getElementById('hj').innerHTML=zxs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function add_pm(){
|
||||
var obj=document.getElementById('form_pm');
|
||||
if(obj.title.value==''){
|
||||
alert('请输入名称!');
|
||||
return false;
|
||||
}
|
||||
obj.sub1.value='保存中...';
|
||||
obj.sub1.disabled=true;
|
||||
return true;
|
||||
}
|
||||
</script>";
|
||||
$content.="<form name='form_pm' id='form_pm' action='".$_SERVER["PHP_SELF"]."' method='post' onsubmit='return add_pm();' target='frame_pm'><input type='hidden' name='_m' value='".$_m."'><input type='hidden' name='dpid' value='".$dpid."'><input type='hidden' name='iid' value='".$iid."'><input type='hidden' name='obj' value='".$obj."'><input type='hidden' name='id' value='".$id."'><input type='hidden' name='_a' value='save_add'><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" align=\"left\" bgcolor='#cccccc'>";
|
||||
$content.="<tr bgcolor='#f0f0f0'><td width='50'>名称</td>".$tr_size_title."<td align='center' width='25'>".$str_zxs."</td></tr>";
|
||||
$content.="<tr bgcolor='#ffffff'><td><input type='text' id='title' name='title' value='".$title."' style='width:50px;'></td>".$tr_size_input."<td align='center'><div id='hj'>".$hj."</div></td></tr>";
|
||||
$content.="<tr bgcolor='#ffffff'><td colspan='".(2+count($arr_size))."'><input type='submit' name='sub1' id='sub1' value='保存'> <input type='button' name='back' id='back' value='返回' onclick='history.back();'></td></tr>";
|
||||
$content.="</table></form>";
|
||||
|
||||
$json_data.="\"id\":\"".$id."\",";
|
||||
$json_data.="\"obj\":\"".$obj."\",";
|
||||
$json_data.="\"gz\":\"".$gz."\",";
|
||||
$json_data.="\"title\":\"".$title."\",";
|
||||
$json_data.="\"zxs\":\"".$str_zxs."\",";
|
||||
$json_data.="\"size\":[".$str_s."],";
|
||||
$json_data.="\"hj\":\"".$hj."\",";
|
||||
break;
|
||||
case "save_add":
|
||||
$title=trim($title);
|
||||
if(strstr($title,"|")){
|
||||
//alert_and_back("非法字串“|”,请检查!");
|
||||
$msg="非法字串“|”,请检查!";
|
||||
}
|
||||
if(!$title){
|
||||
if(!$msg){
|
||||
$msg="配码名称不能为空";
|
||||
}
|
||||
}
|
||||
//
|
||||
$num=0;
|
||||
//检查是否符合尺码数量
|
||||
$gz="";
|
||||
$arr_size=explode(",",$m_kh["size"]);
|
||||
for($i=0;$i<count($arr_size);$i++){
|
||||
$var="gz_".$arr_size[$i];
|
||||
$arr_gz[$i]=$$var;
|
||||
$num+=$$var;
|
||||
$gz.=$$var.":";
|
||||
}
|
||||
if($gz)
|
||||
$gz=substr($gz,0,-1);
|
||||
if(count($arr_size)!=count($arr_gz)){
|
||||
//alert_and_back("对不起,配码数与尺码数不符,请检查!");
|
||||
if(!$msg){
|
||||
$msg="对不起,配码数与尺码数不符,请检查!";
|
||||
}
|
||||
}
|
||||
//检查是否符合装箱数
|
||||
$arr_zxs=array();
|
||||
$q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$m_client["username"]."' or dj='') and kh='".$m_kh["no"]."' order by num";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zxs[]=$m1["num"];
|
||||
}
|
||||
if($arr_zxs){
|
||||
if(!in_array($num,$arr_zxs)){
|
||||
//alert_and_back("对不起,配码不符合装箱数,请检查!");
|
||||
if(!$msg){
|
||||
$msg="对不起,配码不符合装箱数,请检查!";
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
//检查是否存在
|
||||
$check=get_db_msg("select id from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."' and gz='".$gz."' and id<>'".$id."'");
|
||||
if($check["id"]>0){
|
||||
$rurl="?_m=".$_m."&dpid=".$dpid."&iid=".$iid."&obj=".$obj;
|
||||
//取得配码行数
|
||||
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."'");
|
||||
$pm_rows=deel_num($tmp1["num"]);
|
||||
//echo "<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=gb2312\"></head><body><script> alert('保存失败!(该配码已经存在)');window.parent.set_pm_div_h(".$pm_rows.",'".$obj."');window.parent.location.href='".$rurl."'; </script></body></html>";
|
||||
//exit();
|
||||
if(!$msg){
|
||||
$msg="保存失败!(该配码已经存在)";
|
||||
}
|
||||
}
|
||||
$qy_uid=get_qy_id($m_client["path"]);
|
||||
if($id>0){
|
||||
//修改
|
||||
$msg_old=get_db_msg("select * from ".$table_pre."size_pm where id='".$id."'");
|
||||
if($msg_old["gz"]!=$gz){
|
||||
//如果已经有订单用了,不允许修改
|
||||
$check1=get_db_msg("select count(*) 'num' from ".$table_pre."order_pm where pmid='".$id."'");
|
||||
if($check1["num"]>0){
|
||||
//alert_and_back("对不起,该配码已经使用,不允许修改!");
|
||||
if(!$msg){
|
||||
$msg="对不起,该配码已经使用,不允许修改!";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($msg){
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg."\",";
|
||||
}else{
|
||||
$q1="update ".$table_pre."size_pm set title='".$title."',gz='".$gz."',num='".$num."' where id='".$id."'";
|
||||
$db->query($q1);
|
||||
$json_data.="\"code\":101,";
|
||||
}
|
||||
}else{
|
||||
if($msg){
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg."\",";
|
||||
}else{
|
||||
//新增
|
||||
$q1="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,pm_dj,title,gz,num) values ('".$qy_uid."','".$dpid."','".$m_kh["size_group"]."','".$m_kh["pm_dj"]."','".$title."','".$gz."','".$num."')";
|
||||
$db->query($q1);
|
||||
$json_data.="\"code\":101,";
|
||||
}
|
||||
}
|
||||
$rurl="?_m=".$_m."&dpid=".$dpid."&iid=".$iid."&obj=".$obj;
|
||||
//取得配码行数
|
||||
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."'");
|
||||
$pm_rows=deel_num($tmp1["num"]);
|
||||
$json_data.="\"pm_rows\":\"".$pm_rows."\",";
|
||||
//echo "<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=gb2312\"></head><body><script> alert('保存成功');window.parent.set_pm_div_h(".$pm_rows.",'".$obj."');window.parent.location.href='".$rurl."'; </script></body></html>";
|
||||
//exit();
|
||||
break;
|
||||
case "del":
|
||||
$check1=get_db_msg("select count(*) 'num' from ".$table_pre."order_pm where pmid='".$id."'");
|
||||
if($check1["num"]>0){
|
||||
//alert_and_back("对不起,该配码已经使用,不允许删除!");
|
||||
$msg="对不起,该配码已经使用,不允许删除!";
|
||||
}
|
||||
$check2=get_db_msg("select uid from ".$table_pre."size_pm where id='".$id."'");
|
||||
if($check2["uid"]!=$dpid){
|
||||
//alert_and_back("对不起,该配码已经使用,不允许删除!");
|
||||
$msg="对不起,只能修改自己的配码!";
|
||||
}
|
||||
if($msg){
|
||||
$json_data.="\"code\":0,\"msg\":\"".$msg."\",";
|
||||
}else{
|
||||
$q="delete from ".$table_pre."size_pm where id='".$id."'";
|
||||
$db->query($q);
|
||||
$json_data.="\"code\":101,";
|
||||
}
|
||||
$rurl="?_m=".$_m."&dpid=".$dpid."&iid=".$iid."&obj=".$obj;
|
||||
//取得配码行数
|
||||
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."'");
|
||||
$pm_rows=deel_num($tmp1["num"]);
|
||||
$json_data.="\"pm_rows\":\"".$pm_rows."\",";
|
||||
//echo "<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=gb2312\"></head><body><script> alert('删除成功');window.parent.set_pm_div_h(".$pm_rows.",'".$obj."');window.parent.location.href='".$rurl."'; </script></body></html>";
|
||||
//exit();
|
||||
break;
|
||||
default:
|
||||
$content="<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">";
|
||||
$content.="<tr><td align=\"left\" bgcolor=\"#f0f0f0\"><b>选择配码</b> <input type=\"button\" value=\"新增配码\" onclick=\"window.location.href='?_m=".$_m."&dpid=".$dpid."&iid=".$iid."&obj=".$obj."&_a=add'\"></td></tr>";
|
||||
|
||||
$kh=get_db_msg("select * from ".$table_pre."kh where id='".$iid."'");
|
||||
$json_data.="\"size\":\"".$kh["size"]."\",";
|
||||
|
||||
$json_data.="\"obj\":\"".$obj."\",";
|
||||
//取得装箱数
|
||||
$q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$m_client["username"]."' or dj='') and kh='".$m_kh["no"]."' order by num";
|
||||
//echo $q1;
|
||||
$r1=$db->query($q1);
|
||||
$sql_pm="";
|
||||
$str_zxs="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$sql_pm.="num='".$m1["num"]."' or ";
|
||||
//$str_zxs.="{\"zxs\":\"".$m1["num"]."\"},";
|
||||
$str_zxs.=$m1["num"].",";
|
||||
}
|
||||
if($str_zxs){
|
||||
$str_zxs=deel_end($str_zxs);
|
||||
}
|
||||
$json_data.="\"zxs\":\"".$str_zxs."\",";
|
||||
if($sql_pm)
|
||||
$sql_pm=" and (".substr($sql_pm,0,-4).")";
|
||||
//读取配码信息
|
||||
//配码等级一样,店铺id一样或者店铺id为空(适合所有店铺的配码)
|
||||
$q="select * from ".$table_pre."size_pm where (uid='".$dpid."' or uid='') and pm_dj='".$m_kh["pm_dj"]."' ".$sql_pm." order by id";
|
||||
//echo $q;
|
||||
$r=$db->query($q);
|
||||
$content_pm="<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\" bgcolor=\"#eeeeee\">";
|
||||
$i=0;
|
||||
$size_ws_kh=count(explode(",",$m_kh["size"]));
|
||||
$str_pm="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$size_ws=count(explode(":",$m["gz"]));
|
||||
//echo $size_ws."|".$size_ws_kh."-<br>";
|
||||
if($size_ws==$size_ws_kh){
|
||||
$is_edit=($m["uid"]==$dpid)?"y":"n";
|
||||
$str_pm.="{\"is_edit\":\"".$is_edit."\",\"id\":\"".$m["id"]."\",\"title\":\"".$m["title"]."\",\"gz\":\"".$m["gz"]."\",\"num\":\"".$m["num"]."\"},";
|
||||
|
||||
$content_pm.="<tr bgcolor=\"#ffffff\"><td onclick=\"check_pm('".$obj."','".$m["id"]."|".$m["title"]."|".$m["gz"]."')\"><input type='radio' name='pm_id' value='".$m["id"]."|".$m["gz"]."'>".$m["title"]."</td><td>".$m["gz"]."=".$m["num"]."</td><td width=\"110\"><input type=\"button\" value=\"修改\" style='width:50px;' onclick=\"window.location.href='?_m=".$_m."&dpid=".$dpid."&iid=".$iid."&obj=".$obj."&id=".$m["id"]."&_a=add'\"".$is_edit."> <input type=\"button\" value=\"删除\" style='width:50px;' onclick=\"d_confirm('确认删除吗?','?_m=".$_m."&dpid=".$dpid."&iid=".$iid."&obj=".$obj."&id=".$m["id"]."&_a=del')\"".$is_edit."></td></tr>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if($str_pm){
|
||||
$str_pm=deel_end($str_pm);
|
||||
}
|
||||
$json_data.="\"pm\":[".$str_pm."],";
|
||||
$content_pm.="</table>";
|
||||
if($i==0)
|
||||
$content_pm="暂无您的配码信息,请先新增。";
|
||||
$content.="<tr><td align=\"left\">".$content_pm."</td></tr>";
|
||||
//
|
||||
$content.="</table>";
|
||||
break;
|
||||
}
|
||||
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
//
|
||||
$zb_client_show=get_set("zb_client_show");
|
||||
$zb_type=get_set("zb_type");
|
||||
if($zb_client_show=="y")
|
||||
$arr_zb_type=explode(",",$zb_type);
|
||||
else
|
||||
$arr_zb_type=array();
|
||||
$face=$msg_client["face"];
|
||||
$jd_password=get_set("jd_password");
|
||||
$show_jd=get_set("show_jd");
|
||||
$is_brand=is_brand();
|
||||
$is_spk=get_set("is_spk");
|
||||
$json_data.="\"face\":\"".$face."\",";
|
||||
switch($_a){
|
||||
default:
|
||||
//---------------任务完成率
|
||||
$json_data.="\"table_top\":[\"".get_cate_title_no("arr_select","brand")."\",\"实际订量\",\"实际结算金额\",\"订货指标\",\"完成率\",\"订单状态\"],";
|
||||
//
|
||||
$q="select * from ".$table_pre."client_brand where cid='".$uid."' order by brand";
|
||||
$r=$db->query($q);
|
||||
$total_num=$total_money=$total_zb=$count=$total_wc=0;
|
||||
$tmp_sql="";
|
||||
if($is_spk=="y")
|
||||
$tmp_sql=" and is_sp<>'y'";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$sty1=($count%2)?"td2":"td1";
|
||||
$list=$count+1;
|
||||
$m_yd=get_db_msg("select sum(jsje) 'jsje',sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and ka<>'y' and brand='".$m["brand"]."' and _key='".$_key."'".$tmp_sql);
|
||||
$total_num+=$m_yd["num"];
|
||||
$total_money+=$m_yd["jsje"];
|
||||
if(in_array("je",$arr_zb_type)){
|
||||
$zb=$m["zb"]*10000;
|
||||
$wc_yd=$m_yd["jsje"];
|
||||
}else{
|
||||
$zb=$m["zb_js"];
|
||||
$wc_yd=$m_yd["num"];
|
||||
}
|
||||
$total_rw+=$zb;
|
||||
$total_wc+=$wc_yd;
|
||||
if($m["is_checked"]!="y" && $m["is_jd"]!="y" && $show_jd=="y"){
|
||||
$button_jd="&jd2=y&s_brand=".$m["brand"]."";
|
||||
}
|
||||
else
|
||||
$button_jd="";
|
||||
$count++;
|
||||
$json_data1.="[\"".get_cate_title_no("brand",$m["brand"])."|||".$button_jd."\",\"".$m_yd["num"]."\",\"".deel_num($m_yd["jsje"])."\",\"".$zb."\",\"".deel_bfb1($wc_yd,$zb,1)."\",\"".get_client_state($m["is_jd"],$m["is_checked"])."\"],";
|
||||
}
|
||||
//合计
|
||||
$json_data.="\"table_mid\":[".substr($json_data1,0,-1)."],";
|
||||
$json_data.="\"table_hj\":[\"合计\",\"".$total_num."\",\"".deel_num($total_money)."\",\"".$total_rw."\",\"".deel_bfb1($total_wc,$total_rw,1)."\",\" \"],";
|
||||
//$json_data.="\"code\":1";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/////////////////////////////////////////////////////////////////////////////////////上传图片
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$att_dir=dir_cutb(THIS_FILE_ROOT,1);
|
||||
//
|
||||
$up_image=$_FILES["up_image"];
|
||||
$msg=get_db_msg("select no from ".$table_pre."kh where id='".$id."'");
|
||||
if($up_image["name"]){
|
||||
$path1="../attachments/design/big";
|
||||
$path2="../attachments/design/mini";
|
||||
$new_file_name=$msg["no"]."_".$c.".jpg";
|
||||
make_mini_picture($up_image["tmp_name"],$path1."/".$new_file_name,800);
|
||||
//缩略图
|
||||
make_mini_picture($path1."/".$new_file_name,$path2."/".$new_file_name);
|
||||
}
|
||||
echo "{\"success\":\"success\",\"isnew\":\"y\",\"jsname\":\"refresh_admin()\"}";
|
||||
?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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."'");
|
||||
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
$json_data.="\"face\":\"".$msg_login["face"]."\",";
|
||||
switch($_a){
|
||||
case "get_scene":
|
||||
//获取默认
|
||||
$tmp=get_db_msg("select * from web_scene where sceneDefault='y' limit 0,1");
|
||||
$json_data.="\"firstScene\":\"".$tmp["sceneName"]."\",";
|
||||
|
||||
$str="";
|
||||
$sql="select * from web_scene order by sceneName";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
|
||||
$pic="../attachments/scene/".$msg["scenePic"].".jpg";
|
||||
|
||||
//
|
||||
$hotstr="";
|
||||
$sql2="select * from web_scene_hotspots where sid='".$msg["id"]."'";
|
||||
$res2=$db->query($sql2);
|
||||
while($msg2=$db->fetch_array($res2)){
|
||||
if($msg2["hot_type"]=="info"){
|
||||
$tmp_kh=get_db_msg("select id from web_kh where no='".$msg2["khno"]."'");
|
||||
$khid=$tmp_kh["id"]?$tmp_kh["id"]:"0";
|
||||
$hotstr.="{\"id\":\"".$khid."\",\"pitch\":\"".$msg2["hot_pitch"]."\",\"yaw\":\"".$msg2["hot_yaw"]."\",\"type\":\"".$msg2["hot_type"]."\",\"text\":\"".$msg2["khno"]."\",\"sceneId\":\"".$msg2["hot_sceneId"]."\"},";
|
||||
}else{
|
||||
$hotstr.="{\"pitch\":\"".$msg2["hot_pitch"]."\",\"yaw\":\"".$msg2["hot_yaw"]."\",\"type\":\"".$msg2["hot_type"]."\",\"text\":\"".$msg2["hot_title"]."\",\"sceneId\":\"".$msg2["hot_sceneId"]."\"},";
|
||||
}
|
||||
}
|
||||
|
||||
$str.="\"".$msg["sceneName"]."\":{\"type\":\"equirectangular\",\"title1\":\"".$msg["sceneTitle"]."\",\"panorama\":\"".$pic."\",\"hotSpots\":[".substr($hotstr,0,-1)."]},";
|
||||
}
|
||||
$json_data.="\"code\":0,\"data\":{".substr($str,0,-1)."},";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,332 @@
|
||||
<?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."'");
|
||||
|
||||
$arr_report=array("ph"=>"我的排行榜","ks_qs"=>"款式趋势报表");
|
||||
|
||||
$_a=$_a?$_a:"ph";
|
||||
|
||||
if($_a=="ph" || $_a=="ks_qs"){
|
||||
$json_data.="\"s_a\":\"".$_a."\",";
|
||||
$str_tab="";
|
||||
foreach($arr_report as $k1=>$v1){
|
||||
$str_tab.="{\"_a\":\"".$k1."\",\"title\":\"".$v1."\"},";
|
||||
}
|
||||
$str_tab=deel_end($str_tab);
|
||||
$json_data.="\"tab\":[".$str_tab."],";
|
||||
}
|
||||
$arr_zd=array("1"=>"订单量");
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
switch($_a){
|
||||
case "ph":
|
||||
$s_ms=$s_ms?$s_ms:"1";
|
||||
if($s_ms=="2"){
|
||||
$con_group_by="no,color";
|
||||
}else{
|
||||
$con_group_by="no";
|
||||
}
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
//
|
||||
$arr_ms=array("1"=>"到款","2"=>"到色");
|
||||
$tmp_ms="";
|
||||
foreach($arr_ms as $k => $v){
|
||||
$tmp_ms.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$tmp_ms=deel_end($tmp_ms);
|
||||
$json_data.="\"select_ms\":{\"no\":\"s_ms\",\"title\":\"排行模式\",\"value\":\"".$s_ms."\",\"op\":[".$tmp_ms."]},";
|
||||
|
||||
//
|
||||
$s_order=$s_order?$s_order:"num";
|
||||
$arr_order=array("num"=>"数量排序","je"=>"金额排序");
|
||||
$tmp_order="";
|
||||
foreach($arr_order as $k => $v){
|
||||
$tmp_order.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$tmp_order=deel_end($tmp_order);
|
||||
$json_data.="\"select_order\":{\"no\":\"s_order\",\"title\":\"排序\",\"value\":\"".$s_order."\",\"op\":[".$tmp_order."]},";
|
||||
|
||||
|
||||
//取得定制选项
|
||||
$select_dz="";
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
//取得选项
|
||||
$tmp="";
|
||||
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no");
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$var="s_".$arr_select_no[$i];
|
||||
$select_dz.="{\"no\":\"".$arr_select_no[$i]."\",\"title\":\"".$arr_select_title[$i]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},";
|
||||
}
|
||||
$select_dz=deel_end($select_dz);
|
||||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||||
$json_data.="\"s_no\":\"".$s_no."\",";
|
||||
|
||||
$thead_str="";
|
||||
$thead_str.="{\"zd\":\"zpm\",\"title\":\"全国排名\"},";
|
||||
$thead_str.="{\"zd\":\"kh\",\"title\":\"款号\"},";
|
||||
$thead_str.="{\"zd\":\"pic\",\"title\":\"图片\"},";
|
||||
if($s_ms=="2"){
|
||||
$thead_str.="{\"zd\":\"color\",\"title\":\"颜色\"},";
|
||||
}
|
||||
$thead_str.="{\"zd\":\"wpm\",\"title\":\"我的排名\"},";
|
||||
$thead_str.="{\"zd\":\"dpj\",\"title\":\"吊牌价\"},";
|
||||
$thead_str.="{\"zd\":\"sl\",\"title\":\"件数\"},";
|
||||
$thead_str.="{\"zd\":\"je\",\"title\":\"吊牌金额\"}";
|
||||
$json_data.="\"thead_str\":[".$thead_str."],";
|
||||
|
||||
$con1="";
|
||||
//取得设计师条件
|
||||
$con_designer="where id>0 ";
|
||||
$tmp=get_db_msg("select no from ".$table_pre."keyword where title='".$msg_login["title"]."' and cate='designer'");
|
||||
if($tmp["no"]){
|
||||
$con1.="designer='".$tmp["no"]."' and ";
|
||||
$con_designer=" and designer='".$tmp["no"]."'";
|
||||
}
|
||||
if($s_no)
|
||||
$con1.="no like '%".$s_no."%' and ";
|
||||
for($i=0;$i<count($arr_select_no);$i++){
|
||||
if($arr_select_no!="designer"){
|
||||
$v="s_".$arr_select_no[$i];
|
||||
if($$v)
|
||||
$con1.=$arr_select_no[$i]."='".$$v."' and ";
|
||||
}
|
||||
}
|
||||
if($con1){
|
||||
$con1="where ".substr($con1,0,-4);
|
||||
}else{
|
||||
$con1="where id>0 ";
|
||||
}
|
||||
|
||||
//取得总排名数据
|
||||
$arr_je_zpm=$arr_num_zpm=array();
|
||||
$q1="select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where _key='".$_key."' group by ".$con_group_by." order by ".$s_order." desc";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_je_zpm[]=$m1["je"];
|
||||
$arr_num_zpm[]=$m1["num"];
|
||||
}
|
||||
//取得我的排名数据
|
||||
$arr_je_wpm=$arr_num_wpm=array();
|
||||
$q1="select sum(num) 'num',sum(je) 'je' from ".$table_pre."order ".$con_designer." and _key='".$_key."' group by ".$con_group_by." order by ".$s_order." desc";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_je_wpm[]=$m1["je"];
|
||||
$arr_num_wpm[]=$m1["num"];
|
||||
}
|
||||
//默认每页显示20
|
||||
$page=$page?$page:"1";
|
||||
$ord_num=20;
|
||||
$start=($page-1)*$ord_num;
|
||||
$end=$ord_num;
|
||||
$tmp_tal=get_db_msg("select count(distinct ".$con_group_by.") 'num' from ".$table_pre."order ".$con1." and _key='".$_key."'");
|
||||
$pages=ceil($tmp_tal["num"]/$ord_num);
|
||||
$json_data.="\"pages\":\"".$pages."\",";
|
||||
|
||||
$q="select sum(num) 'num',sum(je) 'je',iid,color from ".$table_pre."order ".$con1." and _key='".$_key."' group by ".$con_group_by." order by ".$s_order." desc limit ".$start.",".$end;
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
|
||||
$v1="arr_".$s_order."_zpm";
|
||||
$v2="arr_".$s_order."_wpm";
|
||||
$num=$m["num"];
|
||||
$money=$m["je"];
|
||||
$tbody_str.="{";
|
||||
$tbody_str.="\"zpm\":\"".(get_main_key1($$v1,$$s_order)+1)."\",";
|
||||
$tbody_str.="\"kh\":\"".$m1["no"]."\",";
|
||||
$tbody_str.="\"yph\":\"".get_kh_xh($m1)."\",";
|
||||
if($s_ms=="2"){
|
||||
$tbody_str.="\"color\":\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\",";
|
||||
$pic=get_kh_color_picture($m1["no"],$m["color"],$flag_pad_offline);
|
||||
}else{
|
||||
$pic=get_kh_picture($m1["no"],$m1["main_pic"],$m1["color"],$flag_pad_offline);
|
||||
}
|
||||
$arr_pic_set=out_good_pic_set_arr($pic,100,100);
|
||||
$tbody_str.="\"pic_src\":\"".$pic."\",";
|
||||
$tbody_str.="\"pic_w\":\"".$arr_pic_set[0]."\",";
|
||||
$tbody_str.="\"pic_h\":\"".$arr_pic_set[1]."\",";
|
||||
$tbody_str.="\"wpm\":\"".(get_main_key1($$v2,$$s_order)+1)."\",";
|
||||
$tbody_str.="\"dpj\":\"".$m1["price"]."\",";
|
||||
$tbody_str.="\"sl\":\"".$num."\",";
|
||||
$tbody_str.="\"je\":\"".deel_num($money)."\"";
|
||||
$tbody_str.="},";
|
||||
}
|
||||
$json_data.="\"tbody_str\":[".substr($tbody_str,0,-1)."],";
|
||||
|
||||
break;
|
||||
case "ks_qs":
|
||||
$s_con_time=$s_con_time?$s_con_time:"day";
|
||||
//
|
||||
$s_zd="";
|
||||
foreach($arr_zd as $k => $v){
|
||||
$var="zd_".$k;
|
||||
if($$var=="on")
|
||||
$s_zd.=$k.",";
|
||||
}
|
||||
$s_zd=deel_end($s_zd);
|
||||
$s_zd=$s_zd?$s_zd:"1";
|
||||
$arr_s_zd=explode(",",$s_zd);
|
||||
$json_data.="\"s_zd\":\"".$s_zd."\",";
|
||||
//组合条件
|
||||
if($s_con_time=="day"){
|
||||
$sql_time="substring(add_date,1,11)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else if($s_con_time=="half_day"){
|
||||
$sql_time="concat(substring(add_date,1,11),' ',case when substring(add_date,12,2)<13 then '1' when substring(add_date,12,2)<19 then '2' else '3' end)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else{
|
||||
$sql_time="concat(substring(add_date,1,11),'',substring(add_date,12,2))";
|
||||
$con_hour=" where action>20 and action<25 and substring(add_date,1,11)='".$s_day."'";
|
||||
}
|
||||
//取得时间段数据
|
||||
$q="select ".$sql_time." as '_t' from ".$table_pre."log_hd".$con_hour." group by _t order by _t";
|
||||
$r=$db->query($q);
|
||||
$arr_sjd=array();
|
||||
$tb_data_x="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_sjd[]=$m["_t"];
|
||||
$tb_data_x.=deel_date_format($s_con_time,$m["_t"]).",";
|
||||
}
|
||||
$tb_data_x=deel_end($tb_data_x);
|
||||
//取得数据
|
||||
$q="select b.iid 'iid',sum(case when b.action in (21,23) then b.num when b.action in (22,24) then -b.num else 0 end) 'num_1',count(distinct b.uid) 'num_2' from ".$table_pre."log_hd b where b.action>20 and b.action<25 group by b.iid order by num_1 desc";
|
||||
$r=$db->query($q);
|
||||
$i=0;
|
||||
$total_num=0;
|
||||
$arr_data_js=$arr_data_khs=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
//
|
||||
$data_tb_v1=$data_tb_v2="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$m1=get_db_msg("select sum(case when action in (21,23) then num when action in (22,24) then -num else 0 end) 'num_1',count(distinct uid) 'num_2' from ".$table_pre."log_hd where iid='".$m["iid"]."' and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
$data_tb_v1.=add_0($m1["num_1"]).",";
|
||||
$data_tb_v2.=add_0($m1["num_2"]).",";
|
||||
}
|
||||
$arr_data_js[$m["iid"]]=deel_end($data_tb_v1);
|
||||
$arr_data_khs[$m["iid"]]=deel_end($data_tb_v2);
|
||||
$i++;
|
||||
}
|
||||
//-----------------------输出数据
|
||||
//表头
|
||||
$thead="";
|
||||
//第一行
|
||||
$tr="{\"title\":\"圆牌号\",\"width\":80,\"align\":\"center\",\"rowspan\":2},{\"title\":\"款号\",\"width\":80,\"align\":\"center\",\"rowspan\":2},{\"title\":\"总订量\",\"width\":70,\"align\":\"center\",\"rowspan\":2},";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
$tr.="{\"title\":\"".deel_date_format($s_con_time,$arr_sjd[$i])."\"";
|
||||
if(count($arr_s_zd)>1)
|
||||
$tr.=",\"colspan\":".count($arr_s_zd).",\"align\":\"center\"";
|
||||
$tr.="},";
|
||||
}
|
||||
$thead.="{\"row\":0,\"tr\":[".deel_end($tr)."]},";
|
||||
//第二行
|
||||
$tr="";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$tr.="{\"title\":\"".get_main_value($arr_zd,$arr_s_zd[$j])."\",\"align\":\"center\"},";
|
||||
}
|
||||
}
|
||||
$thead.="{\"row\":1,\"tr\":[".deel_end($tr)."]}";
|
||||
$json_data.="\"thead\":[".$thead."],";
|
||||
//计算标准差
|
||||
$arr_pc=array();
|
||||
$i=0;
|
||||
foreach($arr_data_js as $iid => $str_data_js){
|
||||
$arr_pc[$iid]=get_pc(explode(",",$str_data_js));
|
||||
$i++;
|
||||
}
|
||||
arsort($arr_pc);
|
||||
//内容
|
||||
$i=0;
|
||||
$hj_total_num=0;
|
||||
$data="";
|
||||
foreach($arr_pc as $iid => $pc){
|
||||
$m_kh=get_db_msg("select no,id,main_pic,color,xh from ".$table_pre."kh where id='".$iid."'");
|
||||
if(!$s_no || ($s_no && (strpos(" ".$m_kh["no"],$s_no)!=false))){
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and iid='".$iid."' and _key='".$_key."'");
|
||||
$tmp_total_num=$tmp["num"];
|
||||
$hj_total_num+=$tmp_total_num;
|
||||
//
|
||||
$content1="";
|
||||
$arr_tmp_js=explode(",",$arr_data_js[$iid]);
|
||||
$arr_tmp_khs=explode(",",$arr_data_khs[$iid]);
|
||||
for($i1=0;$i1<count($arr_tmp_js);$i1++){
|
||||
$num_1=$arr_tmp_js[$i1];
|
||||
$num_2=$arr_tmp_khs[$i1];
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$var="num_".$arr_s_zd[$j];
|
||||
$content1.=",\"num_".$i1."_".$j."\":\"".add_0($$var)."\"";
|
||||
}
|
||||
$v="hj_".$i1;
|
||||
$$v+=$num_1;
|
||||
}
|
||||
$list=$i+1;
|
||||
$tb_data_y="";
|
||||
if(in_array("1",$arr_s_zd))
|
||||
$tb_data_y.=get_main_value($arr_zd,"1").",".$arr_data_js[$iid]."|";
|
||||
if(in_array("2",$arr_s_zd))
|
||||
$tb_data_y.=get_main_value($arr_zd,"2").",".$arr_data_khs[$iid]."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$pic=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
|
||||
$data.="{\"xh\":\"".get_kh_xh($m_kh)."\",\"id\":\"".$m_kh["id"]."\",\"pic\":\"".$pic."\",\"tb_data_y\":\"".$tb_data_y."\",\"kh\":\"".$m_kh["no"]."\",\"total_num\":\"".$tmp_total_num."\"".$content1."},";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
//合计
|
||||
$data_tb_v1="";
|
||||
$data_tb_v2="";
|
||||
$content1="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$var="hj_".$i1;
|
||||
for($j1=0;$j1<count($arr_s_zd);$j1++){
|
||||
if($arr_s_zd[$j1]==1){
|
||||
if($i1==0)
|
||||
$data_tb_v1.=get_main_value($arr_zd,"1").",";
|
||||
$content1.=",\"num_".$i1."_".$j1."\":\"".add_0($$var)."\"";
|
||||
$data_tb_v1.=add_0($$var).",";
|
||||
}else if($arr_s_zd[$j1]==2){
|
||||
if($i1==0)
|
||||
$data_tb_v2.=get_main_value($arr_zd,"2").",";
|
||||
$m1=get_db_msg("select count(distinct uid) 'num_2' from ".$table_pre."log_hd where action>20 and action<25 and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
$content1.=",\"num_".$i1."_".$j1."\":\"".add_0($m1["num_2"])."\"";
|
||||
$data_tb_v2.=add_0($m1["num_2"]).",";
|
||||
}
|
||||
}
|
||||
}
|
||||
//合计
|
||||
$data.="{\"xh\":\"合计\",\"id\":\"0\",\"kh\":\"\",\"total_num\":\"".$hj_total_num."\"".$content1."},";
|
||||
//输出表格数据
|
||||
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$i.",\"data\":[".deel_end($data)."],";
|
||||
//输出图表数据
|
||||
$data_tb_v1=deel_end($data_tb_v1);
|
||||
$data_tb_v2=deel_end($data_tb_v2);
|
||||
$tb_data_y="";
|
||||
if($data_tb_v1)
|
||||
$tb_data_y.=$data_tb_v1."|";
|
||||
if($data_tb_v2)
|
||||
$tb_data_y.=$data_tb_v2."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$json_data.="\"chart_title\":\"订单趋势图\",";
|
||||
$json_data.="\"chart_type\":\"line\",";
|
||||
$json_data.="\"chart_data_x\":\"".$tb_data_x."\",";
|
||||
$json_data.="\"chart_data_y\":\"".$tb_data_y."\",";
|
||||
break;
|
||||
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
//-------------------------------沙盘订货
|
||||
/*
|
||||
店铺和区经角色
|
||||
*/
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
|
||||
$uid=check_cookie_jxs();
|
||||
//系统变量
|
||||
$sys_close=get_set("sys_close");
|
||||
$sys_close_image=get_set("sys_close_image");
|
||||
$is_session=get_set("is_session");
|
||||
$zb_type=get_set("zb_type");
|
||||
$is_spk=get_set("is_spk");
|
||||
$zbxf=get_set("zbxf");
|
||||
$zbxf_type=get_set("zbxf_type");
|
||||
$sys_ms=get_set("sys_ms");
|
||||
$is_msg=get_set("is_msg");
|
||||
$is_ewm=get_set("is_ewm");
|
||||
$is_window="y";
|
||||
$zk_type=get_set("zk_type");
|
||||
$is_hd_log=get_set("is_hd_log");
|
||||
$xh_ms=get_set("xh_ms");
|
||||
$order_session=get_set("order_session");
|
||||
$sys_size_num=get_max_size_num();
|
||||
$theme_path=get_theme_path();
|
||||
|
||||
$is_sy=get_set("is_sy");
|
||||
|
||||
$bs_kh_dj=get_set("bs_kh_dj");
|
||||
$json_data.="\"bs_kh_dj\":\"".$bs_kh_dj."\",";
|
||||
|
||||
$tmpl_m3_lie=6;
|
||||
$tmpl_m3_pic_width=100;
|
||||
$tmpl_m3_pic_height=100;
|
||||
$tmpl_m3_cl_pic_width=400;
|
||||
$tmpl_m3_cl_pic_height=300;
|
||||
$json_data.="\"sys_ver_hy\":\"".$sys_ver_hy."\",";
|
||||
//沙盘订货滑动条上限
|
||||
$json_data.="\"slider_max\":30,";
|
||||
|
||||
//$db=_mysql_connect();
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
if($msg_login["available"]!="y"){
|
||||
$json_data.="\"error\":\"用户已被禁用\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
|
||||
}else{
|
||||
$json_data.="\"face\":\"".$msg_login["face"]."\",";
|
||||
$json_data.="\"uid\":\"".$msg_login["id"]."\",";
|
||||
|
||||
$json_data.="\"username\":\"".$msg_login["username"]."\",";
|
||||
$json_data.="\"is_sy\":\"".$is_sy."\",";
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
$rurl=$rurl?$rurl:get_this_url();
|
||||
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
|
||||
$zb_client_show=get_set("zb_client_show");
|
||||
if($zb_client_show=="y")
|
||||
$arr_zb_type=explode(",",$zb_type);
|
||||
else
|
||||
$arr_zb_type=array();
|
||||
$is_brand=is_brand();
|
||||
$show_jd=get_set("show_jd");
|
||||
$is_dkds=get_set("is_dkds");
|
||||
$is_multi_price=get_set("is_multi_price");
|
||||
$order_close=get_set("order_close");
|
||||
$search_type=get_set("search_type");
|
||||
|
||||
|
||||
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
||||
$json_data.="\"is_dkds\":\"".$is_dkds."\",";
|
||||
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
||||
$json_data.="\"is_multi_price\":\"".$is_multi_price."\",";
|
||||
|
||||
|
||||
if($is_brand=="y")
|
||||
$link_var_brand="&s_brand=".$s_brand;
|
||||
else
|
||||
$link_var_brand="";
|
||||
$title_brand=$con_brand="";
|
||||
if($s_brand){
|
||||
$arr_s_brand=explode(",",$s_brand);
|
||||
for($i=0;$i<count($arr_s_brand);$i++){
|
||||
$con_brand.="brand='".$arr_s_brand[$i]."' or ";
|
||||
$title_brand.=get_cate_title_no("brand",$arr_s_brand[$i]).",";
|
||||
}
|
||||
if($title_brand)
|
||||
$title_brand=substr($title_brand,0,-1);
|
||||
if($con_brand)
|
||||
$con_brand=" and (".substr($con_brand,0,-3).")";
|
||||
}
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
//文胸
|
||||
if($bx_sizegroup_title){
|
||||
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
|
||||
$bx_sizegroup_id=$tmp["id"];
|
||||
}else{
|
||||
$bx_sizegroup_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;
|
||||
}
|
||||
$con_spk=($is_spk=="y")?" and is_sp<>'y'":"";
|
||||
$flag_spk=($is_spk=="y")?"1":"";
|
||||
//------------------------------------包含定制模块,店铺界面,顶部已订数和完成率的显示
|
||||
//include_once $path_dz."/dp/wcl.php";
|
||||
//
|
||||
//--------------交单按钮
|
||||
$jd_password=get_set("jd_password");
|
||||
if($is_brand<>"y"){
|
||||
$tmp=$msg_login;
|
||||
$is_jd=$msg_login["is_jd"];
|
||||
$is_checked=$msg_login["is_checked"];
|
||||
}else{
|
||||
$tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_jd limit 0,1");
|
||||
$is_jd=$tmp["is_jd"];
|
||||
$tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_checked limit 0,1");
|
||||
$is_checked=$tmp["is_checked"];
|
||||
}
|
||||
if($show_jd=="y"){
|
||||
if($is_jd=="y")
|
||||
$jd_button="已交单|";
|
||||
if($is_checked=="y")
|
||||
$jd_button="已确认|";
|
||||
if($is_brand=="y"){
|
||||
$jd_button="交单|go_url('".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=o&s_tab=wcl')";
|
||||
}else{
|
||||
if($is_jd!="y" && $is_checked!="y")
|
||||
$jd_button="交单|do_jd('".$jd_password."','".$_SERVER[PHP_SELF]."?_m=".$_m."&_a=jd".$link_var_brand."')";
|
||||
}
|
||||
}else{
|
||||
|
||||
$jd_button="|";
|
||||
}
|
||||
//计算订货规则按钮
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."gz where dj='' or dj='".$msg_login["dj"]."'");
|
||||
if($tmp["num"]>0)
|
||||
$menu_dhgz="订货规则";
|
||||
else
|
||||
$menu_dhgz="";
|
||||
|
||||
|
||||
switch($_a){
|
||||
case "wdjh":
|
||||
//定制条件
|
||||
$query="select * from ".$table_pre."client_shsj where uid='".$uid."' order by ord";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
|
||||
$strarr="";
|
||||
$pcsl=0;
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$strarr.="{\"id\":".$msg["id"].",\"color_number\":\"".$msg["kss"]."\",\"date\":\"".$msg["add_date"]."\",\"ord\":\"".$msg["ord"]."\"},";
|
||||
$pcsl++;
|
||||
}
|
||||
$json_data.="\"plan\":[".deel_end($strarr)."],";
|
||||
$json_data.="\"pcsl\":\"".$pcsl."\",";
|
||||
break;
|
||||
case "wdjh_save":
|
||||
$arr=explode("|",deel_end($data));
|
||||
$tmptime="";
|
||||
$errmsg="";
|
||||
foreach($arr as $k => $v){
|
||||
$tmp=explode("_",$v);
|
||||
if($tmptime==""){
|
||||
$tmptime=$tmp[1];
|
||||
}else{
|
||||
$cp=strtotime($tmptime)-strtotime($tmp[1]);
|
||||
if($cp>0){
|
||||
$errmsg="每个计划时间必须比前一个要晚!";
|
||||
}
|
||||
$tmptime=$tmp[1];
|
||||
}
|
||||
}
|
||||
if($errmsg){
|
||||
$json_data.="\"code\":100,";
|
||||
$json_data.="\"msg\":\"".$errmsg."\",";
|
||||
}else{
|
||||
$ct=1;
|
||||
//$q="delete from ".$table_pre."client_shsj where uid='".$uid."'";
|
||||
//$db->query($q);
|
||||
$ord=1;
|
||||
foreach($arr as $k => $v){
|
||||
$tmp=explode("_",$v);
|
||||
if($tmp[0] && $tmp[0]!="undefined"){
|
||||
$q="update ".$table_pre."client_shsj set add_date='".$tmp[1]."',kss='".$tmp[2]."',ord='".$ord."' where id='".$tmp[0]."'";
|
||||
//echo $q;
|
||||
$db->query($q);
|
||||
}else{
|
||||
$q="insert into ".$table_pre."client_shsj (uid,add_date,kss,ord) values ('".$uid."','".$tmp[1]."','".$tmp[2]."','".$ord."')";
|
||||
//echo $q;
|
||||
$db->query($q);
|
||||
}
|
||||
$ord++;
|
||||
}
|
||||
$json_data.="\"code\":101,";
|
||||
}
|
||||
break;
|
||||
case "wdjh_del":
|
||||
$q="delete from ".$table_pre."client_shsj where id='".$id."'";
|
||||
$db->query($q);
|
||||
$q="delete from ".$table_pre."kh_sp where uid='".$uid."' and sszq='".$id."'";
|
||||
$db->query($q);
|
||||
$json_data.="\"code\":101,";
|
||||
break;
|
||||
default:
|
||||
//----------------------------------------------沙盘模式
|
||||
|
||||
$w2=188;
|
||||
$h2=250;
|
||||
|
||||
//
|
||||
|
||||
/*$sql_con=" where zsh>0 and ";
|
||||
if($s_type){
|
||||
$sql_con.=get_sql_client_type($s_type);
|
||||
}
|
||||
if($s_no){
|
||||
$sql_con.="kh like '%".$s_no."%' and ";
|
||||
$s_zsh="";
|
||||
}
|
||||
$kl=strlen($s_keyword);
|
||||
if($kl<=3 && $s_keyword && is_numeric($s_keyword)){
|
||||
if($xh_ms=="2"){
|
||||
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
||||
}else{
|
||||
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
||||
}
|
||||
$sql_con.=" kh='".$tmp["no"]."' and";
|
||||
for($i=0;$i<$num_dp_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$$v="";
|
||||
}
|
||||
$s_zsh="";
|
||||
$s_title="";
|
||||
}
|
||||
if($kl>=3){
|
||||
if(is_numeric($s_keyword)){
|
||||
if($xh_ms=="2"){
|
||||
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
||||
}else{
|
||||
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
||||
}
|
||||
$sql_con.=" (kh='".$tmp["no"]."' or kh like '%".$s_keyword."%') and";
|
||||
}else{
|
||||
$sql_con.=" (kh like '%".$s_keyword."%') and";
|
||||
}
|
||||
for($i=0;$i<$num_dp_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$$v="";
|
||||
}
|
||||
$s_zsh="";
|
||||
$s_title="";
|
||||
}
|
||||
if($s_title){
|
||||
$sql_con.="title like '%".$s_title."%' and ";
|
||||
$s_keyword="";
|
||||
$s_zsh="";
|
||||
}
|
||||
for($i=0;$i<$num_cl_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
if($$v1)
|
||||
$sql_con.="zd".($i+1)."='".$$v1."' and ";
|
||||
}
|
||||
if($sql_con)
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
//$sql_order=str_replace("!"," desc",$order);
|
||||
|
||||
$json_data.="\"s_keyword\":\"".$s_keyword."\",";
|
||||
$json_data.="\"s_zsh\":\"".$s_zsh."\",";
|
||||
$json_data.="\"s_title\":\"".$s_title."\",";
|
||||
|
||||
|
||||
$query="select count(distinct zsh) 'total' from ".$table_pre."kh_cl ".$sql_con;
|
||||
$res=$db->query($query);
|
||||
$msg=$db->fetch_array($res);
|
||||
$total=$msg["total"];*/
|
||||
|
||||
|
||||
//定制条件
|
||||
$query="select * from ".$table_pre."client_shsj where uid='".$uid."' order by id";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$rnum=0;
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
$pic_background=get_set("pic_background");
|
||||
$pic_background=$pic_background?$pic_background:"#ffffff";
|
||||
$content_set="[\"".$pic_background."\"]";
|
||||
|
||||
$json_data.="\"style_title_color\":\"".$style_title_color."\",";
|
||||
$json_data.="\"ka_color\":\"".$ka_color."\",";
|
||||
$json_data.="\"content_set\":\"".$pic_background."\",";
|
||||
|
||||
$json_data.="\"cplbs\":[";
|
||||
$data_str="";
|
||||
|
||||
$content_list="[";
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$q="SELECT a.* FROM ".$table_pre."order a INNER JOIN ".$table_pre."kh_sp b on a.uid=b.uid and a.iid=b.iid WHERE a.uid='".$uid."' and FIND_IN_SET(".$msg["id"].",b.allzq)>0";
|
||||
//echo $query."<br>";
|
||||
$r=$db->query($q);
|
||||
$str_k="";
|
||||
$arrkss=array();
|
||||
$strc="";
|
||||
$js=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
//图片获取规则
|
||||
$pic=get_kh_color_picture($m["no"],$m["color"],$flag_pad_offline);
|
||||
$content_list.=$msg["zsh"].",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",\"".$msg["title"]."\",\"".$is_my_cl."\",";
|
||||
$ck=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_k.="{\"khid\":".$m["iid"].",\"kh\":\"".$m["no"]."\",\"js\":\"".$m["num"]."\",\"color\":\"".$m["color"]."\",\"colort\":\"".get_cate_title_no("color",$m["color"])."\",\"pic\":\"".$pic."\",\"pic_w\":".$ck[0].",\"pic_h\":".$ck[1]."},";
|
||||
$strc=$m["no"]."-".$m["color"];
|
||||
$arrkss[$strc]=$strc;
|
||||
$js+=$m["num"];
|
||||
//
|
||||
//$rnum++;
|
||||
}
|
||||
//$date=date('Y年m月d日',$msg["add_date"]);
|
||||
$data_str.="{\"kss\":\"".$msg["kss"]."\",\"ydkss\":\"".count($arrkss)."\",\"ydjs\":\"".$js."\",\"date\":\"".$msg["add_date"]."\",\"list\":[".deel_end($str_k)."]},";
|
||||
}
|
||||
$json_data.=substr($data_str,0,-1)."],";
|
||||
$content_list.="]";
|
||||
|
||||
//自定义筛选条件
|
||||
$str_arr_zy="";
|
||||
$select_dz="";
|
||||
if($sys_zycl=="y"){
|
||||
$tmp1=explode(",",$sys_zycl_client_type);
|
||||
foreach($tmp1 as $k1 => $v1){
|
||||
$tmp2=explode("|",$v1);
|
||||
$str_arr_zy.="{\"no\":\"".$tmp2[0]."\",\"title\":\"".$tmp2[1]."\"},";
|
||||
/*foreach($tmp2 as $k2 => $v2){
|
||||
$str_arr_zy.="{\"no\":\"".$k2."\",\"title\":\"".$v2."\"},";
|
||||
}*/
|
||||
}
|
||||
$str_arr_zy=deel_end($str_arr_zy);
|
||||
$select_dz.="{\"no\":\"s_type\",\"title\":\"沙盘类型\",\"value\":\"".$s_type."\",\"op\":[".$str_arr_zy."]},";
|
||||
}
|
||||
|
||||
$str_arr_select="";
|
||||
|
||||
for($i=0;$i<$num_cl_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$str_arr_select.="\"".$v1."\",\"".$sys_cl_zd[$i]."\",\"".$$v1."\",";
|
||||
$r=$db->query("select zd".($i+1)." from ".$table_pre."kh_cl group by zd".($i+1)." order by zd".($i+1));
|
||||
$op="[";
|
||||
$tmp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="\"".$m["zd".($i+1)]."|".$m["zd".($i+1)]."\",";
|
||||
$tmp.="{\"no\":\"".$m["zd".($i+1)]."\",\"title\":\"".$m["zd".($i+1)]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$select_dz.="{\"no\":\"".$v1."\",\"title\":\"".$sys_cl_zd[$i]."\",\"value\":\"".$$v1."\",\"op\":[".$tmp."]},";
|
||||
$op.="],";
|
||||
$str_arr_select.=$op;
|
||||
}
|
||||
$select_dz=deel_end($select_dz);
|
||||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=check_cookie_jxs();
|
||||
//$tmp_client=get_db_msg("select title from web_client where id='".$uid."'");
|
||||
switch($_a){
|
||||
case "getCilentTime":
|
||||
$now = time();
|
||||
echo $now;
|
||||
break;
|
||||
|
||||
case "showData":
|
||||
//服务器当前
|
||||
$tmp_first=get_db_msg("select id,timetemp from web_barrage where id = '$barrageId'");
|
||||
if($nowTime>0){
|
||||
$now = $tmp_first["id"]?$tmp_first["timetemp"]:$nowTime;
|
||||
}else{
|
||||
$now=time();
|
||||
}
|
||||
$barrageId = $barrageId;
|
||||
//
|
||||
$sql="select id,uid,value from web_barrage where id > '$barrageId' and timetemp>='".$now."'";
|
||||
$result = $db->query($sql);
|
||||
$list = array();
|
||||
$lastId = $barrageId;
|
||||
while($row =$db->fetch_array($result)){
|
||||
$tmp_client=get_db_msg("select title from web_client where id='".$row["uid"]."'");
|
||||
$lastId = $row['id'];
|
||||
$item = array(
|
||||
'barrageId' => $row['id'],
|
||||
'value' => $tmp_client["title"].":".$row['value']
|
||||
);
|
||||
array_push($list,$item);
|
||||
}
|
||||
|
||||
echo json_encode(
|
||||
array(
|
||||
'lastId'=> $lastId,
|
||||
'list'=>$list
|
||||
)
|
||||
);
|
||||
break;
|
||||
case "save_dm":
|
||||
$tmp_client=get_db_msg("select * from web_client where id='".$uid."'");
|
||||
if($tmp_client["is_jy"]=="n"){
|
||||
$db->query("insert into web_barrage(uid,cate,value,timetemp,timeDif,color,fontSize,topPer,speed,wSize,hSize)values('".$uid."','直播','".$value."','".time()."','','','','','','','')");
|
||||
echo 'success';
|
||||
}else{
|
||||
echo 'jy';
|
||||
}
|
||||
break;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
//-------------------------------推送
|
||||
/*
|
||||
店铺和主讲和陈列师
|
||||
*/
|
||||
$uid=check_cookie_jxs();
|
||||
//$db=_mysql_connect();
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$upath=$msg_login["path"]."-".$uid;
|
||||
|
||||
$sys_enable_tb="y";
|
||||
$tmpl_m5_lie=4;
|
||||
$tmpl_m5_pic_width=188;
|
||||
$tmpl_m5_pic_height=250;
|
||||
$tmpl_m5_cl_pic_width=400;
|
||||
$tmpl_m5_cl_pic_height=300;
|
||||
|
||||
$tmpl_no_pic_width=250;
|
||||
$tmpl_no_pic_height=250;
|
||||
$pic_background=get_set("pic_background");
|
||||
$pic_background=$pic_background?$pic_background:"#ffffff";
|
||||
|
||||
$sys_close=get_set("sys_close");
|
||||
$sys_close_image=get_set("sys_close_image");
|
||||
$sys_size_num=get_max_size_num();
|
||||
|
||||
$json_data="{";
|
||||
$bs_kh_dj=get_set("bs_kh_dj");
|
||||
$json_data.="\"bs_kh_dj\":\"".$bs_kh_dj."\",";
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$json_data.="\"pic_background\":\"".$pic_background."\",";
|
||||
$json_data.="\"face\":\"".$msg_login["face"]."\",";
|
||||
if($msg_login["face"]=="2"){
|
||||
$face="qj";
|
||||
}
|
||||
switch($_a){
|
||||
case "ajax_tb":
|
||||
//----------------------------同步
|
||||
$w2=$tmpl_m5_pic_width;
|
||||
$h2=$tmpl_m5_pic_height;
|
||||
//取得默认展厅
|
||||
if($s_tid){
|
||||
$tid=$s_tid;
|
||||
}
|
||||
$json_data.="\"s_tid\":\"".$s_tid."\",";
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_tb_t limit 0,1");
|
||||
$tid=$tid?$tid:$tmp["id"];
|
||||
$json_data.="\"tid\":\"".$tid."\",";
|
||||
//
|
||||
$m=get_db_msg("select zsh,title,pic from ".$table_pre."kh_tb where tid='".$tid."' and is_show='y' group by zsh order by zsh desc limit 0,1");
|
||||
if($m["zsh"]>0){
|
||||
$str=$m["zsh"]."||";
|
||||
$str.=$m["title"]."||";
|
||||
$json_data.="\"zsh\":\"".$m["zsh"]."\",";
|
||||
$json_data.="\"title\":\"".$m["title"]."\",";
|
||||
|
||||
|
||||
//图片
|
||||
$pic1="";
|
||||
if(trim($m["pic"])){
|
||||
$pic1=get_picture($m["pic"],$flag_pad_offline);
|
||||
//$str.=$pic1."|".str_replace("\"","'",out_good_pic_set($pic1,$tmpl_m5_cl_pic_width,$tmpl_m5_cl_pic_height));
|
||||
$tmpwh=out_good_pic_set_arr($pic1,$tmpl_m5_cl_pic_width,$tmpl_m5_cl_pic_height);
|
||||
$json_data.="\"pic\":\"".$pic1."\",";
|
||||
$json_data.="\"pic_w\":\"".$tmpwh[0]."\",";
|
||||
$json_data.="\"pic_h\":\"".$tmpwh[1]."\",";
|
||||
}else{
|
||||
$pic1="images/no_pic_big.png";
|
||||
$json_data.="\"pic\":\"".$pic1."\",";
|
||||
$json_data.="\"pic_w\":\"".$tmpl_no_pic_width."\",";
|
||||
$json_data.="\"pic_h\":\"".$tmpl_no_pic_height."\",";
|
||||
}
|
||||
|
||||
$str.="||";
|
||||
$query="select title,iid,color from ".$table_pre."kh_tb where tid='".$tid."' and zsh='".$m["zsh"]."' order by ord";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
$str.="var arr_content=[";
|
||||
$str_arr_content="";
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$msg["iid"]."'");
|
||||
if($m_kh["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$m_kh["kh_dj"]);
|
||||
}
|
||||
if($msg["iid"]>0){
|
||||
//图片获取规则
|
||||
if($msg["color"]){
|
||||
$pic=get_kh_color_picture($m_kh["no"],$msg["color"],$flag_pad_offline);
|
||||
if($face=="qj"){
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$m_kh["id"]."' and color='".$msg["color"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],""));
|
||||
$n1=deel_num($tmp["num"]);
|
||||
}else{
|
||||
$n1=deel_num(get_order_num_kh_color($m_kh["id"],$msg["color"]));
|
||||
}
|
||||
}else{
|
||||
$pic=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"],$flag_pad_offline);
|
||||
if($face=="qj"){
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' and iid='".$m_kh["id"]."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],""));
|
||||
$n1=deel_num($tmp["num"]);
|
||||
}else{
|
||||
$n1=deel_num(get_order_num_kh($m_kh["id"]));
|
||||
}
|
||||
}
|
||||
//取得评价信息
|
||||
$tmp=get_db_msg("select id,race,remark from ".$table_pre."client_pj where khid='".$m_kh["id"]."' and cid='".$uid."'");
|
||||
$pj_race=$tmp["race"]>0?$tmp["race"]:0;
|
||||
$pj_id=$tmp["id"]>0?$tmp["id"]:0;
|
||||
$msg_pj=$pj_id."|".$pj_race."|".deel_js_var($tmp["remark"]);
|
||||
//取得滑动展示信息
|
||||
$text_main="";
|
||||
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
if($m["no"]=="zd1" || $m["no"]=="zd2" || $m["no"]=="zd3"){
|
||||
//$text_main.=$m_kh[$m["no"]].",";
|
||||
$text_main.=",\"".$m["no"]."\":\"".$m_kh[$m["no"]]."\"";
|
||||
}else{
|
||||
//$text_main.=deel_js_var(get_cate_title_no($m["no"],$m_kh[$m["no"]])).",";
|
||||
$text_main.=",\"".$m["no"]."\":\"".deel_js_var(get_cate_title_no($m["no"],$m_kh[$m["no"]]))."\"";
|
||||
}
|
||||
}
|
||||
//if($text_main)
|
||||
//$text_main=substr($text_main,0,-2);
|
||||
if($m_kh["remark"]!="")
|
||||
$text_main.=",\"remark\":\"".deel_js_var(dhtmlchars($m_kh["remark"]))."\"";
|
||||
//$str.=$m_kh["id"].",\"".get_kh_xh($m_kh,$msg["color"])."\",\"".$m_kh["no"]."|".$msg["color"]."\",".deel_num($m_kh["price"]).",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",\"".$msg_pj."\",\"".$text_main."\",";
|
||||
$clt="";
|
||||
if($msg["color"]){
|
||||
$clt=get_cate_title_no("color",$msg["color"]);
|
||||
}
|
||||
$tmpwh=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_arr_content.="{\"khid\":\"".$m_kh["id"]."\",\"kh_dj\":\"".get_cate_title_no("kh_dj",$m_kh["kh_dj"])."\",\"xh\":\"".get_kh_xh($m_kh,$msg["color"])."\",\"kh\":\"".$m_kh["no"]."\",\"color\":\"".$msg["color"]."\",\"colort\":\"".$clt."\",\"price\":\"".deel_num($m_kh["price"])."\",\"pic\":\"".$pic."\",\"pic_w\":\"".$tmpwh[0]."\",\"pic_h\":\"".$tmpwh[1]."\",\"num\":\"".$n1."\",\"style_color\":\"".$c."\",\"xj\":\"".$pj_race."\",\"pjwz\":\"".deel_js_var($tmp["remark"])."\"".$text_main."},";
|
||||
}
|
||||
}
|
||||
$str_arr_content=substr($str_arr_content,0,-1);
|
||||
$json_data.="\"tss\":[".$str_arr_content."],";
|
||||
$str.="]";
|
||||
}else{
|
||||
$str="0||";
|
||||
$json_data.="\"code\":0,\"msg\":\"暂无数据\",";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if($sys_enable_tb=="y"){
|
||||
|
||||
//取得默认展厅
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_tb_t limit 0,1");
|
||||
$s_tid=$s_tid?$s_tid:$tmp["id"];
|
||||
$json_data.="\"s_tid\":\"".$s_tid."\",";
|
||||
//取得展厅信息
|
||||
$arr_select_zt="";
|
||||
|
||||
$q="select * from ".$table_pre."kh_tb_t";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
//$arr_select_zt.="\"".$m["id"]."|".$m["title"]."\",";
|
||||
$arr_select_zt.="{\"id\":\"".$m["id"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
$arr_select_zt=substr($arr_select_zt,0,-1);
|
||||
$json_data.="\"zt\":[".$arr_select_zt."],";
|
||||
}else{
|
||||
$json_data.="\"code\":0,\"msg\":\"对不起,目前只有IPAD支持该功能!\",";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,493 @@
|
||||
<?php
|
||||
//-------------------------------推送
|
||||
/*
|
||||
店铺和主讲和陈列师
|
||||
*/
|
||||
$uid=check_cookie_jxs();
|
||||
//$db=_mysql_connect();
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$upath=$msg_login["path"]."-".$uid;
|
||||
|
||||
$sys_enable_tb="y";
|
||||
$tmpl_m5_lie=4;
|
||||
$tmpl_m5_pic_width=188;
|
||||
$tmpl_m5_pic_height=250;
|
||||
$tmpl_m5_cl_pic_width=400;
|
||||
$tmpl_m5_cl_pic_height=300;
|
||||
|
||||
$sys_close=get_set("sys_close");
|
||||
$sys_close_image=get_set("sys_close_image");
|
||||
$sys_size_num=get_max_size_num();
|
||||
$order_session=get_set("order_session");
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
switch($_a){
|
||||
case "set_show":
|
||||
//-------------------------------推送到当前展示号的下一个展示号
|
||||
//echo $no;
|
||||
$json_data.="\"no\":\"".$no."\",";
|
||||
$arr_khno=explode(",",$no);//接收到的款号参数
|
||||
$tid=$tid>0?$tid:0;//$tid来自于浏览器URL$tid
|
||||
//取得当前展示号
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' and is_show='y' order by zsh");
|
||||
if($tmp["zsh"]>0){
|
||||
$dq_zsh=$tmp['zsh'];
|
||||
//大于当前展示号的顺延
|
||||
$db->query("update ".$table_pre."kh_tb set zsh=zsh+1 where zsh>'".$dq_zsh."' and tid='".$tid."'");
|
||||
}else{
|
||||
$tmp=get_db_msg("select MAX(zsh) 'zsh' from ".$table_pre."kh_tb where tid='".$tid."'");
|
||||
$dq_zsh=$tmp['zsh']?$tmp['zsh']:0;
|
||||
}
|
||||
//
|
||||
$ord=1;
|
||||
if($s_zsh){
|
||||
$tmp_dph=get_db_msg("select * from web_kh_dp where zsh='".$s_zsh."' limit 0,1");
|
||||
$s_dir=$order_session?$order_session."/":"";
|
||||
$pic="dp/".$s_dir."big/".$tmp_dph["pic"].".jpg";
|
||||
|
||||
$sql="insert into ".$table_pre."kh_tb (tid,zsh,pic,iid,color,ord,is_show) values ";
|
||||
foreach($arr_khno as $khno){
|
||||
$arr_tmp=explode("|",$khno);
|
||||
$sql.="(".$tid.",".($dq_zsh+1).",'".$pic."',".$arr_tmp[0].",'".$arr_tmp[1]."',".$ord++.",'y'),";
|
||||
}
|
||||
}else{
|
||||
$sql="insert into ".$table_pre."kh_tb (tid,zsh,iid,color,ord,is_show) values ";
|
||||
foreach($arr_khno as $khno){
|
||||
$arr_tmp=explode("|",$khno);
|
||||
$sql.="(".$tid.",".($dq_zsh+1).",".$arr_tmp[0].",'".$arr_tmp[1]."',".$ord++.",'y'),";
|
||||
}
|
||||
}
|
||||
$sql=substr($sql,0,-1).";";
|
||||
$json_data.="\"q\":\"".$sql."\",";
|
||||
$db->query($sql);
|
||||
if($tid>0){
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='n' where zsh<>'".($dq_zsh+1)."' and tid='".$tid."'");
|
||||
}else{
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='n' where zsh<>'".($dq_zsh+1)."'");
|
||||
}
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
break;
|
||||
case "tb_search":
|
||||
$w2=$tmpl_m5_pic_width;
|
||||
$h2=$tmpl_m5_pic_height;
|
||||
$arr_ksh=explode(",",$wanted_kh);
|
||||
//默认展厅后新添加自定义推送的单款
|
||||
$sql="select * from ".$table_pre."kh where no='".$arr_ksh[0]."'";
|
||||
$str="";
|
||||
$str_dk="";
|
||||
$msg=get_db_msg($sql);
|
||||
if($msg['id']>0){
|
||||
if($msg["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$msg["kh_dj"]);
|
||||
}
|
||||
//取得搜索结果的款号图片
|
||||
if($arr_ksh[1]){
|
||||
$pic=get_kh_color_picture($msg["no"],$arr_ksh[1]);
|
||||
}else{
|
||||
$pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline);
|
||||
}
|
||||
//单款信息拼接
|
||||
$str.=$msg["id"].",".get_kh_xh($msg).",".$msg["no"].",".$arr_ksh[1].",".$msg["price"].",".$pic.",".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2));
|
||||
$tmpwh=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_dk.="{\"khid\":\"".$msg["id"]."\",\"xh\":\"".get_kh_xh($msg)."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$arr_ksh[1]."\",\"colort\":\"".get_cate_title_no("color",$arr_ksh[1])."\",\"price\":\"".$msg["price"]."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($tmpwh[0]).",\"pic_h\":".deel_num($tmpwh[1])."},";
|
||||
}
|
||||
$str_dk=substr($str_dk,0,-1);
|
||||
$json_data.="\"arr_dk\":[".$str_dk."],";
|
||||
//------------------------------
|
||||
break;
|
||||
case "tb_search_dp":
|
||||
$w2=$tmpl_m5_pic_width;
|
||||
$h2=$tmpl_m5_pic_height;
|
||||
if($s_zsh){
|
||||
$dph=$s_zsh;
|
||||
}
|
||||
$arr_ksh=explode(",",$wanted_kh);
|
||||
//默认展厅后新添加自定义推送的单款
|
||||
$query="select * from ".$table_pre."kh_dp where zsh='".$dph."'";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$str="";
|
||||
$str_dp="";
|
||||
$dp_pic="";
|
||||
while($msg1=$db->fetch_array($res)){
|
||||
$dp_pic=$msg1["pic"];
|
||||
$msg=get_db_msg("select * from ".$table_pre."kh where no='".$msg1["kh"]."' ");
|
||||
if($msg["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$msg["kh_dj"]);
|
||||
}
|
||||
//取得搜索结果的款号图片
|
||||
$pic=get_kh_color_picture($msg["no"],$msg1["color"]);
|
||||
//单款信息拼接
|
||||
//$str.=$msg["id"].",".get_kh_xh($msg).",".$msg["no"].",".$arr_ksh[1].",".$msg["price"].",".$pic.",".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2));
|
||||
$tmpwh=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_dp.="{\"khid\":\"".$msg["id"]."\",\"xh\":\"".get_kh_xh($msg)."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$msg1["color"]."\",\"colort\":\"".get_cate_title_no("color",$msg1["color"])."\",\"price\":\"".$msg["price"]."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($tmpwh[0]).",\"pic_h\":".deel_num($tmpwh[1])."},";
|
||||
}
|
||||
$str_dp=substr($str_dp,0,-1);
|
||||
$json_data.="\"arr_dk\":[".$str_dp."],";
|
||||
//------------------------------
|
||||
break;
|
||||
case "tb_pre":
|
||||
//设置上一组同步
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' and is_show='y' group by zsh order by zsh desc limit 0,1");
|
||||
if($tmp["zsh"]>0){
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' and zsh<'".$tmp["zsh"]."' group by zsh order by zsh desc limit 0,1");
|
||||
}else{
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' group by zsh order by zsh limit 0,1");
|
||||
}
|
||||
if($tmp1["zsh"]){
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='y' where tid='".$tid."' and zsh='".$tmp1["zsh"]."'");
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='n' where tid='".$tid."' and zsh<>'".$tmp1["zsh"]."' and is_show='y'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="n";
|
||||
$json_data.="\"code\":0,";
|
||||
}
|
||||
break;
|
||||
case "tb_next":
|
||||
//设置下一组同步
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' and is_show='y' group by zsh order by zsh desc limit 0,1");
|
||||
if($tmp["zsh"]>0){
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' and zsh>'".$tmp["zsh"]."' group by zsh order by zsh limit 0,1");
|
||||
}else{
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_tb where tid='".$tid."' group by zsh order by zsh limit 0,1");
|
||||
}
|
||||
if($tmp1["zsh"]){
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='y' where tid='".$tid."' and zsh='".$tmp1["zsh"]."'");
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='n' where tid='".$tid."' and zsh<>'".$tmp1["zsh"]."' and is_show='y'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="n";
|
||||
$json_data.="\"code\":0,";
|
||||
}
|
||||
break;
|
||||
case "tb_zsh":
|
||||
//设置特定展示号同步
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_tb where tid='".$tid."' and zsh='".$zsh."' limit 0,1");
|
||||
if($tmp["id"]>0){
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='y' where tid='".$tid."' and zsh='".$zsh."'");
|
||||
$db->query("update ".$table_pre."kh_tb set is_show='n' where tid='".$tid."' and zsh<>'".$zsh."' and is_show='y'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="n";
|
||||
$json_data.="\"code\":0,";
|
||||
}
|
||||
break;
|
||||
case "del_zsh":
|
||||
//删除特定展示组
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_tb where tid='".$tid."' and zsh='".$zsh."' limit 0,1");
|
||||
if($tmp["id"]>0){
|
||||
$db->query("delete from ".$table_pre."kh_tb where tid='".$tid."' and zsh='".$zsh."'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="不存在";
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"msg\":\"不存在\",";
|
||||
}
|
||||
break;
|
||||
case "kh_color" :
|
||||
//
|
||||
$sql_con="";
|
||||
if($q){
|
||||
$sql_con.=" and no like '%".$q."%'";
|
||||
}
|
||||
//$json_data.="\"q\":\"".$q."\",";
|
||||
$query="select * from ".$table_pre."kh where id>0 ".$sql_con." order by no";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$data=array();
|
||||
$str_tmp="";
|
||||
$i=0;
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$color=explode(",",$msg["color"]);
|
||||
$colork=explode(",",$msg["color_ka"]);
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg)."\"},";
|
||||
foreach($color as $k => $v){
|
||||
if(!in_array($v,$colork)){
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg,$v)."\",\"color\":\"".$v."\",\"colort\":\"".get_cate_title_no("color",$v)."\"},";
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($str_tmp)."],";
|
||||
break;
|
||||
case "kh_color1" :
|
||||
//
|
||||
$sql_con="";
|
||||
if($q){
|
||||
$sql_con.=" and xh='".$q."'";
|
||||
}
|
||||
//$json_data.="\"q\":\"".$q."\",";
|
||||
$query="select * from ".$table_pre."kh where id>0 ".$sql_con." order by no";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$data=array();
|
||||
$str_tmp="";
|
||||
$i=0;
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$color=explode(",",$msg["color"]);
|
||||
$colork=explode(",",$msg["color_ka"]);
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg)."\"},";
|
||||
foreach($color as $k => $v){
|
||||
if(!in_array($v,$colork)){
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg,$v)."\",\"color\":\"".$v."\",\"colort\":\"".get_cate_title_no("color",$v)."\"},";
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($str_tmp)."],";
|
||||
break;
|
||||
case "get_dph" :
|
||||
//
|
||||
$sql_con="";
|
||||
if($q){
|
||||
$sql_con.=" and zsh like '%".$q."%'";
|
||||
}
|
||||
$query="select DISTINCT zsh,title from ".$table_pre."kh_dp where id>0 ".$sql_con." order by zsh";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$data=array();
|
||||
$str_tmp="";
|
||||
$i=0;
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$str_tmp.="{\"zsh\":\"".$msg["zsh"]."\",\"title\":\"".$msg["title"]."\"},";
|
||||
$i++;
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($str_tmp)."],";
|
||||
break;
|
||||
case "pj":
|
||||
$q1="select * from ".$table_pre."client_pj where khid='".$khid."'";
|
||||
$r1=$db->query($q1);
|
||||
$ct1=1;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$client=get_db_msg("select * from web_client where id='".$m1["cid"]."'");
|
||||
$tbyd.="<tr>";
|
||||
$tbyd.="<td>".$ct1."</td>";
|
||||
$tbyd.="<td>".$client["title"]."</td>";
|
||||
$tbyd.="<td>".$m1["race"]."星</td>";
|
||||
$tbyd.="<td>".$m1["remark"]."</td>";
|
||||
$tbyd.="</tr>";
|
||||
$ct1++;
|
||||
}
|
||||
$tbyd="<table width='100%' class='layui-table'><thead><tr><td>序号</td><td>客户</td><td>评价星级</td><td>评价内容</td></tr></thead><tbody>".$tbyd."</tbody></table>";
|
||||
$json_data.="\"tbyd\":\"".$tbyd."\",";
|
||||
break;
|
||||
default:
|
||||
//----------------------------同步
|
||||
$w2=$tmpl_m5_pic_width;
|
||||
$h2=$tmpl_m5_pic_height;
|
||||
if($s_tid){
|
||||
$tid=$s_tid;
|
||||
}
|
||||
//取得默认展厅
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_tb_t limit 0,1");
|
||||
$tid=$tid?$tid:$tmp["id"];
|
||||
if($tid){
|
||||
$tid_con="and tid='".$tid."'";
|
||||
}else{
|
||||
$tid_con='';
|
||||
}
|
||||
$json_data.="\"tid\":\"".$tid."\",";
|
||||
$q1="select * from ".$table_pre."kh_tb_t ";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tid="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tid.="{\"no\":\"".$m1["id"]."\",\"value\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
$arr_tid=deel_end($arr_tid);
|
||||
$json_data.="\"zt\":[".$arr_tid."],";
|
||||
//
|
||||
//$m=get_db_msg("select zsh,pic from ".$table_pre."kh_tb where tid='".$tid."' and is_show='y' group by zsh order by zsh desc limit 0,1");
|
||||
$m=get_db_msg("select zsh,pic from ".$table_pre."kh_tb where is_show='y' ".$tid_con." group by zsh order by zsh desc limit 0,1");
|
||||
//$json_data.="\"q\":\"select zsh,pic from ".$table_pre."kh_tb where is_show='y' ".$tid_con." group by zsh order by zsh desc limit 0,1\",";
|
||||
if($m["zsh"]>0){
|
||||
//$str=$m["zsh"]."||";
|
||||
$json_data.="\"zsh\":\"".$m["zsh"]."\",";
|
||||
//图片
|
||||
$pic1="";
|
||||
if(trim($m["pic"])){
|
||||
$pic1=get_picture($m["pic"],$flag_pad_offline);
|
||||
if(!$pic1){
|
||||
$pic1="images/no_pic.png";
|
||||
}
|
||||
//$str.=$pic1."|".str_replace("\"","'",out_good_pic_set($pic1,$tmpl_m5_cl_pic_width,$tmpl_m5_cl_pic_height));
|
||||
$tmpwh=out_good_pic_set_arr($pic1,$tmpl_m5_cl_pic_width,$tmpl_m5_cl_pic_height);
|
||||
$json_data.="\"pic\":\"".$pic1."\",";
|
||||
$json_data.="\"pic_w\":".deel_num($tmpwh[0]).",";
|
||||
$json_data.="\"pic_h\":".deel_num($tmpwh[1]).",";
|
||||
}
|
||||
//$str.="||";
|
||||
//$query="select iid from ".$table_pre."kh_tb where tid='".$tid."' and zsh='".$m["zsh"]."' order by ord";
|
||||
$query="select iid,color from ".$table_pre."kh_tb where zsh='".$m["zsh"]."' ".$tid_con." order by ord";
|
||||
$res=$db->query($query);
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
//$str.="var arr_content=[";
|
||||
$str_arr_content="";
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$msg["iid"]."'");
|
||||
if($m_kh["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$m_kh["kh_dj"]);
|
||||
}
|
||||
if($msg["iid"]>0){
|
||||
//图片获取规则
|
||||
if($msg["color"]){
|
||||
$pic=get_kh_color_picture($m_kh["no"],$msg["color"]);
|
||||
$con_color_tmp=" and color='".$msg["color"]."'";
|
||||
$color_str=",".$msg["color"];
|
||||
}else{
|
||||
$pic=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"],$flag_pad_offline);
|
||||
$con_color_tmp="";
|
||||
$color_str="";
|
||||
}
|
||||
$n1=0;
|
||||
//----取得评价
|
||||
$tmp=get_db_msg("select sum(race) 'num' from ".$table_pre."client_pj where khid='".$msg["iid"]."' ");
|
||||
$pj_num=add_0($tmp["num"]);
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client_pj where khid='".$msg["iid"]."' ");
|
||||
$pj_clients=add_0($tmp["num"]);
|
||||
//----取得订单
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where iid='".$msg["iid"]."' and _key='".$_key."'".$con_color_tmp);
|
||||
$order_num=add_0($tmp["num"]);
|
||||
$tmp=get_db_msg("select count(distinct uid) 'num' from ".$table_pre."order where iid='".$msg["iid"]."' and _key='".$_key."'".$con_color_tmp);
|
||||
$order_clients=add_0($tmp["num"]);
|
||||
//
|
||||
$ppf=$pj_clients>0?keep_float($pj_num/$pj_clients,1):0;
|
||||
//$str.="".$m_kh["id"].",\"".get_kh_xh($m_kh,$msg["color"])."\",\"".$m_kh["no"].$color_str."\",".deel_num($m_kh["price"]).",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",\"".$order_num."|".$order_clients."|".$ppf."|".$pj_clients."\",";
|
||||
|
||||
$tmpwh=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_arr_content.="{\"khid\":\"".$m_kh["id"]."\",\"xh\":\"".get_kh_xh($m_kh,$msg["color"])."\",\"kh\":\"".$m_kh["no"]."\",\"color\":\"".$msg["color"]."\",\"colort\":\"".get_cate_title_no("color",$msg["color"])."\",\"price\":\"".deel_num($m_kh["price"])."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($tmpwh[0]).",\"pic_h\":".deel_num($tmpwh[1]).",\"num\":".$n1.",\"style_color\":\"".$c."\",\"order_num\":".$order_num.",\"order_clients\":\"".$order_clients."\",\"ppf\":\"".$ppf."\",\"pj_clients\":\"".$pj_clients."\"},";
|
||||
}
|
||||
}
|
||||
//$str.="]||";
|
||||
$str_arr_content=substr($str_arr_content,0,-1);
|
||||
$json_data.="\"tsz\":[".$str_arr_content."],";
|
||||
}else{
|
||||
//$str="0||pic||kh||";
|
||||
$json_data.="\"msg\":\"暂无数据\",";
|
||||
}
|
||||
//--------------------------候选
|
||||
$this_zsh=$m["zsh"]>0?$m["zsh"]:0;
|
||||
$arr_zsh1=array();
|
||||
$q1="select zsh from ".$table_pre."kh_tb where tid='".$tid."' and zsh<".$this_zsh." group by zsh order by zsh desc limit 0,2";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zsh1[]=$m1["zsh"];
|
||||
}
|
||||
$arr_zsh2=array();
|
||||
$q1="select zsh from ".$table_pre."kh_tb where tid='".$tid."' and zsh>".$this_zsh." group by zsh order by zsh limit 0,2";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zsh2[]=$m1["zsh"];
|
||||
}
|
||||
if(count($arr_zsh1)<2 && count($arr_zsh2)<2){
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$tid."' group by zsh order by zsh";
|
||||
}else if(count($arr_zsh1)<2){
|
||||
if($arr_zsh1[0]>0)
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$tid."' and zsh>='".$arr_zsh1[0]."' group by zsh order by zsh limit 0,5";
|
||||
else
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$tid."' group by zsh order by zsh limit 0,5";
|
||||
}else if(count($arr_zsh2)<2){
|
||||
if($arr_zsh2[0]>0)
|
||||
$q1="select count(distinct zsh) 'num' from ".$table_pre."kh_tb where tid='".$tid."' and zsh<='".$arr_zsh2[0]."'";
|
||||
else
|
||||
$q1="select count(distinct zsh) 'num' from ".$table_pre."kh_tb where tid='".$tid."'";
|
||||
$m1=get_db_msg($q1);
|
||||
$limit_s=($m1["num"]-5)>0?($m1["num"]-5):0;
|
||||
if($arr_zsh2[0]>0)
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$tid."' and zsh<='".$arr_zsh2[0]."' group by zsh order by zsh limit ".$limit_s.",5";
|
||||
else
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$tid."' group by zsh order by zsh limit ".$limit_s.",5";
|
||||
}else{
|
||||
$query="select zsh,pic,title from ".$table_pre."kh_tb where tid='".$tid."' and zsh>='".$arr_zsh1[1]."' group by zsh order by zsh limit 0,5";
|
||||
}
|
||||
//echo $query."--<br>";
|
||||
$re=$db->query($query);
|
||||
//$str.="arr_content_yl=[";
|
||||
$arr_content_yl="";
|
||||
while($rows=$db->fetch_array($re)){
|
||||
$arr_tmp=array();
|
||||
$tmp=get_db_msg("select count(distinct iid,color) 'num' from ".$table_pre."kh_tb where zsh=".$rows['zsh']." and tid='".$tid."'");
|
||||
$r=$db->query("select * from ".$table_pre."kh_tb where zsh=".$rows['zsh']." and tid='".$tid."'");
|
||||
$i=0;
|
||||
while($m1=$db->fetch_array($r)){
|
||||
$arr_tmp[$i]['titile']=$m1['titile'];
|
||||
$arr_tmp[$i]['pic']=$m1['pic'];
|
||||
$arr_tmp[$i]['iid']=$m1['iid'];
|
||||
$arr_tmp[$i]['color']=$m1['color'];
|
||||
$i++;
|
||||
}
|
||||
$pic="";
|
||||
$pic_w=$pic_h=0;
|
||||
$tmp2=get_db_msg("select * from ".$table_pre."kh where id='".$arr_tmp[0]["iid"]."' limit 0,1");
|
||||
if($rows['pic']!=""){
|
||||
//$rows['pic']=str_replace("\"","'",out_good_pic("../attachments/".$rows['pic'],110,110));
|
||||
$pic="../attachments/".$rows['pic'];
|
||||
$ck=out_good_pic_set_arr($pic,110,110);
|
||||
$pic_w=$ck[0];
|
||||
$pic_h=$ck[1];
|
||||
}
|
||||
if($rows['pic']==""){
|
||||
//$rows['pic']="";
|
||||
$pic="images/no_pic.png";
|
||||
//$pic="";
|
||||
$pic_w=110;
|
||||
$pic_h=110;
|
||||
}
|
||||
|
||||
if($tmp['num']==1 && $rows['pic']==""){
|
||||
if($arr_tmp[0]["color"]){
|
||||
//$rows['pic']=str_replace("\"","'",out_good_pic(get_kh_color_picture($tmp2["no"],$arr_tmp[0]["color"]),110,110));
|
||||
$pic=get_kh_color_picture($tmp2["no"],$arr_tmp[0]["color"]);
|
||||
$ck=out_good_pic_set_arr($pic,110,110);
|
||||
$pic_w=$ck[0];
|
||||
$pic_h=$ck[1];
|
||||
}else{
|
||||
//$rows['pic']=str_replace("\"","'",out_good_pic(get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"]),110,110));
|
||||
$pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"]);
|
||||
$ck=out_good_pic_set_arr($pic,110,110);
|
||||
$pic_w=$ck[0];
|
||||
$pic_h=$ck[1];
|
||||
}
|
||||
}
|
||||
$info="<br>";
|
||||
foreach($arr_tmp as $key => $value){
|
||||
$tmp=get_db_msg("select no from ".$table_pre."kh where id=".$value["iid"]);
|
||||
$info.=$tmp['no'];
|
||||
if ($value['color']) {
|
||||
$info.=",".$value['color'];
|
||||
}else{
|
||||
$info.="";
|
||||
}
|
||||
$info.="<br>";
|
||||
}
|
||||
|
||||
//$str.="\"".$rows['zsh']."-".$rows['pic']."-".$info;
|
||||
//$str.="\",";
|
||||
$arr_content_yl.="{\"tsh\":\"".$rows['zsh']."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($pic_w).",\"pic_h\":".deel_num($pic_h).",\"info\":\"".$info."\"},";
|
||||
}
|
||||
$arr_content_yl=substr($arr_content_yl,0,-1);
|
||||
$json_data.="\"zjs\":[".$arr_content_yl."],";
|
||||
//$str=substr($str, 0, -1);
|
||||
//$str.="]";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
+1603
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,788 @@
|
||||
<?php
|
||||
//-------------------------------推演师
|
||||
/*
|
||||
店铺和区经角色
|
||||
*/
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
|
||||
$uid=check_cookie_jxs();
|
||||
//系统变量
|
||||
$sys_close=get_set("sys_close");
|
||||
$sys_close_image=get_set("sys_close_image");
|
||||
$is_session=get_set("is_session");
|
||||
$zb_type=get_set("zb_type");
|
||||
$is_spk=get_set("is_spk");
|
||||
$zbxf=get_set("zbxf");
|
||||
$zbxf_type=get_set("zbxf_type");
|
||||
$sys_ms=get_set("sys_ms");
|
||||
$is_msg=get_set("is_msg");
|
||||
$is_ewm=get_set("is_ewm");
|
||||
$is_window="y";
|
||||
$zk_type=get_set("zk_type");
|
||||
$is_hd_log=get_set("is_hd_log");
|
||||
$xh_ms=get_set("xh_ms");
|
||||
$order_session=get_set("order_session");
|
||||
$sys_size_num=get_max_size_num();
|
||||
$theme_path=get_theme_path();
|
||||
|
||||
$arr_size_merged=get_size_merged();
|
||||
$num_size_total=count($arr_size_merged);
|
||||
|
||||
|
||||
|
||||
$tmpl_m1_pic_width=188;
|
||||
$tmpl_m1_pic_height=250;
|
||||
$tmpl_m3_lie=6;
|
||||
$tmpl_m3_pic_width=90;
|
||||
$tmpl_m3_pic_height=120;
|
||||
$tmpl_m3_cl_pic_width=400;
|
||||
$tmpl_m3_cl_pic_height=300;
|
||||
|
||||
//$db=_mysql_connect();
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
if($msg_login["available"]!="y"){
|
||||
$json_data.="\"error\":\"用户已被禁用\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
|
||||
}else{
|
||||
$json_data.="\"face\":\"".$msg_login["face"]."\",";
|
||||
$json_data.="\"uid\":\"".$msg_login["id"]."\",";
|
||||
$json_data.="\"jpty\":\"".$msg_login["jpty"]."\",";
|
||||
|
||||
$json_data.="\"clxs\":\"".$clxs."\",";
|
||||
$json_data.="\"cldp\":\"".$cldp."\",";
|
||||
$json_data.="\"cl_order_top\":\"".$cl_order_top."\",";
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
$rurl=$rurl?$rurl:get_this_url();
|
||||
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
|
||||
$zb_client_show=get_set("zb_client_show");
|
||||
if($zb_client_show=="y")
|
||||
$arr_zb_type=explode(",",$zb_type);
|
||||
else
|
||||
$arr_zb_type=array();
|
||||
$is_brand=is_brand();
|
||||
$show_jd=get_set("show_jd");
|
||||
$is_dkds=get_set("is_dkds");
|
||||
$is_multi_price=get_set("is_multi_price");
|
||||
$order_close=get_set("order_close");
|
||||
$search_type=get_set("search_type");
|
||||
|
||||
|
||||
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
||||
$json_data.="\"is_dkds\":\"".$is_dkds."\",";
|
||||
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
||||
$json_data.="\"is_multi_price\":\"".$is_multi_price."\",";
|
||||
|
||||
|
||||
if($is_brand=="y")
|
||||
$link_var_brand="&s_brand=".$s_brand;
|
||||
else
|
||||
$link_var_brand="";
|
||||
$title_brand=$con_brand="";
|
||||
if($s_brand){
|
||||
$arr_s_brand=explode(",",$s_brand);
|
||||
for($i=0;$i<count($arr_s_brand);$i++){
|
||||
$con_brand.="brand='".$arr_s_brand[$i]."' or ";
|
||||
$title_brand.=get_cate_title_no("brand",$arr_s_brand[$i]).",";
|
||||
}
|
||||
if($title_brand)
|
||||
$title_brand=substr($title_brand,0,-1);
|
||||
if($con_brand)
|
||||
$con_brand=" and (".substr($con_brand,0,-3).")";
|
||||
}
|
||||
//取得选项
|
||||
$arr_select_no=array();
|
||||
$arr_select_title=array();
|
||||
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_select_no[]=$m["no"];
|
||||
$arr_select_title[]=$m["title"];
|
||||
}
|
||||
//文胸
|
||||
if($bx_sizegroup_title){
|
||||
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
|
||||
$bx_sizegroup_id=$tmp["id"];
|
||||
}else{
|
||||
$bx_sizegroup_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;
|
||||
}
|
||||
$con_spk=($is_spk=="y")?" and is_sp<>'y'":"";
|
||||
$flag_spk=($is_spk=="y")?"1":"";
|
||||
//------------------------------------包含定制模块,店铺界面,顶部已订数和完成率的显示
|
||||
//include_once $path_dz."/dp/wcl.php";
|
||||
//
|
||||
//--------------交单按钮
|
||||
|
||||
|
||||
switch($_a){
|
||||
case "get_data":
|
||||
$arr_dpph=array();
|
||||
$dhkh="";
|
||||
$dlkhjs="";
|
||||
$query="select * from ".$table_pre."kh_ty where zsh='".$s_zsh."' order by ord";
|
||||
$res=$db->query($query);
|
||||
while($msg1=$db->fetch_array($res)){
|
||||
$q1="select * from ".$table_pre."kh_dp where title='".$msg1["kh"]."' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
$dpjs=0;
|
||||
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
|
||||
$tmp_kh_order1=get_db_msg("select sum(num) num from ".$table_pre."order where ka<>'y' and no='".$m1["kh"]."' and _key='".$_key."'");
|
||||
$dpjs+=$tmp_kh_order1["num"];
|
||||
if($msg1["kh"]==$dph){
|
||||
$kh=get_db_msg("select * from web_kh where no='".$m1["kh"]."'");
|
||||
$dhkh.="'".$m1["kh"]."',";
|
||||
$dlkhjs.=get_cate_title_no("category",$kh["category"])."-".$m1["kh"]."-".$tmp_kh_order1["num"]."|";
|
||||
}
|
||||
}
|
||||
|
||||
$arr_dpph[$msg1["kh"]]=$dpjs;
|
||||
}
|
||||
$dhkh=deel_end($dhkh);
|
||||
$dlkhjs=deel_end($dlkhjs);
|
||||
$tmpc=get_db_msg("select count(DISTINCT uid) dps,sum(num) num from web_order where no in (".$dhkh.") and ka<>'y'");
|
||||
arsort($arr_dpph);
|
||||
$ct=1;
|
||||
$dpph=0;
|
||||
foreach($arr_dpph as $k => $v){
|
||||
if($k==$dph){
|
||||
$dpph=$ct;
|
||||
}
|
||||
$ct++;
|
||||
}
|
||||
$json_data.="\"dph\":\"".$dph."\",";
|
||||
$json_data.="\"tph\":\"".$dpph."\",";
|
||||
$json_data.="\"khs\":\"".$tmpc["dps"]."\",";
|
||||
$json_data.="\"js\":\"".$tmpc["num"]."\",";
|
||||
$json_data.="\"dlkhjs\":\"".$dlkhjs."\",";
|
||||
break;
|
||||
case "single":
|
||||
$w2=$tmpl_m3_pic_width;
|
||||
$h2=$tmpl_m3_pic_height;
|
||||
$cl_lie=$tmpl_m3_lie;
|
||||
$s_con=$s_con?$s_con:$s_con_default;
|
||||
$rurl=$rurl?$rurl:get_this_url();
|
||||
$json_data.="\"w2\":\"".$w2."\",";
|
||||
$json_data.="\"h2\":\"".$h2."\",";
|
||||
$json_data.="\"cl_lie\":\"".$cl_lie."\",";
|
||||
//$json_data.="\"rurl\":\"".$rurl."\",";
|
||||
if($zsh){
|
||||
$s_zsh=$zsh;
|
||||
}
|
||||
$msg_err="";
|
||||
$kl=strlen($s_title);
|
||||
if($kl<=3 && $s_title && is_numeric($s_title)){
|
||||
$sql_con="where xh='".$s_title."'";
|
||||
}
|
||||
if($kl>=3){
|
||||
if(is_numeric($s_title)){
|
||||
$sql_con="where xh='".$s_title."' or no like '%".$s_title."%'";
|
||||
}else{
|
||||
$sql_con="where no like '%".$s_title."%'";
|
||||
}
|
||||
}
|
||||
if($s_title){
|
||||
$msg=get_db_msg("select * from ".$table_pre."kh ".$sql_con);
|
||||
$m1=get_db_msg("select count(*) 'num' from ".$table_pre."kh ".$sql_con);
|
||||
$json_data.="\"khid\":\"".$msg["id"]."\",";
|
||||
$json_data.="\"s_title\":\"".$s_title."\",";
|
||||
$id=$msg["id"];
|
||||
$str_title="";
|
||||
if($m1["num"]>1){
|
||||
$q2="select * from ".$table_pre."kh ".$sql_con;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$str_title.="{\"khid\":\"".$m2["id"]."\",\"title\":\"".$m2["xh"]."#".$m2["no"]."\"},";
|
||||
}
|
||||
if($msg_err){
|
||||
$str_title=deel_end($str_title);
|
||||
$msg_err="存在以下符合条件的多个款:".$msg_err;
|
||||
}
|
||||
}
|
||||
//
|
||||
if(!$id){
|
||||
$msg_err="记录不存在";
|
||||
}
|
||||
}
|
||||
if($msg_err){
|
||||
if($str_title){
|
||||
$json_data.="\"code\":101,";
|
||||
$json_data.="\"msg\":[".$str_title."],";
|
||||
}else{
|
||||
$json_data.="\"code\":102,";
|
||||
$json_data.="\"msg\":\"".$msg_err."\",";
|
||||
}
|
||||
}else{
|
||||
$json_data.="\"code\":100,";
|
||||
$tmp=get_db_msg("select min(zsh) 'zsh' from ".$table_pre."kh_ty");
|
||||
$default_zsh=$tmp["zsh"];
|
||||
$s_zsh=$s_zsh?$s_zsh:$default_zsh;
|
||||
$msg_cl=get_db_msg("select * from ".$table_pre."kh_ty where zsh='".$s_zsh."'");
|
||||
if($s_zsh){
|
||||
$sql_con.=" where zsh='".$s_zsh."' and ";
|
||||
$s_no="";
|
||||
}
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
//取得总设计款数
|
||||
/*$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'y'");
|
||||
$total_ks=$tmp["num"];
|
||||
//取得已订总款数
|
||||
if($msg_login["face"]=="4"){
|
||||
$tmp=get_db_msg("select count(distinct(iid)) 'num' from ".$table_pre."order where uid='".$uid."' and _key='".$_key."'");
|
||||
}
|
||||
if($msg_login["face"]=="2"){
|
||||
$tmp=get_db_msg("select count(distinct(iid)) 'num' from ".$table_pre."order where ka<>'y' and _key='".$_key."' ".get_qj_ucon_all_dpid($msg_login["charge_uid"],""));
|
||||
}
|
||||
$total_yd_ks=$tmp["num"];*/
|
||||
|
||||
|
||||
$json_data.="\"zsh\":\"".$s_zsh."\",";
|
||||
|
||||
//定制条件
|
||||
$query="select * from ".$table_pre."kh_ty where zsh='".$s_zsh."' order by ord";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
$pic_background=get_set("pic_background");
|
||||
$pic_background=$pic_background?$pic_background:"#ffffff";
|
||||
$content_set="[\"".$pic_background."\"]";
|
||||
|
||||
$json_data.="\"content_set\":\"".$pic_background."\",";
|
||||
$json_data.="\"style_title_color\":\"".$style_title_color."\",";
|
||||
$json_data.="\"ka_color\":\"".$ka_color."\",";
|
||||
$count=0;
|
||||
$rnum=0;
|
||||
$zks=$ydjs=$ydks=0;
|
||||
//$content_list="[";
|
||||
$num_arr="";
|
||||
|
||||
$num_arr1="";
|
||||
$num_arr2="";
|
||||
$ydcl="";
|
||||
|
||||
$yddp1="";
|
||||
|
||||
$all_w=0;
|
||||
$arr_dk=$bzks=$bzkss=$ydks=$ydkss=array();
|
||||
$tmp_strjs=" and no in (";
|
||||
$arr_dp="";
|
||||
while($msg1=$db->fetch_array($res)){
|
||||
$num_arr_s="";
|
||||
$clp=$msg1["pic"];
|
||||
//echo $msg1["kh"]."-";
|
||||
$q1="select * from ".$table_pre."kh_dp where title='".$msg1["kh"]."' order by ord";
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
//$yddp=substr($yddp,0,-1);
|
||||
$yddp1.=$msg1["kh"]."|";
|
||||
$num_arr.="\"".$msg1["kh"]."\":[";
|
||||
$num_arr1.="\"".$msg1["kh"]."\",";
|
||||
$num_arr2.="\"".$msg1["zd1"]."\",";
|
||||
|
||||
$dp_pic=$dp_zsh="";
|
||||
$yddp="";
|
||||
$dhqk="";
|
||||
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
|
||||
|
||||
$msg=get_db_msg("select * from ".$table_pre."kh where no='".$m1["kh"]."'");
|
||||
$bzks[$m1["kh"]]=$m1["kh"];
|
||||
$tmp_strjs.="'".$m1["kh"]."',";
|
||||
$tmp_kh_order1=get_db_msg("select sum(num) num from ".$table_pre."order where ka<>'y' and no='".$m1["kh"]."' and uid='".$uid."' and _key='".$_key."'");
|
||||
if($tmp_kh_order1["num"]){
|
||||
$ydks[$m1["kh"]]=$m1["kh"];
|
||||
}
|
||||
$dp_pic=$m1["pic"];
|
||||
$dp_zsh=$m1["zsh"];
|
||||
|
||||
//echo $dp_pic;
|
||||
$arr_color=explode(",",$msg["color"]);
|
||||
foreach($arr_color as $na => $t1){
|
||||
$dkcs=$m1["kh"]."_".$t1;
|
||||
$bzkss[$dkcs]=$dkcs;
|
||||
|
||||
|
||||
|
||||
$tmp_kh_order=get_db_msg("select num from ".$table_pre."order where ka<>'y' and no='".$m1["kh"]."' and color='".$t1."' and uid='".$uid."' and _key='".$_key."'");
|
||||
|
||||
if($tmp_kh_order["num"]){
|
||||
$ydkss[$dkcs]=$dkcs;
|
||||
$tmp_ps1="../attachments/ty/big/".$msg1["zsh"]."_".$m1["kh"]."_".$t1.".png";
|
||||
//echo $tmp_ps1;
|
||||
if(is_file($tmp_ps1)){
|
||||
//$ydcl.=$msg1["zsh"]."_".$m1["kh"]."_".$t1.",";
|
||||
$tmpwh=out_good_pic_set_arr($tmp_ps1,$tmpl_m3_cl_pic_width,$tmpl_m3_cl_pic_height);
|
||||
$ydcl.="{\"pic\":\"".$tmp_ps1."\",\"pic_w\":\"".deel_num($tmpwh[0])."\",\"pic_h\":\"".deel_num($tmpwh[1])."\"},";
|
||||
}else{
|
||||
//$ydcl.="nopic,";
|
||||
}
|
||||
$tmp_ps="../attachments/yddp/".$msg1["kh"]."_".$m1["kh"]."_".$t1.".png";
|
||||
if(is_file($tmp_ps)){
|
||||
//$yddp.=$msg1["kh"]."_".$m1["kh"]."_".$t1.",";
|
||||
$tmpwh=out_good_pic_set_arr($tmp_ps,$tmpl_m1_pic_width,$tmpl_m1_pic_height);
|
||||
$yddp.="{\"pic\":\"".$tmp_ps."\",\"pic_w\":\"".deel_num($tmpwh[0])."\",\"pic_h\":\"".deel_num($tmpwh[1])."\"},";
|
||||
}else{
|
||||
//$yddp.="nopic,";
|
||||
}
|
||||
//$dhqk.=get_cate_title_no("category",$msg["category"])."-".get_cate_title_no("color",$t1).":".$tmp_kh_order["num"]."件<br> ";
|
||||
$dhqk.="{\"wz\":\"".get_cate_title_no("category",$msg["category"])."-".get_cate_title_no("color",$t1)."\",\"num\":".deel_num($tmp_kh_order["num"])."},";
|
||||
}else{
|
||||
//$yddp.="nopic,";
|
||||
//$dhqk.=get_cate_title_no("category",$msg["category"])."-".get_cate_title_no("color",$t1).":0件<br> ";
|
||||
$dhqk.="{\"wz\":\"".get_cate_title_no("category",$msg["category"])."-".get_cate_title_no("color",$t1)."\",\"num\":0},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$arr_dp.="{\"zsh\":\"".$dp_zsh."\",";
|
||||
$arr_dp.="\"xszt\":\"".$msg1["zd1"]."\",";
|
||||
$arr_dp.="\"title\":\"".$msg1["kh"]."\",";
|
||||
$tmpdppic=get_kh_dp_mini($dp_pic,$flag_pad_offline);
|
||||
$tmpwh=out_good_pic_set_arr($tmpdppic,$tmpl_m1_pic_width,$tmpl_m1_pic_height);
|
||||
$arr_dp.="\"pic\":\"".$tmpdppic."\",";
|
||||
$arr_dp.="\"pic_w\":\"".deel_num($tmpwh[0])."\",";
|
||||
$arr_dp.="\"pic_h\":\"".deel_num($tmpwh[1])."\",";
|
||||
$picdp="../attachments/yddp/".$dp_pic.".png";
|
||||
if(is_file($picdp)){
|
||||
$tmppic=out_good_pic_set_arr($picdp,$tmpl_m1_pic_width,$tmpl_m1_pic_height);
|
||||
$arr_dp.="\"yddppic\":\"".$picdp."\",";
|
||||
$arr_dp.="\"yddppic_w\":".deel_num($tmppic[0]).",";
|
||||
$arr_dp.="\"yddppic_h\":".deel_num($tmppic[1]).",";
|
||||
}else{
|
||||
$picdp="images/no_pic.png";
|
||||
$tmppic=out_good_pic_set_arr($picdp,$tmpl_m1_pic_width,$tmpl_m1_pic_height);
|
||||
$arr_dp.="\"yddppic\":\"".$picdp."\",";
|
||||
$arr_dp.="\"yddppic_w\":".deel_num($tmppic[0]).",";
|
||||
$arr_dp.="\"yddppic_h\":".deel_num($tmppic[1]).",";
|
||||
}
|
||||
$arr_dp.="\"yddp\":[".deel_end($yddp)."],";
|
||||
//$arr_dp.="\"dhqk\":\"".$dhqk."\",";
|
||||
$arr_dp.="\"dhqk\":[".deel_end($dhqk)."]},";
|
||||
$yddp=substr($yddp,0,-1);
|
||||
$yddp.="|";
|
||||
//$dhqk=substr($dhqk,0,-1);
|
||||
$dhqk.="|";
|
||||
//echo htmlspecialchars($dhqk);
|
||||
$yddppic.=get_kh_dp_mini($dp_pic,$flag_pad_offline)."|";
|
||||
$yddppic1.=$dp_pic."|";
|
||||
|
||||
$picdp1=get_kh_dp_mini($dp_pic,$flag_pad_offline);
|
||||
if(is_file($picdp1)){
|
||||
$wh=GetImageSize($picdp1);
|
||||
}else{
|
||||
$pic1=str_replace("content://com.muchuang.edt/","../",$picdp1).".jpg";
|
||||
if(is_file($pic1))
|
||||
$wh=GetImageSize($pic1);
|
||||
}
|
||||
$num_arr.=deel_end($num_arr_s)."],";
|
||||
$tmp="";
|
||||
if(($tmpl_m2_dp_pic_width>0 && $tmpl_m2_dp_pic_width<$wh[0]) || ($tmpl_m2_dp_pic_height>0 && $tmpl_m2_dp_pic_height<$wh[1])){
|
||||
if(($wh[0]/$tmpl_m2_dp_pic_width)>($wh[1]/$tmpl_m2_dp_pic_height)){
|
||||
$tmp=" width=".$tmpl_m2_dp_pic_width." height=".round($wh[1]*$tmpl_m2_dp_pic_width/$wh[0]);
|
||||
$yddppic_set_h.=round($wh[1]*$tmpl_m2_dp_pic_width/$wh[0]);
|
||||
$yddppic_set_w.=$tmpl_m2_dp_pic_width;
|
||||
$all_w+=$tmpl_m2_dp_pic_width;
|
||||
}else{
|
||||
$tmp=" width=".round($wh[0]*$tmpl_m2_dp_pic_height/$wh[1])." height=".$tmpl_m2_dp_pic_height;
|
||||
$yddppic_set_h.=$tmpl_m2_dp_pic_height;
|
||||
$yddppic_set_w.=round($wh[0]*$tmpl_m2_dp_pic_height/$wh[1]);
|
||||
$all_w+=round($wh[0]*$tmpl_m2_dp_pic_height/$wh[1]);
|
||||
}
|
||||
}else{
|
||||
$tmp=" width=".$wh[0]." height=".$wh[1];
|
||||
$yddppic_set_h.=$wh[1];
|
||||
$yddppic_set_w.=$wh[0];
|
||||
$all_w+=$wh[0];
|
||||
}
|
||||
#$yddppic_set.=out_good_pic_set("../attachments/yddp/".$dp_pic.".png",$tmpl_m2_dp_pic_width,$tmpl_m2_dp_pic_height);
|
||||
#$yddppic_set.="|";
|
||||
$yddppic_set_h.="|";
|
||||
$yddppic_set_w.="|";
|
||||
$yddpzsh.=$dp_zsh."|";
|
||||
}
|
||||
|
||||
$json_data.="\"ydcl\":[".deel_end($ydcl)."],";
|
||||
$json_data.="\"dps\":[".deel_end($arr_dp)."],";
|
||||
|
||||
if( $tmp_strjs!=" and no in ("){
|
||||
$tmp_strjs=substr($tmp_strjs,0,-1);
|
||||
$tmp_strjs.=")";
|
||||
$tmp_ydjs=get_db_msg("select sum(num) num from ".$table_pre."order where ka<>'y' ".$tmp_strjs." and uid='".$uid."' and _key='".$_key."'");
|
||||
$ydjs=$tmp_ydjs["num"];
|
||||
}else{
|
||||
$ydjs=0;
|
||||
}
|
||||
$ztdx="20px";
|
||||
$bzdhqk="<table><tr><td><font style='font-size:".$ztdx."'>本组款数:</font></td><td><font style='font-size:".$ztdx."'>(".count($bzks).")</font></td><td><font style='font-size:".$ztdx."'>已订款数: </font></td><td><font style='font-size:".$ztdx."'>(".count($ydks).")</font></td><td></td><td></td></tr><tr><td><font style='font-size:".$ztdx."'>本组款色数:</font></td><td><font style='font-size:".$ztdx."'>(".count($bzkss).")</font></td><td><font style='font-size:".$ztdx."'>已订款色数:</font></td><td><font style='font-size:".$ztdx."'>(".count($ydkss).")</font></td><td><font style='font-size:".$ztdx."'>已订件数:</font></td><td><font style='font-size:".$ztdx."'>(".$ydjs.")</font></td><td></tr></table>";
|
||||
|
||||
$num_arr.="}";
|
||||
//echo $num_arr;
|
||||
$num_arr1=substr($num_arr1,0,-1);
|
||||
$num_arr1.="]";
|
||||
$num_arr2=substr($num_arr2,0,-1);
|
||||
$num_arr2.="]";
|
||||
//print_r($num_arr);
|
||||
$yddp=substr($yddp,0,-1);
|
||||
$dhqk=substr($dhqk,0,-1);
|
||||
//echo htmlspecialchars($dhqk);
|
||||
//print_r( $dhqk);
|
||||
$yddppic=substr($yddppic,0,-1);
|
||||
$yddppic_set_h=substr($yddppic_set_h,0,-1);
|
||||
$yddppic_set_w=substr($yddppic_set_w,0,-1);
|
||||
$yddpzsh=substr($yddpzsh,0,-1);
|
||||
|
||||
$clpic=get_kh_ty_big($clp);
|
||||
$tmppic=out_good_pic_set_arr($clpic,$tmpl_m3_cl_pic_width,$tmpl_m3_cl_pic_height);
|
||||
$json_data.="\"pic\":\"".$clpic."\",";
|
||||
$json_data.="\"pic_w\":".deel_num($tmppic[0]).",";
|
||||
$json_data.="\"pic_h\":".deel_num($tmppic[1]).",";
|
||||
|
||||
$q1="select * from ".$table_pre."pm_count where uid='".$uid."' order by num desc limit 0,3";
|
||||
$r1=$db->query($q1);
|
||||
$str_cypm="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$str_cypm.="{\"gz\":\"".$m1["gz"]."\"},";
|
||||
}
|
||||
$str_cypm=deel_end($str_cypm);
|
||||
$json_data.="\"cypm\":[".$str_cypm."],";
|
||||
|
||||
|
||||
$no_ydclpic=0;
|
||||
if(is_file("../attachments/ty/big/".$msg_cl["pic"].".png")){
|
||||
if($ydcl){
|
||||
$ydcl=substr($ydcl,0,-1);
|
||||
}
|
||||
#$ydclw=$tmpl_m3_cl_pic_width;
|
||||
#$ydclh=$tmpl_m3_cl_pic_height;
|
||||
$ydclpic="../attachments/ty/big/".$msg_cl["pic"].".png";
|
||||
$tmppic=out_good_pic_set_arr($ydclpic,$tmpl_m3_cl_pic_width,$tmpl_m3_cl_pic_height);
|
||||
$json_data.="\"ydclpic\":\"".$ydclpic."\",";
|
||||
$json_data.="\"ydclpic_w\":".deel_num($tmppic[0]).",";
|
||||
$json_data.="\"ydclpic_h\":".deel_num($tmppic[1]).",";
|
||||
}else{
|
||||
$no_ydclpic=1;
|
||||
$ydclpic="images/no_pic_big.png";
|
||||
$json_data.="\"ydclpic\":\"".$ydclpic."\",";
|
||||
$json_data.="\"ydclpic_w\":\"0\",";
|
||||
$json_data.="\"ydclpic_h\":\"0\",";
|
||||
}
|
||||
$json_data.="\"no_ydclpic\":\"".$no_ydclpic."\",";
|
||||
$content_list.="]";
|
||||
//上一组、下一组
|
||||
$pre_xh=get_db_msg("select zsh from ".$table_pre."kh_ty where zsh<'".$s_zsh."' order by zsh desc limit 0,1");
|
||||
$next_xh=get_db_msg("select zsh from ".$table_pre."kh_ty where zsh>'".$s_zsh."' order by zsh limit 0,1");
|
||||
//$str_sxk="[\"".$pre_xh["zsh"]."\",\"".$next_xh["zsh"]."\"]";
|
||||
$json_data.="\"prev\":\"".$pre_xh["zsh"]."\",";
|
||||
$json_data.="\"next\":\"".$next_xh["zsh"]."\",";
|
||||
}
|
||||
break;
|
||||
case "khdlbb":
|
||||
$q1="select * from ".$table_pre."kh_dp where title='".$dph."' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$dhkh.="'".$m1["kh"]."',";
|
||||
}
|
||||
$dhkh=deel_end($dhkh);
|
||||
$q1="select uid,sum(num) num from ".$table_pre."order where no in (".$dhkh.") group by uid";
|
||||
$r1=$db->query($q1);
|
||||
$arr_uid=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_uid[$m1["uid"]]=$m1["num"];
|
||||
}
|
||||
|
||||
$q1="select * from ".$table_pre."client where face='4' ";
|
||||
$r1=$db->query($q1);
|
||||
$ct1=$ct2=1;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
if($arr_uid[$m1["id"]]>0){
|
||||
$tbyd.="<tr>";
|
||||
$tbyd.="<td>".$ct1."</td>";
|
||||
$tbyd.="<td>".$m1["title"]."</td>";
|
||||
$tbyd.="<td>".$arr_uid[$m1["id"]]."</td>";
|
||||
$tbyd.="</tr>";
|
||||
$ct1++;
|
||||
}else{
|
||||
$tbwd.="<tr>";
|
||||
$tbwd.="<td>".$ct2."</td>";
|
||||
$tbwd.="<td>".$m1["title"]."</td>";
|
||||
$qyid=get_qy_id($m1["path"]);
|
||||
$qy=get_db_msg("select title from web_client where id='".$qyid."'");
|
||||
$tbwd.="<td>".$qy["title"]."</td>";
|
||||
$tbwd.="</tr>";
|
||||
$ct2++;
|
||||
}
|
||||
}
|
||||
$tbyd="<table width='100%' class='layui-table'><thead><tr><td>序号</td><td>客户</td><td>件数</td></tr></thead><tbody>".$tbyd."</tbody></table>";
|
||||
$tbwd="<table width='100%' class='layui-table'><thead><tr><td>序号</td><td>客户</td><td>所属区域</td></tr></thead><tbody>".$tbwd."</tbody></table>";
|
||||
$json_data.="\"tbyd\":\"".$tbyd."\",";
|
||||
$json_data.="\"tbwd\":\"".$tbwd."\",";
|
||||
break;
|
||||
case "dpphbb":
|
||||
$arr_dpph=$arr_dpty=array();
|
||||
$con="";
|
||||
if($tyh){
|
||||
$con="where zsh='".$tyh."'";
|
||||
}
|
||||
$query="select * from ".$table_pre."kh_ty ".$con." order by ord";
|
||||
$res=$db->query($query);
|
||||
while($msg1=$db->fetch_array($res)){
|
||||
$q1="select * from ".$table_pre."kh_dp where title='".$msg1["kh"]."' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
$dpjs=0;
|
||||
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
|
||||
$tmp_kh_order1=get_db_msg("select sum(num) num from ".$table_pre."order where ka<>'y' and no='".$m1["kh"]."' and _key='".$_key."'");
|
||||
$dpjs+=$tmp_kh_order1["num"];
|
||||
if($msg1["kh"]==$dph){
|
||||
$kh=get_db_msg("select * from web_kh where no='".$m1["kh"]."'");
|
||||
$dhkh.="'".$m1["kh"]."',";
|
||||
$dlkhjs.=get_cate_title_no("category",$kh["category"])."-".$m1["kh"]."-".$tmp_kh_order1["num"]."|";
|
||||
}
|
||||
}
|
||||
$arr_dpph[$msg1["kh"]]=$dpjs;
|
||||
if($arr_dpty[$msg1["kh"]]){
|
||||
$arr_dpty[$msg1["kh"]]=$arr_dpty[$msg1["kh"]]."<br>".$msg1["title"];
|
||||
}else{
|
||||
$arr_dpty[$msg1["kh"]]=$msg1["title"];
|
||||
}
|
||||
}
|
||||
arsort($arr_dpph);
|
||||
$tb="<table width='100%' class='layui-table'><thead><tr><td>推演号</td><td>搭配号</td><td>件数</td></tr></thead><tbody>";
|
||||
foreach($arr_dpph as $k => $v){
|
||||
$tb.="<tr>";
|
||||
$tb.="<td>".$arr_dpty[$k]."</td>";
|
||||
$tb.="<td>".$k."</td>";
|
||||
$tb.="<td>".$v."</td>";
|
||||
$tb.="</tr>";
|
||||
}
|
||||
$tb.="</tbody></table>";
|
||||
$json_data.="\"tb\":\"".$tb."\",";
|
||||
break;
|
||||
case "dkzl":
|
||||
$q1="select * from ".$table_pre."kh_dp where title='".$dph."' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$dhkh.="'".$m1["kh"]."',";
|
||||
}
|
||||
$dhkh=deel_end($dhkh);
|
||||
$q1="select no,color,sum(num) num from ".$table_pre."order where no in (".$dhkh.") group by no,color order by no,color";
|
||||
$r1=$db->query($q1);
|
||||
$arr_data=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$ks=$m1["no"]."-".$m1["color"];
|
||||
$arr_data[$ks]=$m1["num"];
|
||||
}
|
||||
$ct=1;
|
||||
foreach ($arr_data as $n => $t){
|
||||
$ks=explode("-",$n);
|
||||
$tbyd.="<tr>";
|
||||
$tbyd.="<td>".$ct."</td>";
|
||||
$tbyd.="<td>".$ks[0]."</td>";
|
||||
$tbyd.="<td>".get_cate_title_no("color",$ks[1])."</td>";
|
||||
$tbyd.="<td>".$t."</td>";
|
||||
$tbyd.="</tr>";
|
||||
$ct++;
|
||||
}
|
||||
$tbyd="<table width='100%' class='layui-table'><thead><tr><td>序号</td><td>款号</td><td>颜色</td><td>件数</td></tr></thead><tbody>".$tbyd."</tbody></table>";
|
||||
$json_data.="\"tbyd\":\"".$tbyd."\",";
|
||||
break;
|
||||
default:
|
||||
//----------------------------------------------陈列模式
|
||||
if($sys_zycl=="y"){
|
||||
$s_type=$s_type?$s_type:"1";
|
||||
}
|
||||
$json_data.="\"sys_zycl\":\"".$sys_zycl."\",";
|
||||
//require THIS_FILE_ROOT."/include/page_js.class.php";
|
||||
$w2=$tmpl_m3_cl_pic_width;
|
||||
$h2=$tmpl_m3_cl_pic_height;
|
||||
$page_size=$tmpl_m1_page_size;
|
||||
$page_size=$tmpl_m1_page_size;
|
||||
|
||||
$page=$page>0?$page:1;
|
||||
$limit=$limit>0?$limit:6;
|
||||
$start=($page-1)*$limit;
|
||||
$end=$limit;
|
||||
|
||||
//
|
||||
|
||||
$sql_con=" where zsh>0 and ";
|
||||
if($s_type){
|
||||
$sql_con.=get_sql_client_type($s_type);
|
||||
}
|
||||
/*if($s_no){
|
||||
$sql_con.="kh like '%".$s_no."%' and ";
|
||||
$s_zsh="";
|
||||
}*/
|
||||
$kl=strlen($s_keyword);
|
||||
if($kl<=3 && $s_keyword && is_numeric($s_keyword)){
|
||||
if($xh_ms=="2"){
|
||||
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
||||
}else{
|
||||
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
||||
}
|
||||
$sql_con.=" kh='".$tmp["no"]."' and";
|
||||
for($i=0;$i<$num_dp_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$$v="";
|
||||
}
|
||||
$s_zsh="";
|
||||
$s_title="";
|
||||
}
|
||||
if($kl>=3){
|
||||
if(is_numeric($s_keyword)){
|
||||
if($xh_ms=="2"){
|
||||
$tmp=get_db_msg("select kh as no from web_kh_xh where xh='".$s_keyword."'");
|
||||
}else{
|
||||
$tmp=get_db_msg("select no from web_kh where xh='".$s_keyword."'");
|
||||
}
|
||||
$sql_con.=" (kh='".$tmp["no"]."' or kh like '%".$s_keyword."%') and";
|
||||
}else{
|
||||
$sql_con.=" (kh like '%".$s_keyword."%') and";
|
||||
}
|
||||
for($i=0;$i<$num_dp_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$$v="";
|
||||
}
|
||||
$s_zsh="";
|
||||
$s_title="";
|
||||
}
|
||||
if($s_title){
|
||||
$sql_con.="title like '%".$s_title."%' and ";
|
||||
$s_keyword="";
|
||||
$s_zsh="";
|
||||
}
|
||||
for($i=0;$i<$num_cl_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
if($$v1)
|
||||
$sql_con.="zd".($i+1)."='".$$v1."' and ";
|
||||
}
|
||||
if($sql_con)
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
//$sql_order=str_replace("!"," desc",$order);
|
||||
|
||||
$json_data.="\"s_keyword\":\"".$s_keyword."\",";
|
||||
$json_data.="\"s_zsh\":\"".$s_zsh."\",";
|
||||
$json_data.="\"s_title\":\"".$s_title."\",";
|
||||
|
||||
|
||||
$query="select count(distinct zsh) 'total' from ".$table_pre."kh_ty ".$sql_con;
|
||||
$res=$db->query($query);
|
||||
$msg=$db->fetch_array($res);
|
||||
$total=$msg["total"];
|
||||
|
||||
|
||||
//定制条件
|
||||
$query="select * from ".$table_pre."kh_ty ".$sql_con." group by zsh order by zsh limit ".$start.",".$end;
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$rnum=0;
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
$pic_background=get_set("pic_background");
|
||||
$pic_background=$pic_background?$pic_background:"#ffffff";
|
||||
$content_set="[\"".$pic_background."\"]";
|
||||
|
||||
$json_data.="\"style_title_color\":\"".$style_title_color."\",";
|
||||
$json_data.="\"ka_color\":\"".$ka_color."\",";
|
||||
$json_data.="\"content_set\":\"".$pic_background."\",";
|
||||
|
||||
$json_data.="\"count\":".$total.",\"content_list\":[";
|
||||
$data_str="";
|
||||
|
||||
$content_list="[";
|
||||
for($count=0;$count<$end;$count++){
|
||||
$msg=$db->fetch_array($res);
|
||||
if($msg["id"]>0){
|
||||
//图片获取规则
|
||||
$pic=get_kh_ty_mini($msg["pic"]);
|
||||
$is_my_cl="n";
|
||||
$content_list.=$msg["zsh"].",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",\"".$msg["title"]."\",\"".$is_my_cl."\",";
|
||||
$ck=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$data_str.="{\"zsh\":".$msg["zsh"].",\"title\":\"".$msg["title"]."\",\"is_my_cl\":\"".$is_my_cl."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($ck[0]).",\"pic_h\":".deel_num($ck[1])."},";
|
||||
//
|
||||
$rnum++;
|
||||
}
|
||||
}
|
||||
$json_data.=substr($data_str,0,-1)."],";
|
||||
$content_list.="]";
|
||||
|
||||
//自定义筛选条件
|
||||
$str_arr_zy="";
|
||||
$select_dz="";
|
||||
if($sys_zycl=="y"){
|
||||
$tmp1=explode(",",$sys_zycl_client_type);
|
||||
foreach($tmp1 as $k1 => $v1){
|
||||
$tmp2=explode("|",$v1);
|
||||
$str_arr_zy.="{\"no\":\"".$tmp2[0]."\",\"title\":\"".$tmp2[1]."\"},";
|
||||
/*foreach($tmp2 as $k2 => $v2){
|
||||
$str_arr_zy.="{\"no\":\"".$k2."\",\"title\":\"".$v2."\"},";
|
||||
}*/
|
||||
}
|
||||
$str_arr_zy=deel_end($str_arr_zy);
|
||||
$select_dz.="{\"no\":\"s_type\",\"title\":\"陈列类型\",\"value\":\"".$s_type."\",\"op\":[".$str_arr_zy."]},";
|
||||
}
|
||||
$num_cl_zd=0;
|
||||
if(is_array($sys_cl_zd)){
|
||||
$num=count($sys_cl_zd);
|
||||
$num_cl_zd=($num<5)?$num:5;
|
||||
}
|
||||
$str_arr_select="";
|
||||
|
||||
for($i=0;$i<$num_cl_zd;$i++){
|
||||
$v1="s_zd".($i+1);
|
||||
$str_arr_select.="\"".$v1."\",\"".$sys_cl_zd[$i]."\",\"".$$v1."\",";
|
||||
$r=$db->query("select zd".($i+1)." from ".$table_pre."kh_ty group by zd".($i+1)." order by zd".($i+1));
|
||||
$op="[";
|
||||
$tmp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="\"".$m["zd".($i+1)]."|".$m["zd".($i+1)]."\",";
|
||||
$tmp.="{\"no\":\"".$m["zd".($i+1)]."\",\"title\":\"".$m["zd".($i+1)]."\"},";
|
||||
}
|
||||
$tmp=deel_end($tmp);
|
||||
$select_dz.="{\"no\":\"".$v1."\",\"title\":\"".$sys_dp_zd[$i]."\",\"value\":\"".$$v1."\",\"op\":[".$tmp."]},";
|
||||
$op.="],";
|
||||
$str_arr_select.=$op;
|
||||
}
|
||||
$select_dz=deel_end($select_dz);
|
||||
$json_data.="\"select_dz\":[".$select_dz."],";
|
||||
|
||||
$total_page=ceil($total/$limit);
|
||||
$json_data.="\"total_page\":".$total_page.",";
|
||||
$json_data.="\"page\":".$page.",";
|
||||
break;
|
||||
}
|
||||
}
|
||||
function get_kh_ty_mini($clh){
|
||||
global $order_session;
|
||||
$s_dir=$order_session?$order_session."/":"";
|
||||
$pic="../attachments/ty/mini/".$clh.".jpg";
|
||||
if(!is_file($pic)){
|
||||
$pic="images/no_pic.png";
|
||||
}
|
||||
return $pic;
|
||||
}
|
||||
function get_kh_ty_big($clh){
|
||||
global $order_session;
|
||||
$s_dir=$order_session?$order_session."/":"";
|
||||
$pic="../attachments/ty/big/".$clh.".jpg";
|
||||
if(!is_file($pic)){
|
||||
$pic="images/no_pic_big.png";
|
||||
}
|
||||
return $pic;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,556 @@
|
||||
<?php
|
||||
//-------------------------------行为分析-界面
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=check_cookie_jxs();
|
||||
$arr_zd=array("1"=>"订单量","2"=>"客户数");
|
||||
$arr_con_time=array("day"=>"一天","half_day"=>"半天","hour"=>"小时");
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
switch($cate){
|
||||
case "ms":
|
||||
$json_data.="\"cate\":\"ms\",";
|
||||
$s_con_time=$s_con_time?$s_con_time:"day";
|
||||
//
|
||||
$s_zd="";
|
||||
foreach($arr_zd as $k => $v){
|
||||
$var="zd_".$k;
|
||||
if($$var=="on")
|
||||
$s_zd.=$k.",";
|
||||
}
|
||||
$s_zd=deel_end($s_zd);
|
||||
$s_zd=$s_zd?$s_zd:"1";
|
||||
$arr_s_zd=explode(",",$s_zd);
|
||||
//时间条件选项
|
||||
$tmp="";
|
||||
foreach($arr_con_time as $k => $v){
|
||||
$tmp.="{\"val\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$json_data.="\"con_time\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_con_time\":\"".$s_con_time."\",";
|
||||
|
||||
//按照天的选项
|
||||
$q="select substring(add_date,1,11) '_d' from ".$table_pre."log_hd where action>20 and action<25 group by _d order by _d";
|
||||
$r=$db->query($q);
|
||||
$tmp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tmp.="{\"val\":\"".$m["_d"]."\",\"title\":\"".deel_date_format("day",$m["_d"])."\"},";
|
||||
}
|
||||
$json_data.="\"con_day\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_day\":\"".$s_day."\",";
|
||||
//数据选项
|
||||
$tmp="";
|
||||
foreach($arr_zd as $k => $v){
|
||||
$tmp.="{\"val\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$json_data.="\"con_zd\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_zd\":\"".$s_zd."\",";
|
||||
|
||||
//取得数据
|
||||
$arr_data=array();
|
||||
if($s_con_time=="day"){
|
||||
$sql_time="substring(add_date,1,11)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else if($s_con_time=="half_day"){
|
||||
$sql_time="concat(substring(add_date,1,11),' ',case when substring(add_date,12,2)<13 then '1' when substring(add_date,12,2)<19 then '2' else '3' end)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else{
|
||||
$sql_time="concat(substring(add_date,1,11),'',substring(add_date,12,2))";
|
||||
$con_hour=" where action>20 and action<25 and substring(add_date,1,11)='".$s_day."'";
|
||||
}
|
||||
//取得时间段数据
|
||||
$q="select ".$sql_time." as '_t' from ".$table_pre."log_hd".$con_hour." group by _t order by _t";
|
||||
$r=$db->query($q);
|
||||
$arr_sjd=array();
|
||||
$tb_data_x="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_sjd[]=$m["_t"];
|
||||
$tb_data_x.=deel_date_format($s_con_time,$m["_t"]).",";
|
||||
}
|
||||
$tb_data_x=deel_end($tb_data_x);
|
||||
//内容
|
||||
$q="select ms from ".$table_pre."log_hd where ms<>'' group by ms order by ms";
|
||||
$r=$db->query($q);
|
||||
$i=0;
|
||||
$total_num=0;
|
||||
$arr_data_js=$arr_data_khs=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$data_tb_v1=$data_tb_v2="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$m1=get_db_msg("select sum(case when action in (21,23) then num when action in (22,24) then -num else 0 end) 'num_1',count(distinct uid) 'num_2' from ".$table_pre."log_hd where ms='".$m["ms"]."' and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
$data_tb_v1.=add_0($m1["num_1"]).",";
|
||||
$data_tb_v2.=add_0($m1["num_2"]).",";
|
||||
}
|
||||
$arr_data_js[$m["ms"]]=deel_end($data_tb_v1);
|
||||
$arr_data_khs[$m["ms"]]=deel_end($data_tb_v2);
|
||||
$i++;
|
||||
}
|
||||
//表头
|
||||
$thead="";
|
||||
//第一行
|
||||
$tr="{\"title\":\"模式\",\"width\":80,\"align\":\"center\",\"rowspan\":2},";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
$tr.="{\"title\":\"".deel_date_format($s_con_time,$arr_sjd[$i])."\"";
|
||||
if(count($arr_s_zd)>1)
|
||||
$tr.=",\"colspan\":".count($arr_s_zd).",\"align\":\"center\"";
|
||||
$tr.="},";
|
||||
}
|
||||
$thead.="{\"row\":0,\"tr\":[".deel_end($tr)."]},";
|
||||
//第二行
|
||||
$tr="";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$tr.="{\"title\":\"".get_main_value($arr_zd,$arr_s_zd[$j])."\",\"align\":\"center\"},";
|
||||
}
|
||||
}
|
||||
$thead.="{\"row\":1,\"tr\":[".deel_end($tr)."]}";
|
||||
$json_data.="\"thead\":[".$thead."],";
|
||||
|
||||
//计算标准差
|
||||
$arr_pc=array();
|
||||
$i=0;
|
||||
foreach($arr_data_js as $iid => $str_data_js){
|
||||
$arr_pc[$iid]=get_pc(explode(",",$str_data_js));
|
||||
$i++;
|
||||
}
|
||||
arsort($arr_pc);
|
||||
|
||||
//内容
|
||||
$i=0;
|
||||
$data="";
|
||||
foreach($arr_pc as $iid => $pc){
|
||||
//
|
||||
$content1="";
|
||||
$arr_tmp_js=explode(",",$arr_data_js[$iid]);
|
||||
$arr_tmp_khs=explode(",",$arr_data_khs[$iid]);
|
||||
for($i1=0;$i1<count($arr_tmp_js);$i1++){
|
||||
$num_1=$arr_tmp_js[$i1];
|
||||
$num_2=$arr_tmp_khs[$i1];
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$var="num_".$arr_s_zd[$j];
|
||||
$content1.=",\"num_".$i1."_".$j."\":\"".add_0($$var)."\"";
|
||||
}
|
||||
$v="hj_".$i1;
|
||||
$$v+=$num_1;
|
||||
}
|
||||
$list=$i+1;
|
||||
$tb_data_y="";
|
||||
if(in_array("1",$arr_s_zd))
|
||||
$tb_data_y.=get_main_value($arr_zd,"1").",".$arr_data_js[$iid]."|";
|
||||
if(in_array("2",$arr_s_zd))
|
||||
$tb_data_y.=get_main_value($arr_zd,"2").",".$arr_data_khs[$iid]."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$data.="{\"tb_data_y\":\"".$tb_data_y."\",\"ms\":\"".$iid."\"".$content1."},";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//合计
|
||||
$data_tb_v1="";
|
||||
$data_tb_v2="";
|
||||
$content1="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$var="hj_".$i1;
|
||||
for($j1=0;$j1<count($arr_s_zd);$j1++){
|
||||
if($arr_s_zd[$j1]==1){
|
||||
if($i1==0)
|
||||
$data_tb_v1.=get_main_value($arr_zd,"1").",";
|
||||
$content1.=",\"num_".$i1."_".$j1."\":\"".add_0($$var)."\"";
|
||||
$data_tb_v1.=add_0($$var).",";
|
||||
}else if($arr_s_zd[$j1]==2){
|
||||
if($i1==0)
|
||||
$data_tb_v2.=get_main_value($arr_zd,"2").",";
|
||||
$m1=get_db_msg("select count(distinct uid) 'num_2' from ".$table_pre."log_hd where action>20 and action<25 and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
$content1.=",\"num_".$i1."_".$j1."\":\"".add_0($m1["num_2"])."\"";
|
||||
$data_tb_v2.=add_0($m1["num_2"]).",";
|
||||
}
|
||||
}
|
||||
}
|
||||
//合计
|
||||
$data.="{\"ms\":\"合计\"".$content1."},";
|
||||
//输出表格数据
|
||||
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$i.",\"data\":[".deel_end($data)."],";
|
||||
//输出图表数据
|
||||
$data_tb_v1=deel_end($data_tb_v1);
|
||||
$data_tb_v2=deel_end($data_tb_v2);
|
||||
$tb_data_y="";
|
||||
if($data_tb_v1)
|
||||
$tb_data_y.=$data_tb_v1."|";
|
||||
if($data_tb_v2)
|
||||
$tb_data_y.=$data_tb_v2."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$json_data.="\"chart_title\":\"订单模式趋势图\",";
|
||||
$json_data.="\"chart_type\":\"line\",";
|
||||
$json_data.="\"chart_data_x\":\"".$tb_data_x."\",";
|
||||
$json_data.="\"chart_data_y\":\"".$tb_data_y."\",";
|
||||
break;
|
||||
case "client":
|
||||
$json_data.="\"cate\":\"client\",";
|
||||
$s_con_time=$s_con_time?$s_con_time:"day";
|
||||
//
|
||||
$s_zd="";
|
||||
foreach($arr_zd as $k => $v){
|
||||
$var="zd_".$k;
|
||||
if($$var=="on")
|
||||
$s_zd.=$k.",";
|
||||
}
|
||||
$s_zd=deel_end($s_zd);
|
||||
$s_zd=$s_zd?$s_zd:"1";
|
||||
$arr_s_zd=explode(",",$s_zd);
|
||||
$json_data.="\"s_zd\":\"".$s_zd."\",";
|
||||
//时间条件选项
|
||||
$tmp="";
|
||||
foreach($arr_con_time as $k => $v){
|
||||
$tmp.="{\"val\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$json_data.="\"con_time\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_con_time\":\"".$s_con_time."\",";
|
||||
|
||||
//按照天的选项
|
||||
$q="select substring(add_date,1,11) '_d' from ".$table_pre."log_hd where action>20 and action<25 group by _d order by _d";
|
||||
$r=$db->query($q);
|
||||
$tmp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tmp.="{\"val\":\"".$m["_d"]."\",\"title\":\"".deel_date_format("day",$m["_d"])."\"},";
|
||||
}
|
||||
$json_data.="\"con_day\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_day\":\"".$s_day."\",";
|
||||
|
||||
$json_data.="\"s_username\":\"".$s_username."\",";
|
||||
|
||||
//组合条件
|
||||
if($s_con_time=="day"){
|
||||
$sql_time="substring(add_date,1,11)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else if($s_con_time=="half_day"){
|
||||
$sql_time="concat(substring(add_date,1,11),' ',case when substring(add_date,12,2)<13 then '1' when substring(add_date,12,2)<19 then '2' else '3' end)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else{
|
||||
$sql_time="concat(substring(add_date,1,11),'',substring(add_date,12,2))";
|
||||
$con_hour=" where action>20 and action<25 and substring(add_date,1,11)='".$s_day."'";
|
||||
}
|
||||
|
||||
//取得时间段数据
|
||||
$q="select ".$sql_time." as '_t' from ".$table_pre."log_hd".$con_hour." group by _t order by _t";
|
||||
$r=$db->query($q);
|
||||
$arr_sjd=array();
|
||||
$tb_data_x="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_sjd[]=$m["_t"];
|
||||
$tb_data_x.=deel_date_format($s_con_time,$m["_t"]).",";
|
||||
}
|
||||
$tb_data_x=deel_end($tb_data_x);
|
||||
|
||||
$con1="";
|
||||
if($s_username){
|
||||
$m1=get_db_msg("select id,face,path from ".$table_pre."client where username='".$s_username."'");
|
||||
if($m1["id"]>0){
|
||||
if($m1["face"]=="4")
|
||||
$con1.=" and c.id='".$m1["id"]."'";
|
||||
else
|
||||
$con1.=" and c.path='".$m1["path"]."-".$m1["id"]."'";
|
||||
}else{
|
||||
$con1.=" and c.id='0'";
|
||||
}
|
||||
}
|
||||
//取得数据
|
||||
$q="select b.uid 'uid',sum(case when b.action in (21,23) then b.num when b.action in (22,24) then -b.num else 0 end) 'num_1' from ".$table_pre."log_hd b,".$table_pre."client c where c.face='4' and b.uid=c.id ".$con1." and b.action>20 and b.action<25 group by b.uid order by num_1 desc";
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
$i=0;
|
||||
$total_num=0;
|
||||
$arr_data_js=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
//
|
||||
$data_tb_v1="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$m1=get_db_msg("select sum(case when action in (21,23) then num when action in (22,24) then -num else 0 end) 'num_1' from ".$table_pre."log_hd where uid='".$m["uid"]."' and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
if(in_array("1",$arr_s_zd))
|
||||
$data_tb_v1.=add_0($m1["num_1"]).",";
|
||||
}
|
||||
$data_tb_v1=substr($data_tb_v1,0,-1);
|
||||
$arr_data_js[$m["uid"]]=$data_tb_v1;
|
||||
$i++;
|
||||
}
|
||||
|
||||
//-----------------------输出数据
|
||||
//表头
|
||||
$thead="";
|
||||
//第一行
|
||||
$tr="{\"title\":\"序号\",\"width\":80,\"align\":\"center\",\"rowspan\":2},{\"title\":\"店铺\",\"width\":80,\"align\":\"center\",\"rowspan\":2},{\"title\":\"总订量\",\"width\":70,\"align\":\"center\",\"rowspan\":2},";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
$tr.="{\"title\":\"".deel_date_format($s_con_time,$arr_sjd[$i])."\"";
|
||||
if(count($arr_s_zd)>1)
|
||||
$tr.=",\"colspan\":".count($arr_s_zd).",\"align\":\"center\"";
|
||||
$tr.="},";
|
||||
}
|
||||
$thead.="{\"row\":0,\"tr\":[".deel_end($tr)."]},";
|
||||
//第二行
|
||||
$tr="";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$tr.="{\"title\":\"".get_main_value($arr_zd,$arr_s_zd[$j])."\",\"align\":\"center\"},";
|
||||
}
|
||||
}
|
||||
$thead.="{\"row\":1,\"tr\":[".deel_end($tr)."]}";
|
||||
$json_data.="\"thead\":[".$thead."],";
|
||||
|
||||
//计算标准差
|
||||
$arr_pc=array();
|
||||
$i=0;
|
||||
foreach($arr_data_js as $iid => $str_data_js){
|
||||
$arr_pc[$iid]=get_pc(explode(",",$str_data_js));
|
||||
$i++;
|
||||
}
|
||||
arsort($arr_pc);
|
||||
|
||||
//内容
|
||||
$i=0;
|
||||
$hj_total_num=0;
|
||||
$data="";
|
||||
foreach($arr_pc as $uid => $pc){
|
||||
$m_client=get_db_msg("select username,title from ".$table_pre."client where id='".$uid."'");
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and uid='".$uid."' and _key='".$_key."'");
|
||||
$tmp_total_num=$tmp["num"];
|
||||
$hj_total_num+=$tmp_total_num;
|
||||
//
|
||||
$content1="";
|
||||
$arr_tmp_js=explode(",",$arr_data_js[$iid]);
|
||||
for($i1=0;$i1<count($arr_tmp_js);$i1++){
|
||||
$num_1=$arr_tmp_js[$i1];
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$var="num_".$arr_s_zd[$j];
|
||||
$content1.=",\"num_".$i1."_".$j."\":\"".add_0($$var)."\"";
|
||||
}
|
||||
$v="hj_".$i1;
|
||||
$$v+=$num_1;
|
||||
}
|
||||
$list=$i+1;
|
||||
$tb_data_y="";
|
||||
if(in_array("1",$arr_s_zd))
|
||||
$tb_data_y.=get_main_value($arr_zd,"1").",".$arr_data_js[$iid]."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$data.="{\"xh\":\"".$list."\",\"title\":\"".$m_client["title"]."(".$m_client["username"].")"."\",\"tb_data_y\":\"".$tb_data_y."\",\"total_num\":\"".$tmp_total_num."\"".$content1."},";
|
||||
$i++;
|
||||
|
||||
}
|
||||
//合计
|
||||
$data_tb_v1="";
|
||||
$content1="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$var="hj_".$i1;
|
||||
for($j1=0;$j1<count($arr_s_zd);$j1++){
|
||||
if($arr_s_zd[$j1]==1){
|
||||
if($i1==0)
|
||||
$data_tb_v1.=get_main_value($arr_zd,"1").",";
|
||||
$content1.=",\"num_".$i1."_".$j1."\":\"".add_0($$var)."\"";
|
||||
$data_tb_v1.=add_0($$var).",";
|
||||
}
|
||||
}
|
||||
}
|
||||
//合计
|
||||
$data.="{\"xh\":\"合计\",\"title\":\"\",\"total_num\":\"".$hj_total_num."\"".$content1."},";
|
||||
//输出表格数据
|
||||
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$i.",\"data\":[".deel_end($data)."],";
|
||||
//输出图表数据
|
||||
$data_tb_v1=deel_end($data_tb_v1);
|
||||
$tb_data_y="";
|
||||
if($data_tb_v1)
|
||||
$tb_data_y.=$data_tb_v1."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$json_data.="\"chart_title\":\"客户订单趋势\",";
|
||||
$json_data.="\"chart_type\":\"line\",";
|
||||
$json_data.="\"chart_data_x\":\"".$tb_data_x."\",";
|
||||
$json_data.="\"chart_data_y\":\"".$tb_data_y."\",";
|
||||
|
||||
break;
|
||||
case "kh":
|
||||
$json_data.="\"cate\":\"kh\",";
|
||||
$s_con_time=$s_con_time?$s_con_time:"day";
|
||||
//
|
||||
$s_zd="";
|
||||
foreach($arr_zd as $k => $v){
|
||||
$var="zd_".$k;
|
||||
if($$var=="on")
|
||||
$s_zd.=$k.",";
|
||||
}
|
||||
$s_zd=deel_end($s_zd);
|
||||
$s_zd=$s_zd?$s_zd:"1";
|
||||
$arr_s_zd=explode(",",$s_zd);
|
||||
|
||||
|
||||
//时间条件选项
|
||||
$tmp="";
|
||||
foreach($arr_con_time as $k => $v){
|
||||
$tmp.="{\"val\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$json_data.="\"con_time\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_con_time\":\"".$s_con_time."\",";
|
||||
|
||||
//按照天的选项
|
||||
$q="select substring(add_date,1,11) '_d' from ".$table_pre."log_hd where action>20 and action<25 group by _d order by _d";
|
||||
$r=$db->query($q);
|
||||
$tmp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tmp.="{\"val\":\"".$m["_d"]."\",\"title\":\"".deel_date_format("day",$m["_d"])."\"},";
|
||||
}
|
||||
$json_data.="\"con_day\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_day\":\"".$s_day."\",";
|
||||
|
||||
//数据选项
|
||||
$tmp="";
|
||||
foreach($arr_zd as $k => $v){
|
||||
$tmp.="{\"val\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
}
|
||||
$json_data.="\"con_zd\":[".deel_end($tmp)."],";
|
||||
$json_data.="\"s_zd\":\"".$s_zd."\",";
|
||||
$json_data.="\"s_no\":\"".$s_no."\",";
|
||||
|
||||
//组合条件
|
||||
if($s_con_time=="day"){
|
||||
$sql_time="substring(add_date,1,11)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else if($s_con_time=="half_day"){
|
||||
$sql_time="concat(substring(add_date,1,11),' ',case when substring(add_date,12,2)<13 then '1' when substring(add_date,12,2)<19 then '2' else '3' end)";
|
||||
$con_hour=" where action>20 and action<25";
|
||||
}else{
|
||||
$sql_time="concat(substring(add_date,1,11),'',substring(add_date,12,2))";
|
||||
$con_hour=" where action>20 and action<25 and substring(add_date,1,11)='".$s_day."'";
|
||||
}
|
||||
//取得时间段数据
|
||||
$q="select ".$sql_time." as '_t' from ".$table_pre."log_hd".$con_hour." group by _t order by _t";
|
||||
$r=$db->query($q);
|
||||
$arr_sjd=array();
|
||||
$tb_data_x="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_sjd[]=$m["_t"];
|
||||
$tb_data_x.=deel_date_format($s_con_time,$m["_t"]).",";
|
||||
}
|
||||
$tb_data_x=deel_end($tb_data_x);
|
||||
//取得数据
|
||||
$q="select b.iid 'iid',sum(case when b.action in (21,23) then b.num when b.action in (22,24) then -b.num else 0 end) 'num_1',count(distinct b.uid) 'num_2' from ".$table_pre."log_hd b where b.action>20 and b.action<25 group by b.iid order by num_1 desc";
|
||||
$r=$db->query($q);
|
||||
$i=0;
|
||||
$total_num=0;
|
||||
$arr_data_js=$arr_data_khs=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
//
|
||||
$data_tb_v1=$data_tb_v2="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$m1=get_db_msg("select sum(case when action in (21,23) then num when action in (22,24) then -num else 0 end) 'num_1',count(distinct uid) 'num_2' from ".$table_pre."log_hd where iid='".$m["iid"]."' and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
$data_tb_v1.=add_0($m1["num_1"]).",";
|
||||
$data_tb_v2.=add_0($m1["num_2"]).",";
|
||||
}
|
||||
$arr_data_js[$m["iid"]]=deel_end($data_tb_v1);
|
||||
$arr_data_khs[$m["iid"]]=deel_end($data_tb_v2);
|
||||
$i++;
|
||||
}
|
||||
//-----------------------输出数据
|
||||
//表头
|
||||
$thead="";
|
||||
//第一行
|
||||
$tr="{\"title\":\"圆牌号\",\"width\":80,\"align\":\"center\",\"rowspan\":2},{\"title\":\"款号\",\"width\":80,\"align\":\"center\",\"rowspan\":2},{\"title\":\"总订量\",\"width\":70,\"align\":\"center\",\"rowspan\":2},";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
$tr.="{\"title\":\"".deel_date_format($s_con_time,$arr_sjd[$i])."\"";
|
||||
if(count($arr_s_zd)>1)
|
||||
$tr.=",\"colspan\":".count($arr_s_zd).",\"align\":\"center\"";
|
||||
$tr.="},";
|
||||
}
|
||||
$thead.="{\"row\":0,\"tr\":[".deel_end($tr)."]},";
|
||||
//第二行
|
||||
$tr="";
|
||||
for($i=0;$i<count($arr_sjd);$i++){
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$tr.="{\"title\":\"".get_main_value($arr_zd,$arr_s_zd[$j])."\",\"align\":\"center\"},";
|
||||
}
|
||||
}
|
||||
$thead.="{\"row\":1,\"tr\":[".deel_end($tr)."]}";
|
||||
$json_data.="\"thead\":[".$thead."],";
|
||||
//计算标准差
|
||||
$arr_pc=array();
|
||||
$i=0;
|
||||
foreach($arr_data_js as $iid => $str_data_js){
|
||||
$arr_pc[$iid]=get_pc(explode(",",$str_data_js));
|
||||
$i++;
|
||||
}
|
||||
arsort($arr_pc);
|
||||
//内容
|
||||
$i=0;
|
||||
$hj_total_num=0;
|
||||
$data="";
|
||||
foreach($arr_pc as $iid => $pc){
|
||||
$m_kh=get_db_msg("select no,id,main_pic,color,xh from ".$table_pre."kh where id='".$iid."'");
|
||||
if(!$s_no || ($s_no && (strpos(" ".$m_kh["no"],$s_no)!=false))){
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where ka<>'y' and iid='".$iid."' and _key='".$_key."'");
|
||||
$tmp_total_num=$tmp["num"];
|
||||
$hj_total_num+=$tmp_total_num;
|
||||
//
|
||||
$content1="";
|
||||
$arr_tmp_js=explode(",",$arr_data_js[$iid]);
|
||||
$arr_tmp_khs=explode(",",$arr_data_khs[$iid]);
|
||||
for($i1=0;$i1<count($arr_tmp_js);$i1++){
|
||||
$num_1=$arr_tmp_js[$i1];
|
||||
$num_2=$arr_tmp_khs[$i1];
|
||||
for($j=0;$j<count($arr_s_zd);$j++){
|
||||
$var="num_".$arr_s_zd[$j];
|
||||
$content1.=",\"num_".$i1."_".$j."\":\"".add_0($$var)."\"";
|
||||
}
|
||||
$v="hj_".$i1;
|
||||
$$v+=$num_1;
|
||||
}
|
||||
$list=$i+1;
|
||||
$tb_data_y="";
|
||||
if(in_array("1",$arr_s_zd))
|
||||
$tb_data_y.=get_main_value($arr_zd,"1").",".$arr_data_js[$iid]."|";
|
||||
if(in_array("2",$arr_s_zd))
|
||||
$tb_data_y.=get_main_value($arr_zd,"2").",".$arr_data_khs[$iid]."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$pic=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
|
||||
$data.="{\"xh\":\"".get_kh_xh($m_kh)."\",\"id\":\"".$m_kh["id"]."\",\"pic\":\"".$pic."\",\"tb_data_y\":\"".$tb_data_y."\",\"kh\":\"".$m_kh["no"]."\",\"total_num\":\"".$tmp_total_num."\"".$content1."},";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
//合计
|
||||
$data_tb_v1="";
|
||||
$data_tb_v2="";
|
||||
$content1="";
|
||||
for($i1=0;$i1<count($arr_sjd);$i1++){
|
||||
$var="hj_".$i1;
|
||||
for($j1=0;$j1<count($arr_s_zd);$j1++){
|
||||
if($arr_s_zd[$j1]==1){
|
||||
if($i1==0)
|
||||
$data_tb_v1.=get_main_value($arr_zd,"1").",";
|
||||
$content1.=",\"num_".$i1."_".$j1."\":\"".add_0($$var)."\"";
|
||||
$data_tb_v1.=add_0($$var).",";
|
||||
}else if($arr_s_zd[$j1]==2){
|
||||
if($i1==0)
|
||||
$data_tb_v2.=get_main_value($arr_zd,"2").",";
|
||||
$m1=get_db_msg("select count(distinct uid) 'num_2' from ".$table_pre."log_hd where action>20 and action<25 and ".$sql_time."<='".$arr_sjd[$i1]."'");
|
||||
$content1.=",\"num_".$i1."_".$j1."\":\"".add_0($m1["num_2"])."\"";
|
||||
$data_tb_v2.=add_0($m1["num_2"]).",";
|
||||
}
|
||||
}
|
||||
}
|
||||
//合计
|
||||
$data.="{\"xh\":\"合计\",\"id\":\"0\",\"kh\":\"\",\"total_num\":\"".$hj_total_num."\"".$content1."},";
|
||||
//输出表格数据
|
||||
$json_data.="\"code\":0,\"msg\":\"\",\"count\":".$i.",\"data\":[".deel_end($data)."],";
|
||||
//输出图表数据
|
||||
$data_tb_v1=deel_end($data_tb_v1);
|
||||
$data_tb_v2=deel_end($data_tb_v2);
|
||||
$tb_data_y="";
|
||||
if($data_tb_v1)
|
||||
$tb_data_y.=$data_tb_v1."|";
|
||||
if($data_tb_v2)
|
||||
$tb_data_y.=$data_tb_v2."|";
|
||||
$tb_data_y=deel_end($tb_data_y);
|
||||
$json_data.="\"chart_title\":\"订单趋势图\",";
|
||||
$json_data.="\"chart_type\":\"line\",";
|
||||
$json_data.="\"chart_data_x\":\"".$tb_data_x."\",";
|
||||
$json_data.="\"chart_data_y\":\"".$tb_data_y."\",";
|
||||
break;
|
||||
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,790 @@
|
||||
<?php
|
||||
//-------------------------------推送
|
||||
/*
|
||||
店铺和主讲和陈列师
|
||||
*/
|
||||
$uid=check_cookie_jxs();
|
||||
//$db=_mysql_connect();
|
||||
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
||||
$upath=$msg_login["path"]."-".$uid;
|
||||
|
||||
$sys_enable_tb="y";
|
||||
$tmpl_m5_lie=4;
|
||||
$tmpl_m5_pic_width=188;
|
||||
$tmpl_m5_pic_height=250;
|
||||
$tmpl_m5_cl_pic_width=400;
|
||||
$tmpl_m5_cl_pic_height=300;
|
||||
|
||||
$sys_close=get_set("sys_close");
|
||||
$sys_close_image=get_set("sys_close_image");
|
||||
$sys_size_num=get_max_size_num();
|
||||
$order_session=get_set("order_session");
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
switch($_a){
|
||||
case "set_show":
|
||||
//-------------------------------推送到当前展示号的下一个展示号
|
||||
//echo $no;
|
||||
$json_data.="\"no\":\"".$no."\",";
|
||||
$arr_khno=explode(",",$no);//接收到的款号参数
|
||||
/*$tid=$tid>0?$tid:0;//$tid来自于浏览器URL$tid
|
||||
//取得当前展示号
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_zblist where is_show='y' order by zsh");
|
||||
if($tmp["zsh"]>0){
|
||||
$dq_zsh=$tmp['zsh'];
|
||||
//大于当前展示号的顺延
|
||||
$db->query("update ".$table_pre."kh_zblist set zsh=zsh+1 where zsh>'".$dq_zsh."' ");
|
||||
}else{
|
||||
$tmp=get_db_msg("select MAX(zsh) 'zsh' from ".$table_pre."kh_zblist ");
|
||||
$dq_zsh=$tmp['zsh']?$tmp['zsh']:0;
|
||||
}*/
|
||||
$this_zsh=create_guid();
|
||||
//
|
||||
$ord=1;
|
||||
$sql="insert into ".$table_pre."kh_zblist (zsh,kh,color,ord,is_show) values ";
|
||||
foreach($arr_khno as $khno){
|
||||
$arr_tmp=explode("|",$khno);
|
||||
$sql.="('".($this_zsh)."','".$arr_tmp[0]."','".$arr_tmp[1]."',".$ord++.",'y'),";
|
||||
}
|
||||
$sql=substr($sql,0,-1).";";
|
||||
$json_data.="\"q\":\"".$sql."\",";
|
||||
$db->query($sql);
|
||||
if($tid>0){
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='n' where zsh<>'".($this_zsh)."' ");
|
||||
}else{
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='n' where zsh<>'".($this_zsh)."'");
|
||||
}
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
break;
|
||||
case "tb_search":
|
||||
$w2=$tmpl_m5_pic_width;
|
||||
$h2=$tmpl_m5_pic_height;
|
||||
$arr_ksh=explode(",",$wanted_kh);
|
||||
//默认展厅后新添加自定义推送的单款
|
||||
$sql="select * from ".$table_pre."kh where no='".$arr_ksh[0]."'";
|
||||
$str="";
|
||||
$str_dk="";
|
||||
$msg=get_db_msg($sql);
|
||||
if($msg['id']>0){
|
||||
if($msg["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$msg["kh_dj"]);
|
||||
}
|
||||
//取得搜索结果的款号图片
|
||||
if($arr_ksh[1]){
|
||||
$pic=get_kh_color_picture($msg["no"],$arr_ksh[1]);
|
||||
}else{
|
||||
$pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"],$flag_pad_offline);
|
||||
}
|
||||
//单款信息拼接
|
||||
$str.=$msg["id"].",".get_kh_xh($msg).",".$msg["no"].",".$arr_ksh[1].",".$msg["price"].",".$pic.",".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2));
|
||||
$tmpwh=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_dk.="{\"khid\":\"".$msg["id"]."\",\"xh\":\"".get_kh_xh($msg)."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$arr_ksh[1]."\",\"colort\":\"".get_cate_title_no("color",$arr_ksh[1])."\",\"price\":\"".$msg["price"]."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($tmpwh[0]).",\"pic_h\":".deel_num($tmpwh[1])."},";
|
||||
}
|
||||
$str_dk=substr($str_dk,0,-1);
|
||||
$json_data.="\"arr_dk\":[".$str_dk."],";
|
||||
//------------------------------
|
||||
break;
|
||||
case "tb_search_dp":
|
||||
$w2=$tmpl_m5_pic_width;
|
||||
$h2=$tmpl_m5_pic_height;
|
||||
if($s_zsh){
|
||||
$dph=$s_zsh;
|
||||
}
|
||||
$arr_ksh=explode(",",$wanted_kh);
|
||||
//默认展厅后新添加自定义推送的单款
|
||||
$query="select * from ".$table_pre."kh_dp where zsh='".$dph."'";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$str="";
|
||||
$str_dp="";
|
||||
$dp_pic="";
|
||||
while($msg1=$db->fetch_array($res)){
|
||||
$dp_pic=$msg1["pic"];
|
||||
$msg=get_db_msg("select * from ".$table_pre."kh where no='".$msg1["kh"]."' ");
|
||||
if($msg["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$msg["kh_dj"]);
|
||||
}
|
||||
//取得搜索结果的款号图片
|
||||
$pic=get_kh_color_picture($msg["no"],$msg1["color"]);
|
||||
//单款信息拼接
|
||||
//$str.=$msg["id"].",".get_kh_xh($msg).",".$msg["no"].",".$arr_ksh[1].",".$msg["price"].",".$pic.",".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2));
|
||||
$tmpwh=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_dp.="{\"khid\":\"".$msg["id"]."\",\"xh\":\"".get_kh_xh($msg)."\",\"kh\":\"".$msg["no"]."\",\"color\":\"".$msg1["color"]."\",\"colort\":\"".get_cate_title_no("color",$msg1["color"])."\",\"price\":\"".$msg["price"]."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($tmpwh[0]).",\"pic_h\":".deel_num($tmpwh[1])."},";
|
||||
}
|
||||
$str_dp=substr($str_dp,0,-1);
|
||||
$json_data.="\"arr_dk\":[".$str_dp."],";
|
||||
//------------------------------
|
||||
break;
|
||||
case "tb_pre":
|
||||
//设置上一组同步
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_zblist where is_show='y' group by zsh order by zsh+1 desc limit 0,1");
|
||||
if($tmp["zsh"]>0){
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_zblist where zsh<'".$tmp["zsh"]."' group by zsh order by zsh+1 desc limit 0,1");
|
||||
}else{
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_zblist group by zsh order by zsh+1 limit 0,1");
|
||||
}
|
||||
if($tmp1["zsh"]){
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='y' where zsh='".$tmp1["zsh"]."'");
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='n' where zsh<>'".$tmp1["zsh"]."' and is_show='y'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="n";
|
||||
$json_data.="\"code\":0,";
|
||||
}
|
||||
break;
|
||||
case "tb_next":
|
||||
//设置下一组同步
|
||||
$tmp=get_db_msg("select zsh from ".$table_pre."kh_zblist where is_show='y' group by zsh order by zsh+1 desc limit 0,1");
|
||||
if($tmp["zsh"]>0){
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_zblist where zsh>'".$tmp["zsh"]."' group by zsh order by zsh+1 limit 0,1");
|
||||
}else{
|
||||
$tmp1=get_db_msg("select zsh from ".$table_pre."kh_zblist group by zsh order by zsh+1 limit 0,1");
|
||||
}
|
||||
if($tmp1["zsh"]){
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='y' where zsh='".$tmp1["zsh"]."'");
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='n' where zsh<>'".$tmp1["zsh"]."' and is_show='y'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="n";
|
||||
$json_data.="\"code\":0,";
|
||||
}
|
||||
break;
|
||||
case "tb_zsh":
|
||||
//设置特定展示号同步
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_zblist where zsh='".$zsh."' limit 0,1");
|
||||
if($tmp["id"]>0){
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='y' where zsh='".$zsh."'");
|
||||
$db->query("update ".$table_pre."kh_zblist set is_show='n' where zsh<>'".$zsh."' and is_show='y'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="n";
|
||||
$json_data.="\"code\":0,";
|
||||
}
|
||||
break;
|
||||
case "del_zsh":
|
||||
//删除特定展示组
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_zblist where zsh='".$zsh."' limit 0,1");
|
||||
if($tmp["id"]>0){
|
||||
$db->query("delete from ".$table_pre."kh_zblist where zsh='".$zsh."'");
|
||||
$str="y";
|
||||
$json_data.="\"code\":101,";
|
||||
}else{
|
||||
$str="不存在";
|
||||
$json_data.="\"code\":0,";
|
||||
$json_data.="\"msg\":\"不存在\",";
|
||||
}
|
||||
break;
|
||||
case "kh_color" :
|
||||
//
|
||||
$sql_con="";
|
||||
if($q){
|
||||
$sql_con.=" and no like '%".$q."%'";
|
||||
}
|
||||
//$json_data.="\"q\":\"".$q."\",";
|
||||
$query="select * from ".$table_pre."kh where id>0 ".$sql_con." order by no";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$data=array();
|
||||
$str_tmp="";
|
||||
$i=0;
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$color=explode(",",$msg["color"]);
|
||||
$colork=explode(",",$msg["color_ka"]);
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg)."\"},";
|
||||
foreach($color as $k => $v){
|
||||
if(!in_array($v,$colork)){
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg,$v)."\",\"color\":\"".$v."\",\"colort\":\"".get_cate_title_no("color",$v)."\"},";
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($str_tmp)."],";
|
||||
break;
|
||||
case "kh_color1" :
|
||||
//
|
||||
$sql_con="";
|
||||
if($q){
|
||||
$sql_con.=" and xh='".$q."'";
|
||||
}
|
||||
//$json_data.="\"q\":\"".$q."\",";
|
||||
$query="select * from ".$table_pre."kh where id>0 ".$sql_con." order by no";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$data=array();
|
||||
$str_tmp="";
|
||||
$i=0;
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$color=explode(",",$msg["color"]);
|
||||
$colork=explode(",",$msg["color_ka"]);
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg)."\"},";
|
||||
foreach($color as $k => $v){
|
||||
if(!in_array($v,$colork)){
|
||||
$str_tmp.="{\"id\":\"".$msg["id"]."\",\"no\":\"".$msg["no"]."\",\"xh\":\"".get_kh_xh($msg,$v)."\",\"color\":\"".$v."\",\"colort\":\"".get_cate_title_no("color",$v)."\"},";
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($str_tmp)."],";
|
||||
break;
|
||||
case "get_dph" :
|
||||
//
|
||||
$sql_con="";
|
||||
if($q){
|
||||
$sql_con.=" and zsh like '%".$q."%'";
|
||||
}
|
||||
$query="select DISTINCT zsh,title from ".$table_pre."kh_dp where id>0 ".$sql_con." order by zsh";
|
||||
//echo $query."<br>";
|
||||
$res=$db->query($query);
|
||||
$count=0;
|
||||
$data=array();
|
||||
$str_tmp="";
|
||||
$i=0;
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$str_tmp.="{\"zsh\":\"".$msg["zsh"]."\",\"title\":\"".$msg["title"]."\"},";
|
||||
$i++;
|
||||
}
|
||||
$json_data.="\"data\":[".deel_end($str_tmp)."],";
|
||||
break;
|
||||
case "client":
|
||||
$json_data.="\"s_online\":\"".$s_online."\",";
|
||||
$q1="select * from ".$table_pre."session where action like 'zbuser|%' and uid in (select id from web_client where face='4' and available='y')";
|
||||
$r1=$db->query($q1);
|
||||
$zxkh="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$zxkh.="'".$m1["uid"]."',";
|
||||
}
|
||||
$zxkh=deel_end($zxkh);
|
||||
|
||||
if($zxkh){
|
||||
$q1="select * from ".$table_pre."client where face='4' and available='y' and id not in (".$zxkh.")";
|
||||
}else{
|
||||
$q1="select * from ".$table_pre."client where face='4' and available='y'";
|
||||
}
|
||||
$r1=$db->query($q1);
|
||||
$bzxkh="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$bzxkh.="'".$m1["id"]."',";
|
||||
}
|
||||
$bzxkh=deel_end($bzxkh);
|
||||
|
||||
if($zxkh){
|
||||
$q1="select * from ".$table_pre."client where id in (".$zxkh.") order by path";
|
||||
$r1=$db->query($q1);
|
||||
$ct1=1;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tbyd.="<tr>";
|
||||
$tbyd.="<td>".$ct1."</td>";
|
||||
$qyt=get_qy_title($m1["path"]);
|
||||
$tbyd.="<td>".$qyt."</td>";
|
||||
$dlt=get_dl_title($m1["path"]);
|
||||
$tbyd.="<td>".$dlt."</td>";
|
||||
$tbyd.="<td>".$m1["title"]."</td>";
|
||||
$tbyd.="</tr>";
|
||||
$ct1++;
|
||||
}
|
||||
}else{
|
||||
$tbyd="";
|
||||
}
|
||||
|
||||
$q1="select * from ".$table_pre."client where id in (".$bzxkh.") order by path";
|
||||
//echo $bzxkh;
|
||||
$r1=$db->query($q1);
|
||||
$ct2=1;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tbwd.="<tr>";
|
||||
$tbwd.="<td>".$ct2."</td>";
|
||||
$qyt=get_qy_title($m1["path"]);
|
||||
$tbwd.="<td>".$qyt."</td>";
|
||||
$dlt=get_dl_title($m1["path"]);
|
||||
$tbwd.="<td>".$dlt."</td>";
|
||||
$tbwd.="<td>".$m1["title"]."</td>";
|
||||
$tbwd.="</tr>";
|
||||
$ct2++;
|
||||
}
|
||||
$tbyd="<span>在线客户</span><table width='100%' class='layui-table'><thead><tr><td>序号</td><td>区域</td><td>代理商</td><td>客户</td></tr></thead><tbody>".$tbyd."</tbody></table>";
|
||||
$tbwd="<span>未在线客户</span><table width='100%' class='layui-table'><thead><tr><td>序号</td><td>区域</td><td>代理商</td><td>客户</td></tr></thead><tbody>".$tbwd."</tbody></table>";
|
||||
$json_data.="\"tbyd\":\"".$tbyd."\",";
|
||||
$json_data.="\"tbwd\":\"".$tbwd."\",";
|
||||
break;
|
||||
case "zxmx":
|
||||
|
||||
$q="select * from ".$table_pre."client where face='4' and available='y'";
|
||||
$r=$db->query($q);
|
||||
$bzxkh="";
|
||||
$dps_all=$dps_zx=$dps_bzx=0;
|
||||
$arr_all=$arr_zx=$arr_bzx=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$sfzb=get_db_msg("select * from ".$table_pre."session where action like 'zbuser|%' and uid='".$m["id"]."'");
|
||||
$qyinfo=get_qy_info($m["path"]);
|
||||
$dlinfo=get_dl_info($m["path"]);
|
||||
if($sfzb["id"]){
|
||||
if($qyinfo["id"]){
|
||||
$arr_zx[$qyinfo["id"]][$dlinfo["id"]]["qyt"]=$qyinfo["title"]."(".$qyinfo["username"].")";
|
||||
}else{
|
||||
$arr_zx[$qyinfo["id"]][$dlinfo["id"]]["qyt"]="";
|
||||
}
|
||||
if($dlinfo["id"]){
|
||||
$arr_zx[$qyinfo["id"]][$dlinfo["id"]]["dlt"]=$dlinfo["title"]."(".$dlinfo["username"].")";
|
||||
}else{
|
||||
$arr_zx[$qyinfo["id"]][$dlinfo["id"]]["dlt"]="";
|
||||
}
|
||||
$arr_zx[$qyinfo["id"]][$dlinfo["id"]]["num"]++;
|
||||
$dps_zx++;
|
||||
}else{
|
||||
if($qyinfo["id"]){
|
||||
$arr_bzx[$qyinfo["id"]][$dlinfo["id"]]["qyt"]=$qyinfo["title"]."(".$qyinfo["username"].")";
|
||||
}else{
|
||||
$arr_bzx[$qyinfo["id"]][$dlinfo["id"]]["qyt"]="";
|
||||
}
|
||||
if($dlinfo["id"]){
|
||||
$arr_bzx[$qyinfo["id"]][$dlinfo["id"]]["dlt"]=$dlinfo["title"]."(".$dlinfo["username"].")";
|
||||
}else{
|
||||
$arr_bzx[$qyinfo["id"]][$dlinfo["id"]]["dlt"]="";
|
||||
}
|
||||
//$arr_bzx[$qyinfo["id"]][$dlinfo["id"]]["qyt"]=$qyinfo["title"]."(".$qyinfo["username"].")";
|
||||
//$arr_bzx[$qyinfo["id"]][$dlinfo["id"]]["dlt"]=$dlinfo["title"]."(".$dlinfo["username"].")";
|
||||
$arr_bzx[$qyinfo["id"]][$dlinfo["id"]]["num"]++;
|
||||
$dps_bzx++;
|
||||
}
|
||||
if($qyinfo["id"]){
|
||||
$arr_all[$qyinfo["id"]][$dlinfo["id"]]["qyt"]=$qyinfo["title"]."(".$qyinfo["username"].")";
|
||||
}else{
|
||||
$arr_all[$qyinfo["id"]][$dlinfo["id"]]["qyt"]="";
|
||||
}
|
||||
if($dlinfo["id"]){
|
||||
$arr_all[$qyinfo["id"]][$dlinfo["id"]]["dlt"]=$dlinfo["title"]."(".$dlinfo["username"].")";
|
||||
}else{
|
||||
$arr_all[$qyinfo["id"]][$dlinfo["id"]]["dlt"]="";
|
||||
}
|
||||
//$arr_all[$qyinfo["id"]][$dlinfo["id"]]["qyt"]=$qyinfo["title"]."(".$qyinfo["username"].")";
|
||||
//$arr_all[$qyinfo["id"]][$dlinfo["id"]]["dlt"]=$dlinfo["title"]."(".$dlinfo["username"].")";
|
||||
$arr_all[$qyinfo["id"]][$dlinfo["id"]]["num"]++;
|
||||
$dps_all++;
|
||||
}
|
||||
//print_r($arr_all);
|
||||
|
||||
$tb="";
|
||||
$xh=1;
|
||||
foreach($arr_all as $k1 => $v1){
|
||||
foreach($v1 as $k2 => $v2){
|
||||
$tb.="<tr>";
|
||||
$tb.="<td>".$xh."</td>";
|
||||
$tb.="<td>".$v2["qyt"]."</td>";
|
||||
$tb.="<td>".$v2["dlt"]."</td>";
|
||||
$tb.="<td>".$v2["num"]."</td>";
|
||||
if(!$k1){
|
||||
$qyid=0;
|
||||
}else{
|
||||
$qyid=$k1;
|
||||
}
|
||||
if(!$k2){
|
||||
$dlid=0;
|
||||
}else{
|
||||
$dlid=$k2;
|
||||
}
|
||||
$tb.="<td onclick='openzx(".$qyid.",".$dlid.")'>".$arr_zx[$k1][$k2]["num"]."</td>";
|
||||
$tb.="<td onclick='openbzx(".$qyid.",".$dlid.")'>".$arr_bzx[$k1][$k2]["num"]."</td>";
|
||||
$tb.="</tr>";
|
||||
$xh++;
|
||||
}
|
||||
}
|
||||
|
||||
$tb="<table width='100%' class='layui-table'><thead><tr><td>序号</td><td>区域</td><td>代理商</td><td>店铺数</td><td>在线店铺数量</td><td>未在线店铺数</td></tr></thead><tbody>".$tb."</tbody><tfoot><tr><td colspan='3'>合计</td><td>".$dps_all."</td><td>".$dps_zx."</td><td>".$dps_bzx."</td></tr></tfoot></table>";
|
||||
|
||||
$json_data.="\"tb\":\"".$tb."\",";
|
||||
break;
|
||||
case "zxbb":
|
||||
if($dlid!=0){
|
||||
$dl=get_db_msg("select * from ".$table_pre."client where id='".$dlid."'");
|
||||
$dlcon=" and (path='".$dl["path"]."-".$dl["id"]."' or path like '".$dl["path"]."-".$dl["id"]."%')";
|
||||
}else{
|
||||
|
||||
|
||||
if($qyid!=0){
|
||||
$qy=get_db_msg("select * from ".$table_pre."client where id='".$qyid."'");
|
||||
$qycon=" and (path='".$qy["path"]."-".$qy["id"]."' or path like '".$qy["path"]."-".$qy["id"]."%')";
|
||||
$q1="select * from ".$table_pre."client where face='4' and available='y'".$qycon."";
|
||||
}else{
|
||||
$q1="select * from ".$table_pre."client where face='4' and available='y'";
|
||||
}
|
||||
$tmpdl="";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$dlt=get_dl_title($m1["path"]);
|
||||
if(!$dlt){
|
||||
if($qyid!=0){
|
||||
$tmpdl.="'".$m1["id"]."',";
|
||||
}else{
|
||||
$qyt=get_qy_title($m1["path"]);
|
||||
if(!$qyt){
|
||||
$tmpdl.="'".$m1["id"]."',";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($tmpdl){
|
||||
$dlcon=" and id in (".deel_end($tmpdl).")";
|
||||
}else{
|
||||
$dlcon=" and id=0";
|
||||
}
|
||||
}
|
||||
|
||||
$q1="select * from ".$table_pre."session where action like 'zbuser|%' and uid in (select id from web_client where face='4' and available='y'".$dlcon.")";
|
||||
$r1=$db->query($q1);
|
||||
$zxkh="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$zxkh.="'".$m1["uid"]."',";
|
||||
}
|
||||
$zxkh=deel_end($zxkh);
|
||||
|
||||
if($zxkh){
|
||||
$q1="select * from ".$table_pre."client where face='4' and available='y' and id not in (".$zxkh.")".$dlcon."";
|
||||
}else{
|
||||
$q1="select * from ".$table_pre."client where face='4' and available='y'".$dlcon."";
|
||||
}
|
||||
$r1=$db->query($q1);
|
||||
$bzxkh="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$bzxkh.="'".$m1["id"]."',";
|
||||
}
|
||||
$bzxkh=deel_end($bzxkh);
|
||||
|
||||
$json_data.="\"dlcon\":\"".$dlcon."\",";
|
||||
$json_data.="\"bzxkh\":\"".$bzxkh."\",";
|
||||
$json_data.="\"zxkh\":\"".$zxkh."\",";
|
||||
|
||||
if($zxkh){
|
||||
$q1="select * from ".$table_pre."client where id in (".$zxkh.")".$dlcon." order by path";
|
||||
$r1=$db->query($q1);
|
||||
$ct1=1;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tbyd.="<tr>";
|
||||
$tbyd.="<td>".$ct1."</td>";
|
||||
$qyt=get_qy_title($m1["path"]);
|
||||
$tbyd.="<td>".$qyt."</td>";
|
||||
$dlt=get_dl_title($m1["path"]);
|
||||
$tbyd.="<td>".$dlt."</td>";
|
||||
$tbyd.="<td>".$m1["title"]."</td>";
|
||||
$tbyd.="</tr>";
|
||||
$ct1++;
|
||||
}
|
||||
}else{
|
||||
$tbyd="";
|
||||
}
|
||||
|
||||
if($bzxkh){
|
||||
$q1="select * from ".$table_pre."client where id in (".$bzxkh.")".$dlcon." order by path";
|
||||
//echo $bzxkh;
|
||||
$r1=$db->query($q1);
|
||||
$ct2=1;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$tbwd.="<tr>";
|
||||
$tbwd.="<td>".$ct2."</td>";
|
||||
$qyt=get_qy_title($m1["path"]);
|
||||
$tbwd.="<td>".$qyt."</td>";
|
||||
$dlt=get_dl_title($m1["path"]);
|
||||
$tbwd.="<td>".$dlt."</td>";
|
||||
$tbwd.="<td>".$m1["title"]."</td>";
|
||||
$tbwd.="</tr>";
|
||||
$ct2++;
|
||||
}
|
||||
}else{
|
||||
$tbwd="";
|
||||
}
|
||||
$tbyd="<span>在线客户</span><table width='100%' class='layui-table'><thead><tr><td>序号</td><td>区域</td><td>代理商</td><td>客户</td></tr></thead><tbody>".$tbyd."</tbody></table>";
|
||||
$tbwd="<span>未在线客户</span><table width='100%' class='layui-table'><thead><tr><td>序号</td><td>区域</td><td>代理商</td><td>客户</td></tr></thead><tbody>".$tbwd."</tbody></table>";
|
||||
$json_data.="\"tbyd\":\"".$tbyd."\",";
|
||||
$json_data.="\"tbwd\":\"".$tbwd."\",";
|
||||
break;
|
||||
case "pj":
|
||||
$q1="select * from ".$table_pre."client_pj where khid='".$khid."'";
|
||||
$r1=$db->query($q1);
|
||||
$ct1=1;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$client=get_db_msg("select * from web_client where id='".$m1["cid"]."'");
|
||||
$tbyd.="<tr>";
|
||||
$tbyd.="<td>".$ct1."</td>";
|
||||
$tbyd.="<td>".$client["title"]."</td>";
|
||||
$tbyd.="<td>".$m1["race"]."星</td>";
|
||||
$tbyd.="<td>".$m1["remark"]."</td>";
|
||||
$tbyd.="</tr>";
|
||||
$ct1++;
|
||||
}
|
||||
$tbyd="<table width='100%' class='layui-table'><thead><tr><td>序号</td><td>客户</td><td>评价星级</td><td>评价内容</td></tr></thead><tbody>".$tbyd."</tbody></table>";
|
||||
$json_data.="\"tbyd\":\"".$tbyd."\",";
|
||||
break;
|
||||
default:
|
||||
//----------------------------同步
|
||||
$w2=$tmpl_m5_pic_width;
|
||||
$h2=$tmpl_m5_pic_height;
|
||||
/*if($s_tid){
|
||||
$tid=$s_tid;
|
||||
}
|
||||
//取得默认展厅
|
||||
$tmp=get_db_msg("select id from ".$table_pre."kh_zblist_t limit 0,1");
|
||||
$tid=$tid?$tid:$tmp["id"];
|
||||
if($tid){
|
||||
$tid_con="";
|
||||
}else{
|
||||
$tid_con='';
|
||||
}
|
||||
$json_data.="\"tid\":\"".$tid."\",";
|
||||
$q1="select * from ".$table_pre."kh_zblist_t ";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tid="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tid.="{\"no\":\"".$m1["id"]."\",\"value\":\"".$m1["title"]."\"},";
|
||||
}
|
||||
$arr_tid=deel_end($arr_tid);
|
||||
$json_data.="\"zt\":[".$arr_tid."],";*/
|
||||
//
|
||||
//$m=get_db_msg("select zsh,pic from ".$table_pre."kh_zblist where is_show='y' group by zsh order by zsh+1 desc limit 0,1");
|
||||
$m=get_db_msg("select zsh from ".$table_pre."kh_zblist where is_show='y' ".$tid_con." group by zsh order by zsh+1 desc limit 0,1");
|
||||
//$json_data.="\"q\":\"select zsh,pic from ".$table_pre."kh_zblist where is_show='y' ".$tid_con." group by zsh order by zsh+1 desc limit 0,1\",";
|
||||
if($m["zsh"]){
|
||||
//$str=$m["zsh"]."||";
|
||||
$json_data.="\"zsh\":\"".$m["zsh"]."\",";
|
||||
//图片
|
||||
$pic1="";
|
||||
if(trim($m["pic"])){
|
||||
$pic1=get_picture($m["pic"],$flag_pad_offline);
|
||||
if(!$pic1){
|
||||
$pic1="images/no_pic.png";
|
||||
}
|
||||
//$str.=$pic1."|".str_replace("\"","'",out_good_pic_set($pic1,$tmpl_m5_cl_pic_width,$tmpl_m5_cl_pic_height));
|
||||
$tmpwh=out_good_pic_set_arr($pic1,$tmpl_m5_cl_pic_width,$tmpl_m5_cl_pic_height);
|
||||
$json_data.="\"pic\":\"".$pic1."\",";
|
||||
$json_data.="\"pic_w\":".deel_num($tmpwh[0]).",";
|
||||
$json_data.="\"pic_h\":".deel_num($tmpwh[1]).",";
|
||||
}
|
||||
//$str.="||";
|
||||
//$query="select kh from ".$table_pre."kh_zblist where zsh='".$m["zsh"]."' order by ord";
|
||||
$query="select kh,color from ".$table_pre."kh_zblist where zsh='".$m["zsh"]."' ".$tid_con." order by ord";
|
||||
$res=$db->query($query);
|
||||
$style_title_color=get_set("style_title_color");
|
||||
$ka_color=get_set("ka_color");
|
||||
//$str.="var arr_content=[";
|
||||
$str_arr_content="";
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where no='".$msg["kh"]."'");
|
||||
if($m_kh["ka"]=="y"){
|
||||
$c=$ka_color;
|
||||
}else{
|
||||
$c=get_set_value_dote($style_title_color,$m_kh["kh_dj"]);
|
||||
}
|
||||
if($msg["kh"]){
|
||||
//图片获取规则
|
||||
if($msg["color"]){
|
||||
$pic=get_kh_color_picture($m_kh["no"],$msg["color"]);
|
||||
$con_color_tmp=" and color='".$msg["color"]."'";
|
||||
$color_str=",".$msg["color"];
|
||||
}else{
|
||||
$pic=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"],$flag_pad_offline);
|
||||
$con_color_tmp="";
|
||||
$color_str="";
|
||||
}
|
||||
$n1=0;
|
||||
//----取得评价
|
||||
$tmp=get_db_msg("select sum(race) 'num' from ".$table_pre."client_pj where khid='".$m_kh["id"]."' ");
|
||||
$pj_num=add_0($tmp["num"]);
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client_pj where khid='".$m_kh["id"]."' ");
|
||||
$pj_clients=add_0($tmp["num"]);
|
||||
//----取得订单
|
||||
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where no='".$msg["kh"]."' and _key='".$_key."'".$con_color_tmp);
|
||||
$order_num=add_0($tmp["num"]);
|
||||
$tmp=get_db_msg("select count(distinct uid) 'num' from ".$table_pre."order where no='".$msg["kh"]."' and _key='".$_key."'".$con_color_tmp);
|
||||
$order_clients=add_0($tmp["num"]);
|
||||
//
|
||||
$ppf=$pj_clients>0?keep_float($pj_num/$pj_clients,1):0;
|
||||
//$str.="".$m_kh["id"].",\"".get_kh_xh($m_kh,$msg["color"])."\",\"".$m_kh["no"].$color_str."\",".deel_num($m_kh["price"]).",\"".$pic."\",\"".str_replace("\"","'",out_good_pic_set($pic,$w2,$h2))."\",".$n1.",\"".$c."\",\"".$order_num."|".$order_clients."|".$ppf."|".$pj_clients."\",";
|
||||
|
||||
$tmpwh=out_good_pic_set_arr($pic,$w2,$h2);
|
||||
$str_arr_content.="{\"khid\":\"".$m_kh["id"]."\",\"xh\":\"".get_kh_xh($m_kh,$msg["color"])."\",\"kh\":\"".$m_kh["no"]."\",\"color\":\"".$msg["color"]."\",\"colort\":\"".get_cate_title_no("color",$msg["color"])."\",\"price\":\"".deel_num($m_kh["price"])."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($tmpwh[0]).",\"pic_h\":".deel_num($tmpwh[1]).",\"num\":".$n1.",\"style_color\":\"".$c."\",\"order_num\":".$order_num.",\"order_clients\":\"".$order_clients."\",\"ppf\":\"".$ppf."\",\"pj_clients\":\"".$pj_clients."\"},";
|
||||
}
|
||||
}
|
||||
//$str.="]||";
|
||||
$str_arr_content=substr($str_arr_content,0,-1);
|
||||
$json_data.="\"tsz\":[".$str_arr_content."],";
|
||||
}else{
|
||||
//$str="0||pic||kh||";
|
||||
$json_data.="\"msg\":\"暂无数据\",";
|
||||
}
|
||||
//--------------------------候选
|
||||
$this_zsh=$m["zsh"]>0?$m["zsh"]:0;
|
||||
$arr_zsh1=array();
|
||||
$q1="select zsh from ".$table_pre."kh_zblist where zsh<".$this_zsh." group by zsh order by zsh+1 desc limit 0,2";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zsh1[]=$m1["zsh"];
|
||||
}
|
||||
$arr_zsh2=array();
|
||||
$q1="select zsh from ".$table_pre."kh_zblist where zsh>".$this_zsh." group by zsh order by zsh+1 limit 0,2";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_zsh2[]=$m1["zsh"];
|
||||
}
|
||||
if(count($arr_zsh1)<2 && count($arr_zsh2)<2){
|
||||
$query="select zsh,title from ".$table_pre."kh_zblist group by zsh order by zsh";
|
||||
}else if(count($arr_zsh1)<2){
|
||||
if($arr_zsh1[0]>0)
|
||||
$query="select zsh,title from ".$table_pre."kh_zblist where zsh>='".$arr_zsh1[0]."' group by zsh order by zsh+1 limit 0,5";
|
||||
else
|
||||
$query="select zsh,title from ".$table_pre."kh_zblist group by zsh order by zsh+1 limit 0,5";
|
||||
}else if(count($arr_zsh2)<2){
|
||||
if($arr_zsh2[0]>0)
|
||||
$q1="select count(distinct zsh) 'num' from ".$table_pre."kh_zblist where zsh<='".$arr_zsh2[0]."'";
|
||||
else
|
||||
$q1="select count(distinct zsh) 'num' from ".$table_pre."kh_zblist ";
|
||||
$m1=get_db_msg($q1);
|
||||
$limit_s=($m1["num"]-5)>0?($m1["num"]-5):0;
|
||||
if($arr_zsh2[0]>0)
|
||||
$query="select zsh,title from ".$table_pre."kh_zblist where zsh<='".$arr_zsh2[0]."' group by zsh order by zsh+1 limit ".$limit_s.",5";
|
||||
else
|
||||
$query="select zsh,title from ".$table_pre."kh_zblist group by zsh order by zsh+1 limit ".$limit_s.",5";
|
||||
}else{
|
||||
$query="select zsh,title from ".$table_pre."kh_zblist where zsh>='".$arr_zsh1[1]."' group by zsh order by zsh+1 limit 0,5";
|
||||
}
|
||||
//echo $query."--<br>";
|
||||
$re=$db->query($query);
|
||||
//$str.="arr_content_yl=[";
|
||||
$arr_content_yl="";
|
||||
while($rows=$db->fetch_array($re)){
|
||||
$arr_tmp=array();
|
||||
$tmp=get_db_msg("select count(distinct kh,color) 'num' from ".$table_pre."kh_zblist where zsh='".$rows['zsh']."' ");
|
||||
$r=$db->query("select * from ".$table_pre."kh_zblist where zsh='".$rows['zsh']."' ");
|
||||
$i=0;
|
||||
while($m1=$db->fetch_array($r)){
|
||||
$arr_tmp[$i]['title']=$m1['title'];
|
||||
$arr_tmp[$i]['pic']=$m1['pic'];
|
||||
$arr_tmp[$i]['kh']=$m1['kh'];
|
||||
$arr_tmp[$i]['color']=$m1['color'];
|
||||
$i++;
|
||||
}
|
||||
$pic="";
|
||||
$pic_w=$pic_h=0;
|
||||
$tmp2=get_db_msg("select * from ".$table_pre."kh where no='".$arr_tmp[0]["kh"]."' limit 0,1");
|
||||
if($rows['pic']!=""){
|
||||
//$rows['pic']=str_replace("\"","'",out_good_pic("../attachments/".$rows['pic'],110,110));
|
||||
$pic="../attachments/".$rows['pic'];
|
||||
$ck=out_good_pic_set_arr($pic,110,110);
|
||||
$pic_w=$ck[0];
|
||||
$pic_h=$ck[1];
|
||||
}
|
||||
if($rows['pic']==""){
|
||||
//$rows['pic']="";
|
||||
$pic="images/no_pic.png";
|
||||
//$pic="";
|
||||
$pic_w=110;
|
||||
$pic_h=110;
|
||||
}
|
||||
|
||||
//if($tmp['num']==1 && $rows['pic']==""){
|
||||
if($arr_tmp[0]["color"]){
|
||||
//$rows['pic']=str_replace("\"","'",out_good_pic(get_kh_color_picture($tmp2["no"],$arr_tmp[0]["color"]),110,110));
|
||||
$pic=get_kh_color_picture($tmp2["no"],$arr_tmp[0]["color"]);
|
||||
$ck=out_good_pic_set_arr($pic,110,110);
|
||||
$pic_w=$ck[0];
|
||||
$pic_h=$ck[1];
|
||||
}else{
|
||||
//$rows['pic']=str_replace("\"","'",out_good_pic(get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"]),110,110));
|
||||
$pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"]);
|
||||
$ck=out_good_pic_set_arr($pic,110,110);
|
||||
$pic_w=$ck[0];
|
||||
$pic_h=$ck[1];
|
||||
}
|
||||
//}
|
||||
$info="<br>";
|
||||
foreach($arr_tmp as $key => $value){
|
||||
$tmp=get_db_msg("select no from ".$table_pre."kh where no='".$value["kh"]."'");
|
||||
$info.=$tmp['no'];
|
||||
if ($value['color']) {
|
||||
$info.=",".$value['color'];
|
||||
}else{
|
||||
$info.="";
|
||||
}
|
||||
$info.="<br>";
|
||||
}
|
||||
|
||||
//$str.="\"".$rows['zsh']."-".$rows['pic']."-".$info;
|
||||
//$str.="\",";
|
||||
$arr_content_yl.="{\"tsh\":\"".$rows['zsh']."\",\"title\":\"".$rows['title']."\",\"pic\":\"".$pic."\",\"pic_w\":".deel_num($pic_w).",\"pic_h\":".deel_num($pic_h).",\"info\":\"".$info."\"},";
|
||||
}
|
||||
$arr_content_yl=substr($arr_content_yl,0,-1);
|
||||
$json_data.="\"zjs\":[".$arr_content_yl."],";
|
||||
//$str=substr($str, 0, -1);
|
||||
//$str.="]";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
|
||||
//取得上级区域
|
||||
function get_qy_title($path){
|
||||
global $db,$table_pre;
|
||||
$arr_path=explode("-",$path);
|
||||
for($i=count($arr_path)-1;$i>=0;$i--){
|
||||
if($arr_path[$i]>0){
|
||||
$m1=get_db_msg("select id,face,title from ".$table_pre."client where id='".$arr_path[$i]."'");
|
||||
if($m1["face"]=="9"){
|
||||
return $m1["title"];
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
//取得上级代理
|
||||
function get_dl_title($path){
|
||||
global $db,$table_pre;
|
||||
$arr_path=explode("-",$path);
|
||||
for($i=count($arr_path)-1;$i>=0;$i--){
|
||||
if($arr_path[$i]>0){
|
||||
$m1=get_db_msg("select id,face,title from ".$table_pre."client where id='".$arr_path[$i]."'");
|
||||
if($m1["face"]=="3"){
|
||||
return $m1["title"];
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
//取得上级区域
|
||||
function get_qy_info($path){
|
||||
global $db,$table_pre;
|
||||
$arr_path=explode("-",$path);
|
||||
for($i=count($arr_path)-1;$i>=0;$i--){
|
||||
if($arr_path[$i]>0){
|
||||
$m1=get_db_msg("select id,face,title,username from ".$table_pre."client where id='".$arr_path[$i]."'");
|
||||
if($m1["face"]=="9"){
|
||||
return $m1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
//取得上级代理
|
||||
function get_dl_info($path){
|
||||
global $db,$table_pre;
|
||||
$arr_path=explode("-",$path);
|
||||
for($i=count($arr_path)-1;$i>=0;$i--){
|
||||
if($arr_path[$i]>0){
|
||||
$m1=get_db_msg("select id,face,title,username from ".$table_pre."client where id='".$arr_path[$i]."'");
|
||||
if($m1["face"]=="3"){
|
||||
return $m1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
function second2duration($seconds)
|
||||
{
|
||||
$duration = '';
|
||||
|
||||
$seconds = (int) $seconds;
|
||||
if ($seconds <= 0) {
|
||||
return $duration;
|
||||
}
|
||||
|
||||
list($day, $hour, $minute, $second) = explode(' ', gmstrftime('%j %H %M %S', $seconds));
|
||||
|
||||
$day -= 1;
|
||||
if ($day > 0) {
|
||||
$duration .= (int) $day.'d';
|
||||
}
|
||||
if ($hour > 0) {
|
||||
$duration .= (int) $hour.':';
|
||||
}
|
||||
if ($minute > 0) {
|
||||
$duration .= (int) $minute.':';
|
||||
}
|
||||
if ($second > 0) {
|
||||
$duration .= (int) $second;
|
||||
}else{
|
||||
$duration .= '00';
|
||||
}
|
||||
|
||||
return $duration;
|
||||
}
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
$json_data="{";
|
||||
if(THIS_IN!="edt_ipad")
|
||||
exit("错误的访问!");
|
||||
$uid=check_cookie_jxs();
|
||||
$tmp_client=get_db_msg("select * from web_client where id='".$uid."'");
|
||||
$tmp_issy=get_db_msg("select * from web_set where _k='is_sy'");
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
$json_data.="\"is_sy\":\"".$tmp_issy["_v"]."\",";
|
||||
$json_data.="\"username\":\"".$tmp_client["username"]."\",";
|
||||
$json_data.="\"face\":\"".$tmp_client["face"]."\",";
|
||||
$json_data.="\"appzbconfig\":\"".$Appzbconfig."\",";
|
||||
$strzd="";
|
||||
foreach($arr_zbxs as $n => $t){
|
||||
$strzd.="{\"no\":\"".$n."\",\"title\":\"".$t."\"},";
|
||||
}
|
||||
$json_data.="\"arr_zbxs\":[".deel_end($strzd)."],";
|
||||
|
||||
switch($_a){
|
||||
case "get_khlist":
|
||||
$title="";
|
||||
$count=0;
|
||||
$str_kh="";
|
||||
$sql="select * from web_kh_zblist where is_show='y' order by ord";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$tmp2=get_db_msg("select * from web_kh where no='".$msg["kh"]."' limit 0,1");
|
||||
|
||||
$tmp_pj=get_db_msg("select * from web_client_pj where cid='".$uid."' and khid='".$tmp2["id"]."'");
|
||||
$tmp_zpj=get_db_msg("select sum(race) race from web_client_pj where khid='".$tmp2["id"]."'");
|
||||
|
||||
|
||||
if($msg["color"]){
|
||||
$tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."' and color='".$msg["color"]."'");
|
||||
$tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and color='".$msg["color"]."' and uid='".$uid."'");
|
||||
$pic=get_kh_color_picture($tmp2["no"],$msg["color"],$flag_pad_offline);
|
||||
}else{
|
||||
$tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."'");
|
||||
$tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and uid='".$uid."'");
|
||||
//图片获取规则
|
||||
$pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"],$flag_pad_offline);
|
||||
}
|
||||
$ck=out_good_pic_set_arr($pic,120,120);
|
||||
$str_kh.="{\"khid\":\"".$tmp2["id"]."\",\"no\":\"".$tmp2["no"]."\",\"color\":\"".get_cate_title_no('color',$msg["color"])."\",\"colorno\":\"".$msg["color"]."\",\"imgurl\":\"".$pic."\",\"js\":\"".$tmp["js"]."\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"xj\":\"".$tmp_pj["race"]."\",\"zxj\":\"".$tmp_zpj["race"]."\",\"khs\":\"".$tmp_khs["khs"]."\",\"zjs\":\"".$tmp_khs["js"]."\"},";
|
||||
$count++;
|
||||
$title=$msg["title"];
|
||||
}
|
||||
if($str_kh)
|
||||
$str_kh=substr($str_kh,0,-1);
|
||||
|
||||
$tmp_total=get_db_msg("select sum(num) 'js',sum(je) 'je' from web_order where uid='".$uid."' and ka<>'y'");
|
||||
$json_data.="\"khlist\":[".$str_kh."],";
|
||||
|
||||
$wcl=deel_bfb1($tmp_total["je"],$tmp_client["zb"]*10000);
|
||||
|
||||
$json_data.="\"code\":\"200\",\"msg\":\"\",\"is_living\":\"y\",\"ydjs\":\"".$tmp_total["js"]."\",\"ydje\":\"".$tmp_total["je"]."\",\"wcl\":\"".$wcl."\",\"khnum\":\"".$count."\",\"title\":\"".$title."\",";
|
||||
break;
|
||||
case "get_khlist1":
|
||||
$title="";
|
||||
$count=0;
|
||||
$str_kh="";
|
||||
$sql="select * from web_kh_zblist where is_show='y' order by ord";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$tmp2=get_db_msg("select * from web_kh where no='".$msg["kh"]."' limit 0,1");
|
||||
|
||||
$tmp_pj=get_db_msg("select * from web_client_pj where cid='".$uid."' and khid='".$tmp2["id"]."'");
|
||||
$tmp_zpj=get_db_msg("select sum(race) race from web_client_pj where khid='".$tmp2["id"]."'");
|
||||
|
||||
|
||||
if($msg["color"]){
|
||||
$tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."' and color='".$msg["color"]."'");
|
||||
$tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and color='".$msg["color"]."' and uid='".$uid."'");
|
||||
$pic=get_kh_color_picture($tmp2["no"],$msg["color"],$flag_pad_offline);
|
||||
}else{
|
||||
$tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."'");
|
||||
$tmp=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and uid='".$uid."'");
|
||||
//图片获取规则
|
||||
$pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"],$flag_pad_offline);
|
||||
}
|
||||
$ck=out_good_pic_set_arr($pic,120,120);
|
||||
$str_kh.="{\"khid\":\"".$tmp2["id"]."\",\"colorno\":\"".$msg["color"]."\",\"js\":\"".$tmp["js"]."\",\"xj\":\"".$tmp_pj["race"]."\",\"zxj\":\"".$tmp_zpj["race"]."\",\"khs\":\"".$tmp_khs["khs"]."\",\"zjs\":\"".$tmp_khs["js"]."\"},";
|
||||
$count++;
|
||||
$title=$msg["title"];
|
||||
}
|
||||
if($str_kh)
|
||||
$str_kh=substr($str_kh,0,-1);
|
||||
|
||||
$tmp_total=get_db_msg("select sum(num) 'js',sum(je) 'je' from web_order where uid='".$uid."' and ka<>'y'");
|
||||
$json_data.="\"khlist\":[".$str_kh."],";
|
||||
|
||||
$wcl=deel_bfb1($tmp_total["je"],$tmp_client["zb"]*10000);
|
||||
|
||||
$json_data.="\"ydjs\":\"".$tmp_total["js"]."\",\"ydje\":\"".$tmp_total["je"]."\",\"wcl\":\"".$wcl."\",\"khnum\":\"".$count."\",";
|
||||
break;
|
||||
case "get_userlist":
|
||||
/***
|
||||
$str_userlist="";
|
||||
$sql_userlist="select uid from web_session where action like 'zbuser|%' order by lastactivity desc";
|
||||
$res_userlist=$db->query($sql_userlist);
|
||||
while($msg_userlist=$db->fetch_array($res_userlist)){
|
||||
$tmp_uid=get_db_msg("select title from web_client where id='".$msg_userlist["uid"]."'");
|
||||
$str_userlist.="{\"id\":\"".$msg_userlist["uid"]."\",\"title\":\"".$tmp_uid["title"]."\",\"icon\":\"\"},";
|
||||
}
|
||||
if($str_userlist)
|
||||
$str_userlist=substr($str_userlist,0,-1);
|
||||
|
||||
$json_data.="\"usersList\":[".$str_userlist."],";
|
||||
$json_data.="\"code\":\"200\",\"msg\":\"\",";
|
||||
***/
|
||||
$tmp_userlist=get_db_msg("select count(distinct uid) 'num' from web_session where action like 'zbuser|%'");
|
||||
$json_data.="\"usersListNum\":\"".$tmp_userlist["num"]."\",";
|
||||
$json_data.="\"code\":\"200\",\"msg\":\"\",";
|
||||
|
||||
break;
|
||||
case "lookvideo":
|
||||
$tmp=get_db_msg("select * from web_video_num where vid='".$id."' and uid='".$uid."'");
|
||||
if(!$tmp["id"]){
|
||||
$db->query("insert into web_video_num(vid,uid) values('".$id."','".$uid."')");
|
||||
}
|
||||
$json_data.="\"code\":\"200\",\"msg\":\"\",";
|
||||
break;
|
||||
case "get_pullurl":
|
||||
$tmp=get_db_msg("select * from web_zb where state='y' limit 0,1");
|
||||
$arr_pull=explode("spanspan",$tmp["pull_url"]);
|
||||
if($tmp["id"]){
|
||||
$json_data.="\"pull_url\":\"".$arr_pull[0]."\",";
|
||||
$json_data.="\"pull_url2\":\"".$arr_pull[1]."\",";
|
||||
$json_data.="\"pull_url3\":\"".$arr_pull[2]."\",";
|
||||
$json_data.="\"pull_url4\":\"".$arr_pull[3]."\",";
|
||||
}else{
|
||||
$json_data.="\"pull_url\":\"".$sys_pull_url."\",";
|
||||
$json_data.="\"pull_url2\":\"".$sys_pull_url."\",";
|
||||
$json_data.="\"pull_url3\":\"".$sys_pull_url."\",";
|
||||
$json_data.="\"pull_url4\":\"".$sys_pull_url."\",";
|
||||
}
|
||||
$json_data.="\"code\":\"200\",\"msg\":\"\",";
|
||||
break;
|
||||
default:
|
||||
require_once '../admin/include/video.php';
|
||||
$videoObj = new AliyunVideo(); //实例化阿里云对象
|
||||
$tmp=get_db_msg("select * from web_zb where state='y' limit 0,1");
|
||||
$arr_pull=explode("spanspan",$tmp["pull_url"]);
|
||||
if($tmp["id"]){
|
||||
$json_data.="\"pull_url\":\"".$arr_pull[0]."\",";
|
||||
$json_data.="\"pull_url2\":\"".$arr_pull[1]."\",";
|
||||
$json_data.="\"pull_url3\":\"".$arr_pull[2]."\",";
|
||||
$json_data.="\"pull_url4\":\"".$arr_pull[3]."\",";
|
||||
}else{
|
||||
$json_data.="\"pull_url\":\"".$sys_pull_url."\",";
|
||||
$json_data.="\"pull_url2\":\"".$sys_pull_url."\",";
|
||||
$json_data.="\"pull_url3\":\"".$sys_pull_url."\",";
|
||||
$json_data.="\"pull_url4\":\"".$sys_pull_url."\",";
|
||||
}
|
||||
//封面
|
||||
$json_data.="\"cover_img\":\"".$tmp["cover_img"]."\",";
|
||||
//提示时间
|
||||
if($tmp["zb_date"]>0){
|
||||
$json_data.="\"cover_text\":\"".date("Y-m-d H:i:s",$tmp["zb_date"])."\",";
|
||||
$json_data.="\"cover_text_time\":\"".$tmp["zb_date"]."\",";
|
||||
}else{
|
||||
$json_data.="\"cover_text\":\"\",";
|
||||
$json_data.="\"cover_text_time\":\"\",";
|
||||
}
|
||||
|
||||
//
|
||||
/***
|
||||
$str_userlist="";
|
||||
$sql_userlist="select uid from web_session where action like 'zbuser|%' order by lastactivity desc";
|
||||
$res_userlist=$db->query($sql_userlist);
|
||||
while($msg_userlist=$db->fetch_array($res_userlist)){
|
||||
$tmp_uid=get_db_msg("select title from web_client where id='".$msg_userlist["uid"]."'");
|
||||
$str_userlist.="{\"id\":\"".$msg_userlist["uid"]."\",\"title\":\"".$tmp_uid["title"]."\",\"icon\":\"\"},";
|
||||
}
|
||||
if($str_userlist)
|
||||
$str_userlist=substr($str_userlist,0,-1);
|
||||
$json_data.="\"usersList\":[".$str_userlist."],";
|
||||
***/
|
||||
//
|
||||
$count=0;
|
||||
$str_kh="";
|
||||
$sql="select * from web_kh_zblist where is_show='y' order by ord";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$tmp2=get_db_msg("select * from web_kh where no='".$msg["kh"]."' limit 0,1");
|
||||
$tmp_pj=get_db_msg("select * from web_client_pj where cid='".$uid."' and khid='".$tmp2["id"]."'");
|
||||
$tmp_zpj=get_db_msg("select sum(race) race from web_client_pj where khid='".$tmp2["id"]."'");
|
||||
|
||||
if($msg["color"]){
|
||||
$tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."' and color='".$msg["color"]."'");
|
||||
$tmp3=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and color='".$msg["color"]."' and uid='".$uid."'");
|
||||
$pic=get_kh_color_picture($tmp2["no"],$msg["color"],$flag_pad_offline);
|
||||
}else{
|
||||
$tmp_khs=get_db_msg("select count(DISTINCT uid) khs,sum(num) js from web_order where iid='".$tmp2["id"]."'");
|
||||
$tmp3=get_db_msg("select sum(num) 'js' from web_order where no='".$msg["kh"]."' and uid='".$uid."'");
|
||||
//图片获取规则
|
||||
$pic=get_kh_picture($tmp2["no"],$tmp2["main_pic"],$tmp2["color"],$flag_pad_offline);
|
||||
}
|
||||
$ck=out_good_pic_set_arr($pic,120,120);
|
||||
$str_kh.="{\"khid\":\"".$tmp2["id"]."\",\"no\":\"".$tmp2["no"]."\",\"color\":\"".get_cate_title_no('color',$msg["color"])."\",\"colorno\":\"".$msg["color"]."\",\"imgurl\":\"".$pic."\",\"js\":\"".$tmp3["js"]."\",\"pic_w\":\"".$ck[0]."\",\"pic_h\":\"".$ck[1]."\",\"xj\":\"".$tmp_pj["race"]."\",\"zxj\":\"".$tmp_zpj["race"]."\",\"khs\":\"".$tmp_khs["khs"]."\",\"zjs\":\"".$tmp_khs["js"]."\"},";
|
||||
$count++;
|
||||
}
|
||||
if($str_kh)
|
||||
$str_kh=substr($str_kh,0,-1);
|
||||
$json_data.="\"khlist\":[".$str_kh."],\"khnum\":\"".$count."\",";
|
||||
|
||||
//
|
||||
$tmp_userlist=get_db_msg("select count(distinct uid) 'num' from web_session where action like 'zbuser|%'");
|
||||
$json_data.="\"usersListNum\":\"".$tmp_userlist["num"]."\",";
|
||||
//
|
||||
$str_videoslist="";
|
||||
$sql_videoslist="select * from web_video where cate='直播录像'";
|
||||
$res_videoslist=$db->query($sql_videoslist);
|
||||
while($msg_videoslist=$db->fetch_array($res_videoslist)){
|
||||
$tmp_videonum=get_db_msg("select count(*) 'num' from web_video_num where vid='".$msg_videoslist["id"]."'");
|
||||
$video_time=second2duration($msg_videoslist["duration"]);
|
||||
|
||||
if(substr($msg_videoslist["vid_net"],-5)==".m3u8"){
|
||||
$video_url1=substr($msg_videoslist["vid_net"],0,-5).".m3u8";
|
||||
$video_url2=substr($msg_videoslist["vid_net"],0,-5).".m3u8";
|
||||
$str_videoslist.="{\"id\":\"".$msg_videoslist["id"]."\",\"video_url1\":\"".$video_url1."\",\"video_url2\":\"".$video_url2."\",\"pic\":\"http://47.99.153.58/edt/hcb/attachments/design/mini/12W0101_91.jpg\",\"title1\":\"".$msg_videoslist["vtitle"]."\",\"title2\":\"\",\"aliyun\":\"y\",\"duration\":\"".$video_time."\",\"views\":\"".$tmp_videonum["num"]."\"},";
|
||||
}else{
|
||||
if($msg_videoslist["vid_net"]!=""){
|
||||
$iofo=$videoObj ->get_play_info($msg_videoslist["vid_net"]);
|
||||
$iofo=json_decode( json_encode($iofo),true);
|
||||
//print_r($iofo);
|
||||
$vurl=$iofo["PlayInfoList"]["PlayInfo"][0]["PlayURL"];
|
||||
$vDuration=$iofo["PlayInfoList"]["PlayInfo"][0]["Duration"];
|
||||
$str_videoslist.="{\"id\":\"".$msg_videoslist["id"]."\",\"video_url1\":\"".$vurl."\",\"video_url2\":\"".$vurl."\",\"pic\":\"http://47.99.153.58/edt/hcb/attachments/design/mini/12W0101_91.jpg\",\"title1\":\"".$msg_videoslist["vtitle"]."\",\"title2\":\"\",\"aliyun\":\"n\",\"duration\":\"".$vDuration."\",\"views\":\"".$tmp_videonum["num"]."\"},";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($str_videoslist)
|
||||
$str_videoslist=substr($str_videoslist,0,-1);
|
||||
$json_data.="\"videosList\":[".$str_videoslist."],";
|
||||
$json_data.="\"code\":\"200\",\"msg\":\"\",";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,428 @@
|
||||
<?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."'");
|
||||
$is_sy=get_set("is_sy");
|
||||
$upath=$msg_login["path"]."-".$uid;
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
$json_data.="\"face\":\"".$msg_login["face"]."\",";
|
||||
$json_data.="\"is_sy\":\"".$is_sy."\",";
|
||||
$json_data.="\"username\":\"".$msg_login["username"]."\",";
|
||||
switch($_a){
|
||||
case "init":
|
||||
$tmp=get_db_msg("select * from web_zdb_map where username='".$msg_login["username"]."'");
|
||||
$json_data.="\"client_title\":\"".$msg_login["title"]."\",";
|
||||
$json_data.="\"client_dplx\":\"".$tmp["dplx"]."\",";
|
||||
$json_data.="\"zdb_zd1\":\"".$tmp["address"]."\",";
|
||||
$json_data.="\"zdb_zd2\":\"".$tmp["xj"]."\",";
|
||||
$json_data.="\"zdb_zd3\":\"".$tmp["hzyf"]."\",";
|
||||
//地图
|
||||
$picname2=$tmp["qytitle"]?iconv("UTF-8","GB2312//IGNORE","../attachments/zdb/".$tmp["qytitle"].".jpg"):"../attachments/zdb/no_pic.png";
|
||||
$picname=$tmp["qytitle"]?"../attachments/zdb/".$tmp["qytitle"].".jpg":"../attachments/zdb/no_pic.png";
|
||||
if(!file_exists($picname2)){
|
||||
$picname="../attachments/zdb/no_pic.png";
|
||||
}
|
||||
$json_data.="\"client_map\":\"".$picname."\",";
|
||||
|
||||
//
|
||||
$str1="";
|
||||
$sql1="select pl from web_zdb_ls_je group by pl order by pl";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$str1.="{\"no\":\"".$msg1["pl"]."\",\"title\":\"".$msg1["pl"]."\"},";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
//
|
||||
$arr_xse=array("je"=>"销售额","js"=>"销售量");
|
||||
foreach($arr_xse as $key => $val){
|
||||
$str2.="{\"no\":\"".$key."\",\"title\":\"".$val."\"},";
|
||||
}
|
||||
if($str2)
|
||||
$str2=substr($str2,0,-1);
|
||||
//
|
||||
$ct=3;
|
||||
$str3="";
|
||||
$sql3="select title from web_zdb_config group by title order by id";
|
||||
$res3=$db->query($sql3);
|
||||
while($msg3=$db->fetch_array($res3)){
|
||||
$str3.="{\"no\":\"".$ct."\",\"title\":\"".$msg3["title"]."\"},";
|
||||
$ct++;
|
||||
}
|
||||
if($str3)
|
||||
$str3=substr($str3,0,-1);
|
||||
|
||||
$json_data.="\"lscxk\":{\"cxe_options\":[".$str2."],\"pl_options\":[".$str1."]},";
|
||||
$json_data.="\"dpxg_menu\":[".$str3."],";
|
||||
break;
|
||||
|
||||
case "get_lscxk":
|
||||
if($xseVal=="je"){
|
||||
$table1.=" web_zdb_ls_je ";
|
||||
}else if($xseVal=="js"){
|
||||
$table1.=" web_zdb_ls_js ";
|
||||
}else{
|
||||
$table1.=" web_zdb_ls_je ";
|
||||
}
|
||||
|
||||
$con="";
|
||||
if($plVal){
|
||||
$con.=" pl='".$plVal."' and ";
|
||||
}
|
||||
if($con)
|
||||
$con=" where ".substr($con,0,-4);
|
||||
|
||||
$ct=0;
|
||||
$str1="";
|
||||
$sql1="select * from ".$table1.$con." order by id limit 0,2";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$mouthL="";
|
||||
if($msg1["m1"])
|
||||
$mouthL.="{\"title\":\"1月\",\"val\":\"".$msg1["m1"]."\"},";
|
||||
if($msg1["m2"])
|
||||
$mouthL.="{\"title\":\"2月\",\"val\":\"".$msg1["m2"]."\"},";
|
||||
if($msg1["m3"])
|
||||
$mouthL.="{\"title\":\"3月\",\"val\":\"".$msg1["m3"]."\"},";
|
||||
if($msg1["m4"])
|
||||
$mouthL.="{\"title\":\"4月\",\"val\":\"".$msg1["m4"]."\"},";
|
||||
if($msg1["m5"])
|
||||
$mouthL.="{\"title\":\"5月\",\"val\":\"".$msg1["m5"]."\"},";
|
||||
if($msg1["m6"])
|
||||
$mouthL.="{\"title\":\"6月\",\"val\":\"".$msg1["m6"]."\"},";
|
||||
if($msg1["m7"])
|
||||
$mouthL.="{\"title\":\"7月\",\"val\":\"".$msg1["m7"]."\"},";
|
||||
if($msg1["m8"])
|
||||
$mouthL.="{\"title\":\"8月\",\"val\":\"".$msg1["m8"]."\"},";
|
||||
if($msg1["m9"])
|
||||
$mouthL.="{\"title\":\"9月\",\"val\":\"".$msg1["m9"]."\"},";
|
||||
if($msg1["m10"])
|
||||
$mouthL.="{\"title\":\"10月\",\"val\":\"".$msg1["m10"]."\"},";
|
||||
if($msg1["m11"])
|
||||
$mouthL.="{\"title\":\"11月\",\"val\":\"".$msg1["m11"]."\"},";
|
||||
if($msg1["m12"])
|
||||
$mouthL.="{\"title\":\"12月\",\"val\":\"".$msg1["m12"]."\"},";
|
||||
if($mouthL)
|
||||
$mouthL=deel_end($mouthL);
|
||||
$xszl=$msg1["m1"]+$msg1["m2"]+$msg1["m3"]+$msg1["m4"]+$msg1["m5"]+$msg1["m6"]+$msg1["m7"]+$msg1["m8"]+$msg1["m9"]+$msg1["m10"]+$msg1["m11"]+$msg1["m12"];
|
||||
$mouthmax=max($msg1["m1"],$msg1["m2"],$msg1["m3"],$msg1["m4"],$msg1["m5"],$msg1["m6"],$msg1["m7"],$msg1["m8"],$msg1["m9"],$msg1["m10"],$msg1["m11"],$msg1["m12"]);
|
||||
//
|
||||
$str1.="{";
|
||||
$str1.="\"id\":\"".$msg1["id"]."\",";
|
||||
$str1.="\"kh\":\"".$msg1["kh"]."\",";
|
||||
$str1.="\"pl\":\"".$msg1["pl"]."\",";
|
||||
$str1.="\"price\":\"".$msg1["price"]."\",";
|
||||
$str1.="\"ph\":\"".$msg1["ph"]."\",";
|
||||
$str1.="\"xsje_zb\":\"".$msg1["xsje_zb"]."\",";
|
||||
$str1.="\"xsje\":\"".$msg1["xsje"]."\",";
|
||||
$str1.="\"ljxsje_zb\":\"".$msg1["ljxsje_zb"]."\",";
|
||||
$str1.="\"zfs\":\"".$msg1["zfs"]."\",";
|
||||
$str1.="\"dzl\":\"".$msg1["dzl"]."\",";
|
||||
$str1.="\"mouthlist\":[".$mouthL."],";
|
||||
$str1.="\"mouthmax\":\"".$mouthmax."\",";
|
||||
$str1.="\"xszl\":\"".$xszl."\"";
|
||||
$str1.="},";
|
||||
|
||||
$ct++;
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
|
||||
if($ct===0){
|
||||
$str1="";
|
||||
}else if($ct==1){
|
||||
$str1="{\"id\":\"-1\"},".$str1.",{\"id\":\"-1\"}";
|
||||
}else{
|
||||
$str1="{\"id\":\"-1\"},".$str1;
|
||||
}
|
||||
|
||||
$json_data.="\"cxk_list\":[".$str1."],";
|
||||
break;
|
||||
|
||||
case "get_lscxk_id":
|
||||
if($xseVal=="je"){
|
||||
$table1.=" web_zdb_ls_je ";
|
||||
}else if($xseVal=="js"){
|
||||
$table1.=" web_zdb_ls_js ";
|
||||
}else{
|
||||
$table1.=" web_zdb_ls_je ";
|
||||
}
|
||||
|
||||
$con="";
|
||||
if($plVal){
|
||||
$con.=" pl='".$plVal."' and ";
|
||||
}
|
||||
if($direction=="prev"){
|
||||
//上一款
|
||||
$tmp=get_db_msg("select * from ".$table1." where ".$con." id<'".$lsid."' order by id desc limit 0,1");
|
||||
$zid=$tmp["id"]>0?$tmp["id"]:"-1";
|
||||
}else{
|
||||
//下一款
|
||||
$tmp=get_db_msg("select * from ".$table1." where ".$con." id>'".$lsid."' order by id limit 0,1");
|
||||
$zid=$tmp["id"]>0?$tmp["id"]:"-1";
|
||||
}
|
||||
//
|
||||
$mouthL="";
|
||||
if($tmp["m1"])
|
||||
$mouthL.="{\"title\":\"1月\",\"val\":\"".$tmp["m1"]."\"},";
|
||||
if($tmp["m2"])
|
||||
$mouthL.="{\"title\":\"2月\",\"val\":\"".$tmp["m2"]."\"},";
|
||||
if($tmp["m3"])
|
||||
$mouthL.="{\"title\":\"3月\",\"val\":\"".$tmp["m3"]."\"},";
|
||||
if($tmp["m4"])
|
||||
$mouthL.="{\"title\":\"4月\",\"val\":\"".$tmp["m4"]."\"},";
|
||||
if($tmp["m5"])
|
||||
$mouthL.="{\"title\":\"5月\",\"val\":\"".$tmp["m5"]."\"},";
|
||||
if($tmp["m6"])
|
||||
$mouthL.="{\"title\":\"6月\",\"val\":\"".$tmp["m6"]."\"},";
|
||||
if($tmp["m7"])
|
||||
$mouthL.="{\"title\":\"7月\",\"val\":\"".$tmp["m7"]."\"},";
|
||||
if($tmp["m8"])
|
||||
$mouthL.="{\"title\":\"8月\",\"val\":\"".$tmp["m8"]."\"},";
|
||||
if($tmp["m9"])
|
||||
$mouthL.="{\"title\":\"9月\",\"val\":\"".$tmp["m9"]."\"},";
|
||||
if($tmp["m10"])
|
||||
$mouthL.="{\"title\":\"10月\",\"val\":\"".$tmp["m10"]."\"},";
|
||||
if($tmp["m11"])
|
||||
$mouthL.="{\"title\":\"11月\",\"val\":\"".$tmp["m11"]."\"},";
|
||||
if($tmp["m12"])
|
||||
$mouthL.="{\"title\":\"12月\",\"val\":\"".$tmp["m12"]."\"},";
|
||||
if($mouthL)
|
||||
$mouthL=deel_end($mouthL);
|
||||
$xszl=$tmp["m1"]+$tmp["m2"]+$tmp["m3"]+$tmp["m4"]+$tmp["m5"]+$tmp["m6"]+$tmp["m7"]+$tmp["m8"]+$tmp["m9"]+$tmp["m10"]+$tmp["m11"]+$tmp["m12"];
|
||||
$mouthmax=max($tmp["m1"],$tmp["m2"],$tmp["m3"],$tmp["m4"],$tmp["m5"],$tmp["m6"],$tmp["m7"],$tmp["m8"],$tmp["m9"],$tmp["m10"],$tmp["m11"],$tmp["m12"]);
|
||||
|
||||
$str1="{\"id\":\"".$zid."\",\"kh\":\"".$tmp["kh"]."\",\"pl\":\"".$tmp["pl"]."\",\"price\":\"".$tmp["price"]."\",\"ph\":\"".$tmp["ph"]."\",\"xsje_zb\":\"".$tmp["xsje_zb"]."\",\"xsje\":\"".$tmp["xsje"]."\",\"ljxsje_zb\":\"".$tmp["ljxsje_zb"]."\",\"zfs\":\"".$tmp["zfs"]."\",\"dzl\":\"".$tmp["dzl"]."\",\"mouthlist\":[".$mouthL."],\"mouthmax\":\"".$mouthmax."\",\"xszl\":\"".$xszl."\"}";
|
||||
|
||||
$json_data.="\"cxk_detail\":[".$str1."],";
|
||||
break;
|
||||
|
||||
case "get_dpxg1":
|
||||
$str1="";
|
||||
$sql1="select name from web_zdb_dpxg where title='".$title."' group by name";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$ct=1;
|
||||
$str2="";
|
||||
$sql2="select xdata,ydata from web_zdb_dpxg where title='".$title."' and name='".$msg1["name"]."' order by xdata";
|
||||
$res2=$db->query($sql2);
|
||||
while($msg2=$db->fetch_array($res2)){
|
||||
$str2.="{\"no\":\"".$ct."\",\"title\":\"".$msg2["xdata"]."\",\"value\":\"".$msg2["ydata"]."\"},";
|
||||
$ct++;
|
||||
}
|
||||
$str1.="{\"no\":\"1\",\"title\":\"".$msg1["name"]."\",\"content\":[".substr($str2,0,-1)."]},";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
$json_data.="\"data\":[".$str1."],";
|
||||
break;
|
||||
|
||||
case "get_dpxg2":
|
||||
$str1="";
|
||||
$sql1="select * from web_zdb_dpxg where title='".$title."'";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$str1.="{\"name\": \"".$msg1["name"]."\",\"xAxis\":\"".$msg1["xdata"]."\",\"yAxis\":\"".$msg1["ydata"]."\"},";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
$json_data.="\"data\":[".$str1."],";
|
||||
break;
|
||||
|
||||
case "get_dpxg_select":
|
||||
$str1="";
|
||||
$sql1="select * from web_zdb_config where title='".$title."'";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$str1.="{\"id\":\"".$msg1["id"]."\",\"title\": \"".$msg1["title2"]."\",\"tbcate\":\"".$msg1["tb_cate"]."\"},";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
$json_data.="\"data\":[".$str1."],";
|
||||
break;
|
||||
|
||||
case "get_dpxg_other":
|
||||
if($tbcate=="line"){
|
||||
$str1="";
|
||||
$sql1="select name from web_zdb_dpxg where title='".$title."' and title2='".$title2."' group by name";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$ct=1;
|
||||
$str2="";
|
||||
$sql2="select xdata,ydata from web_zdb_dpxg where title='".$title."' and title2='".$title2."' and name='".$msg1["name"]."' order by xdata";
|
||||
$res2=$db->query($sql2);
|
||||
while($msg2=$db->fetch_array($res2)){
|
||||
$str2.="{\"no\":\"".$ct."\",\"title\":\"".$msg2["xdata"]."\",\"value\":\"".$msg2["ydata"]."\"},";
|
||||
$ct++;
|
||||
}
|
||||
$str1.="{\"no\":\"1\",\"title\":\"".$msg1["name"]."\",\"content\":[".substr($str2,0,-1)."]},";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
$json_data.="\"data\":[".$str1."],";
|
||||
}else if($tbcate=="markArea"){
|
||||
$str1="";
|
||||
$sql1="select * from web_zdb_dpxg where title='".$title."' and title2='".$title2."'";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$str1.="{\"name\": \"".$msg1["name"]."\",\"xAxis\":\"".$msg1["xdata"]."\",\"yAxis\":\"".$msg1["ydata"]."\"},";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
$json_data.="\"data\":[".$str1."],";
|
||||
}else if($tbcate=="bar" || $tbcate=="pie"){
|
||||
$str1="";
|
||||
$sql1="select * from web_zdb_dpxg where title='".$title."' and title2='".$title2."'";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$str1.="{\"title\": \"".$msg1["xdata"]."\", \"value\": \"".$msg1["ydata"]."\"},";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
$json_data.="\"data\":[".$str1."],";
|
||||
}else if($tbcate=="barmore"){
|
||||
//
|
||||
$str4="";
|
||||
$arr4=array();
|
||||
$sql4="select name from web_zdb_dpxg where title='".$title."' and title2='".$title2."' group by name";
|
||||
$res4=$db->query($sql4);
|
||||
while($msg4=$db->fetch_array($res4)){
|
||||
$str4.="\"".$msg4["name"]."\",";
|
||||
$arr4[]=$msg4["name"];
|
||||
}
|
||||
|
||||
$str1="";
|
||||
$sql1="select xdata from web_zdb_dpxg where title='".$title."' and title2='".$title2."' group by xdata";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$str2="";
|
||||
for($i=0;$i<count($arr4);$i++){
|
||||
$tmp=get_db_msg("select ydata from web_zdb_dpxg where title='".$title."' and title2='".$title2."' and name='".$arr4[$i]."' and xdata='".$msg1["xdata"]."' limit 0,1");
|
||||
$str2.=",\"".$arr4[$i]."\":\"".$tmp["ydata"]."\"";
|
||||
}
|
||||
$str1.="{\"product\":\"".$msg1["xdata"]."\"".$str2."},";
|
||||
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
|
||||
$json_data.="\"data\":{\"dimensions\":[".substr($str4,0,-1)."],\"dataList\":[".$str1."]},";
|
||||
|
||||
|
||||
}else if($tbcate=="shadow"){
|
||||
//
|
||||
$str4="";
|
||||
$arr4=array();
|
||||
$sql4="select xdata from web_zdb_dpxg where title='".$title."' and title2='".$title2."' group by xdata";
|
||||
$res4=$db->query($sql4);
|
||||
while($msg4=$db->fetch_array($res4)){
|
||||
$str4.="\"".$msg4["xdata"]."\",";
|
||||
$arr4[]=$msg4["xdata"];
|
||||
}
|
||||
|
||||
$str1="";
|
||||
$str3="";
|
||||
$sql1="select name from web_zdb_dpxg where title='".$title."' and title2='".$title2."' group by name";
|
||||
$res1=$db->query($sql1);
|
||||
while($msg1=$db->fetch_array($res1)){
|
||||
$str2="";
|
||||
for($i=0;$i<count($arr4);$i++){
|
||||
$tmp=get_db_msg("select ydata from web_zdb_dpxg where title='".$title."' and title2='".$title2."' and name='".$msg1["name"]."' and xdata='".$arr4[$i]."' limit 0,1");
|
||||
$str2.="\"".$tmp["ydata"]."\",";
|
||||
}
|
||||
$str1.="{\"name\":\"".$msg1["name"]."\",\"type\": \"bar\",\"stack\":\"总量\",\"label\": {\"show\": true,\"position\": \"insideRight\"},\"data\":[".substr($str2,0,-1)."]},";
|
||||
$str3.="\"".$msg1["name"]."\",";
|
||||
}
|
||||
if($str1)
|
||||
$str1=substr($str1,0,-1);
|
||||
|
||||
$json_data.="\"data\":{\"legend\":[".substr($str3,0,-1)."],\"xList\":[".substr($str4,0,-1)."],\"dataList\":[".$str1."]},";
|
||||
}
|
||||
break;
|
||||
//获取订单数量
|
||||
case "get_order_num":
|
||||
if($clienID=="" || $khid ==""){
|
||||
$json_data.="\"code\":\"-1\",\"msg\":\"参数不完整\",";
|
||||
}else{
|
||||
$tmp=get_db_msg("select sum(num) 'js' from web_order where uid='".$clienID."' and iid='".$khid."' and color='".$khcolor."' and _key='".$_key."'");
|
||||
$totaljs=$tmp["js"]?$tmp["js"]:0;
|
||||
$json_data.="\"code\":\"1\",\"msg\":\"success\",\"js\":\"".$totaljs."\",";
|
||||
}
|
||||
break;
|
||||
|
||||
//理想订货方案--陈列
|
||||
case "lxdh":
|
||||
$khzd1="bc";
|
||||
$khzd2="season";
|
||||
$khzd3="sxz";
|
||||
$order_session=get_set("order_session");
|
||||
if($direction=="next"){
|
||||
$tmp=get_db_msg("select * from web_kh_cl where zsh>".$zsh." order by zsh limit 0,1");
|
||||
}else if($direction=="prev"){
|
||||
$tmp=get_db_msg("select * from web_kh_cl where zsh<".$zsh." order by zsh desc limit 0,1");
|
||||
}else{
|
||||
$tmp=get_db_msg("select * from web_kh_cl order by zsh limit 0,1");
|
||||
}
|
||||
$this_zsh=$tmp["zsh"]?$tmp["zsh"]:"-1";
|
||||
$str1="";
|
||||
if($this_zsh=="-1"){
|
||||
$str1.="\"zsh\":\"-1\"";
|
||||
}else{
|
||||
$clpic=get_kh_cl_big($tmp["pic"],$flag_pad_offline);
|
||||
$tmppic=out_good_pic_set_arr($clpic,400,300);
|
||||
$str1.="\"zsh\":\"".$this_zsh."\",";
|
||||
$str1.="\"pic\":\"".$clpic."\",";
|
||||
$str1.="\"pic_w\":\"".$tmppic[0]."\",";
|
||||
$str1.="\"pic_h\":\"".$tmppic[1]."\",";
|
||||
$str1.="\"pic_remark\":\"".$tmp["remark"]."\",";
|
||||
//
|
||||
$str2="";
|
||||
$sql="select * from web_kh_cl where zsh='".$this_zsh."' group by kh,color order by ord";
|
||||
$res=$db->query($sql);
|
||||
while($msg=$db->fetch_array($res)){
|
||||
$tmp_kh=get_db_msg("select * from web_kh where no='".$msg["kh"]."'");
|
||||
$tmp_zdb_yc=get_db_msg("select * from web_zdb_yc where no='".$msg["kh"]."' and color='".$msg["color"]."'");
|
||||
$tmp_order=get_db_msg("select sum(num) 'js' from web_order where uid='".$uid."' and no='".$msg["kh"]."' and color='".$msg["color"]."' and ka<>'y' and _key='".$_key."'");
|
||||
|
||||
$pic=get_kh_color_picture($msg["kh"],$msg["color"],$flag_pad_offline);
|
||||
$tmppic=out_good_pic_set_arr($pic,100,100);
|
||||
$str2.="{";
|
||||
$str2.="\"khid\":\"".$tmp_kh["id"]."\",";
|
||||
$str2.="\"pic\":\"".$pic."\",";
|
||||
$str2.="\"pic_w\":\"".$tmppic[0]."\",";
|
||||
$str2.="\"pic_h\":\"".$tmppic[1]."\",";
|
||||
$str2.="\"kh\":\"".$msg["kh"]."\",";
|
||||
$str2.="\"pl\":\"".get_cate_title_no("category",$tmp_kh["category"])."\",";
|
||||
$str2.="\"khzd1\":\"".get_cate_title_no($khzd1,$tmp_kh[$khzd1])."\",";
|
||||
$str2.="\"khzd2\":\"".get_cate_title_no($khzd2,$tmp_kh[$khzd2])."\",";
|
||||
$str2.="\"khzd3\":\"".get_cate_title_no($khzd3,$tmp_kh[$khzd3])."\",";
|
||||
$str2.="\"color\":\"".$msg["color"]."\",";
|
||||
$str2.="\"remark\":\"".get_cate_title_no("color",$msg["color"])."\",";
|
||||
$str2.="\"ycgxd\":\"".$tmp_zdb_yc["ycgxd"]."\",";
|
||||
$str2.="\"tjdhl\":\"".$tmp_zdb_yc["tjdhl"]."\",";
|
||||
$str2.="\"tjdhl1\":\"".$tmp_zdb_yc["tjdhl1"]."\",";
|
||||
$str2.="\"zd1\":\"".$tmp_zdb_yc["zd1"]."\",";
|
||||
$str2.="\"zd2\":\"".$tmp_zdb_yc["zd2"]."\",";
|
||||
$str2.="\"zd3\":\"".$tmp_zdb_yc["zd3"]."\",";
|
||||
$str2.="\"zd4\":\"".$tmp_zdb_yc["zd4"]."\",";
|
||||
$str2.="\"zd5\":\"".$tmp_zdb_yc["zd5"]."\",";
|
||||
$str2.="\"zd6\":\"".$tmp_zdb_yc["zd6"]."\",";
|
||||
$str2.="\"zd7\":\"".$tmp_zdb_yc["zd7"]."\",";
|
||||
$str2.="\"zd8\":\"".$tmp_zdb_yc["zd8"]."\",";
|
||||
$str2.="\"zd9\":\"".$tmp_zdb_yc["zd9"]."\",";
|
||||
$str2.="\"zd10\":\"".$tmp_zdb_yc["zd10"]."\",";
|
||||
$str2.="\"ydjs\":\"".$tmp_order["js"]."\"";
|
||||
$str2.="},";
|
||||
}
|
||||
$str1.="\"dks\":[".substr($str2,0,-1)."]";
|
||||
}
|
||||
$json_data.="\"cldata\":{".$str1."},";
|
||||
break;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,677 @@
|
||||
<?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_cl_my_pic_width="110";
|
||||
$tmpl_cl_my_pic_height="110";
|
||||
$order_session=get_set("order_session");
|
||||
$default_gan_js=1;
|
||||
$json_data.="\"uid\":\"".$uid."\",";
|
||||
switch($_a){
|
||||
case "smll":
|
||||
$arr_yc_old=explode(",",$str_yc_old);
|
||||
$arr_bxk_old=explode(",",$str_bxk_old);
|
||||
//----------------------------------------扫描录入
|
||||
//取得本陈列mb参数
|
||||
$arr_this_mb=array();
|
||||
for($i=0;$i<count($sys_zycl_mb);$i++){
|
||||
$tmp=explode("|",$sys_zycl_mb[$i]);
|
||||
$tmp1=explode(",",$tmp[0]);
|
||||
if($tmp1[0]==$mb){
|
||||
$arr_this_mb=explode("|",$sys_zycl_mb[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
$arr_this_wzh=explode(",",$arr_this_mb[1]);
|
||||
$content="<form name='form_smll' action='./?_m=zycl' method='post'><input type=\"hidden\" name=\"_a\" value=\"smll_sub\"><input type=\"hidden\" name=\"mb\" value=\"".$mb."\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"center\">";
|
||||
$content.="<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr>";
|
||||
for($i=0;$i<count($arr_this_wzh);$i++){
|
||||
//取得已穿数据
|
||||
$tmp_ks="";
|
||||
for($j=0;$j<count($arr_yc_old);$j++){
|
||||
$arr1=explode("|",$arr_yc_old[$j]);
|
||||
if($arr1[0]==$arr_this_wzh[$i]){
|
||||
$tmp_ks.=str_replace("&",",",$arr1[5])."\n";
|
||||
}
|
||||
}
|
||||
$content.="<td><span style=\"font-size:14px;font-weight:bold;\">".$arr_this_wzh[$i]."</span><br><textarea id=\"wz_".$arr_this_wzh[$i]."\" name=\"wz_".$arr_this_wzh[$i]."\" style=\"width:150px;\" rows=\"35\">".$tmp_ks."</textarea></td>";
|
||||
}
|
||||
//备选款
|
||||
$tmp_ks="";
|
||||
for($j=0;$j<count($arr_bxk_old);$j++){
|
||||
$arr1=explode("|",$arr_bxk_old[$j]);
|
||||
if($arr1[3])
|
||||
$tmp_ks.=str_replace("&",",",$arr1[3])."\n";
|
||||
}
|
||||
$content.="<td><span style=\"font-size:14px;font-weight:bold;\">备选款</span><br><textarea id=\"bxk\" name=\"bxk\" style=\"width:150px;\" rows=\"35\">".$tmp_ks."</textarea></td>";
|
||||
$content.="</tr></table></td></tr>";
|
||||
$content.="<tr><td align=\"center\" height=\"40\"><input type=\"image\" src=\"images/button_gray_yl.png\" style=\"width:90px;height:30px;\"></td></tr></table></form>";
|
||||
echo $content;
|
||||
exit;
|
||||
break;
|
||||
case "smll_sub":
|
||||
//取得本陈列mb参数
|
||||
$arr_this_mb=array();
|
||||
for($i=0;$i<count($sys_zycl_mb);$i++){
|
||||
$tmp=explode("|",$sys_zycl_mb[$i]);
|
||||
$tmp1=explode(",",$tmp[0]);
|
||||
if($tmp1[0]==$mb){
|
||||
$arr_this_mb=explode("|",$sys_zycl_mb[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
$arr_this_wzh=explode(",",$arr_this_mb[1]);
|
||||
$arr_this_num_limit=explode(",",$arr_this_mb[4]);
|
||||
//验证
|
||||
$str_yc=$wrong_msg="";
|
||||
$num_gan=0;
|
||||
for($i=0,$ord=1;$i<count($arr_this_wzh);$i++){
|
||||
$v1="wz_".$arr_this_wzh[$i];
|
||||
$v2="gan_num_".$arr_this_wzh[$i];
|
||||
$v3="arr_wz_".$arr_this_wzh[$i];
|
||||
$$v1=trim($$v1);
|
||||
$arr_ks=array();
|
||||
$arr_dress_level=array();
|
||||
if($$v1){
|
||||
$arr_tmp=explode("\n",$$v1);
|
||||
for($j=0;$j<count($arr_tmp);$j++){
|
||||
if(trim($arr_tmp[$j])){
|
||||
$arr_tmp1=explode(",",trim($arr_tmp[$j]));
|
||||
$kh=$arr_tmp1[0];
|
||||
$color=$arr_tmp1[1];
|
||||
$m=get_db_msg("select * from ".$table_pre."kh_cl_pic where kh='".$kh."' and color='".$color."'");
|
||||
if($m["id"]>0){
|
||||
//取得dress_level
|
||||
$tmp=get_db_msg("select dress_level from ".$table_pre."kh where no='".$m["kh"]."'");
|
||||
$is_pic_z1=$is_pic_z2=$is_pic_c="n";
|
||||
$pic_z1="../attachments/zycl/".$sys_zycl_pic_path_zen1."/".trim($m["pic"]).".png";
|
||||
if(is_file($pic_z1))
|
||||
$is_pic_z1="y";
|
||||
$pic_z2="../attachments/zycl/".$sys_zycl_pic_path_zen2."/".trim($m["pic"]).".png";
|
||||
if(is_file($pic_z2))
|
||||
$is_pic_z2="y";
|
||||
$pic_c="../attachments/zycl/".$sys_zycl_pic_path_gan."/".trim($m["pic"]).".png";
|
||||
if(is_file($pic_c)){
|
||||
$is_pic_c="y";
|
||||
$g_wh=getimagesize($pic_c);
|
||||
}else{
|
||||
$g_wh=array(0,0);
|
||||
}
|
||||
$js=(get_zycl_pic_path($mb,$arr_this_wzh[$i])=="gan")?$default_gan_js:1;
|
||||
$str_yc.=$arr_this_wzh[$i]."|".$ord."|".$tmp["dress_level"]."|".$m["pic"]."|".out_good_pic_set(get_zycl_pic(trim($m["pic"]),"mini"),$tmpl_cl_my_pic_width,$tmpl_cl_my_pic_height)."|".$m["kh"]."&".$m["color"]."|".$js."|".$g_wh[0]."|".$is_pic_z1."&".$is_pic_z2."&".$is_pic_c.",";
|
||||
$ord++;
|
||||
$$v2+=$default_gan_js;
|
||||
$arr_ks[]=$kh.",".$color;
|
||||
$arr_dress_level[$kh.",".$color]=$tmp["dress_level"];
|
||||
}else{
|
||||
//款号信息有误
|
||||
$wrong_msg.=$kh.",".$color.";\\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if(get_zycl_pic_path($mb,$arr_this_wzh[$i])!="gan"){
|
||||
//检测正挂重复dress_level
|
||||
$arr1=find_repeat_data($arr_dress_level);
|
||||
$msg_repeat_dress_level="";
|
||||
foreach($arr1[1] as $k1 => $v1){
|
||||
$msg_repeat_dress_level.=$k1.";";
|
||||
}
|
||||
if($msg_repeat_dress_level)
|
||||
$wrong_msg.="穿着层级重复:".$msg_repeat_dress_level."\\n";
|
||||
}
|
||||
//检测重复款色
|
||||
$arr1=find_repeat_data($arr_ks);
|
||||
$msg_repeat_ks="";
|
||||
foreach($arr1[1] as $k1 => $v1){
|
||||
$msg_repeat_ks.=$v1.";";
|
||||
}
|
||||
if($msg_repeat_ks)
|
||||
$wrong_msg.="重复数据:".$msg_repeat_ks."\\n";
|
||||
}
|
||||
//检查是否超过件数限制
|
||||
for($i=0;$i<count($arr_this_wzh);$i++){
|
||||
$v2="gan_num_".$arr_this_wzh[$i];
|
||||
if($arr_this_num_limit[$i]>0 && $$v2>$arr_this_num_limit[$i]){
|
||||
$wrong_msg.="位置".$arr_this_wzh[$i]."陈列了".$$v2."件,超过件数限制".$arr_this_num_limit[$i]."件;\\n";
|
||||
}
|
||||
}
|
||||
//备选款
|
||||
$str_bxk="";
|
||||
$bxk=trim($bxk);
|
||||
if($bxk){
|
||||
$arr_tmp=explode("\n",$bxk);
|
||||
for($j=0;$j<count($arr_tmp);$j++){
|
||||
if(trim($arr_tmp[$j])){
|
||||
$arr_tmp1=explode(",",trim($arr_tmp[$j]));
|
||||
$kh=$arr_tmp1[0];
|
||||
$color=$arr_tmp1[1];
|
||||
$m=get_db_msg("select * from ".$table_pre."kh_cl_pic where kh='".$kh."' and color='".$color."'");
|
||||
if($m["id"]>0){
|
||||
//取得dress_level
|
||||
$tmp=get_db_msg("select dress_level from ".$table_pre."kh where no='".$m["kh"]."'");
|
||||
$pic1="../attachments/zycl/".$sys_zycl_pic_path_gan."/".trim($m["pic"]).".png";
|
||||
if(is_file($pic1)){
|
||||
$g_wh=getimagesize($pic1);
|
||||
}else{
|
||||
$g_wh=array(0,0);
|
||||
}
|
||||
$str_bxk.=$tmp["dress_level"]."|".$m["pic"]."|".out_good_pic_set(get_zycl_pic(trim($m["pic"]),"mini"),$tmpl_cl_my_pic_width,$tmpl_cl_my_pic_height)."|".$kh."&".$color."|".get_cate_title_no("color",$m["color"])."|".$g_wh[0].",";
|
||||
}else{
|
||||
//款号信息有误
|
||||
$wrong_msg.=$kh.",".$color.";\\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//检查
|
||||
if($wrong_msg){
|
||||
alert_and_back("以下数据有问题,请检查:\\n".$wrong_msg);
|
||||
}else{
|
||||
if($str_yc)
|
||||
$str_yc=substr($str_yc,0,-1);
|
||||
if($str_bxk)
|
||||
$str_bxk=substr($str_bxk,0,-1);
|
||||
echo "<script>
|
||||
var str_yc_sm='".$str_yc."';
|
||||
if(str_yc_sm){
|
||||
window.parent.str_yc=str_yc_sm;
|
||||
window.parent.re_order_str_yc();
|
||||
window.parent.dress_all();
|
||||
}
|
||||
var str_bxk_sm='".$str_bxk."';
|
||||
if(str_bxk_sm){
|
||||
window.parent.str_bxk=str_bxk_sm;
|
||||
window.parent.put_bxk();
|
||||
}
|
||||
window.parent.document.getElementById('div_smll').style.display='none';
|
||||
window.parent.document.getElementById('msll_frame').src='about:blank';
|
||||
</script>";
|
||||
}
|
||||
exit;
|
||||
break;
|
||||
case "save":
|
||||
//----------------------------------------保存
|
||||
//http://localhost/edt/yyj/ipad/index.php?_m=zycl&zsh=0&_a=save&mb=mb1&str_yc=D1|1|22|12W2120_51| width=92 height=110|12W2120%2651|1|27|y%26y%26y,C|1|22|12W2120_51| width=92 height=110|12W2120%2651|1|27|y%26y%26y,C|2|22|12W2120_82| width=92 height=110|12W2120%2682|1|24|y%26y%26y,C|3|22|12W2121_91| width=87 height=110|12W2121%2691|1|25|y%26y%26y
|
||||
//参数str_yc,str_pic_zz,mb
|
||||
$clh=trim($clh);
|
||||
if($zsh>0){
|
||||
//--------------------修改
|
||||
//删除原来图片
|
||||
$m1=get_db_msg("select pic from ".$table_pre."kh_cl where zsh='".$zsh."' limit 0,1");
|
||||
del_file("../attachments/cl/".$order_session."/big/".$m1["pic"].".jpg");
|
||||
del_file("../attachments/cl/".$order_session."/mini/".$m1["pic"].".jpg");
|
||||
//删除图片库
|
||||
$db->query("delete from ".$table_pre."pic where pic_mod='zycl' and pic_name='".$m1["pic"].".jpg'");
|
||||
//删除数据
|
||||
$db->query("delete from ".$table_pre."kh_cl where zsh='".$zsh."'");
|
||||
}else{
|
||||
//--------------------新增
|
||||
//取得zsh
|
||||
$tmp=get_db_msg("select max(zsh) 'zsh' from ".$table_pre."kh_cl");
|
||||
$zsh=$tmp["zsh"]+1;
|
||||
}
|
||||
//----------------------------------------图片处理
|
||||
//取得本陈列mb参数
|
||||
$arr_this_mb=array();
|
||||
for($i=0;$i<count($sys_zycl_mb);$i++){
|
||||
$tmp=explode("|",$sys_zycl_mb[$i]);
|
||||
$tmp1=explode(",",$tmp[0]);
|
||||
if($tmp1[0]==$mb){
|
||||
$arr_this_mb=explode("|",$sys_zycl_mb[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
$mt_pic="../attachments/zycl/".$mb.".jpg";
|
||||
$target_img=Imagecreatefromjpeg($mt_pic);
|
||||
$arr_this_wzh=explode(",",$arr_this_mb[1]);
|
||||
$arr_this_pic_path=explode(",",$arr_this_mb[2]);
|
||||
$arr_this_map_rec=explode(",",$arr_this_mb[3]);
|
||||
$arr_yc=explode(",",$str_yc);
|
||||
//
|
||||
$arr_pic_my_zz=array();
|
||||
if($str_pic_zz!=""){
|
||||
$arr_pic_zz=explode(",",$str_pic_zz);
|
||||
for($i1=0;$i1<count($arr_pic_zz);$i1++){
|
||||
$tmp=explode("_",$arr_pic_zz[$i1]);
|
||||
$arr_pic_my_zz[$tmp[1]]="../attachments/zycl/".$arr_pic_zz[$i1].".png";
|
||||
}
|
||||
}
|
||||
//
|
||||
$arr_pic_my=array();
|
||||
$arr_is_xz=array();
|
||||
$arr_pic_wzh=array();
|
||||
for($i=0;$i<count($arr_this_wzh);$i++){
|
||||
if($arr_pic_my_zz[$arr_this_wzh[$i]]){
|
||||
$zz_pic=$arr_pic_my_zz[$arr_this_wzh[$i]];
|
||||
}else{
|
||||
$zz_pic="";
|
||||
}
|
||||
$list_sz=0;
|
||||
for($j=0;$j<count($arr_yc);$j++){
|
||||
$arr_tmp=explode("|",$arr_yc[$j]);
|
||||
if($arr_tmp[0]==$arr_this_wzh[$i]){
|
||||
for($k=0;$k<$arr_tmp[6];$k++){
|
||||
if($arr_tmp[3]!="")
|
||||
$arr_pic_my[]="../attachments/zycl/".get_zycl_pic_big_path($mb,$arr_tmp[0],$list_sz)."/".$arr_tmp[3].".png";
|
||||
if($arr_tmp[2]>=11 && $arr_tmp[2]<=20){
|
||||
$arr_is_xz[]="y";
|
||||
}else{
|
||||
$arr_is_xz[]="n";
|
||||
$list_sz++;
|
||||
}
|
||||
$arr_pic_wzh[]=$arr_tmp[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($zz_pic){
|
||||
//插入遮罩图
|
||||
$arr1=insert_last_2($arr_pic_my,$zz_pic);
|
||||
$arr2=insert_last_2($arr_pic_wzh,$arr_this_wzh[$i]);
|
||||
$arr3=insert_last_2($arr_is_xz,"n");
|
||||
$arr_pic_my=$arr1;
|
||||
$arr_pic_wzh=$arr2;
|
||||
$arr_is_xz=$arr3;
|
||||
}
|
||||
}
|
||||
$source= array();
|
||||
foreach($arr_pic_my as $k=>$v){
|
||||
if(is_file($v)){
|
||||
$source[$k]['source']=Imagecreatefrompng($v);
|
||||
$source[$k]['size']=getimagesize($v);
|
||||
}else{
|
||||
$source[$k]['source']="";
|
||||
$source[$k]['size']=array(0,0);
|
||||
}
|
||||
}
|
||||
//取得每个侧挂位置的杆宽度,图片总宽度
|
||||
for($i=0;$i<count($arr_this_wzh);$i++){
|
||||
if($arr_this_pic_path[$i]=="gan"){
|
||||
$var="arr_pic_width_".$arr_this_wzh[$i];//图片总宽度
|
||||
$$var=get_gan_pic_width($mb,$arr_this_wzh[$i],$arr_yc);
|
||||
$v1=$$var;
|
||||
//echo "pic_width:".$v1[0]."|".$v1[1].",";
|
||||
$var="gan_width_".$arr_this_wzh[$i];//杆宽度
|
||||
$$var=get_gan_width($arr_this_mb,$arr_this_wzh[$i]);
|
||||
//echo "gan_width:".$$var.",<br>";
|
||||
//初始化
|
||||
$var="lj_x_".$arr_this_wzh[$i];
|
||||
$$var=0;
|
||||
$var="tmp_x_".$arr_this_wzh[$i];
|
||||
$$var=0;
|
||||
$var="gan_num_".$arr_this_wzh[$i];
|
||||
$$var=0;
|
||||
}
|
||||
}
|
||||
//
|
||||
$arr_pic_gan=array();
|
||||
for($i=0,$j=0;$i<count($arr_pic_my);$i++){
|
||||
if($source[$i]['source']){
|
||||
$arr_zb=get_zycl_pic_zb($mb,$arr_pic_wzh[$i],$arr_is_xz[$i],$source[$i]['size'][0]);
|
||||
if(get_zycl_pic_path($mb,$arr_pic_wzh[$i])=="gan"){
|
||||
//侧挂图片特殊处理,只记录信息
|
||||
$var="gan_width_".$arr_pic_wzh[$i];
|
||||
$gan_width=$$var;//本杆宽度
|
||||
$var="arr_pic_width_".$arr_pic_wzh[$i];
|
||||
$arr_tmp=$$var;
|
||||
$gan_pic_width=$arr_tmp[0];//本杆图片压缩总宽度
|
||||
$sj_pic_width=$arr_tmp[1];//本杆图片实际总宽度
|
||||
//
|
||||
$var="lj_x_".$arr_pic_wzh[$i];
|
||||
$lj_x=$$var;
|
||||
$var="tmp_x_".$arr_pic_wzh[$i];
|
||||
$$var=$arr_zb[0]+$lj_x;
|
||||
$tmp_x1=$$var;
|
||||
//
|
||||
$var="lj_x_".$arr_pic_wzh[$i];
|
||||
$$var+=$source[$i]['size'][0]-$source[$i]['size'][0]*$sys_zycl_sjbl-count_gan_pic_die_num($gan_width,$gan_pic_width,$sj_pic_width,$source[$i]['size'][0]);
|
||||
//
|
||||
$arr_pic_gan[$j]=array($source[$i]['source'],$tmp_x1,$arr_zb[1],$source[$i]['size'][0],$source[$i]['size'][1]);
|
||||
$var="gan_num_".$arr_pic_wzh[$i];
|
||||
$$var++;
|
||||
$gan_num=$$var;
|
||||
$j++;
|
||||
//测试代码
|
||||
//echo $i.":".$arr_pic_wzh[$i].",".$arr_pic_my[$i].",".$arr_is_xz[$i].",".$source[$i]['size'][0]."|"."tmp_x_".$arr_pic_wzh[$i].":".$tmp_x1.",".$arr_zb[1]."|".$gan_num."<br>";
|
||||
}else{
|
||||
$tmp_x=$arr_zb[0];
|
||||
imagecopymerge_alpha($target_img,$source[$i]['source'],$tmp_x,$arr_zb[1],0,0,$source[$i]['size'][0],$source[$i]['size'][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//exit;
|
||||
//添加侧挂图片,从最后一张开始加
|
||||
for($j=count($arr_pic_gan)-1;$j>=0;$j--){
|
||||
imagecopymerge_alpha($target_img,$arr_pic_gan[$j][0],$arr_pic_gan[$j][1],$arr_pic_gan[$j][2],0,0,$arr_pic_gan[$j][3],$arr_pic_gan[$j][4]);
|
||||
}
|
||||
$pic=$msg_login["username"]."_".$zsh."_".get_rand(4);
|
||||
$dest_big_name="../attachments/cl/".$order_session."/big/".$pic.".jpg";
|
||||
$dest_mini_name="../attachments/cl/".$order_session."/mini/".$pic.".jpg";
|
||||
Imagejpeg($target_img,$dest_big_name,100);
|
||||
//复制图片
|
||||
make_mini_picture($dest_big_name,$dest_big_name,800,90);
|
||||
make_mini_picture($dest_big_name,$dest_mini_name,200);
|
||||
//图片插入数据库
|
||||
put_pic_to_mysql("zycl","big",$pic.".jpg",$dest_big_name);
|
||||
put_pic_to_mysql("zycl","mini",$pic.".jpg",$dest_mini_name);
|
||||
$ord=1;
|
||||
for($i=0;$i<count($arr_yc);$i++){
|
||||
$arr_tmp=explode("|",$arr_yc[$i]);
|
||||
$arr_tmp2=explode("&",$arr_tmp[5]);
|
||||
$kh=$arr_tmp2[0];
|
||||
$color=$arr_tmp2[1];
|
||||
$pic_my=$arr_tmp[3];
|
||||
$wzh=$arr_tmp[0];
|
||||
$js=$arr_tmp[6];
|
||||
$q="insert into ".$table_pre."kh_cl (zsh,title,pic,kh,color,ord,remark,zd1,zd2,zd3,zd4,zd5,upath,pic_my,mb,wzh,js,bxk) values ('".$zsh."','".$clh."','".$pic."','".$kh."','".$color."','".$ord."','".$remark."','".$zd1."','".$zd2."','".$zd3."','".$zd4."','".$zd5."','".$upath."','".$pic_my."','".$mb."','".$wzh."','".$js."','".$sub_bxk."')";
|
||||
$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_cl where zsh='".$zsh."' limit 0,1");
|
||||
//取得new_zsh
|
||||
$tmp=get_db_msg("select max(zsh) 'zsh' from ".$table_pre."kh_cl");
|
||||
$new_zsh=$tmp["zsh"]+1;
|
||||
//图片处理
|
||||
$tmp=get_db_msg("select max(title) 'title' from ".$table_pre."kh_cl where upath='".$upath."'");
|
||||
$new_clh=deel_multi_num($tmp["title"]+1,3);
|
||||
$order_session=get_set("order_session");
|
||||
$pic=$msg_login["username"]."_".$new_zsh."_".get_rand(4);
|
||||
$old_pic="../attachments/cl/".$order_session."/big/".$m_old["pic"].".jpg";
|
||||
$dest_big_name="../attachments/cl/".$order_session."/big/".$pic.".jpg";
|
||||
$dest_mini_name="../attachments/cl/".$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("zycl","big",$pic.".jpg",$dest_big_name);
|
||||
put_pic_to_mysql("zycl","mini",$pic.".jpg",$dest_mini_name);
|
||||
//
|
||||
$q="select * from ".$table_pre."kh_cl where zsh='".$zsh."'";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$q1="insert into ".$table_pre."kh_cl (zsh,title,pic,kh,color,ord,remark,zd1,zd2,zd3,zd4,zd5,upath,pic_my,mb,wzh,js,bxk) values ('".$new_zsh."','".$new_clh."','".$pic."','".$m["kh"]."','".$m["color"]."','".$m["ord"]."','".$m["remark"]."','".$m["zd1"]."','".$m["zd2"]."','".$m["zd3"]."','".$m["zd4"]."','".$m["zd5"]."','".$upath."','".$m["pic_my"]."','".$m["mb"]."','".$m["wzh"]."','".$m["js"]."','".$m["bxk"]."')";
|
||||
//echo $q1."<br>";
|
||||
$db->query($q1);
|
||||
}
|
||||
$json_data.="\"cate\":\"copyok\",";
|
||||
break;
|
||||
case "del":
|
||||
//----------------------------------------删除
|
||||
$m_old=get_db_msg("select * from ".$table_pre."kh_cl where zsh='".$zsh."' limit 0,1");
|
||||
//删除图片
|
||||
del_file("../attachments/cl/".$order_session."/big/".$m_old["pic"].".jpg");
|
||||
del_file("../attachments/cl/".$order_session."/mini/".$m_old["pic"].".jpg");
|
||||
//删除图片库
|
||||
$db->query("delete from ".$table_pre."pic where pic_mod='zycl' and pic_name='".$m_old["pic"].".jpg'");
|
||||
//删除数据
|
||||
$db->query("delete from ".$table_pre."kh_cl where zsh='".$zsh."'");
|
||||
//
|
||||
$json_data.="\"cate\":\"delok\",";
|
||||
break;
|
||||
case "kh_list":
|
||||
$sql_con="";
|
||||
$page_size=8;
|
||||
$offset=$offset?$offset:0;
|
||||
$url_var="s_no=".$s_no."&s_xh=".$s_xh."&s_is_ordered=".$s_is_ordered;
|
||||
if(is_array($sys_zycl_select)){
|
||||
for($i=0;$i<count($sys_zycl_select);$i++){
|
||||
$v1="s_".$sys_zycl_select[$i];
|
||||
if($$v1){
|
||||
$sql_con.=" and b.".$sys_zycl_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_cl_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_cl_pic a,".$table_pre."kh b".$t1." where a.kh=b.no ".$sql_con;
|
||||
}
|
||||
//计算上下组
|
||||
$m1=get_db_msg($query);
|
||||
$total_num=$m1["num"];
|
||||
if($offset>0)
|
||||
$url_pre_page="?_m=zycl&_a=kh_list&offset=".($offset-8)."&".$url_var;
|
||||
else
|
||||
$url_pre_page="javascript:alert('没有了')";
|
||||
if($offset<$total_num-$page_size)
|
||||
$url_next_page="?_m=zycl&_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_cl_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 a.kh,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_cl_pic a,".$table_pre."kh b".$t1." where a.kh=b.no ".$sql_con." order by a.kh,a.color limit ".$offset.",".$page_size;
|
||||
}
|
||||
//echo $q."<Br>";
|
||||
$r=$db->query($q);
|
||||
$content="<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"1\"><tr><td height=\"280\" 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 valign=\"top\"><table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"1\">";
|
||||
if($total_num>0){
|
||||
$list=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);
|
||||
if(trim($m["pic"])){
|
||||
$pic=get_zycl_pic(trim($m["pic"]),"mini");
|
||||
$is_pic_z1=$is_pic_z2=$is_pic_c="n";
|
||||
$pic_z1="../attachments/zycl/".$sys_zycl_pic_path_zen1."/".trim($m["pic"]).".png";
|
||||
if(is_file($pic_z1))
|
||||
$is_pic_z1="y";
|
||||
$pic_z2="../attachments/zycl/".$sys_zycl_pic_path_zen2."/".trim($m["pic"]).".png";
|
||||
if(is_file($pic_z2))
|
||||
$is_pic_z2="y";
|
||||
$pic_c="../attachments/zycl/".$sys_zycl_pic_path_gan."/".trim($m["pic"]).".png";
|
||||
if(is_file($pic_c)){
|
||||
$g_wh=getimagesize($pic_c);
|
||||
$is_pic_c="y";
|
||||
}else{
|
||||
$g_wh=array(0,0);
|
||||
}
|
||||
if($pic=="images/no_pic_80.gif")
|
||||
$put_pic="";
|
||||
else
|
||||
$put_pic=trim($m["pic"]);
|
||||
$content.="<td width=\"25%\" align=\"center\" valign=\"middle\" style=\"cursor:pointer;\" onclick=\"window.parent.dress_up(".$m["dress_level"].",'".$put_pic."','".out_good_pic_set($pic,$tmpl_cl_my_pic_width,$tmpl_cl_my_pic_height)."','".$m["kh"]."&".$m["color"]."',1,'".$g_wh[0]."','".$is_pic_z1."&".$is_pic_z2."&".$is_pic_c."')\">";
|
||||
$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\" height=\"30px\">".$m["kh"].",".$m["color"].get_cate_title_no("color",$m["color"]).$yd." <a href=\"javascript:window.parent.in_bxk(".$m["dress_level"].",'".trim($m["pic"])."','".out_good_pic_set($pic,$tmpl_cl_my_pic_width,$tmpl_cl_my_pic_height)."','".$m["kh"]."&".$m["color"]."','".get_cate_title_no("color",$m["color"])."','".$g_wh[0]."')\"><img src=\"images/button_in_bx.png\" align=\"middle\" border=0 style=\"margin-top:-15px;\" ></a></td>";
|
||||
$list++;
|
||||
}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.="\"sys_zycl_dress_level\":\"".$sys_zycl_dress_level."\",";
|
||||
$json_data.="\"zen1_pic_path\":\"".$sys_zycl_pic_path_zen1."\",";
|
||||
$json_data.="\"zen2_pic_path\":\"".$sys_zycl_pic_path_zen2."\",";
|
||||
$json_data.="\"sys_zycl_xz_top\":\"".$sys_zycl_xz_top."\",";
|
||||
$json_data.="\"gan_pic_path\":\"".$sys_zycl_pic_path_gan."\",";
|
||||
$json_data.="\"sys_zycl_sjbl\":\"".$sys_zycl_sjbl."\",";
|
||||
|
||||
//款号筛选条件
|
||||
if(is_array($sys_zycl_select)){
|
||||
$select_dz="";
|
||||
for($i=0;$i<count($sys_zycl_select);$i++){
|
||||
$v1="s_".$sys_zycl_select[$i];
|
||||
$strtmp="";
|
||||
$r=$db->query("select no,title from ".$table_pre."keyword where cate='".$sys_zycl_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_zycl_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_cl=get_db_msg("select * from ".$table_pre."kh_cl where zsh='".$zsh."' limit 0,1");
|
||||
$clh=$msg_cl["title"];
|
||||
//取得已穿的款色数组
|
||||
$q="select * from ".$table_pre."kh_cl where zsh='".$zsh."' order by ord";
|
||||
$r=$db->query($q);
|
||||
$str_yc="";
|
||||
$list=1;
|
||||
$cltp="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tmpcl=explode("_",$m["title"]);
|
||||
if($tmpcl[2]){
|
||||
$cltp=$tmpcl[2];
|
||||
}
|
||||
//取得dress_level
|
||||
$tmp=get_db_msg("select dress_level from ".$table_pre."kh where no='".$m["kh"]."'");
|
||||
$is_pic_z1=$is_pic_z2=$is_pic_c="n";
|
||||
$pic_z1="../attachments/zycl/".$sys_zycl_pic_path_zen1."/".trim($m["pic_my"]).".png";
|
||||
if(is_file($pic_z1))
|
||||
$is_pic_z1="y";
|
||||
$pic_z2="../attachments/zycl/".$sys_zycl_pic_path_zen2."/".trim($m["pic_my"]).".png";
|
||||
if(is_file($pic_z2))
|
||||
$is_pic_z2="y";
|
||||
$pic_c="../attachments/zycl/".$sys_zycl_pic_path_gan."/".trim($m["pic_my"]).".png";
|
||||
if(is_file($pic_c)){
|
||||
$is_pic_c="y";
|
||||
$g_wh=getimagesize($pic_c);
|
||||
}else{
|
||||
$g_wh=array(0,0);
|
||||
}
|
||||
$str_yc.=$m["wzh"]."|".$list."|".$tmp["dress_level"]."|".$m["pic_my"]."|".out_good_pic_set(get_zycl_pic(trim($m["pic_my"]),"mini"),$tmpl_cl_my_pic_width,$tmpl_cl_my_pic_height)."|".$m["kh"]."&".$m["color"]."|".$m["js"]."|".$g_wh[0]."|".$is_pic_z1."&".$is_pic_z2."&".$is_pic_c.",";
|
||||
$list++;
|
||||
}
|
||||
if($str_yc)
|
||||
$str_yc=substr($str_yc,0,-1);
|
||||
$mb=$msg_cl["mb"];
|
||||
$str_bxk="";
|
||||
if(trim($msg_cl["bxk"])!=""){
|
||||
$arr_tmp=explode(",",trim($msg_cl["bxk"]));
|
||||
for($i=0;$i<count($arr_tmp);$i++){
|
||||
$arr_tmp1=explode("&",$arr_tmp[$i]);
|
||||
$m1=get_db_msg("select pic from ".$table_pre."kh_cl_pic where kh='".$arr_tmp1[0]."' and color='".$arr_tmp1[1]."'");
|
||||
$pic1="../attachments/zycl/".$sys_zycl_pic_path_gan."/".trim($m1["pic"]).".png";
|
||||
if(is_file($pic1))
|
||||
$g_wh=getimagesize($pic1);
|
||||
else
|
||||
$g_wh=array(0,0);
|
||||
$m2=get_db_msg("select dress_level from ".$table_pre."kh where no='".$arr_tmp1[0]."'");
|
||||
$str_bxk.=$m2["dress_level"]."|".$m1["pic"]."|".out_good_pic_set(get_zycl_pic(trim($m1["pic"]),"mini"),$tmpl_cl_my_pic_width,$tmpl_cl_my_pic_height)."|".$arr_tmp[$i]."|".get_cate_title_no("color",$arr_tmp1[1])."|".$g_wh[0].",";
|
||||
}
|
||||
}
|
||||
if($str_bxk)
|
||||
$str_bxk=substr($str_bxk,0,-1);
|
||||
$remark=trim(str_replace("\r\n","\\n",$msg_cl["remark"]));
|
||||
}else{
|
||||
//新增
|
||||
$tmp=get_db_msg("select max(title) 'title' from ".$table_pre."kh_cl where upath='".$msg_login["path"]."-".$msg_login["id"]."'");
|
||||
$zsh=0;
|
||||
$clh=deel_multi_num($tmp["title"]+1,3);
|
||||
$str_yc="";
|
||||
$tmp=explode("|",$sys_zycl_mb[0]);
|
||||
$tmp=explode(",",$tmp[0]);
|
||||
$mb=$tmp[0];
|
||||
$remark="";
|
||||
$str_bxk="";
|
||||
}
|
||||
//自定义筛选条件
|
||||
$num_cl_zd=0;
|
||||
if(is_array($sys_cl_zd)){
|
||||
$num=count($sys_cl_zd);
|
||||
$num_cl_zd=($num<5)?$num:5;
|
||||
}
|
||||
$str_arr_select="";
|
||||
for($i=0;$i<$num_cl_zd;$i++){
|
||||
$v1="zd".($i+1);
|
||||
$r=$db->query("select zd".($i+1)." from ".$table_pre."kh_cl 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_cl_zd[$i]."\",\"value\":\"".$msg_cl[$v1]."\",\"op\":[".$strtmp2."]},";
|
||||
}
|
||||
$str_arr_select=deel_end($str_arr_select);
|
||||
$json_data.="\"select_zdy\":[".$str_arr_select."],";
|
||||
if($cltp){
|
||||
|
||||
$cl=get_db_msg("select * from web_kh_cl where zsh='".$cltp."'");
|
||||
$clpic=get_kh_ty_big($cl["pic"]);
|
||||
$ck=out_good_pic_set_arr($clpic,460,335);
|
||||
$json_data.="\"clpic\":\"".$clpic."\",\"clpic_w\":\"".$ck[0]."\",\"clpic_h\":\"".$ck[1]."\",";
|
||||
}
|
||||
|
||||
$json_data.="\"clh\":\"".$clh."\",";
|
||||
$json_data.="\"zsh\":\"".$zsh."\",";
|
||||
$json_data.="\"str_yc\":\"".$str_yc."\",";
|
||||
$json_data.="\"str_bxk\":\"".$str_bxk."\",";
|
||||
$json_data.="\"remark\":\"".$remark."\",";
|
||||
$json_data.="\"mb\":\"".$mb."\",";
|
||||
$json_data.="\"str_pic_zz\":\"\",";
|
||||
|
||||
//模版
|
||||
$str="";
|
||||
for($i=0;$i<count($sys_zycl_mb);$i++){
|
||||
$str.="\"".$sys_zycl_mb[$i]."\",";
|
||||
}
|
||||
if($str)
|
||||
$str=substr($str,0,-1);
|
||||
$json_data.="\"arr_mb\":[".$str."],";
|
||||
$json_data.="\"cate\":\"other\",";
|
||||
break;
|
||||
|
||||
}
|
||||
function get_kh_ty_big($clh){
|
||||
global $order_session;
|
||||
$s_dir=$order_session?$order_session."/":"";
|
||||
$pic="../attachments/ty/big/".$clh.".jpg";
|
||||
if(!is_file($pic)){
|
||||
$pic="images/no_pic_big.png";
|
||||
}
|
||||
return $pic;
|
||||
}
|
||||
$json_data=substr($json_data,0,-1)."}";
|
||||
echo $json_data;
|
||||
?>
|
||||
@@ -0,0 +1,290 @@
|
||||
<?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;
|
||||
?>
|
||||
Reference in New Issue
Block a user