src/Biz/OrderFacade/Service/Impl/OrderRefundServiceImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\OrderFacade\Service\Impl;

use Biz\BaseService;
use Biz\Order\OrderException;
use Biz\OrderFacade\Service\OrderRefundService;
use Biz\User\UserException;
use Codeages\Biz\Order\Service\OrderService;

class OrderRefundServiceImpl extends BaseService implements OrderRefundService
{
    public function searchRefunds($conditions, $orderBy, $start, $limit)
    {
        return $this->getOrderRedoundService()->searchRefunds($conditions, $orderBy, $start, $limit);
    }

    public function countRefunds($conditions)
    {
        return $this->getOrderRedoundService()->countRefunds($conditions);
    }

    public function getOrderRefundById($id)
    {
        return $this->getOrderRedoundService()->getOrderRefundById($id);
    }

    public function applyOrderRefund($orderId, $fields)
    {
        $order = $this->getOrderService()->getOrder($orderId);
        list($product, $orderItem) = $this->getProductAndOrderItem($order);

        $user = $this->getCurrentUser();

        $canApplyOrderRefund = ($user->getId() == $order['created_user_id']) && ($order['pay_amount'] > 0) && ($order['refund_deadline'] > time());
        $refunds = $this->getOrderRedoundService()->searchRefunds(array('order_id' => $order['id'], 'status' => 'auditing'), array(), 0, PHP_INT_MAX);
        if (count($refunds) >= 1) {
            $refund = $refunds[0];
            $canApplyOrderRefund = false;
        }
        if ($canApplyOrderRefund) {
            try {
                $this->beginTransaction();
                $refund = $this->getWorkflowService()->applyOrderRefund($order['id'], array(
                    'reason' => $fields['reason'],
                ));
                $this->notifyStudent($product);
                $this->notifyAdmins($product);
                $this->commit();
            } catch (\Exception $exception) {
                $this->rollback();
                throw $exception;
            }
        }

        return $refund;
    }

    public function refuseRefund($orderId, $data)
    {

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

AI 解读 AI

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

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