Commit 1df1092c authored by hujun's avatar hujun

修改

parent 1b0f0b96
...@@ -87,7 +87,7 @@ class UploadFileService ...@@ -87,7 +87,7 @@ class UploadFileService
if ($info) { if ($info) {
$data['code'] = 200; $data['code'] = 200;
$data["msg"][$k]['img_path'] = $date . $info->getSaveName(); //生成的图片路径 $data["msg"][$k]['img_path'] = $date .'/'. $info->getSaveName(); //生成的图片路径
$data["msg"][$k]['img_ext'] = $info->getExtension(); $data["msg"][$k]['img_ext'] = $info->getExtension();
} else { } else {
$data['code'] = 101; $data['code'] = 101;
...@@ -102,7 +102,7 @@ class UploadFileService ...@@ -102,7 +102,7 @@ class UploadFileService
$info = $_file->validate($valid_date)->move($path, $name_str . '.' . $file_info['extension']); $info = $_file->validate($valid_date)->move($path, $name_str . '.' . $file_info['extension']);
if ($info) { if ($info) {
$data['code'] = 200; $data['code'] = 200;
$data["msg"]['img_path'] = $date . $info->getSaveName(); //生成的图片路径 $data["msg"]['img_path'] = $date .'/'. $info->getSaveName(); //生成的图片路径
$data["msg"]['img_ext'] = $info->getExtension(); $data["msg"]['img_ext'] = $info->getExtension();
} else { } else {
$data['code'] = 101; $data['code'] = 101;
......
...@@ -84,17 +84,18 @@ class News extends Basic ...@@ -84,17 +84,18 @@ class News extends Basic
return $this->response(101, '内容为空!'); return $this->response(101, '内容为空!');
} }
if (empty($_FILES['file_img'])) { if (mb_strlen($this->params['content']) > 501) {
return $this->response(101, '封面图片为空'); return $this->response(101, '内容字数超过限制!');
} }
$upload = new UploadFileService(); if (empty($this->params['file_img'])) {
$result = $upload->upload($_FILES['file_img'], 'business_school'); return $this->response(101, '封面图片为空');
}
$data['title'] = trim($this->params['title']); $data['title'] = trim($this->params['title']);
$data['content'] = trim($this->params['content']); $data['content'] = trim($this->params['content']);
$data['publisher_id'] = $this->userId; $data['publisher_id'] = $this->userId;
$data['cover_plan'] = $result['msg']['img_path']; $data['cover_plan'] = $this->params['file_img'];
$num = $this->m_news->editData($data, $this->params['id']); $num = $this->m_news->editData($data, $this->params['id']);
if ($num < 1) { if ($num < 1) {
......
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