add: php artisan command csvExport:generate
This commit is contained in:
parent
f25148606a
commit
024c3de06d
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Http\Controllers\GiteaApiController\GiteaExport;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class exportCsv extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'csvExport:generate';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Export in stringa del csv con integrazione di nextcloud e invio email.';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
// Write your script logic here
|
||||||
|
$this->info('Inizio esecuzione.');
|
||||||
|
$firstDay = date('Y-m-01'); // First day of the current month
|
||||||
|
$lastDay = date('Y-m-t'); // Last day of the current month
|
||||||
|
$this->info('Export da ' . $firstDay .' a '. $lastDay );
|
||||||
|
$calculate_agent_cost = true;
|
||||||
|
$third_party_integrations_allow = true;
|
||||||
|
$third_party_integrations_nextcloud = true;
|
||||||
|
$third_party_integrations_open_project = false;
|
||||||
|
$email_send_allow = true;
|
||||||
|
$this->info(
|
||||||
|
'Le seguenti opzioni sono attive '
|
||||||
|
. ' calculate_agent_cost '. $calculate_agent_cost . '\n'
|
||||||
|
. ' third_party_integrations_allow '. $third_party_integrations_allow . '\n'
|
||||||
|
. ' third_party_integrations_nextcloud '. $third_party_integrations_nextcloud . '\n'
|
||||||
|
. ' third_party_integrations_open_project '. $third_party_integrations_open_project . '\n'
|
||||||
|
. ' email_send_allow '. $email_send_allow . '\n'
|
||||||
|
);
|
||||||
|
$gitea_export = new GiteaExport(
|
||||||
|
$calculate_agent_cost,
|
||||||
|
$third_party_integrations_allow,
|
||||||
|
$third_party_integrations_nextcloud,
|
||||||
|
$third_party_integrations_open_project,
|
||||||
|
$email_send_allow,
|
||||||
|
);
|
||||||
|
$gitea_export->export_issues($firstDay, $lastDay, ['state' => 'closed']);
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
|
use App\Console\Commands\exportCsv;
|
||||||
|
use App\Console\Commands\exportCsvCli;
|
||||||
use App\Http\Controllers\GiteaApiController\GiteaExport;
|
use App\Http\Controllers\GiteaApiController\GiteaExport;
|
||||||
use Dotenv\Dotenv;
|
use Dotenv\Dotenv;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
@ -15,7 +17,7 @@ class Kernel extends ConsoleKernel
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $commands = [
|
protected $commands = [
|
||||||
//
|
exportCsv::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue