private function _getRowData($row)
 {
     $cityName = trim(keepOnlyChineseWord(array_get($row, 0)));
     $stateName = trim(keepOnlyChineseWord(array_get($row, 1)));
     $city = City::findByName($cityName)->first();
     $state = NULL !== $city ? State::findByName($stateName)->first() : NULL;
     $zipcode = NULL !== $state ? $state->zipcode : '';
     return '' !== $zipcode ? [$cityName, $stateName, $zipcode] : [array_get($row, 0), array_get($row, 1), ''];
 }
Beispiel #2
0
 protected function filter($result)
 {
     foreach ($result as $key => $var) {
         $result[$key]['isAddressError'] = false;
         if (1 < $var['分寄單數']) {
             continue;
         }
         if (1 === (int) $var['分寄單數'] && Chinghwa::CITY === trim(keepOnlyChineseWord($var['縣市'])) && Chinghwa::TOWN === trim(keepOnlyChineseWord($var['區'])) && false !== strpos(trim(keepOnlyChineseWord($var['地址'])), '寶強路')) {
             $result[$key]['isAddressError'] = true;
             continue;
         }
         if (0 === (int) $var['應付帳款']) {
             continue;
         }
         unset($result[$key]);
         continue;
     }
     return $result;
 }
Beispiel #3
0
 public function isAddressLengthEnough($address)
 {
     return Import::MINLENGTH_ADDRESS <= mb_strlen(keepOnlyChineseWord($address), Import::DOC_ENCODE);
 }
Beispiel #4
0
 /**
  * 僅保留中文字
  * 
  * @return string
  */
 public function getName($val)
 {
     return keepOnlyChineseWord($val);
 }