<?php
 namespace Module\Event\Listener; use Carbon\Carbon; use ModStart\Core\Dao\ModelUtil; use Module\Event\Constant\PayConstant; use Module\Event\Type\EventOrderStatus; use Module\PayCenter\Events\OrderPayedEvent; class EventPayListener { public function onOrderPayed(OrderPayedEvent $event) { $biz = $event->biz; $bizId = $event->bizId; switch ($biz) { case PayConstant::EVENT_ORDER: ModelUtil::update('event_order', ['id' => $bizId], ['status' => EventOrderStatus::COMPLETED, 'payTime' => Carbon::now(),]); ModelUtil::update('event_order_item', ['orderId' => $bizId], ['orderStatus' => EventOrderStatus::COMPLETED]); break; } } public function subscribe($events) { $events->listen( OrderPayedEvent::class, '\Module\Event\Listener\EventPayListener@onOrderPayed' ); } } 