feat : wechatPay callback

This commit is contained in:
2025-03-18 15:15:25 +08:00
parent c8a36f4af8
commit a115068bbc
3 changed files with 13 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ namespace App\Service\Api\Order;
use App\Constants\Common\OrderCode;
use App\Exception\ErrException;
use App\Model\Order;
use App\Model\PayOrder;
use App\Service\Api\BaseService;
use App\Service\ServiceTrait\Common\OrderChangeStatusTrait;
use Hyperf\Di\Annotation\Inject;
@@ -29,6 +30,12 @@ class RefundOrderService extends BaseService
#[Inject]
protected Order $orderModel;
/**
* @var PayOrder
*/
#[Inject]
protected PayOrder $payOrderModel;
/**
* @return array
* @throws ContainerExceptionInterface
@@ -44,8 +51,11 @@ class RefundOrderService extends BaseService
if ($orderInfo->status != OrderCode::PAYED) throw new ErrException('该订单状态已变更,请勿重复操作,刷新后无法退款请联系客服');
$payInfo = $this->payOrderModel->getInfoByOrderIdAndType($orderInfo->id,OrderCode::ORDER_TYPE_GOOD);
if (empty($payInfo)) throw new ErrException('订单支付信息不存在');
//立即取消
$this->joinRefundQueue($orderId, $type, (float)$orderInfo->actual_price, '用户主动取消订单');
$this->joinRefundQueue($orderId, $type, (float)$payInfo->pay_money, '用户主动取消订单');
return $this->return->success();
}