Files
hyperf_service/app/Service/Amqp/Refund/PartialRefundOrderService.php
2025-03-21 15:14:43 +08:00

62 lines
1.3 KiB
PHP

<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Amqp\Refund;
use App\Constants\Common\OrderCode;
use App\Model\OrderGood;
use Exception;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class PartialRefundOrderService extends BaseRefundOrderService
{
/**
* @var int
*/
protected int $orderType = OrderCode::ORDER_TYPE_GOOD;
/**
* @var OrderGood
*/
#[Inject]
protected OrderGood $orderGoodModel;
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws Exception
*/
public function handle(): void
{
try {
$this->getOrderInfo();
$this->checkGoodOrder();
$this->getPayOrder();
$this->getRefundAmount();
$this->insertRefundOrder();
$this->refund();
$this->updateRefund();
} catch (Exception $e) {
$errArr = explode(":", $e->getMessage());
$errMsg = $errArr[0];
$this->updateError($errMsg);
throw new Exception($e->getMessage());
}
}
}