Files
hyperf_service/app/Service/Amqp/Refund/RefundGoodOrderFinishService.php
2025-03-25 16:04:12 +08:00

81 lines
1.6 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\Order;
use App\Model\PayOrder;
use App\Model\RefundOrder;
use App\Service\ServiceTrait\Api\CateringTrait;
use App\Service\ServiceTrait\Api\CouponTrait;
use App\Service\ServiceTrait\Api\OrderTrait;
use App\Service\ServiceTrait\Api\RefundOrderTrait;
use Hyperf\DbConnection\Db;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class RefundGoodOrderFinishService
{
use RefundOrderTrait;
use CateringTrait;
use CouponTrait;
use OrderTrait;
/**
* @var string
*/
public string $orderSno;
/**
* @var int
*/
public int $payType;
/**
* @var int
*/
public int $orderType;
/**
* @var Order
*/
protected Order $orderInfo;
/**
* @var PayOrder
*/
protected PayOrder $payInfo;
/**
* @var RefundOrder
*/
protected RefundOrder $refundInfo;
/**
* @return void
*/
public function handle(): void
{
$this->checkRefundOrder();
Db::transaction(function (){
$this->manageRefundOrder();
$this->manageOrderByRefund();
$this->manageSubCateringLog();
if ($this->orderInfo->coupin_id > 0) $this->rollbackCoupon(OrderCode::ORDER_TYPE_GOOD,$this->orderInfo);
});
// $this->sendStockMq($this->orderInfo->id,$this->orderInfo->status);
}
}