/** * 附件管理首页 */ public function indexAct() { if (!IS_POST) { $buttonStyle = $this->buttonAuthStyle(array('edit', 'del')); $buttonStyle['add'] = 'style="display:none;"'; $this->assign(array('buttonStyle' => $buttonStyle)); $this->display(); } else { $data = D('Upfile')->selectPage($this->getSelectParam()); foreach ($data['rows'] as $key => $value) { $data['rows'][$key]['fileType'] = $this->fileType[$value['fileType']]; $data['rows'][$key]['realUrl'] = get_upfile_url($value['url']); } $this->ajaxReturn($data); } }
public function delData($data) { if (!$data['id']) { return result_data(0, '附件不存在!'); } $result = parent::delData($data['id']); if ($result['status'] == 1) { if ($data['delFile'] == 'on') { //删除本身附件 $url = get_upfile_url($data['url']); $result2 = unlink($url); if (!$result2) { return result_data(0, '本身文件删除失败!'); } } } return $result; }
/** * 查看操作 */ public function indexAct() { if (!IS_POST) { $this->assign(array('buttonStyle' => $this->buttonAuthStyle(array('add', 'edit', 'del', 'export')))); $this->display(); } else { $list = D('Channel')->queryChannel(); $list['rows'] = array_values($list['rows']); foreach ($list['rows'] as $key => $value) { $navImgUrl = explode(",", $value['imgUrl']); $realNavImgUrl = array(); foreach ($navImgUrl as $key2 => $value2) { $realNavImgUrl[] = get_upfile_url($value2); } $list['rows'][$key]['realNavImgUrl'] = implode(",", $realNavImgUrl); } $this->ajaxReturn($list); } }