作者 lyh

gx

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :MonthReportController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/2/2 15:01
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\BCom;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\HomeCount\MonthCount;
  15 +
  16 +class MonthReportController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :获取项目当前所有月份
  20 + * @name :getMonth
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2024/2/2 15:14
  24 + */
  25 + public function getMonth(){
  26 + $monthCountModel = new MonthCount();
  27 + $this->map['project_id'] = $this->user['project_id'];
  28 + $month = $monthCountModel->formatQuery($this->map)->pluck('month')->toArray();
  29 + $this->response('success',Code::SUCCESS,$month);
  30 + }
  31 +
  32 + /**
  33 + * @remark :月报告详情
  34 + * @name :monthReportInfo
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2024/2/2 15:02
  38 + */
  39 + public function monthReportInfo(){
  40 + $monthCountModel = new MonthCount();
  41 + $this->map['project_id'] = $this->user['project_id'];
  42 + $info = $monthCountModel->read($this->map);
  43 + foreach ($info as $k => $v){
  44 + if(!empty($v['source_country'])){
  45 + $v['source_country'] = json_decode($v['source_country']);
  46 + }
  47 + if(!empty($v['referrer_port'])){
  48 + $v['referrer_port'] = json_decode($v['referrer_port']);
  49 + }
  50 + if(!empty($v['referrer_url'])){
  51 + $v['referrer_url'] = json_decode($v['referrer_url']);
  52 + }
  53 + if(!empty($v['source'])){
  54 + $v['source'] = json_decode($v['source']);
  55 + }
  56 + if(!empty($v['country'])){
  57 + $v['country'] = json_decode($v['country']);
  58 + }
  59 + $lists[$k] = $v;
  60 + }
  61 + $this->response('success',Code::SUCCESS,$info);
  62 + }
  63 +}
@@ -495,6 +495,12 @@ Route::middleware(['bloginauth'])->group(function () { @@ -495,6 +495,12 @@ Route::middleware(['bloginauth'])->group(function () {
495 Route::any('/save', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'save'])->name('rating_save'); 495 Route::any('/save', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'save'])->name('rating_save');
496 Route::any('/code', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'verificationCode'])->name('rating_code'); 496 Route::any('/code', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'verificationCode'])->name('rating_code');
497 }); 497 });
  498 +
  499 + //月报表
  500 + Route::prefix('month_report')->group(function () {
  501 + Route::any('/month', [\App\Http\Controllers\Bside\BCom\MonthReportController::class, 'getMonth'])->name('month_report_getMonth');
  502 + Route::any('/read', [\App\Http\Controllers\Bside\BCom\MonthReportController::class, 'monthReportInfo'])->name('month_report_read');
  503 + });
498 }); 504 });
499 //无需登录验证的路由组 505 //无需登录验证的路由组
500 Route::group([], function () { 506 Route::group([], function () {