Tambah Function declare xlaku joybidder-temp
This commit is contained in:
@@ -15,6 +15,8 @@ use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Models\LogUser;
|
||||
use App\Models\User;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\Cart;
|
||||
|
||||
|
||||
|
||||
@@ -22,14 +24,16 @@ class AutoTamatLelong implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($id)
|
||||
{
|
||||
//
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,6 +52,18 @@ class AutoTamatLelong implements ShouldQueue
|
||||
->where('tarikh_lelong',$tarikhlelong)
|
||||
->update(['sts_lelong' => 2]);
|
||||
|
||||
$cawlelong = CawanganLelong::where('lelong_id','=',$this->id)->get();
|
||||
foreach($cawlelong as $cawlel) //save old harga asas
|
||||
{
|
||||
// $cawlel->masatamat_lelong = $currenttime;
|
||||
$cawlel->status_online = 0; //start lelong
|
||||
$cawlel->save();
|
||||
}
|
||||
|
||||
$hapuscart = Cart::truncate();
|
||||
|
||||
|
||||
|
||||
$getnoajk = User::where('user_type', 3)->get();
|
||||
foreach($getnoajk as $notifikasi){
|
||||
$mobile_no = '6'.$notifikasi->notelbimbit;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class WhatsappPengesahanPembida implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_notelbimbit;
|
||||
public $user_namapembida;
|
||||
|
||||
// protected $notisid;
|
||||
// protected $cawid;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_notelbimbit,$user_namapembida)
|
||||
{
|
||||
$this->user_notelbimbit = $user_notelbimbit;
|
||||
$this->user_namapembida = $user_namapembida;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$mobile_no = ltrim($this->user_notelbimbit, '+');
|
||||
$message = 'AR-RAHN PKB: Terima Kasih '.$this->user_namapembida .', Pembayaran Anda Telah Disahkan, Sila Ke Cawangan Berkenaan Untuk Tuntutan Barang Bidaan Anda Hari Ini.';
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(env('WABOT_API'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => env('WABOT_INSTANCES_ID'),
|
||||
'access_token' => env('WABOT_TOKEN_KEYS')
|
||||
]);
|
||||
|
||||
Log::info("WABOT - Akaun Telah Sahkan Pembayaran: ".$this->user_namapembida .'' . $response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\LogUser;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
|
||||
|
||||
class WhatsappTidakSahBayaran implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_namapembida;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_namapembida)
|
||||
{
|
||||
$this->user_namapembida = $user_namapembida;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$getnoajk = User::where('user_type', 3)->get();
|
||||
foreach($getnoajk as $notifikasi){
|
||||
$mobile_no = '6'.$notifikasi->notelbimbit;
|
||||
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(env('WABOT_API'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => 'Bayaran Pembida yang bernama *'.$this->user_namapembida.'* Adalah *Tidak Sah*, Mohon Pihak AJK Lelong Untuk Buat Semakan, Terima Kasih.' ,
|
||||
'instance_id' => env('WABOT_INSTANCES_ID'),
|
||||
'access_token' => env('WABOT_TOKEN_KEYS')
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user