Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:36:47 +02:00
parent bfa3bb1df4
commit 9ae662f63e
243 changed files with 12580 additions and 12018 deletions

View file

@ -52,48 +52,36 @@ class BusinessStore extends Command
*/
public function handle()
{
$executeDay = (int) Setting::getContentBySlug('day-exectute-business-structur');
$this->info('RUN Command BusinessStore on Day: '. $executeDay);
$presentDay = (int) date('d');
$this->info('RUN Command BusinessStore on Day: '. $executeDay);
$this->info('RUN Command BusinessStore present Day: '. $presentDay);
if($executeDay !== $presentDay){
$this->info('NOT RUN Command BusinessStore is not present Day: '. $presentDay);
return 0;
}
$this->timeStart = microtime(true);
//$this->info('RUN Command BusinessStore');
$this->month = $this->argument('month');
$this->year = $this->argument('year');
if(!$this->month || !$this->year){
$this->month = (int) date("m", strtotime("-1 month", time()));
$this->year = (int) date("Y", strtotime("-1 month", time()));
}
$this->info('RUN Command BusinessStore on month: '.$this->month.' | year: '.$this->year);
//erstellt die Business Struktur und die Details
$this->storeBusinessStructureUsersDetailMonth();
//Struktur und die Details für mehrere Montate for / to month
//$this->storeBusinessStructureUsersDetailPeriod(1, 6);
//erstellt die Gutschriften
// Argumente mit Standardwerten für den Vormonat
$this->month = $this->argument('month') ?: (int) date("m", strtotime("-1 month"));
$this->year = $this->argument('year') ?: (int) date("Y", strtotime("-1 month"));
$this->info('RUN Command BusinessStore on month: '.$this->month.' | year: '.$this->year);
// Prozesse ausführen
$this->storeBusinessStructureUsersDetailMonth();
$this->userBusinessCommissionsToCredit();
//erstellt aus den Gutschriften die PDFs
//$this->userCreatePaymentCreditsPDF();
//update user Level
//$this->userLevelUpdate();
// Auskommentierte Prozesse
// $this->userCreatePaymentCreditsPDF();
// $this->userLevelUpdate();
// $this->storeBusinessStructureUsersDetailPeriod(1, 6);
return 0;
//\Log::info('Cron is running');
//return 0;
}
private function storeBusinessStructureUsersDetailMonth(){
@ -104,11 +92,8 @@ class BusinessStore extends Command
$businessUsersStore->storeBusinessUsersDetail();
$bool = $businessUsersStore->storeBusinessCompleted();
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command storeBusinessStructureUsersDetailMonth: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command storeBusinessStructureUsersDetailMonth: '.$bool);
}
private function userBusinessCommissionsToCredit(){
@ -121,11 +106,8 @@ class BusinessStore extends Command
$ret = $userPaymentCredits->addUserCreditItem($userBusiness);
$this->info('userBusinessCredit: '.$ret->user_id.' : Team: '.$ret->commission_pp_total.' | Shop: '.$ret->commission_shop_sales);
}
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command userBusinessCommissionsToCredit: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command userBusinessCommissionsToCredit:');
}
private function userCreatePaymentCreditsPDF(){
@ -139,11 +121,8 @@ class BusinessStore extends Command
$this->info('creditsPDF: '.$bool.' user_id: '.$creditItemUser->user_id);
}
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command userCreatePaymentCreditsPDF: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command userCreatePaymentCreditsPDF:');
}
private function userLevelUpdate(){
@ -162,29 +141,32 @@ class BusinessStore extends Command
}
}
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command userLevelUpdate: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command userLevelUpdate:');
}
private function storeBusinessStructureUsersDetailPeriod($for, $to){
for($i = $for; $i<=$to; $i++){
$month = $i;
$this->info('Store Business Structure Users Detail month: '.$month.' year:'.$this->year);
$businessUsersStore = new BusinessUsersStore($month, $this->year);
private function storeBusinessStructureUsersDetailPeriod($from, $to)
{
for($i = $from; $i <= $to; $i++){
$this->info('Store Business Structure Users Detail month: '.$i.' year:'.$this->year);
$businessUsersStore = new BusinessUsersStore($i, $this->year);
$businessUsersStore->storeUserBusinessStructure();
$businessUsersStore->storeBusinessUsersDetail();
$bool = $businessUsersStore->storeBusinessCompleted();
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('Period BusinessStore: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('Period BusinessStore: '.$bool);
}
}
}
private function logExecutionTime($message)
{
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info($message. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
}
}