Statistiken: Kundenfeedback 2026-08-19 komplett (N1-N8) + Review-Fixes + VP-/Incentive-Repair gehärtet
Statistik-Änderungen 2026-08-19 (dev/2026-07-22/entwicklungsplan-2026-08-19.md, alle 8 Pakete gemäß beantworteten F-Fragen): - N1 Monatsstatistik: Team-Cluster (Firstlines klickbar -> neue Seite user_team_firstlines, Teampartner gesamt/Payline [nur aktive], Abos Payline mit +N) + Level-Kachel (Quali-Stufe, fehlende Payline-/persönliche Punkte, Karriere-Level); LiveCommissionService-Snapshot v3 reicht Level-/Quali-Daten durch - N2 Abo-Kacheln auf Home monatsbezogen (aboStockCount-Rückrechnung über cancel/deleted/Status-Historie; VIP-Statistik bleibt tagesaktuell) - N3 VIP-Statistik 'Recruiter des Monats' (Neupartner-Definition wie KPI, rekursives Ketten-Volumen als Gesamtpunkte inkl. Starterpaket) + Drilldown/CSV-Spalte 'Punkte gesamt' - N4 Prognose-Block 'Level & Provision laut Prognose (Stand 25.)' mit unverbindlich-Kennzeichnung (ebenengenaue offene Abo-Punkte + TP-Laufstände) - N5 Checkout-Herkunft: Dropdown raus, Pflicht-Freitext (lokalisierte Fehlermeldung) - N6 Berater-Profilfoto (user_accounts.profile_image, Einwilligung als Sprachkey-Platzhalter, DSGVO-Löschung) + teaminterne Top-3-Karte (TopResultsService, Scope-Schalter) - N7 USt-Optionen: 'nicht umsatzsteuerpflichtig' zuerst + '§ 19 UStG'-Textfix - N8 Jahresgebühr-Nachfassliste je Berater (AnnualFeeDueService, überfällig/1-3 Monate, Sidenav) Kontroll-Review (8 Perspektiven) angewendet: next-Level-Fallback im Steady-State (resolveNextLevel — sonst 'Höchstes Level erreicht' für Normalfälle), _calculated-Punktebasis bei mehr Paylines, keine Wiederbelebung deaktivierter Abos in der Monatsrückrechnung, Payline-Abo-Kachel monatskonsistent, Top-3-Nachrücker; Performance: BackofficeDashboardService als Singleton mit lineBuckets-Memo (+flushLineBucketsMemo), level_forecast 6h-Cache; Reuse: User-Scopes firstlinesOf/newPartnerIn, SalesVolumePoints::totalPointsByUser, Slim::storeCroppedImage (3 Upload-Kopien vereinigt), activeAbo-Scope statt Inline-Prädikate, Form::open-Konvention, Return-Types Repair-Härtung (Kundenentscheide): VP-Nachtrepair dedupliziert über shopping_order_id (Live-Pfad schreibt sie jetzt mit), zählende Alt-Zeilen-Erkennung, Vormonats-Scan für Monatswechsel, Firmenaccount-Buchungen (config mivita.company_user_id) werden automatisch auf den Berater umgebucht (in place bzw. per Gegenbuchung bei geschlossenem Monat; Echtfall Anna Schall Order 58797 -> Christina Schuder), Berater-zu-Berater nur Warnung; Incentive-Repair: m_sponsor=NULL löscht nicht mehr, FK-Repair vor Stale-Bereinigung, gebatchte Lookups, zentrales Incentive::qualificationWindow(); .env aus dem Git-Tracking entfernt (Pflege per SFTP) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
841d87e161
commit
867dc21b57
87 changed files with 4480 additions and 240 deletions
|
|
@ -1,14 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
abstract class SlimStatus {
|
||||
abstract class SlimStatus
|
||||
{
|
||||
const FAILURE = 'failure';
|
||||
|
||||
const SUCCESS = 'success';
|
||||
}
|
||||
|
||||
class Slim {
|
||||
class Slim
|
||||
{
|
||||
/**
|
||||
* Speichert ein Slim-Cropper-Upload (Base64-Payload aus getImages()) im
|
||||
* public-Disk und liefert Dateiname + Metadaten — gemeinsame Logik für
|
||||
* Shop- und Profilfoto-Upload. Null bei nicht erlaubtem Dateityp.
|
||||
*
|
||||
* @param array $image Ein Eintrag aus {@see getImages()}
|
||||
* @return array{filename: string, originalname: string, ext: string, mime: string, size: mixed}|null
|
||||
*/
|
||||
public static function storeCroppedImage(array $image, string $directory): ?array
|
||||
{
|
||||
$allowed = ['image/jpeg' => 'jpg', 'image/png' => 'png'];
|
||||
|
||||
public static function getImages($inputName = 'slim') {
|
||||
if (! isset($allowed[$image['output']['type']])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$name = uniqid().'_'.Slim::sanitizeFileName($image['output']['name']);
|
||||
|
||||
\Storage::disk('public')->put(rtrim($directory, '/').'/'.$name, $image['output']['data']);
|
||||
|
||||
return [
|
||||
'filename' => $name,
|
||||
'originalname' => $image['output']['name'],
|
||||
'ext' => $allowed[$image['output']['type']],
|
||||
'mime' => $image['output']['type'],
|
||||
'size' => $image['input']['size'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getImages($inputName = 'slim')
|
||||
{
|
||||
|
||||
$values = Slim::getPostData($inputName);
|
||||
|
||||
|
|
@ -18,9 +51,9 @@ class Slim {
|
|||
}
|
||||
|
||||
// determine if contains multiple input values, if is singular, put in array
|
||||
$data = array();
|
||||
if (!is_array($values)) {
|
||||
$values = array($values);
|
||||
$data = [];
|
||||
if (! is_array($values)) {
|
||||
$values = [$values];
|
||||
}
|
||||
|
||||
// handle all posted fields
|
||||
|
|
@ -37,10 +70,13 @@ class Slim {
|
|||
}
|
||||
|
||||
// $value should be in JSON format
|
||||
private static function parseInput($value) {
|
||||
private static function parseInput($value)
|
||||
{
|
||||
|
||||
// if no json received, exit, don't handle empty input values.
|
||||
if (empty($value)) {return null;}
|
||||
if (empty($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If magic quotes enabled
|
||||
// Magic quotes were removed in PHP 5.4, no need to check in PHP 8.2
|
||||
|
|
@ -54,27 +90,26 @@ class Slim {
|
|||
$output = null;
|
||||
$meta = null;
|
||||
|
||||
if (isset ($data->input)) {
|
||||
if (isset($data->input)) {
|
||||
|
||||
$inputData = null;
|
||||
if (isset($data->input->image)) {
|
||||
$inputData = Slim::getBase64Data($data->input->image);
|
||||
}
|
||||
else if (isset($data->input->field)) {
|
||||
} elseif (isset($data->input->field)) {
|
||||
$filename = $_FILES[$data->input->field]['tmp_name'];
|
||||
if ($filename) {
|
||||
$inputData = file_get_contents($filename);
|
||||
}
|
||||
}
|
||||
|
||||
$input = array(
|
||||
$input = [
|
||||
'data' => $inputData,
|
||||
'name' => $data->input->name,
|
||||
'type' => $data->input->type,
|
||||
'size' => $data->input->size,
|
||||
'width' => $data->input->width,
|
||||
'height' => $data->input->height,
|
||||
);
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -83,41 +118,40 @@ class Slim {
|
|||
$outputDate = null;
|
||||
if (isset($data->output->image)) {
|
||||
$outputData = Slim::getBase64Data($data->output->image);
|
||||
}
|
||||
else if (isset ($data->output->field)) {
|
||||
} elseif (isset($data->output->field)) {
|
||||
$filename = $_FILES[$data->output->field]['tmp_name'];
|
||||
if ($filename) {
|
||||
$outputData = file_get_contents($filename);
|
||||
}
|
||||
}
|
||||
|
||||
$output = array(
|
||||
$output = [
|
||||
'data' => $outputData,
|
||||
'name' => $data->output->name,
|
||||
'type' => $data->output->type,
|
||||
'width' => $data->output->width,
|
||||
'height' => $data->output->height
|
||||
);
|
||||
'height' => $data->output->height,
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($data->actions)) {
|
||||
$actions = array(
|
||||
'crop' => $data->actions->crop ? array(
|
||||
$actions = [
|
||||
'crop' => $data->actions->crop ? [
|
||||
'x' => $data->actions->crop->x,
|
||||
'y' => $data->actions->crop->y,
|
||||
'width' => $data->actions->crop->width,
|
||||
'height' => $data->actions->crop->height,
|
||||
'type' => $data->actions->crop->type
|
||||
) : null,
|
||||
'size' => $data->actions->size ? array(
|
||||
'type' => $data->actions->crop->type,
|
||||
] : null,
|
||||
'size' => $data->actions->size ? [
|
||||
'width' => $data->actions->size->width,
|
||||
'height' => $data->actions->size->height
|
||||
) : null,
|
||||
'height' => $data->actions->size->height,
|
||||
] : null,
|
||||
'rotation' => $data->actions->rotation,
|
||||
'filters' => $data->actions->filters ? array(
|
||||
'sharpen' => $data->actions->filters->sharpen
|
||||
) : null
|
||||
);
|
||||
'filters' => $data->actions->filters ? [
|
||||
'sharpen' => $data->actions->filters->sharpen,
|
||||
] : null,
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($data->meta)) {
|
||||
|
|
@ -125,16 +159,17 @@ class Slim {
|
|||
}
|
||||
|
||||
// We've sanitized the base64data and will now return the clean file object
|
||||
return array(
|
||||
return [
|
||||
'input' => $input,
|
||||
'output' => $output,
|
||||
'actions' => $actions,
|
||||
'meta' => $meta
|
||||
);
|
||||
'meta' => $meta,
|
||||
];
|
||||
}
|
||||
|
||||
// $path should have trailing slash
|
||||
public static function saveFile($data, $name, $path = 'tmp/', $uid = true) {
|
||||
public static function saveFile($data, $name, $path = 'tmp/', $uid = true)
|
||||
{
|
||||
|
||||
// Add trailing slash if omitted
|
||||
if (substr($path, -1) !== '/') {
|
||||
|
|
@ -142,7 +177,7 @@ class Slim {
|
|||
}
|
||||
|
||||
// Test if directory already exists
|
||||
if(!is_dir($path)){
|
||||
if (! is_dir($path)) {
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
|
||||
|
|
@ -151,41 +186,44 @@ class Slim {
|
|||
|
||||
// Let's put a unique id in front of the filename so we don't accidentally overwrite other files
|
||||
if ($uid) {
|
||||
$name = uniqid() . '_' . $name;
|
||||
$name = uniqid().'_'.$name;
|
||||
}
|
||||
|
||||
// Add name to path, we need the full path including the name to save the file
|
||||
$path = $path . $name;
|
||||
$path = $path.$name;
|
||||
|
||||
// store the file
|
||||
Slim::save($data, $path);
|
||||
|
||||
// return the files new name and location
|
||||
return array(
|
||||
return [
|
||||
'name' => $name,
|
||||
'path' => $path
|
||||
);
|
||||
'path' => $path,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data from remote URL
|
||||
* @param $url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function fetchURL($url, $maxFileSize) {
|
||||
if (!ini_get('allow_url_fopen')) {
|
||||
public static function fetchURL($url, $maxFileSize)
|
||||
{
|
||||
if (! ini_get('allow_url_fopen')) {
|
||||
return null;
|
||||
}
|
||||
$content = null;
|
||||
try {
|
||||
$content = @file_get_contents($url, false, null, 0, $maxFileSize);
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public static function outputJSON($data) {
|
||||
public static function outputJSON($data)
|
||||
{
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
|
@ -196,33 +234,34 @@ class Slim {
|
|||
* or any of the following characters -_~,;[]().
|
||||
* If you don't need to handle multi-byte characters
|
||||
* you can use preg_replace rather than mb_ereg_replace
|
||||
* @param $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sanitizeFileName($str) {
|
||||
public static function sanitizeFileName($str)
|
||||
{
|
||||
// Basic clean up
|
||||
$str = preg_replace('([^\w\s\d\-_~,;\[\]\(\).])', '', $str);
|
||||
// Remove any runs of periods
|
||||
$str = preg_replace('([\.]{2,})', '', $str);
|
||||
|
||||
$str = (strlen($str) > 33) ? substr($str,-33) : $str;
|
||||
$str = (strlen($str) > 33) ? substr($str, -33) : $str;
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the posted data from the POST or FILES object. If was using Slim to upload it will be in POST (as posted with hidden field) if not enhanced with Slim it'll be in FILES.
|
||||
* @param $inputName
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
private static function getPostData($inputName) {
|
||||
private static function getPostData($inputName)
|
||||
{
|
||||
|
||||
$values = array();
|
||||
$values = [];
|
||||
|
||||
if (isset($_POST[$inputName])) {
|
||||
$values = $_POST[$inputName];
|
||||
}
|
||||
else if (isset($_FILES[$inputName])) {
|
||||
} elseif (isset($_FILES[$inputName])) {
|
||||
// Slim was not used to upload this file
|
||||
return false;
|
||||
}
|
||||
|
|
@ -232,24 +271,25 @@ class Slim {
|
|||
|
||||
/**
|
||||
* Saves the data to a given location
|
||||
* @param $data
|
||||
* @param $path
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function save($data, $path) {
|
||||
if (!file_put_contents($path, $data)) {
|
||||
private static function save($data, $path)
|
||||
{
|
||||
if (! file_put_contents($path, $data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the "data:image..." part of the base64 data string so PHP can save the string as a file
|
||||
* @param $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getBase64Data($data) {
|
||||
private static function getBase64Data($data)
|
||||
{
|
||||
return base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue