feat : spu

This commit is contained in:
2025-03-25 15:54:34 +08:00
parent e25e6cc94b
commit 377f780ab5
12 changed files with 619 additions and 41 deletions

View File

@@ -53,7 +53,7 @@ trait GoodOrderTrait
protected function checkCallBackOrder(): void
{
$this->orderInfo = $this->orderModel->getInfoByOrderSno($this->orderNo);
$this->payInfo = $this->payOrderModel->getInfoByOrderIdAndTypeAndRType($this->orderInfo->id,self::OrderType,self::PayType);
$this->payInfo = $this->payOrderModel->getInfoByOrderIdAndTypeAndRType($this->orderInfo->id,$this->orderType,$this->payType);
if (empty($this->orderInfo) || empty($this->payInfo)) {
$this->log->debug(__CLASS__.':订单不存在,订单号:'.$this->orderNo);

View File

@@ -14,8 +14,6 @@ trait RefundOrderTrait
{
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function checkRefundOrder(): void
{
@@ -23,26 +21,15 @@ trait RefundOrderTrait
$this->orderInfo = $this->orderModel->getInfoById($this->refundInfo->order_id);
$this->payInfo = $this->payOrderModel->getInfoByOrderIdAndTypeAndRType($this->orderInfo->id,self::OrderType,self::PayType);
if (empty($this->orderInfo) || empty($this->payInfo) || empty($this->refundInfo)) {
$this->log->debug(__CLASS__.':订单不存在,订单号:'.$this->orderNo);
throw new ErrException('订单不存在');
}
if (empty($this->orderInfo) || empty($this->payInfo) || empty($this->refundInfo)) throw new ErrException('订单不存在');
if ($this->refundInfo->refund_status != RefundCode::WAIT_BY_PAY_TOOL) {
$this->log->debug(__CLASS__.':订单已退款成功,订单信息:'.json_encode($this->refundInfo->toArray()));
throw new ErrException('订单已退款成功');
}
if ($this->refundInfo->refund_status != RefundCode::WAIT_BY_PAY_TOOL) throw new ErrException('订单已退款成功');
if ($this->refundInfo->refund_type != PayCode::WECHAT_PAY) {
$this->log->debug(__CLASS__.':订单退款渠道错误,订单信息:'.json_encode($this->refundInfo->toArray()));
throw new ErrException('订单退款渠道错误');
}
if ($this->refundInfo->refund_type != PayCode::WECHAT_PAY) throw new ErrException('订单退款渠道错误');
}
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function manageRefundOrder(): void
{
@@ -56,8 +43,8 @@ trait RefundOrderTrait
if (!$this->refundInfo->save()) throw new Exception('更新退款订单失败');
}catch (Exception $e) {
$this->log->error(__CLASS__.':Function:manageGoodOrder:'.$e->getMessage().':orderId:'.$this->orderInfo->id);
throw new ErrException($e->getMessage());
// $this->log->error('Function:RefundFinish:'.$e->getMessage().':orderId:'.$this->orderInfo->id);
throw new ErrException('Function:RefundFinish:'.$e->getMessage().':orderId:'.$this->orderInfo->id);
}
}
@@ -84,7 +71,7 @@ trait RefundOrderTrait
}catch (Exception $e) {
$this->log->error(__CLASS__.':Function:manageGoodOrder:'.$e->getMessage().':orderId:'.$this->orderInfo->id);
throw new ErrException($e->getMessage());
throw new ErrException('Function:RefundFinish:'.$e->getMessage().':orderId:'.$this->orderInfo->id);
}
}
}