完成了基本调整调整
This commit is contained in:
@@ -318,16 +318,18 @@ function defaultBody($act, $orgNo)
|
||||
if ($act === 'share') {
|
||||
$body = [
|
||||
'orgNo' => $orgNo,
|
||||
'amount' => isset($_GET['amount']) ? $_GET['amount'] : '100.00',
|
||||
'amount' => isset($_GET['amount']) ? trim($_GET['amount']) : '100.00',
|
||||
'mobile' => $mobile,
|
||||
'name' => isset($_GET['name']) ? $_GET['name'] : '张三',
|
||||
'saleOrderNo' => $saleOrderNo,
|
||||
'name' => isset($_GET['name']) ? trim($_GET['name']) : '张三',
|
||||
// 销售单号留空则自动生成(同一单号重复提交会走幂等返回,便于测重复下单)
|
||||
'saleOrderNo' => isset($_GET['saleOrderNo']) && trim($_GET['saleOrderNo']) !== '' ? trim($_GET['saleOrderNo']) : $saleOrderNo,
|
||||
'oilCardType' => 'zsy_ticket',
|
||||
];
|
||||
// 司机身份证号:两个通道都必传。
|
||||
// 加 &noIdCard=1 可故意不传,用来验证实名通道下的 0001 拒单是否生效。
|
||||
if (empty($_GET['noIdCard'])) {
|
||||
$body['idCard'] = isset($_GET['idCard']) ? $_GET['idCard'] : '450103199001011238';
|
||||
// 页面上身份证号留空(或带 &noIdCard=1)即不传,用来验证 0001 拒单是否生效。
|
||||
$idCard = isset($_GET['idCard']) ? trim($_GET['idCard']) : '450103199001011238';
|
||||
if ($idCard !== '' && empty($_GET['noIdCard'])) {
|
||||
$body['idCard'] = $idCard;
|
||||
}
|
||||
return [
|
||||
'method' => 'syb.oil.oilCard.share',
|
||||
@@ -349,6 +351,17 @@ function defaultBody($act, $orgNo)
|
||||
'body' => ['orgNo' => $orgNo, 'oilCardNo' => $oilCardNo],
|
||||
];
|
||||
}
|
||||
if ($act === 'refund') {
|
||||
return [
|
||||
'method' => 'syb.oil.oilCard.refund',
|
||||
'path' => '/oilCard/refund',
|
||||
'body' => [
|
||||
'orgNo' => $orgNo,
|
||||
'oilCardNo' => $oilCardNo,
|
||||
'reason' => isset($_GET['reason']) ? $_GET['reason'] : '联调测试退款',
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($act === 'sharelist') {
|
||||
return [
|
||||
'method' => 'syb.oil.oilCard.shareList',
|
||||
@@ -383,7 +396,7 @@ try {
|
||||
$platformPub = platformPublicKey($ROOT);
|
||||
$qconf = qytConf($ROOT, $partner);
|
||||
|
||||
if (in_array($act, ['share', 'qrcode', 'status', 'sharelist'], true)) {
|
||||
if (in_array($act, ['share', 'qrcode', 'status', 'sharelist', 'refund'], true)) {
|
||||
$def = defaultBody($act, $partner['orgNo']);
|
||||
$env = buildEnvelope($partner, $platformPub, $def['method'], $def['body']);
|
||||
$url = apiUrl($def['path']);
|
||||
@@ -416,7 +429,7 @@ if (PHP_SAPI === 'cli') {
|
||||
";
|
||||
}
|
||||
if (!$result) {
|
||||
echo "用法:php qyt_test.php [share|qrcode|status|sharelist]\n";
|
||||
echo "用法:php qyt_test.php [share|qrcode|status|sharelist|refund](qrcode/status/refund 需带 oilCardNo,CLI 下请用浏览器方式)\n";
|
||||
exit;
|
||||
}
|
||||
echo '接口:' . $result['def']['method'] . "\n";
|
||||
@@ -459,6 +472,11 @@ $curOil = isset($_GET['oilCardNo']) ? $_GET['oilCardNo'] : '';
|
||||
.ok{color:#52c41a;font-weight:600}.err{color:#ff4d4f;font-weight:600}
|
||||
.tip{background:#fffbe6;border:1px solid #ffe58f;padding:10px 14px;border-radius:6px;font-size:13px;margin-bottom:16px}
|
||||
.lbl{margin:12px 0 6px;color:#555}
|
||||
.share-form{margin-bottom:14px;padding-bottom:14px;border-bottom:1px dashed #eee}
|
||||
.share-form .fields{display:flex;flex-wrap:wrap;gap:10px 16px;margin-bottom:10px}
|
||||
.share-form label{display:flex;flex-direction:column;font-size:12px;color:#666}
|
||||
.share-form input{margin-top:4px;width:180px;padding:6px 8px;border:1px solid #d9d9d9;border-radius:4px;font-size:13px}
|
||||
.share-form button{padding:7px 16px;background:#52c41a;color:#fff;border:0;border-radius:4px;font-size:13px;cursor:pointer;margin-right:10px}
|
||||
</style>
|
||||
</head>
|
||||
<body><div class="wrap">
|
||||
@@ -526,17 +544,36 @@ $curOil = isset($_GET['oilCardNo']) ? $_GET['oilCardNo'] : '';
|
||||
|
||||
<div class="card">
|
||||
<h2>发起测试</h2>
|
||||
<?php
|
||||
// 表单回填:提交后保留上次填写的值;首次打开用默认值
|
||||
$isShare = $act === 'share';
|
||||
$fv = function ($key, $default) use ($isShare) {
|
||||
return htmlspecialchars($isShare && isset($_GET[$key]) ? (string)$_GET[$key] : $default);
|
||||
};
|
||||
?>
|
||||
<form method="get" class="share-form">
|
||||
<input type="hidden" name="act" value="share">
|
||||
<?php if (!empty($_GET['api'])): ?>
|
||||
<input type="hidden" name="api" value="<?php echo htmlspecialchars($_GET['api']); ?>">
|
||||
<?php endif; ?>
|
||||
<div class="fields">
|
||||
<label>分油金额(元)<input name="amount" value="<?php echo $fv('amount', '100.00'); ?>" placeholder="最多两位小数"></label>
|
||||
<label>司机手机号<input name="mobile" value="<?php echo $fv('mobile', '13800000001'); ?>" maxlength="11"></label>
|
||||
<label>司机姓名<input name="name" value="<?php echo $fv('name', '张三'); ?>"></label>
|
||||
<label>身份证号<input name="idCard" value="<?php echo $fv('idCard', '450103199001011238'); ?>" maxlength="18" placeholder="留空即不传"></label>
|
||||
<label>销售单号<input name="saleOrderNo" value="<?php echo $fv('saleOrderNo', ''); ?>" placeholder="留空自动生成"></label>
|
||||
</div>
|
||||
<button type="submit">① 下单分油 (share)</button>
|
||||
<span class="sub">身份证号留空即不传,应返回 <b>0001</b> 拒单;销售单号填已用过的可测幂等返回</span>
|
||||
</form>
|
||||
<div class="btns">
|
||||
<a class="g" href="?act=share">① 下单分油 (share)</a>
|
||||
<a class="o" href="?act=qrcode&oilCardNo=<?php echo urlencode($curOil); ?>">② 获取加油链接 (qrCode)</a>
|
||||
<a class="p" href="?act=status&oilCardNo=<?php echo urlencode($curOil); ?>">③ 订单状态 (orderStatus)</a>
|
||||
<a href="?act=sharelist">④ 分油记录 (shareList)</a>
|
||||
<a class="r" href="?act=share&noIdCard=1">⑤ 下单但不传身份证号</a>
|
||||
<a href="?act=sharelist&mobile=<?php echo urlencode($isShare && isset($_GET['mobile']) ? $_GET['mobile'] : '13800000001'); ?>">④ 分油记录 (shareList)</a>
|
||||
<a class="r" href="?act=refund&oilCardNo=<?php echo urlencode($curOil); ?>">⑥ 退款 (refund)</a>
|
||||
</div>
|
||||
<div class="sub" style="margin:6px 0 0">
|
||||
②③ 需要 oilCardNo:先点①拿到后会自动带上。<br>
|
||||
① 可自定义参数:<code>?act=share&amount=50.00&mobile=13800000002&name=李四&idCard=110101199003071233</code><br>
|
||||
⑤ 用来验证实名校验:两个通道都要求实名,应当返回 <b>0001</b> 拒单
|
||||
②③⑥ 需要 oilCardNo:先下单拿到后,在下方响应区点对应按钮会自动带上。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -569,6 +606,7 @@ $curOil = isset($_GET['oilCardNo']) ? $_GET['oilCardNo'] : '';
|
||||
<div class="btns" style="margin-top:14px">
|
||||
<a class="o" href="?act=qrcode&oilCardNo=<?php echo urlencode($newOil); ?>">用 <?php echo htmlspecialchars($newOil); ?> 取加油链接</a>
|
||||
<a class="p" href="?act=status&oilCardNo=<?php echo urlencode($newOil); ?>">查该单状态</a>
|
||||
<a class="r" href="?act=refund&oilCardNo=<?php echo urlencode($newOil); ?>">退款该单(需发放成功且未加油)</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user