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."
";
$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"订单量");
$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 $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