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