feat : spu
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Service\Common\Pay\Wx;
|
||||
|
||||
use App\Amqp\Producer\Pay\GoodOrderPayFinishProducer;
|
||||
use App\Amqp\Producer\Refund\GoodOrderRefundFinishProducer;
|
||||
use App\Constants\Common\OrderCode;
|
||||
use App\Constants\Common\PayCode;
|
||||
use App\Constants\Common\RefundCode;
|
||||
@@ -13,7 +15,9 @@ use App\Service\ServiceTrait\Api\OrderTrait;
|
||||
use App\Service\ServiceTrait\Api\PayFinishTrait;
|
||||
use App\Service\ServiceTrait\Api\RefundOrderTrait;
|
||||
use App\Service\ServiceTrait\Common\OrderChangeStatusTrait;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@@ -68,6 +72,12 @@ class WxJsRechargeOrderService extends WxJsRechargeBaseService
|
||||
*/
|
||||
protected bool $isCatering = true;
|
||||
|
||||
/**
|
||||
* @var Producer
|
||||
*/
|
||||
#[Inject]
|
||||
protected Producer $producer;
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
@@ -80,18 +90,25 @@ class WxJsRechargeOrderService extends WxJsRechargeBaseService
|
||||
|
||||
$this->checkWxCallBackOrder();
|
||||
|
||||
$this->checkCallBackOrder();
|
||||
$message = new GoodOrderPayFinishProducer([
|
||||
'order_sno' => $this->orderNo,
|
||||
'pay_type' => self::PayType,
|
||||
]);
|
||||
$this->producer->produce($message);
|
||||
|
||||
Db::transaction(function (){
|
||||
$this->manageOrder();
|
||||
|
||||
$this->manageWxOrder();
|
||||
// $this->checkCallBackOrder();
|
||||
//
|
||||
$this->isCatering = $this->manageAddCateringLog();
|
||||
});
|
||||
|
||||
//已经截单 自动退款
|
||||
if (!$this->isCatering) $this->joinRefundQueue($this->orderId,RefundCode::FULL_GOOD_REFUND,'已截单,系统自动退款');
|
||||
// Db::transaction(function (){
|
||||
// $this->manageOrder();
|
||||
//
|
||||
// $this->manageWxOrder();
|
||||
////
|
||||
// $this->isCatering = $this->manageAddCateringLog();
|
||||
// });
|
||||
//
|
||||
// //已经截单 自动退款
|
||||
// if (!$this->isCatering) $this->joinRefundQueue($this->orderId,RefundCode::FULL_GOOD_REFUND,'已截单,系统自动退款');
|
||||
|
||||
//todo 发送订阅通知
|
||||
// $this->sendGainCoinMsg();
|
||||
@@ -118,19 +135,25 @@ class WxJsRechargeOrderService extends WxJsRechargeBaseService
|
||||
|
||||
$this->checkWxRefundCallBackOrder();
|
||||
|
||||
$this->checkRefundOrder();
|
||||
$message = new GoodOrderRefundFinishProducer([
|
||||
'refund_order_sno' => $this->orderNo,
|
||||
'pay_type' => self::PayType,
|
||||
]);
|
||||
$this->producer->produce($message);
|
||||
|
||||
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);
|
||||
// $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);
|
||||
|
||||
return $this->returnSuccess();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user