| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace common\events\mall;
- use common\enums\EventNameEnum;
- use common\events\data\ListEvent;
- use common\fixtures\ListData;
- /**
- * 商城获取物流事件
- * Class OrderGetExpressEvent
- */
- final class OrderGetExpressEvent extends ListEvent
- {
- /**
- * 触发事件名称(不可修改)
- *
- * @var string
- */
- public $name = EventNameEnum::ORDER_GET_EXPRESS;
- /**
- * 订单来源
- *
- * @var string
- */
- protected $source;
- /**
- * 订单ID
- *
- * @var int
- */
- protected $order_id;
- /**
- * @param integer $mall_id Mall Id
- * @param array $data 变更后的数据
- */
- public function __construct(int $mall_id, array $list = [], int $order_id, string $source)
- {
- parent::__construct($mall_id, $list);
- $this->source = $source;
- $this->order_id = $order_id;
- }
- /**
- * @return int
- */
- public function getOrderId()
- {
- return $this->order_id;
- }
- /**
- * @param string $source
- * @return boolean
- */
- public function isCurrentSource(string $source): bool
- {
- return $this->source == $source;
- }
- /**
- * @param ListData $obj
- * @param Object|array $ads_item
- * @param array $item
- * @return array
- */
- protected function getItem(ListData $obj, $ads_item, $item)
- {
- $express_log = is_object($ads_item)
- ? $ads_item->toArray()
- : ($ads_item === false ? $this->getDefaultValue($obj) : $ads_item);
- $item['express_log'] = $express_log['list']['Traces'] ?? [];
- return $item;
- }
- }
|