7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
790 lines
28 KiB
PHP
790 lines
28 KiB
PHP
<?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 "";
|
|
}
|
|
?>
|