inital commit
This commit is contained in:
71
app/Console/Commands/SendContractSmsNotification.php
Normal file
71
app/Console/Commands/SendContractSmsNotification.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use SoapFault;
|
||||
use SoapClient;
|
||||
use App\Models\ContractSubItems;
|
||||
use Illuminate\Console\Command;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SendContractSmsNotification extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'command:sendcontractsmsnotification';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$contractSubItems = ContractSubItems::where('last_date_update', '<' , Carbon::now()->subMonths(2))->where('last_status_id', '<>', 3)->get();
|
||||
|
||||
foreach ($contractSubItems as $key => $value) {
|
||||
$message = "سلام،\n پروژه راهداری با کد یکتای {$value->unique_code} با مسئولیت شما، به مدت بیشتر از یک ماه به روزرسانی نشده است. لطفا نسبت به روز رسانی دقیق پیشرفت پروژه در سامانه اقدام نمایید.\n rms.rmto.ir";
|
||||
|
||||
self::sms_sender($value->operator_phone, $message);
|
||||
}
|
||||
}
|
||||
|
||||
public function sms_sender($mobile, $msg)
|
||||
{
|
||||
$client=new SoapClient("http://sms1000.ir/webservice/smspro.asmx?WSDL");
|
||||
$result=$client->doSendSMS(
|
||||
array(
|
||||
'uUsername' => 'rmto',
|
||||
'uPassword' => 'Rahdari89',
|
||||
'uNumber' => '1000141',
|
||||
'uCellphones' => $mobile,
|
||||
'uMessage' => $msg,
|
||||
'uFarsi' => true,
|
||||
'uTopic' => false,
|
||||
'uFlash' => false
|
||||
)
|
||||
);
|
||||
$x = $result->doSendSMSResult;
|
||||
return $x;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user