Commit 0c4a7e36 authored by zhuwei's avatar zhuwei

bug

parent 6311256d
...@@ -136,7 +136,7 @@ class News extends Basic ...@@ -136,7 +136,7 @@ class News extends Basic
if (empty($this->params['id'])) { if (empty($this->params['id'])) {
return $this->response(101, "Id is null."); return $this->response(101, "Id is null.");
} }
$field = 'id,title,s_label_id,cover_plan,content,annex_file_name,file_former_name'; $field = 'id,title,s_label_id,cover_plan,content,annex_file_name';
$where['status'] = 0; $where['status'] = 0;
$where['id'] = $this->params['id']; $where['id'] = $this->params['id'];
$data = $this->m_news->getNewsInfo($field, $where); $data = $this->m_news->getNewsInfo($field, $where);
...@@ -204,18 +204,32 @@ class News extends Basic ...@@ -204,18 +204,32 @@ class News extends Basic
public function downloadFile() { public function downloadFile() {
$filepath = '/static/business_school_file/20181203/20181203110021473.jpg'; $data[]=['file_name'=>'12','file_former_name'=>'44'];
$data[]=['file_name'=>'12','file_former_name'=>'44'];
if(file_exists($filepath)){ return $this->response(200, $data);
header("Content-type:application/octet-stream");
$filename = basename($filepath);
header("Content-Disposition:attachment;filename = 11.jpg"); // dump(666);exit;
header("Accept-ranges:bytes"); // $this->params['file_name']= '20181203/20181203110021473.jpg';
header("Accept-length:".filesize($filepath)); // $this->params['file_former_name']='ceshi.jpg';
readfile($filepath); // if (empty($this->params['file_name']) or empty($this->params['file_former_name'])) {
}else{ // echo "<script>alert('文件不存在')</script>";
echo "<script>alert('文件不存在')</script>"; // }
} //
// $file_name = $this->params['file_name'];
// $file_former_name = $this->params['file_former_name'];
//
// $filepath = ROOT_PATH . 'public/static/business_school_file/'.$file_name;
// if(file_exists($filepath)){
// header("Content-type:application/octet-stream");
// $filename = basename($filepath);
// header("Content-Disposition:attachment;filename = {$file_former_name}");
// header("Accept-ranges:bytes");
// header("Accept-length:".filesize($filepath));
// readfile($filepath);
// }else{
// echo "<script>alert('文件不存在')</script>";
// }
} }
} }
\ No newline at end of file
...@@ -87,7 +87,7 @@ class SNews extends BaseModel ...@@ -87,7 +87,7 @@ class SNews extends BaseModel
->find(); ->find();
$file = $this->db_->table('s_file') $file = $this->db_->table('s_file')
->field('id as file_id,file_name') ->field('id as file_id,file_name,file_former_name')
->where('new_id',$params['id']) ->where('new_id',$params['id'])
->where('status',0) ->where('status',0)
->select(); ->select();
......
...@@ -370,7 +370,7 @@ Route::group('index', [ ...@@ -370,7 +370,7 @@ Route::group('index', [
'getRecordsList' => ['index/broker/getRecordsList', ['method' => 'post|get']],//解绑或绑定经纪人设备id 'getRecordsList' => ['index/broker/getRecordsList', ['method' => 'post|get']],//解绑或绑定经纪人设备id
'downloadFile' => ['index/news/downloadFile', ['method' => 'POST']], //新增商学院资讯 'downloadFile' => ['index/news/downloadFile', ['method' => 'GET|POST']], //新增商学院资讯
]); ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment