diff --git a/app/Notifications/WorkOrder/WorkOrder.php b/app/Notifications/WorkOrder/WorkOrder.php index c903a72..4a2c129 100644 --- a/app/Notifications/WorkOrder/WorkOrder.php +++ b/app/Notifications/WorkOrder/WorkOrder.php @@ -7,7 +7,6 @@ use App\Notifications\Channels\WeComChannel; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class WorkOrder extends Notification implements ShouldQueue @@ -29,26 +28,9 @@ public function __construct(WorkOrderModel $work_order) /** * Get the notification's delivery channels. */ - public function via(WorkOrderModel $workOrder): array + public function via(): array { - $methods = [WeComChannel::class, WebChannel::class]; - - if (in_array($workOrder->status, ['processing', 'replied'])) { - $methods[] = 'mail'; - } - - return $methods; - } - - /** - * Get the mail representation of the notification. - */ - public function toMail(WorkOrderModel $workOrder): MailMessage - { - return (new MailMessage) - ->subject('工单: '.$workOrder->title.' 状态更新。') - ->line('我们查阅了您的工单并做出了相应处理。') - ->line('请前往我们的仪表盘继续跟进问题。'); + return [WeComChannel::class, WebChannel::class]; } /** @@ -67,23 +49,10 @@ public function toWeCom(WorkOrderModel $workOrder): false|array { $workOrder->load(['module', 'user']); - $wecom_key = config('settings.wecom.robot_hook.default'); - - if ($workOrder->module) { - $module = $workOrder->module; - - $wecom_key = $module->makeVisible(['wecom_key'])->wecom_key ?? $wecom_key; - } - return [ - 'key' => $wecom_key, + 'key' => $workOrder->wecom_key, 'view' => 'notifications.work_order', 'data' => $workOrder, ]; } - - // public function toBroadcast(WorkOrderModel $workOrder): BroadcastMessage - // { - // return new BroadcastMessage($workOrder->toArray()); - // } }