Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1665 | Revision 1668 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 1665 Revision 1667
Zeile 23... Zeile 23...
23
        protected $description = 'Erstellt CSV-Dateien für Preisagenturen';
23
        protected $description = 'Erstellt CSV-Dateien für Preisagenturen';
Zeile 24... Zeile 24...
24
 
24
 
25
        /**
25
        /**
26
         * Execute the console command.
26
         * Execute the console command.
27
         *
27
         *
28
         * @return void
28
         * @return int
29
         */
29
         */
30
        public function handle(): void
30
        public function handle(): int
31
        {
31
        {
32
            @mkdir( public_path( "preisagentur" ), 0755, true );
32
            @mkdir( public_path( "preisagentur" ), 0755, true );
33
            $items = Item::with( 'price', 'medium.medium', "manufacturer" )->where( 'status', 0 )->get();
33
            $items = Item::with( 'price', 'medium.medium', "manufacturer" )->where( 'status', 0 )->get();
34
            $agencies = PriceAgency::where( 'shop_id', $GLOBALS["INI"]["shops_ID"] )->where( "status", "1" )->get();
34
            $agencies = PriceAgency::where( 'shop_id', $GLOBALS["INI"]["shops_ID"] )->where( "status", "1" )->get();
Zeile 44... Zeile 44...
44
                {
44
                {
45
                    $this->warn( "Agentur nicht komplett konfiguriert!" );
45
                    $this->warn( "Agentur nicht komplett konfiguriert!" );
46
                    continue;
46
                    continue;
47
                }
47
                }
48
                $configFile = storage_path( "config/" ) . $agency["config"];
48
                $configFile = storage_path( "config/" ) . $agency["config"];
49
                if ( file_exists( $configFile ) )
49
                if ( !file_exists( $configFile ) )
50
                {
-
 
51
                    require $configFile;
-
 
52
                }
-
 
53
                else
-
 
54
                {
50
                {
55
                    $this->error( "Konfigurationsdatei " . $configFile . " existiert nicht!" );
51
                    $this->error( "Konfigurationsdatei " . $configFile . " existiert nicht!" );
56
                    continue;
52
                    continue;
57
                }
53
                }
-
 
54
                require $configFile;
58
                $fName = basename( parse_url( $agency["csv_url"], PHP_URL_PATH ) );
55
                $fName = basename( parse_url( $agency["csv_url"], PHP_URL_PATH ) );
59
                $fName = storage_path() . "/" . $fName;
56
                $fName = storage_path() . "/" . $fName;
60
                $f = fopen( $fName, "w" );
57
                $f = fopen( $fName, "w" );
61
                if ( $prefix )
58
                if ( $prefix )
62
                {
59
                {
Zeile 169... Zeile 166...
169
                rename( $fName, public_path( "preisagentur/" ) . basename( $fName ) );
166
                rename( $fName, public_path( "preisagentur/" ) . basename( $fName ) );
170
                $agency->records = $records;
167
                $agency->records = $records;
171
                $agency->last_updated_at = date( "Y-m-d H:i:s" );
168
                $agency->last_updated_at = date( "Y-m-d H:i:s" );
172
                $agency->save();
169
                $agency->save();
173
            }
170
            }
-
 
171
            return Command::SUCCESS;
174
        }
172
        }
175
    }
173
    }