This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

333 lines
12 KiB
PHP

<?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;
?>