* Refactor transfer model: getRowsFromExcel method.
This commit is contained in:
@@ -362,7 +362,7 @@ class transferModel extends model
|
||||
/* If tmpfile not isset create tmpfile. */
|
||||
if(!$tmpFile)
|
||||
{
|
||||
$rows = $this->getRowsFromExcel();
|
||||
$rows = $this->transferZen->getRowsFromExcel();
|
||||
$moduleData = $this->processRows4Fields($rows, $fields);
|
||||
$moduleData = $this->getNatureDatas($module, $moduleData, $filter, $fields);
|
||||
|
||||
@@ -424,27 +424,6 @@ class transferModel extends model
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rows from excel.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRowsFromExcel()
|
||||
{
|
||||
$rows = $this->file->getRowsFromExcel($this->session->fileImportFileName);
|
||||
if(is_string($rows))
|
||||
{
|
||||
if($this->session->fileImportFileName) unlink($this->session->fileImportFileName);
|
||||
unset($_SESSION['fileImportFileName']);
|
||||
unset($_SESSION['fileImportExtension']);
|
||||
echo js::alert($rows);
|
||||
return print(js::locate('back'));
|
||||
}
|
||||
return $rows;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field values by method.
|
||||
*
|
||||
|
||||
+23
-2
@@ -31,6 +31,27 @@ class transferZen extends transfer
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Excel中的数据。
|
||||
* Get rows from excel.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
protected function getRowsFromExcel(): array
|
||||
{
|
||||
$rows = $this->file->getRowsFromExcel($this->session->fileImportFileName);
|
||||
if(is_string($rows))
|
||||
{
|
||||
if($this->session->fileImportFileName) unlink($this->session->fileImportFileName);
|
||||
unset($_SESSION['fileImportFileName']);
|
||||
unset($_SESSION['fileImportExtension']);
|
||||
echo js::alert($rows);
|
||||
return print(js::locate('back'));
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将参数转成变量存到SESSION中。
|
||||
* Set SESSION by params.
|
||||
@@ -149,7 +170,7 @@ class transferZen extends transfer
|
||||
*
|
||||
* @param array $objectDatas
|
||||
* @access public
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function createTmpFile(array $objectDatas)
|
||||
{
|
||||
@@ -189,7 +210,7 @@ class transferZen extends transfer
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkSuhosinInfo(array $datas = array())
|
||||
public function checkSuhosinInfo(array $datas = array()): string
|
||||
{
|
||||
if(empty($datas)) return '';
|
||||
$current = (array)current($datas);
|
||||
|
||||
Reference in New Issue
Block a user