fix some bugs from accounting 9

This commit is contained in:
2026-07-28 21:57:29 +03:30
parent 736d0a4fd1
commit 77e0ba0bb3
4 changed files with 109 additions and 14 deletions
+17 -12
View File
@@ -46,18 +46,23 @@ class CustomerAppNotifyService
}
try {
$row = DB::transaction(function () use ($customerId, $title, $body, $severity) {
$row = AppNotification::create([
'title' => $title,
'body' => $body,
'severity' => $severity,
'is_active' => true,
'created_by' => null,
'audience_type' => AppNotificationAudienceService::TYPE_CUSTOMERS,
'segment_keys' => null,
'audience_label' => 'سیستمی — مشتری '.$customerId,
'recipients_count' => 1,
]);
$payload = [
'title' => $title,
'body' => $body,
'severity' => $severity,
'is_active' => true,
'created_by' => null,
'audience_type' => AppNotificationAudienceService::TYPE_CUSTOMERS,
'segment_keys' => null,
'audience_label' => 'سیستمی — مشتری '.$customerId,
'recipients_count' => 1,
];
if (\Illuminate\Support\Facades\Schema::hasColumn('app_notifications', 'is_system')) {
$payload['is_system'] = true;
}
$row = DB::transaction(function () use ($customerId, $payload) {
$row = AppNotification::create($payload);
AppNotificationRecipient::query()->insert([
'notification_id' => $row->id,