45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Commands;
|
|
|
|
use App\Component\Models\Dishes;
|
|
use App\Component\Models\Folders;
|
|
use App\Component\Models\OrderBotStorage;
|
|
use App\Component\Models\Settings;
|
|
use App\Component\Models\Tasks;
|
|
use App\Console\Commands\HRCCommand;
|
|
use App\Console\Commands\HRCCommandInterface;
|
|
|
|
class GETBot extends HRCCommand implements HRCCommandInterface
|
|
{
|
|
protected $signature = 'getbot';
|
|
|
|
public function command($input, $output = null)
|
|
{
|
|
$settings = Settings::where('code', 5)
|
|
->where('value', 1)
|
|
->get();
|
|
if (isset($settings['0']['value'])) {
|
|
Dishes::where('is_bot_export', '=', 0)
|
|
->update(['is_bot_export' => 1]);
|
|
Folders::where('is_bot_export', '=', 0)
|
|
->update(['is_bot_export' => 1]);
|
|
}
|
|
$orders_info = Tasks::where('method', 'orderinfo')
|
|
->get();
|
|
$delete_params = ['closed', 'deleted'];
|
|
foreach ($orders_info as $more) {
|
|
$order = OrderBotStorage::where('id', intval($more['more']))
|
|
->whereIn('status', $delete_params)
|
|
->get();
|
|
foreach ($order as $value) {
|
|
Tasks::where('method', 'orderinfo')
|
|
->where('more', $value['id'])
|
|
->delete();
|
|
}
|
|
}
|
|
return [
|
|
'status' => 'success',
|
|
];
|
|
}
|
|
} |