Update api requests
This commit is contained in:
34
commands/Bot.php
Normal file
34
commands/Bot.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user