tambah rekod blast sms

This commit is contained in:
Nur Izzati Zulkifli
2023-11-22 15:38:31 +08:00
parent 3364c6167f
commit 68ee50139e
7 changed files with 177 additions and 17 deletions
+24 -3
View File
@@ -4,6 +4,8 @@ namespace App\Jobs;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;
use App\BlastSMS;
use Carbon\Carbon;
class SMSPelangganSAGLAMA extends Job
{
@@ -11,17 +13,23 @@ class SMSPelangganSAGLAMA extends Job
public $telefon;
public $caw_name;
public $nofoncaw;
public $kodcaw;
public $norujukan;
public $tempoh;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($nokp, $telefon, $caw_name,$nofoncaw)
public function __construct($nokp, $telefon, $caw_name,$nofoncaw,$kodcaw,$norujukan,$tempoh)
{
$this->nokp = $nokp;
$this->telefon = $telefon;
$this->caw_name = $caw_name;
$this->nofoncaw = $nofoncaw;
$this->kodcaw = $kodcaw;
$this->norujukan = $norujukan;
$this->tempoh = $tempoh;
}
/**
@@ -31,6 +39,8 @@ class SMSPelangganSAGLAMA extends Job
*/
public function handle()
{
$current = Carbon::now();
$current = new Carbon();
// $mobile_no = ltrim($this->telefon, '+6');
$mobile_no = '60178916936';
$message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis sebelum 15/7/2024 bagi menukar SAG dengan cara:
@@ -40,8 +50,7 @@ Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.';
if(env('APP_ENV') != 'production'){
$mobile_no = env('ADMIN_PHONE_NUMBER');
}
Http::get(env('ONEWAYSMS_API'), [
$response = Http::get(env('ONEWAYSMS_API'), [
'apiusername' => env('ONEWAYSMS_AUTH_USER'),
'apipassword' => env('ONEWAYSMS_AUTH_PASS'),
'senderid' => 'INFO',
@@ -50,6 +59,18 @@ Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.';
'languagetype' => 1
]);
//insert log blast sms
$logblastsms = new BlastSMS();
$logblastsms->kodcaw = $this->kodcaw;
$logblastsms->nokp = $this->nokp;
$logblastsms->notelefon = $this->telefon;
$logblastsms->norujukan = $this->norujukan;
$logblastsms->tempoh = $this->tempoh;
$logblastsms->status = $response;
$logblastsms->created_at = $current;
$logblastsms->updated_at = $current;
$logblastsms->save();
Log::info("SMS - Pelanggan ".$this->caw_name." SAG Tawarruq Lama -".$mobile_no);
}
+27 -1
View File
@@ -4,6 +4,8 @@ namespace App\Jobs;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;
use App\BlastWasap;
use Carbon\Carbon;
class WhatsappPelangganSAGLAMA extends Job
{
@@ -11,17 +13,27 @@ class WhatsappPelangganSAGLAMA extends Job
public $telefon;
public $caw_name;
public $nofoncaw;
public $kodcaw;
public $norujukan;
public $tempoh;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($nokp, $telefon, $caw_name,$nofoncaw)
public function __construct($nokp, $telefon, $caw_name,$nofoncaw,$kodcaw,$norujukan,$tempoh)
{
$this->nokp = $nokp;
$this->telefon = $telefon;
$this->caw_name = $caw_name;
$this->nofoncaw = $nofoncaw;
$this->kodcaw = $kodcaw;
$this->norujukan = $norujukan;
$this->tempoh = $tempoh;
}
/**
@@ -31,6 +43,8 @@ class WhatsappPelangganSAGLAMA extends Job
*/
public function handle()
{
$current = Carbon::now();
$current = new Carbon();
// $mobile_no = ltrim($this->telefon, '+6');
//$mobile_no = '60178916936';
$message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis *sebelum 15/7/2024* bagi menukar SAG dengan cara:
@@ -50,6 +64,18 @@ Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.';
'instance_id' => env('WABOT_INSTANCES_ID'),
'access_token' => env('WABOT_TOKEN_KEYS')
]);
//insert log blast wasap
$logblastwasap = new BlastWasap();
$logblastwasap->kodcaw = $this->kodcaw;
$logblastwasap->nokp = $this->nokp;
$logblastwasap->notelefon = $this->telefon;
$logblastwasap->norujukan = $this->norujukan;
$logblastwasap->tempoh = $this->tempoh;
$logblastwasap->status = $response;
$logblastwasap->created_at = $current;
$logblastwasap->updated_at = $current;
$logblastwasap->save();
Log::info("WABOT - Pelanggan SAG Tawarruq Lama".$response);