fix(price-trigger): restrict notifications to SMS only
Remove email/in-app paths and enforce sms action on create/update so price alerts match the product requirement for SMS-only delivery. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,13 +3,11 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\YourMailableClass;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Price;
|
||||
use App\Models\PriceTrigger;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class PriceTriggerService
|
||||
{
|
||||
@@ -167,14 +165,14 @@ class PriceTriggerService
|
||||
$shopName = (string) Controller::Config('name_fa');
|
||||
$message = 'قیمت ' . $title . ' به ' . number_format((int) $current) . " رسید\n" . $shopName;
|
||||
|
||||
if ($trigger->action === 'email' && ! empty($customer->email)) {
|
||||
Mail::to($customer->email)->send(new YourMailableClass($message, '', '', '', ''));
|
||||
|
||||
if (! Controller::isSmsNotifEnabled('sms_notif_price_trigger')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($trigger->action === 'sms' && Controller::isSmsNotifEnabled('sms_notif_price_trigger')) {
|
||||
Controller::Send($customer->mobile, $message);
|
||||
if (trim((string) ($customer->mobile ?? '')) === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
Controller::Send($customer->mobile, $message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user