Skip to content

Commit

Permalink
Merge pull request #19 from liujundezhanghao/patch-1
Browse files Browse the repository at this point in the history
优化循环,修复快递中文正则匹配bug
  • Loading branch information
uuk020 committed Jan 27, 2021
2 parents d57707b + ef59126 commit a66a615
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SupportLogistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public function getCode(string $channel, string $code, string $companyName = '')
}
foreach ($this->companyList as $name => $item) {
if (isset($kuaidi100CompanyCode) && $item['kuaidi100'] === $kuaidi100CompanyCode) {
$companyCode = $item[$channelName];
return $item[$channelName];
} else {
if ($companyName) {
$pattern = "/($name)(\w+)/i";
$pattern = "/($name)(\W+)/i";
if (1 === \preg_match($pattern, $companyName)) {
$companyCode = $this->companyList[$name][$channelName];
return $this->companyList[$name][$channelName];
}
}
}
Expand Down

0 comments on commit a66a615

Please sign in to comment.