src/Biz/OrderFacade/Command/OrderPayCheck/OrderPayChecker.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Biz\OrderFacade\Command\OrderPayCheck;

use Biz\OrderFacade\Service\OrderFacadeService;
use Codeages\Biz\Framework\Context\BizAware;
use Codeages\Biz\Order\Service\OrderService;

class OrderPayChecker extends BizAware
{
    /**
     * @var OrderPayCheckCommand[][]
     */
    private $commands;

    private $products = array();

    public function addCommand(OrderPayCheckCommand $command, $priority = 1)
    {
        $command->setBiz($this->biz);
        $command->setOrderPayChecker($this);

        $this->commands[] = array(
            'command' => $command,
            'priority' => $priority,
        );

        uasort($this->commands, function ($a1, $a2) {
            return $a1['priority'] < $a2['priority'];
        });
    }

    public function check($order, $params)
    {
        $commands = $this->commands;
        if (empty($commands)) {
            return;
        }

        foreach ($commands as $command) {
            $command['command']->execute($order, $params);
        }
    }

    public function getProducts($order)
    {
        if ($this->products) {
            return $this->products;
        }

        $orderItems = $this->getOrderService()->findOrderItemsByOrderId($order['id']);

        foreach ($orderItems as $orderItem) {
            $this->products[] = $this->getOrderFacadeService()->getOrderProductByOrderItem($orderItem);
        }

        return $this->products;
    }

    /**

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。