fix(API): FCM 알림 채널 매핑 수정
- TodayIssue IMPORTANT_NOTIFICATIONS에서 deposit, withdrawal 제거 - notification_type별 채널 매핑 메서드 추가 - new_vendor → push_urgent (긴급/신규업체) - approval_request → push_payment (결재) - sales_order → push_sales_order (수주) - purchase_order → push_purchase_order (발주) - contract → push_contract (계약) - 나머지 → push_default (일반) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -93,13 +93,12 @@ class TodayIssue extends Model
|
||||
self::BADGE_WITHDRAWAL => 'withdrawal',
|
||||
];
|
||||
|
||||
// 중요 알림 (푸시 알림음) - 수주등록, 신규거래처, 결재요청, 입금, 출금
|
||||
// 중요 알림 (긴급 푸시) - 수주등록, 신규거래처, 결재요청
|
||||
// 입금, 출금, 카드 등은 일반 푸시(push_default)로 발송
|
||||
public const IMPORTANT_NOTIFICATIONS = [
|
||||
'sales_order',
|
||||
'new_vendor',
|
||||
'approval_request',
|
||||
'deposit',
|
||||
'withdrawal',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -441,8 +441,8 @@ public function sendFcmNotification(TodayIssue $issue): void
|
||||
return;
|
||||
}
|
||||
|
||||
// 중요 알림 여부에 따른 채널 결정
|
||||
$channelId = $issue->isImportantNotification() ? 'push_urgent' : 'push_default';
|
||||
// 알림 타입에 따른 채널 결정
|
||||
$channelId = $this->getChannelForNotificationType($issue->notification_type);
|
||||
|
||||
$result = $this->fcmSender->sendToMany(
|
||||
$tokens,
|
||||
@@ -555,4 +555,27 @@ public function createIssueWithFcm(
|
||||
|
||||
return $issue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림 타입에 따른 FCM 채널 ID 반환
|
||||
*
|
||||
* 채널별 알림음:
|
||||
* - push_urgent: 긴급(신규업체)
|
||||
* - push_payment: 결재
|
||||
* - push_sales_order: 수주
|
||||
* - push_purchase_order: 발주
|
||||
* - push_contract: 계약
|
||||
* - push_default: 일반 (입금, 출금, 카드 등)
|
||||
*/
|
||||
private function getChannelForNotificationType(?string $notificationType): string
|
||||
{
|
||||
return match ($notificationType) {
|
||||
'new_vendor' => 'push_urgent', // 긴급(신규업체)
|
||||
'approval_request' => 'push_payment', // 결재
|
||||
'sales_order' => 'push_sales_order', // 수주
|
||||
'purchase_order' => 'push_purchase_order', // 발주
|
||||
'contract' => 'push_contract', // 계약
|
||||
default => 'push_default', // 일반 (입금, 출금, 카드 등)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user