lists(); } public function lists(){ $page = $this->input->get('page'); $size = $this->input->get('size'); !$page && $page = 1; !$size && $size = 20; $this->load->model('sys/sys_plan_model', 'plan_model'); $this->load->model("sys/sys_admin_model", 'admin_model'); $where = array( 'type' => 1, ); if(1 != $this->role){//超级管理员可以看到所有 $where['admin_id'] = $this->uid; } $total = $this->plan_model->count($where); $lists = array(); if($total){ $select = "id, title, total_num, finish_num, plan_info, status, admin_id"; $order = "id DESC"; $rows = $this->plan_model->select($where, $order, $page, $size, $select); $admin_ids = array_column($rows, 'admin_id'); $admin_ids = array_unique($admin_ids); $where = array("id in (" . implode(',', $admin_ids) . ")" => null); $select = 'id, username'; $map_admin = $this->admin_model->map('id', 'username', $where, 'id DESC', 0 ,0, $select); foreach($rows as $row){ $plan_info = json_decode($row['plan_info'], true); if(1 == $row['status']){ $percent = "100%"; } elseif($row['total_num'] <= $row['finish_num']) { $percent = "99%"; } else { $percent = round($row['finish_num'] * 100 / $row['total_num'], 2) . "%"; } $url = $plan_info['file_info']['url']; $http = server_http(); $url = str_replace('http://', $http, $url); $lists[] = array( 'id' => $row['id'], 'admin_name' => $map_admin[$row['admin_id']], 'title' => $row['title'], "file_name" => $plan_info['file_info']['name'], 'percent' => $percent, "status" => $row['status'], "url" => $url, ); } } $this->data['pager'] = array('count' => ceil($total/$size), 'curr' => $page, 'totle' => $total, 'total' => $total); $this->data['lists'] = $lists; $this->data['_title'] = '导出文件列表'; return $this->show_view('app/appusual/expfile/lists', true); } public function get(){ // TODO: Implement get() method. } public function add(){ // TODO: Implement add() method. } public function edit(){ // TODO: Implement edit() method. } public function del(){ // TODO: Implement del() method. } public function batch(){ // TODO: Implement batch() method. } public function export(){ // TODO: Implement export() method. } }