作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !3066
@@ -530,6 +530,7 @@ class InquiryForwardLogic extends BaseLogic @@ -530,6 +530,7 @@ class InquiryForwardLogic extends BaseLogic
530 530
531 //月统计 531 //月统计
532 $data_month = []; 532 $data_month = [];
  533 + $data_month_total = [];
533 $now_month = date('Y-m'); 534 $now_month = date('Y-m');
534 $last_year_month = date('Y-m', strtotime('-11 months')); 535 $last_year_month = date('Y-m', strtotime('-11 months'));
535 while ($last_year_month <= $now_month) { 536 while ($last_year_month <= $now_month) {
@@ -540,15 +541,18 @@ class InquiryForwardLogic extends BaseLogic @@ -540,15 +541,18 @@ class InquiryForwardLogic extends BaseLogic
540 foreach ($manage_ids as $mid) { 541 foreach ($manage_ids as $mid) {
541 $name = $manageModel->getName($mid); 542 $name = $manageModel->getName($mid);
542 $month_count = intval(ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->sum('count') ?? 0); 543 $month_count = intval(ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->sum('count') ?? 0);
543 - $data_month['total'][$name] = ($data_month['total'][$name] ?? 0) + $month_count; 544 + $data_month_total[$name] = ($data_month_total[$name] ?? 0) + $month_count;
544 $data_month[$last_year_month][$name] = $month_count; 545 $data_month[$last_year_month][$name] = $month_count;
545 } 546 }
546 547
547 $last_year_month = date('Y-m', strtotime($last_year_month . ' +1 month')); 548 $last_year_month = date('Y-m', strtotime($last_year_month . ' +1 month'));
548 } 549 }
  550 + $data_month['total'] = $data_month_total;
  551 +
549 552
550 //周统计 553 //周统计
551 $data_week = []; 554 $data_week = [];
  555 + $data_week_total = [];
552 $now_day = date('Y-m-d'); 556 $now_day = date('Y-m-d');
553 $last_week_day = date('Y-m-d', strtotime('-1 week')); 557 $last_week_day = date('Y-m-d', strtotime('-1 week'));
554 while ($last_week_day < $now_day) { 558 while ($last_week_day < $now_day) {
@@ -560,12 +564,13 @@ class InquiryForwardLogic extends BaseLogic @@ -560,12 +564,13 @@ class InquiryForwardLogic extends BaseLogic
560 foreach ($manage_ids as $mid) { 564 foreach ($manage_ids as $mid) {
561 $name = $manageModel->getName($mid); 565 $name = $manageModel->getName($mid);
562 $day_count = ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->where('day', $day)->value('count') ?? 0; 566 $day_count = ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->where('day', $day)->value('count') ?? 0;
563 - $data_week['total'][$name] = ($data_week['total'][$name] ?? 0) + $day_count; 567 + $data_week_total[$name] = ($data_week_total[$name] ?? 0) + $day_count;
564 $data_week[substr($last_week_day, 5)][$name] = $day_count; 568 $data_week[substr($last_week_day, 5)][$name] = $day_count;
565 } 569 }
566 570
567 $last_week_day = date('Y-m-d', strtotime($last_week_day . ' +1 day')); 571 $last_week_day = date('Y-m-d', strtotime($last_week_day . ' +1 day'));
568 } 572 }
  573 + $data_week['total'] = $data_week_total;
569 574
570 return $this->success(['data_month' => $data_month, 'data_week' => $data_week]); 575 return $this->success(['data_month' => $data_month, 'data_week' => $data_week]);
571 } 576 }