restore composer.json, add mysqli extension

This commit is contained in:
2026-04-15 17:02:52 +05:00
commit 77cf56a348
4317 changed files with 1397107 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Jobs\Cron;
use App\Models\Product;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\Order;
class BackProductJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$now = Carbon::parse(time() - 3600)->format('Y-m-d H:i:s');
$back = Carbon::parse(time() - 315360000)->format('Y-m-d H:i:s');
$orders = Order::where('payment_status', 'waiting')->where('status', 'processing')->with('products')->whereBetween('created_at', [$back, $now])->get();
foreach ($orders as $order) {
$order->status = 'cancelled';
$order->save();
foreach ($order->products as $row) {
$product = Product::find($row->product_id);
$product->count = $product->count + $row->count;
$product->save();
}
}
}
}

43
app/Jobs/Cron/CloseOrderJob.php Executable file
View File

@@ -0,0 +1,43 @@
<?php
namespace App\Jobs\Cron;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\Order;
class CloseOrderJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$from = '2020-01-01 00:00:01';
$to = Carbon::parse(time() - 7200)->format('Y-m-d H:i:s');
$orders = Order::where('payment_type', 'credit')->where('payment_status', 'waiting')->whereBetween('created_at', [$from, $to])->get();
foreach ($orders as $order) {
$order->update([
'payment_status' => 'cancelled',
'archived' => true,
'status' => 'cancelled'
]);
}
}
}

46
app/Jobs/Cron/SendSmsJob.php Executable file
View File

@@ -0,0 +1,46 @@
<?php
namespace App\Jobs\Cron;
use App\Api\Sms;
use App\Models\NotificationAvailable;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class SendSmsJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$notifications = NotificationAvailable::where('sms', 0)->get();
$sms = new Sms();
foreach ($notifications as $notification) {
$message = "Quyoshli: Tovar {$notification->product->getName()} teper dostupen dlya pokupki";
$sms->send($notification->phone, $message);
$notification->delete();
sleep(0.5);
}
}
}