|
...
|
...
|
@@ -8,6 +8,7 @@ use App\Helper\Translate; |
|
|
|
use App\Http\Logic\Aside\BaseLogic;
|
|
|
|
use App\Models\Ai\AiCommand;
|
|
|
|
use App\Models\Inquiry\AreaTimezone;
|
|
|
|
use App\Models\Inquiry\ForwardCount;
|
|
|
|
use App\Models\Inquiry\InquiryInfo;
|
|
|
|
use App\Models\Inquiry\InquiryProject;
|
|
|
|
use App\Models\Inquiry\InquiryProjectRoute;
|
|
...
|
...
|
@@ -515,4 +516,55 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据转发人统计询盘数量
|
|
|
|
* @return array
|
|
|
|
* @author Akun
|
|
|
|
* @date 2025/10/28 15:02
|
|
|
|
*/
|
|
|
|
public function inquiryManageCount()
|
|
|
|
{
|
|
|
|
$type = $this->param['type'] ?? 1;//统计类型:1周统计,2月统计
|
|
|
|
|
|
|
|
$manage_ids = ForwardCount::select('manage_id')->orderBy('manage_id', 'asc')->distinct()->pluck('manage_id')->toArray();
|
|
|
|
$manageModel = new Manage();
|
|
|
|
$data = [];
|
|
|
|
if ($type == 1) {
|
|
|
|
//周统计
|
|
|
|
$now_day = date('Y-m-d');
|
|
|
|
$last_week_day = date('Y-m-d', strtotime('-1 week'));
|
|
|
|
while ($last_week_day < $now_day) {
|
|
|
|
$day_arr = explode('-', $last_week_day);
|
|
|
|
$year = $day_arr[0];
|
|
|
|
$month = $day_arr[1];
|
|
|
|
$day = $day_arr[2];
|
|
|
|
|
|
|
|
foreach ($manage_ids as $mid) {
|
|
|
|
$name = $manageModel->getName($mid);
|
|
|
|
$data[$last_week_day][$name] = ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->where('day', $day)->value('count') ?? 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$last_week_day = date('Y-m-d', strtotime($last_week_day . ' +1 day'));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//月统计
|
|
|
|
$now_month = date('Y-m');
|
|
|
|
$last_year_month = date('Y-m', strtotime('-11 months'));
|
|
|
|
while ($last_year_month <= $now_month) {
|
|
|
|
$month_arr = explode('-', $last_year_month);
|
|
|
|
$year = $month_arr[0];
|
|
|
|
$month = $month_arr[1];
|
|
|
|
|
|
|
|
foreach ($manage_ids as $mid) {
|
|
|
|
$name = $manageModel->getName($mid);
|
|
|
|
$data[$last_year_month][$name] = intval(ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->sum('count') ?? 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
$last_year_month = date('Y-m', strtotime($last_year_month . ' +1 month'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|