switch = StatusEnum::ENABLED; $orderCreate->shop_no = $config['shop_no']; $orderCreate->trade_list = Json::encode($trade_list); $resp = $req->send($orderCreate); if ($resp->getError()) return $resp->getError(); // 执行其他操作 try { $res = $resp->toArray(); if (!isset($res['code']) || $res['code'] != StatusEnum::DISABLED) return $res['message'] ?? var_export($res, true); } catch (\Exception $e) { return $e->getMessage(); } return true; } /** * @param array $config * @param array $order * @return void * @throws \Exception */ protected function enterprise(array $config, array $order) { $trade_list[] = (new CreateOrderService())->assembleData($order); if (!empty($trade_list)) { $flag = $this->retry(function () use ($config, $trade_list) { return $this->send($config, $trade_list); }); if (is_string($flag)) throw new \Exception($flag); } } }