Browse Source

导入用户数据税号身份证号判断

master
wanghongjun 2 months ago
parent
commit
dc5dfd15eb
  1. 6
      app/command/ExportExcel.php
  2. 6
      app/controller/admin/WechatUser.php

6
app/command/ExportExcel.php

@ -92,14 +92,14 @@ class ExportExcel extends Command
$type = array_search($type, $typeArr);
if ($taxId) {
if ($type === 1) {
$str = '0-9A-HJ-NPQRTUWXY';
$pattern = '/^[' . $str . ']{2}\d{6}[' . $str . ']{10}$/';
$pattern = '/^\d{15}$|^\d{17}[\dXx]$/';
if (!preg_match($pattern, $taxId)) {
$error_array[] = "第{$key}行:纳税人编号格式不符合";
continue;
}
} else {
$pattern = '/^\d{15}$|^\d{17}[\dXx]$/';
$str = '0-9A-HJ-NPQRTUWXY';
$pattern = '/^[' . $str . ']{2}\d{6}[' . $str . ']{10}$/';
if (!preg_match($pattern, $taxId)) {
$error_array[] = "第{$key}行:纳税人编号格式不符合";
continue;

6
app/controller/admin/WechatUser.php

@ -171,14 +171,14 @@ class WechatUser extends Base
$type = array_search($type, $typeArr);
if ($taxId) {
if ($type === 1) {
$str = '0-9A-HJ-NPQRTUWXY';
$pattern = '/^[' . $str . ']{2}\d{6}[' . $str . ']{10}$/';
$pattern = '/^\d{15}$|^\d{17}[\dXx]$/';
if (!preg_match($pattern, $taxId)) {
$error_array[] = "第{$key}行:纳税人编号格式不符合";
continue;
}
} else {
$pattern = '/^\d{15}$|^\d{17}[\dXx]$/';
$str = '0-9A-HJ-NPQRTUWXY';
$pattern = '/^[' . $str . ']{2}\d{6}[' . $str . ']{10}$/';
if (!preg_match($pattern, $taxId)) {
$error_array[] = "第{$key}行:纳税人编号格式不符合";
continue;

Loading…
Cancel
Save