feat : refund

This commit is contained in:
2025-03-27 10:47:31 +08:00
parent 1265bdcce9
commit f9d3511ed6
7 changed files with 128 additions and 23 deletions

View File

@@ -44,6 +44,11 @@ abstract class BaseRefundOrderService
*/
public int $type;
/**
* @var int
*/
public int $adminId = 0;
/**
* @var array
*/
@@ -213,6 +218,7 @@ abstract class BaseRefundOrderService
$this->refundInfo = new RefundOrder();
$this->refundInfo->user_id = $this->orderInfo->user_id;
$this->refundInfo->action_admin_id = $this->adminId;
$this->refundInfo->order_type = OrderCode::ORDER_TYPE_GOOD;
$this->refundInfo->order_id = $this->orderId;
$this->refundInfo->pay_id = $this->payInfo->id;

View File

@@ -10,6 +10,7 @@ declare(strict_types=1);
namespace App\Service\Amqp\Refund;
use App\Constants\Common\RefundCode;
use App\Event\RefundGoodOrderFinishEvent;
use App\Lib\Log;
use App\Model\Order;
@@ -103,11 +104,23 @@ class RefundGoodOrderFinishService
$this->manageSubCateringLog();
});
if ($this->rollBackStockFlag) {
$this->sendStockMq($this->orderInfo->id,$this->orderInfo->status);
}
$this->eventDispatcher->dispatch(new RefundGoodOrderFinishEvent($this->orderInfo->id, $this->payInfo->id, $this->refundInfo->id));
}
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function rollBackStock(): void
{
if (!$this->rollBackStockFlag) return;
//判断是不是用户行为才退库存
if ($this->refundInfo->action_admin_id != 0) return;
$this->sendStockMq($this->orderInfo->id,$this->orderInfo->status);
}
}