两种通道都增加身份证号必填

This commit is contained in:
2026-09-10 22:03:07 +08:00
parent caeb4d6760
commit 864187e105
24 changed files with 39 additions and 62 deletions
+6 -14
View File
@@ -15,7 +15,7 @@
// | 7.10 消费回调由 app\api\controller\QytNotify 接收
// |
// | 通道:alipay=支付宝企业码(passageway=1) / pingan=平安银行(passageway=2),
// | 通道开关存在企业信息里。平安通道要求实名,7.7 必传 id_card。
// | 通道开关存在企业信息里。两个通道都要求实名,7.7 必传 id_card。
// | 金额:对外「元」入参,7.7 内部换算为「分」。
// |
// | ⚠️ 7.7 是异步接口,返回成功只代表【受理】,真实发放结果需用 7.8
@@ -108,12 +108,6 @@ class QytOil extends BaseService
return (int) ($this->conf['passageway_code'] ?? 1);
}
/** 当前通道是否必须上送司机身份证号(平安银行=是) */
public function requireIdCard(): bool
{
return !empty($this->conf['require_id_card']);
}
/**
* 生成企油通全平台唯一编号(加企业前缀),确定性派生 -> 重试保持一致
* batch_no / waybill_no / waybill_no_code 都是【全平台唯一】而非接入方内唯一,
@@ -131,7 +125,7 @@ class QytOil extends BaseService
// ================================================================
/**
* @param array $data ['batch_no','waybill_no','waybill_no_code','mobile','name','amount'(元),'id_card'(平安通道必填)]
* @param array $data ['batch_no','waybill_no','waybill_no_code','mobile','name','amount'(元),'id_card']
* @return array 归一化 ['code'=>'00'|其它, 'data'=>[], 'message'=>'', 'dup_batch'=>bool]
*/
public function createAndSendQuota(array $data): array
@@ -144,13 +138,15 @@ class QytOil extends BaseService
return $this->fail("企业[{$this->enterpriseName()}]未配置机构号(institution_id),支付宝企业码通道无法下发");
}
// 两个通道都要求实名,id_card 无条件必传
$idCard = trim((string) ($data['id_card'] ?? ''));
if ($this->requireIdCard() && $idCard === '') {
return $this->fail("通道[{$this->channelName()}]要求实名,缺少司机身份证号(idCard)");
if ($idCard === '') {
return $this->fail('缺少司机身份证号(idCard),两个支付通道都要求实名');
}
$employee = [
'mobile' => $data['mobile'],
'id_card' => $idCard,
'name' => $data['name'],
'quota_amount' => self::yuanToFen($data['amount']), // 分
'voucher_name' => $this->conf['voucher_name'],
@@ -158,10 +154,6 @@ class QytOil extends BaseService
'effective_end' => '', // 空=长期有效
'waybill_no_code' => $data['waybill_no_code'],
];
// 身份证号仅在要求实名的通道上送,避免向不需要的通道多传敏感信息
if ($this->requireIdCard()) {
$employee['id_card'] = $idCard;
}
$params = [
'batch_no' => $data['batch_no'],