vendor/codeages/biz-order-pay/src/Invoice/Service/Impl/InvoiceServiceImpl.php

(开头部分) 1KB

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

<?php

namespace Codeages\Biz\Invoice\Service\Impl;

use Codeages\Biz\Framework\Util\ArrayToolkit;
use Codeages\Biz\Framework\Service\BaseService;
use Codeages\Biz\Invoice\Service\InvoiceService;
use Codeages\Biz\Framework\Service\Exception\AccessDeniedException;

class InvoiceServiceImpl extends BaseService implements InvoiceService
{
    public function getInvoice($id)
    {
        return $this->getInvoiceDao()->get($id);
    }

    public function getInvoiceBySn($sn)
    {
        return $this->getInvoiceDao()->getBySn($sn);
    }

    public function applyInvoice($apply)
    {
        $apply = $this->prepareApply($apply);

        $trades = $this->tryApplyInvoice($apply);

        try {
            $this->biz['db']->beginTransaction();

            $apply = $this->createInvoice($apply);

            foreach ($trades as $trade) {
                $this->getPayTradeService()->setTradeInvoiceSnById($trade['id'], $apply['sn']);
            }

            $this->biz['db']->commit();
        } catch (\Exception $e) {
            $this->biz['db']->rollback();
            throw $e;
        }

        return $apply;
    }

    protected function prepareApply($apply)
    {
        $user = $this->biz['user'];
        $apply['user_id'] = $user['id'];

        $apply['ids'] = explode(',', $apply['ids']);

        $apply['money'] *= 100;

        $apply['sn'] = $this->generateSn();

        return $apply;
    }

    protected function generateSn()

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

AI 解读 AI

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

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