services->rabbitMq->push(RabbitMqEnum::EXCHANGE_ORDER, RabbitMqEnum::ORDER_QUEUE, [ 'mall_id' => $mall_id, 'id' => $refund_id, ], self::class, 'execute'); } /** * @param array $data * @return void|null * @throws \Exception */ public function execute(array $data) { \Yii::error(__CLASS__ . "->async_handle: " . Json::encode($data)); if (empty($data)) { Yii::error('OrderRefundRejectService error:售后处理失败,内容为空'); return null; } try { // 退款申请 $refund = OrderRefund::getOne([ ['id' => $data['id']] ], true, ['orderDetail', 'base_user', 'order']); if (empty($refund) || $refund['order']['store_id'] > 0 || $refund['order']['mch_id'] > 0) return; $data['mall_id'] = $refund['mall_id']; $config = (new SettingService())->get($refund['mall_id']); if (empty($config['is_enable'])) { \Yii::error("{$refund['mall_id']} 未开启旺店通插件"); return; } $trade_list[] = (new CreateRefundService())->assembleData($refund, $config); $flag = $this->retry(function () use ($config, $trade_list) { return $this->send($config, $trade_list); }); if (is_string($flag)) throw new \Exception($flag); $this->compensateFinish($data['compensate_id']??0); } catch (\Exception $e) { $this->compensate($data, __CLASS__, __FUNCTION__, $e); } } }