Update api requests

This commit is contained in:
miroman-afk
2021-05-31 16:11:03 +03:00
parent 8990126842
commit 3b61b27200
54 changed files with 1911 additions and 362 deletions

34
commands/Bot.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
namespace App\Commands;
use App\Component\Models\Dishes;
use App\Component\Models\Folders;
use App\Component\Models\Orders;
use App\Component\Models\Settings;
use App\Component\Models\Tasks;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class Bot 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 = Dishes::where('is_bot_export', '=', 0)->update(['is_bot_export' => 1]);
$folders = Folders::where('is_bot_export', '=', 0)->update(['is_bot_export' => 1]);
}
$ordersinfo = Tasks::where('method', '=', 'orderinfo')->get();
$delete_params = ['closed', 'deleted'];
foreach ($ordersinfo as $more) {
$order = Orders::where('id', '=', $more['more'])->whereIn('status', $delete_params)->get();
foreach ($order as $value) {
$delete = Tasks::where('method', '=', 'orderinfo')->where('more', '=', $value['id'])->delete();
}
}
return [
'status' => 'success',
];
}
}