From b688860162c2528d527645a56b1d27757fa5ffc6 Mon Sep 17 00:00:00 2001 From: xxb Date: Wed, 8 Sep 2021 11:11:30 +0800 Subject: [PATCH] liche update for admin order baoxian update load pdf file --- admin/controllers/Upload.php | 47 +- admin/controllers/receiver/Orders.php | 4 +- admin/views/items/goods/edit.php | 2 +- admin/views/receiver/orders/agentinfo.php | 6 +- admin/views/receiver/orders/get.php | 1 - admin/views/uploadpdf.php | 560 ++++++++++++++++++++++ 6 files changed, 613 insertions(+), 7 deletions(-) create mode 100644 admin/views/uploadpdf.php diff --git a/admin/controllers/Upload.php b/admin/controllers/Upload.php index 35013fc4..1da3f66f 100755 --- a/admin/controllers/Upload.php +++ b/admin/controllers/Upload.php @@ -23,6 +23,10 @@ class Upload extends CI_Controller $mark = $this->input->get('mark'); $source = $this->input->get('source'); + if('pdf' == $types){ + return $this->pdf(); + } + $data['mode'] = $mode ? $mode : '1'; $data['types'] = $types ? $types : 'jpg,png'; $data['uptype'] = $uptype ? $uptype : 'qiniu'; @@ -35,7 +39,21 @@ class Upload extends CI_Controller $data['mark_id'] = $mark_data[1]; $data['mark_url'] = count($mark_data) >= 3 ? $mark_data[2] : '/biz/store/pic/add'; } - $this->load->view('upload', $data); + return $this->load->view('upload', $data); + } + + public function pdf(){ + $mode = $this->input->get('mode'); + $types = $this->input->get('type'); + $uptype = $this->input->get('uptype'); + $source = $this->input->get('source'); + + $data['mode'] = $mode ? $mode : '1'; + $data['types'] = $types; + $data['uptype'] = $uptype ? $uptype : 'qiniu'; + $data['mimes'] = $this->file_mime($data['types']); + $data['source'] = $source ? $source : ''; + $this->load->view('uploadpdf', $data); } //文件状态检查 @@ -74,6 +92,33 @@ class Upload extends CI_Controller return $this->show_json('NOT_FOUND', $config); } + //文件状态检查 + public function upstate_pdf() + { + $post = $this->input->post(); + $this->load->library('qiniu'); + + $config = $this->qiniu->getConfig(); + $filename = join('/', str_split($post['md5'], 16)) . '.' . strtolower(pathinfo($post['filename'], PATHINFO_EXTENSION)); + $filename = $config['attch'] . date('Y/m') . '/' . $filename; + + // 检查文件是否已上传 + if ($site_url = $this->qiniu->getFileUrl($filename)) { + return $this->show_json('IS_FOUND', array( + 'site_url' => $site_url, + 'file_url' => $filename, + 'file_title' => substr($filename, strrpos($filename, '/')+1) + )); + } + + // 需要上传文件,生成上传配置参数 + $config = array('uptype' => $post['uptype'], 'file_url' => $filename); + $config['server'] = $this->qiniu->getUploadQiniuUrl(true); + $config['token'] = $this->qiniu->getToken($filename); + + return $this->show_json('NOT_FOUND', $config); + } + //返回json数据 protected function show_json($code = '', $data = array()) { diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index a68cd19b..63c897cc 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -116,9 +116,11 @@ class Orders extends HD_Controller{ if($agent['ins_img']){ $ins_img = json_decode($agent['ins_img']); foreach($ins_img as $val){ + $file_name = substr($val, strrpos($val, '/')+1); $imgs[] = [ 'src' => build_qiniu_image_url($val), - 'value' => $val + 'value' => $val, + 'title' => $file_name ]; } } diff --git a/admin/views/items/goods/edit.php b/admin/views/items/goods/edit.php index 0b1736eb..dd8fef91 100644 --- a/admin/views/items/goods/edit.php +++ b/admin/views/items/goods/edit.php @@ -144,7 +144,7 @@ - diff --git a/admin/views/receiver/orders/agentinfo.php b/admin/views/receiver/orders/agentinfo.php index 1c853a8f..531cfed1 100644 --- a/admin/views/receiver/orders/agentinfo.php +++ b/admin/views/receiver/orders/agentinfo.php @@ -46,16 +46,16 @@
- +
- + {{v.title}} diff --git a/admin/views/receiver/orders/get.php b/admin/views/receiver/orders/get.php index 21dd7a78..a0730ca3 100644 --- a/admin/views/receiver/orders/get.php +++ b/admin/views/receiver/orders/get.php @@ -366,7 +366,6 @@ imgs = ''; if (this.bx_imgs) { jQuery.each(this.bx_imgs, function (i, val) { - console.dir(val) if (imgs) { imgs += "," + val['value']; } else { diff --git a/admin/views/uploadpdf.php b/admin/views/uploadpdf.php new file mode 100644 index 00000000..bdaca0f4 --- /dev/null +++ b/admin/views/uploadpdf.php @@ -0,0 +1,560 @@ + + + + + + + + + + + + + + +
+
+
+
+ 文件大小不超过6MB +
+
+ +
+ + +