两种通道都增加身份证号必填
This commit is contained in:
@@ -86,7 +86,7 @@ class OilCard extends Controller
|
||||
$oilCardType = $data['oilCardType'] ?? '';
|
||||
// 企油通:司机姓名(下单平台必传,用于运单油费下发)
|
||||
$driverName = trim((string)($data['name'] ?? ''));
|
||||
// 企油通:司机身份证号。平安银行通道要求实名必传,支付宝企业码通道可不传
|
||||
// 企油通:司机身份证号。两个支付通道都要求实名,必传
|
||||
$idCard = strtoupper(trim((string)($data['idCard'] ?? '')));
|
||||
// 请求参数orgNo与请求头appKey不存在对应关系
|
||||
if($partners['orgNo'] != $orgNo){
|
||||
@@ -104,12 +104,12 @@ class OilCard extends Controller
|
||||
$this->saveLog('share 未匹配到可用的企油通企业,partners_id=' . $partners['partners_id']);
|
||||
return $this->oilRenderError('99','9999', '', '系统未配置可用企业,请联系平台');
|
||||
}
|
||||
// 身份证号:传了就必须合法;该企业当前通道要求实名时不传直接拒单
|
||||
if($idCard !== '' && !preg_match('/^\d{17}[\dX]$/', $idCard)){
|
||||
return $this->oilRenderError('12','0013', '', 'idCard 身份证号格式不正确(18位)');
|
||||
// 身份证号:两个支付通道都要求实名,必传且必须合法
|
||||
if($idCard === ''){
|
||||
return $this->oilRenderError('12','0001', '', '缺少必填请求参数 idCard(司机身份证号)');
|
||||
}
|
||||
if($idCard === '' && $enterprise->requireIdCard()){
|
||||
return $this->oilRenderError('12','0001', '', '缺少必填请求参数 idCard(司机身份证号,当前支付通道要求实名)');
|
||||
if(!preg_match('/^\d{17}[\dX]$/', $idCard)){
|
||||
return $this->oilRenderError('12','0013', '', 'idCard 身份证号格式不正确(18位)');
|
||||
}
|
||||
// 金额:由下单平台直接传入(单位:元,最多两位小数)
|
||||
if($amount === '' || !preg_match('/^\d{1,8}(\.\d{1,2})?$/', (string)$amount) || (float)$amount <= 0){
|
||||
|
||||
@@ -89,12 +89,6 @@ class Enterprise extends BaseModel
|
||||
return self::PASSAGEWAY_NAME[$this->getData('passageway')] ?? '';
|
||||
}
|
||||
|
||||
/** 当前通道是否要求司机身份证号(平安银行要求实名) */
|
||||
public function requireIdCard(): bool
|
||||
{
|
||||
return $this->getData('passageway') === 'pingan';
|
||||
}
|
||||
|
||||
/** 状态中文(访问器,后台列表直接可用) */
|
||||
public function getStatusTextAttr($value, $data): string
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ class QytConfig
|
||||
* 叠加企业级参数,得到某个企业实际使用的完整配置
|
||||
*
|
||||
* @param EnterpriseModel|array $enterprise
|
||||
* @return array 额外带 enterprise_id / enterprise_name / passageway_code / require_id_card
|
||||
* @return array 额外带 enterprise_id / enterprise_name / passageway_code / passageway_name
|
||||
*/
|
||||
public static function forEnterprise($enterprise): array
|
||||
{
|
||||
@@ -86,8 +86,6 @@ class QytConfig
|
||||
$conf['passageway_code'] = EnterpriseModel::PASSAGEWAY_CODE[$passageway];
|
||||
$conf['passageway_name'] = EnterpriseModel::PASSAGEWAY_NAME[$passageway];
|
||||
$conf['institution_id'] = (string) ($e['institution_id'] ?? '');
|
||||
// 平安银行通道要求实名
|
||||
$conf['require_id_card'] = $passageway === 'pingan';
|
||||
|
||||
// 以下留空则回落接入方级默认值
|
||||
foreach (['app_id', 'no_prefix', 'voucher_name'] as $k) {
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -110,19 +110,18 @@ class PartnersQueue extends Command
|
||||
$waybillNoCode = $order['waybill_no_code'] ?: $qyt->no('C', $seed);
|
||||
$name = trim((string) $order['driver_name']);
|
||||
$idCard = trim((string) $order['id_card']);
|
||||
if ($name === '' || $order['mobile'] === '') {
|
||||
$failed = Db::name('partners_order')->where('order_id', $orderId)->where('oil_status_zsy', 0)
|
||||
->update(['oil_status_zsy' => 3, 'oil_text' => '缺司机姓名/手机号,无法发放', 'update_time' => time()]);
|
||||
$failed && $this->refundBalance($order);
|
||||
return;
|
||||
}
|
||||
// 通道切换后,下单时不需要身份证的老单可能落到实名通道上:
|
||||
// 直接判失败退款,不做无意义重试(重试也永远补不到身份证号)
|
||||
if ($qyt->requireIdCard() && $idCard === '') {
|
||||
// 两个通道都要求实名,姓名/手机号/身份证号缺一不可。
|
||||
// 这类单直接判失败退款,不做无意义重试(重试也永远补不齐这些字段),
|
||||
// 典型来源是改造前建的历史单,它们没有 id_card。
|
||||
$missing = [];
|
||||
$name === '' && $missing[] = '司机姓名';
|
||||
$order['mobile'] === '' && $missing[] = '手机号';
|
||||
$idCard === '' && $missing[] = '身份证号';
|
||||
if ($missing) {
|
||||
$failed = Db::name('partners_order')->where('order_id', $orderId)->where('oil_status_zsy', 0)
|
||||
->update([
|
||||
'oil_status_zsy' => 3,
|
||||
'oil_text' => '当前通道(' . $qyt->channelName() . ')要求实名,该单缺司机身份证号',
|
||||
'oil_text' => '缺' . implode('/', $missing) . ',无法发放',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
$failed && $this->refundBalance($order);
|
||||
|
||||
Reference in New Issue
Block a user