diff --git a/app/Amqp/Consumer/RefundOrderConsumer.php b/app/Amqp/Consumer/RefundOrderConsumer.php index 48aecaa..6cfe923 100644 --- a/app/Amqp/Consumer/RefundOrderConsumer.php +++ b/app/Amqp/Consumer/RefundOrderConsumer.php @@ -69,6 +69,7 @@ class RefundOrderConsumer extends ConsumerMessage $service->orderId = (int)$data['order_id']; $service->reason = $data['reason']; $service->type = $data['type']; + $service->adminId = $data['admin_id'] ?? 0; $service->handle(); } catch (Exception $e) { diff --git a/app/Service/Admin/Order/RefundService.php b/app/Service/Admin/Order/RefundService.php index abafcdd..29d6938 100644 --- a/app/Service/Admin/Order/RefundService.php +++ b/app/Service/Admin/Order/RefundService.php @@ -40,6 +40,7 @@ class RefundService extends BaseService $service->orderId = $orderId; $service->reason = $this->request->input('reason',''); $service->type = RefundCode::FULL_GOOD_REFUND; + $service->adminId = $this->adminId; $service->handle(); @@ -66,6 +67,7 @@ class RefundService extends BaseService $service->reason = $this->request->input('reason',''); $service->orderGoodIds = $orderGoodIds; $service->type = RefundCode::PARTIAL_GOOD_REFUND; + $service->adminId = $this->adminId; $service->handle(); @@ -104,7 +106,7 @@ class RefundService extends BaseService if (empty($orderIds)) throw new ErrException('暂无数据'); foreach ($orderIds as $orderId) { - $this->joinRefundQueue($orderId,RefundCode::FULL_GOOD_REFUND,$reason); + $this->joinRefundQueue($orderId,RefundCode::FULL_GOOD_REFUND,$reason,$this->adminId); } return $this->return->success(); diff --git a/app/Service/Amqp/Refund/BaseRefundOrderService.php b/app/Service/Amqp/Refund/BaseRefundOrderService.php index b0a3566..154e13e 100644 --- a/app/Service/Amqp/Refund/BaseRefundOrderService.php +++ b/app/Service/Amqp/Refund/BaseRefundOrderService.php @@ -127,6 +127,7 @@ abstract class BaseRefundOrderService if ($orderGoodList->isEmpty()) throw new Exception('该订单没有这些商品信息:'.json_encode(['order_id' => $this->orderId,'order_type' => $this->type,'goods_list' => $this->orderGoodIds])); $this->orderGoodList = $orderGoodList->toArray(); unset($orderGoodList); + //todo 优惠券信息没有看 foreach ($this->orderGoodList as $orderGood) { if (!in_array($orderGood['status'],OrderCode::CAN_REFUND_STATUS)) throw new Exception('商品状态不能退款:'.json_encode(['order_info' => $this->orderInfo->toArray(),'order_good' => $orderGood,'goods_list' => $this->orderGoodIds])); diff --git a/app/Service/Common/Pay/Wx/WxJsRechargeBaseService.php b/app/Service/Common/Pay/Wx/WxJsRechargeBaseService.php index 04bbc6b..de0c24e 100644 --- a/app/Service/Common/Pay/Wx/WxJsRechargeBaseService.php +++ b/app/Service/Common/Pay/Wx/WxJsRechargeBaseService.php @@ -97,13 +97,13 @@ abstract class WxJsRechargeBaseService implements ThirdPayInterface { $this->setConfig(); - $this->callbackData = $this->request->all(); -// try { -// $this->callbackData = $this->ysdPay->wechat($this->config)->callback($this->request)->toArray()['resource']['ciphertext']; -// }catch (Exception $e) { -// $this->log->debug(__CLASS__.'wxPay回调解密失败'.json_encode($e->getMessage())); -// throw new ErrException('wxPay回调解密失败'); -// } +// $this->callbackData = $this->request->all(); + try { + $this->callbackData = $this->ysdPay->wechat($this->config)->callback($this->request)->toArray()['resource']['ciphertext']; + }catch (Exception $e) { + $this->log->debug(__CLASS__.'wxPay回调解密失败'.json_encode($e->getMessage())); + throw new ErrException('wxPay回调解密失败'); + } if (empty($this->callbackData)) { $this->log->debug(__CLASS__.'wxPay获取回调失败'.json_encode($this->request)); diff --git a/app/Service/ServiceTrait/Common/OrderChangeStatusTrait.php b/app/Service/ServiceTrait/Common/OrderChangeStatusTrait.php index 1e40ae5..d008a2d 100644 --- a/app/Service/ServiceTrait/Common/OrderChangeStatusTrait.php +++ b/app/Service/ServiceTrait/Common/OrderChangeStatusTrait.php @@ -52,16 +52,16 @@ trait OrderChangeStatusTrait * @param int $orderId * @param int $type refundCode * @param string $reason + * @param int $adminId * @return void - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ - protected function joinRefundQueue(int $orderId, int $type, string $reason = '系统自动'): void + protected function joinRefundQueue(int $orderId, int $type, string $reason = '系统自动',int $adminId = 0): void { $message = new RefundOrderProducer([ 'order_id' => $orderId, 'type' => $type, - 'reason' => $reason + 'reason' => $reason, + 'admin_id' => $adminId ]); // $producer = ApplicationContext::getContainer()->get(Producer::class); $this->producer->produce($message);