|
@@ -192,99 +192,111 @@ class Dashboard extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 销售金额数据统计
|
|
|
+ * 七日销售金额数据统计
|
|
|
*/
|
|
|
- public function datacenter_three(){
|
|
|
- $type = input('type',1);
|
|
|
+ public function datacenterthree(){
|
|
|
|
|
|
$servicetype = Db::name('servicetype')->field('id,title as name')->select();
|
|
|
+ $this->assignconfig('servicetype',array_column($servicetype,'name'));
|
|
|
//七日
|
|
|
- if($type == 1){
|
|
|
- $starttime = strtotime(date('Y-m-d')) - 518400;
|
|
|
- $endtime = strtotime(date('Y-m-d')) + 86399;
|
|
|
-
|
|
|
- $ec_date = [];
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'company_id' => $this->auth->company_id,
|
|
|
- 'status' => 3,
|
|
|
- ];
|
|
|
- if($this->auth->type == 2){
|
|
|
- $map['staff_id'] = $this->auth->id;
|
|
|
+ $starttime = strtotime(date('Y-m-d')) - 518400;
|
|
|
+ $endtime = strtotime(date('Y-m-d')) + 86399;
|
|
|
+
|
|
|
+ $ec_date = [];
|
|
|
+
|
|
|
+ $map = [
|
|
|
+ 'company_id' => $this->auth->company_id,
|
|
|
+ 'status' => 3,
|
|
|
+ ];
|
|
|
+ /*if($this->auth->type == 2){
|
|
|
+ $map['staff_id'] = $this->auth->id;
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+ for($i=$starttime;$i<$endtime;$i+=86400){
|
|
|
+ $starttime_i = $i;
|
|
|
+ $endtime_i = $i + 86399;
|
|
|
+ //日历
|
|
|
+ $ec_date[] = date('d',$starttime_i).'日';
|
|
|
+ }
|
|
|
+ $this->assignconfig('ec_date',$ec_date);
|
|
|
+
|
|
|
+ foreach($servicetype as $key => &$val){
|
|
|
+ $val['type'] = 'bar';
|
|
|
+
|
|
|
+ if($key == 0){
|
|
|
+ $val['barGap'] = 0;
|
|
|
}
|
|
|
|
|
|
+ $val['label'] = 'labelOption';
|
|
|
+ $val['emphasis'] = ['focus'=>'series'];
|
|
|
+ $val['data'] = [];
|
|
|
|
|
|
+ $map['servicetype_id'] = $val['id'];
|
|
|
for($i=$starttime;$i<$endtime;$i+=86400){
|
|
|
$starttime_i = $i;
|
|
|
$endtime_i = $i + 86399;
|
|
|
- //日历
|
|
|
- $ec_date[] = date('d',$starttime_i).'日';
|
|
|
+ //销售金额
|
|
|
+ $map['finish_time'] = ['between',[$starttime_i,$endtime_i]];
|
|
|
+ $val['data'][] = Db::name('order')->where($map)->sum('total_fee');
|
|
|
}
|
|
|
+ unset($val['id']);
|
|
|
+ }
|
|
|
|
|
|
- foreach($servicetype as $key => &$val){
|
|
|
- $map['servicetype_id'] = $val['id'];
|
|
|
- $val['data'] = [];
|
|
|
- $val['textColor'] = '#FFFFFF';
|
|
|
- for($i=$starttime;$i<$endtime;$i+=86400){
|
|
|
- $starttime_i = $i;
|
|
|
- $endtime_i = $i + 86399;
|
|
|
- //销售金额
|
|
|
- $map['finish_time'] = ['between',[$starttime_i,$endtime_i]];
|
|
|
- $val['data'][] = Db::name('order')->where($map)->sum('total_fee');
|
|
|
- }
|
|
|
- unset($val['id']);
|
|
|
- }
|
|
|
+ $this->assignconfig('servicetype',$servicetype);
|
|
|
+ return $this->view->fetch();
|
|
|
+ }
|
|
|
|
|
|
- $result = [
|
|
|
- 'ec_data' => $ec_date,
|
|
|
- 'ec_totalfee' => $servicetype,
|
|
|
- ];
|
|
|
- $this->success(1,$result);
|
|
|
- }else{
|
|
|
- $thismonth = strtotime(date('Y-m-01'));
|
|
|
-
|
|
|
- $ec_date = [];
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'company_id' => $this->auth->company_id,
|
|
|
- 'status' => 3,
|
|
|
- ];
|
|
|
- if($this->auth->type == 2){
|
|
|
- $map['staff_id'] = $this->auth->id;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 半年销售金额数据统计
|
|
|
+ */
|
|
|
+ public function datacenter_three2(){
|
|
|
|
|
|
+ $servicetype = Db::name('servicetype')->field('id,title as name')->select();
|
|
|
|
|
|
- for($i=5;$i>=0;$i--){
|
|
|
- $starttime_i = strtotime("-".$i." month",$thismonth);
|
|
|
- $endtime_i = strtotime("-".($i+1) ." month",$thismonth) - 1;
|
|
|
- //日历
|
|
|
- $ec_date[] = date('m',$starttime_i).'月';
|
|
|
- //dump(date('Y-m-d H:i:s',$starttime_i));
|
|
|
- //dump(date('Y-m-d H:i:s',$endtime_i));
|
|
|
- }
|
|
|
+ $thismonth = strtotime(date('Y-m-01'));
|
|
|
|
|
|
+ $ec_date = [];
|
|
|
|
|
|
- foreach($servicetype as $key => &$val){
|
|
|
- $map['servicetype_id'] = $val['id'];
|
|
|
- $val['data'] = [];
|
|
|
- $val['textColor'] = '#FFFFFF';
|
|
|
- for($i=5;$i>=0;$i-=1){
|
|
|
- $starttime_i = strtotime("-".$i." month",$thismonth);
|
|
|
- $endtime_i = strtotime("-".($i+1) ." month",$thismonth) - 1;
|
|
|
- //销售金额
|
|
|
- $map['finish_time'] = ['between',[$starttime_i,$endtime_i]];
|
|
|
- $val['data'][] = Db::name('order')->where($map)->sum('total_fee');
|
|
|
- }
|
|
|
- unset($val['id']);
|
|
|
- }
|
|
|
+ $map = [
|
|
|
+ 'company_id' => $this->auth->company_id,
|
|
|
+ 'status' => 3,
|
|
|
+ ];
|
|
|
+ if($this->auth->type == 2){
|
|
|
+ $map['staff_id'] = $this->auth->id;
|
|
|
+ }
|
|
|
|
|
|
- $result = [
|
|
|
- 'ec_data' => $ec_date,
|
|
|
- 'ec_totalfee' => $servicetype,
|
|
|
- ];
|
|
|
- $this->success(1,$result);
|
|
|
+
|
|
|
+ for($i=5;$i>=0;$i--){
|
|
|
+ $starttime_i = strtotime("-".$i." month",$thismonth);
|
|
|
+ $endtime_i = strtotime("-".($i+1) ." month",$thismonth) - 1;
|
|
|
+ //日历
|
|
|
+ $ec_date[] = date('m',$starttime_i).'月';
|
|
|
+ //dump(date('Y-m-d H:i:s',$starttime_i));
|
|
|
+ //dump(date('Y-m-d H:i:s',$endtime_i));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ foreach($servicetype as $key => &$val){
|
|
|
+ $map['servicetype_id'] = $val['id'];
|
|
|
+ $val['data'] = [];
|
|
|
+ $val['textColor'] = '#FFFFFF';
|
|
|
+ for($i=5;$i>=0;$i-=1){
|
|
|
+ $starttime_i = strtotime("-".$i." month",$thismonth);
|
|
|
+ $endtime_i = strtotime("-".($i+1) ." month",$thismonth) - 1;
|
|
|
+ //销售金额
|
|
|
+ $map['finish_time'] = ['between',[$starttime_i,$endtime_i]];
|
|
|
+ $val['data'][] = Db::name('order')->where($map)->sum('total_fee');
|
|
|
+ }
|
|
|
+ unset($val['id']);
|
|
|
}
|
|
|
|
|
|
+ $result = [
|
|
|
+ 'ec_data' => $ec_date,
|
|
|
+ 'ec_totalfee' => $servicetype,
|
|
|
+ ];
|
|
|
+ $this->success(1,$result);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|