[ 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postData ] ]); $result = file_get_contents($url, false, $context); return json_decode($result, true); } // 测试基础URL $baseUrl = 'http://localhost:8080/Application/Retail/Controller/RiderController.class.php'; echo "
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } // 测试2: 添加骑手 echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; // 保存新添加的骑手ID用于后续测试 $newRiderId = isset($response['rider_id']) ? $response['rider_id'] : null; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; $newRiderId = null; } // 测试3: 获取骑手详情 if ($newRiderId) { echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } } // 测试4: 编辑骑手 if ($newRiderId) { echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } } // 测试5: 重置密码 if ($newRiderId) { echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } } // 测试6: 认证审核 if ($newRiderId) { echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } } // 测试7: 获取骑手统计数据 echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } // 测试8: 更新骑手状态 if ($newRiderId) { echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } } // 测试9: 删除骑手 (软删除) if ($newRiderId) { echo "" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . ""; } catch (Exception $e) { echo "
错误: " . $e->getMessage() . "
"; } } echo "所有API接口测试已完成。请检查上述输出结果。
"; ?>