Files
xk-api-yii/common/handlers/orderHandler/BaseOrderHandler.php
2024-09-19 11:32:39 +08:00

38 lines
751 B
PHP

<?php
namespace common\handlers\orderHandler;
use common\core\BaseModel;
use common\events\OrderEvent;
use common\models\Mall;
/**
* @property OrderEvent $event
* @property Mall $mall
*/
abstract class BaseOrderHandler extends BaseModel
{
public $event;
public $mall;
/**
* @return mixed
* 事件处理
*/
abstract public function handle();
/**
* @return $this
*/
public function setMall()
{
try {
$this->mall = \Yii::$app->mall;
} catch (\Exception $exception) {
$mall = Mall::findOne(['id' => $this->event->order->mall_id]);
\Yii::$app->setMall($mall);
$this->mall = \Yii::$app->mall;
}
return $this;
}
}