ReadExcelController.class.php
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Created by IntelliJ IDEA.
* User: zhuxun37
* Date: 2017/5/17
* Time: 上午11:22
*/
namespace Apicp\Controller\Department;
use Common\Service\DepartmentService;
use Common\Service\ImportDataService;
class ReadExcelController extends AbstractController
{
public function Index_post()
{
$departmentService = new DepartmentService();
$departmentService->readExcel($this->_result, I('post.'), $this->_login->user);
// 如果读取的行数小于 limit 值, 则说明已读取完毕
if ($this->_result['rowsReaded'] < $this->_result['limit']) {
$importDataService = new ImportDataService();
$condition = array(
'ea_id' => $this->_login->user['eaId'],
'import_flag' => $this->_result['importFlag']
);
$orderOption = array('cid_id' => 'ASC');
$rows = $importDataService->list_by_conds($condition, null, $orderOption, 'cid_id');
$this->_result['cidIds'] = array();
foreach ($rows as $_row) {
$this->_result['cidIds'][] = $_row['cid_id'];
}
}
return true;
}
}