最新服务器上的版本,以后用这个
zhangmeng
2023-04-19 e3f5aa12f58d986098a9de0f5cb38060e403036d
commit | author | age
2207d6 1 <?php
W 2 /**
3  * @copyright ©2018 浙江禾匠信息科技
4  * @author Lu Wei
5  * @link http://www.zjhejiang.com/
6  * Created by IntelliJ IDEA
7  * Date Time: 2019/2/14 10:54
8  */
9
10
11 namespace app\handlers;
12
13 use app\events\OrderEvent;
14 use app\forms\common\order\CommonOrder;
15 use app\models\Order;
16
17 class OrderCanceledHandler extends HandlerBase
18 {
19
20     /**
21      * 事件处理注册
22      */
23     public function register()
24     {
25         \Yii::$app->on(Order::EVENT_CANCELED, function ($event) {
26             /** @var OrderEvent $event */
27             \Yii::$app->setMchId($event->order->mch_id);
28             $commonOrder = CommonOrder::getCommonOrder($event->order->sign);
29             $orderHandler = $commonOrder->getOrderHandler();
30             $handler = $orderHandler->orderCanceledHandlerClass;
31             $handler->orderConfig = $commonOrder->getOrderConfig();
32             $handler->event = $event;
33             $handler->setMall()->handle();
34         });
35     }
36 }