update marketing
All checks were successful
All checks were successful
This commit is contained in:
30
Modules/MarketingAddon/App/SmsGateways/AcnooSms.php
Normal file
30
Modules/MarketingAddon/App/SmsGateways/AcnooSms.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MarketingAddon\App\SmsGateways;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class AcnooSms
|
||||
{
|
||||
public static function send_message($gateway, $numbers, $contents)
|
||||
{
|
||||
$response = Http::post('https://acnoosms.com/send-message', [
|
||||
'client_id' => $gateway->params['client_id'] ?? '',
|
||||
'client_secret' => $gateway->params['client_secret'] ?? '',
|
||||
'gateway_id' => $gateway->params['gateway_id'] ?? '',
|
||||
'type' => 0,
|
||||
'content' => $contents,
|
||||
'numbers' => $numbers,
|
||||
]);
|
||||
|
||||
if ($response['status']) {
|
||||
return [
|
||||
'status' => true,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
21
Modules/MarketingAddon/App/SmsGateways/HaDavar.php
Normal file
21
Modules/MarketingAddon/App/SmsGateways/HaDavar.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MarketingAddon\App\SmsGateways;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class HaDavar
|
||||
{
|
||||
public static function send_message($gateway, $numbers, $contents, $sender_name = null)
|
||||
{
|
||||
$response = Http::asForm()->{$gateway->params['api_method']}($gateway->params['api_url'], array_merge([
|
||||
'Username' => $gateway->params['username'],
|
||||
'Token' => $gateway->params['token'],
|
||||
'Sender' => $sender_name ?? $gateway->params['sender'],
|
||||
$gateway->params['number_key'] => $numbers,
|
||||
$gateway->params['message_key'] => $contents,
|
||||
]));
|
||||
|
||||
return $response->body();
|
||||
}
|
||||
}
|
||||
30
Modules/MarketingAddon/App/SmsGateways/RouteMobile.php
Normal file
30
Modules/MarketingAddon/App/SmsGateways/RouteMobile.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MarketingAddon\App\SmsGateways;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class RouteMobile
|
||||
{
|
||||
public static function send_message($gateway, $numbers, $contents, $sender_name = null)
|
||||
{
|
||||
$response = Http::asForm()->{$gateway->params['api_method']}($gateway->params['api_url'], array_merge([
|
||||
'dlr' => $gateway->params['dlr'],
|
||||
'type' => $gateway->params['type'],
|
||||
'source' => $sender_name ?? $gateway->params['source'],
|
||||
$gateway->params['number_key'] => $numbers,
|
||||
'username' => $gateway->params['username'],
|
||||
'password' => $gateway->params['password'],
|
||||
$gateway->params['message_key'] => $contents,
|
||||
]));
|
||||
|
||||
$words = explode('|', $response);
|
||||
$firstFourWords = array_slice($words, 0, 4);
|
||||
|
||||
if ($firstFourWords[0] == 1701) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Modules/MarketingAddon/App/SmsGateways/TzskSms.php
Normal file
21
Modules/MarketingAddon/App/SmsGateways/TzskSms.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MarketingAddon\App\SmsGateways;
|
||||
|
||||
class TzskSms
|
||||
{
|
||||
public static function send_message($gateway, $numbers, $contents)
|
||||
{
|
||||
$numbers = is_array($numbers) ? $numbers : explode(',', $numbers);
|
||||
|
||||
foreach ($gateway->params as $key => $param) {
|
||||
config(['sms.drivers.' . $gateway->driver . '.' . $key => $param]);
|
||||
}
|
||||
|
||||
sms()->via($gateway->driver)->send($contents, function ($sms) use ($numbers) {
|
||||
$sms->to($numbers);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user