|
@@ -176,7 +176,8 @@ class Template extends Common{ |
|
@@ -176,7 +176,8 @@ class Template extends Common{ |
|
176
|
}*/
|
176
|
}*/
|
|
177
|
|
177
|
|
|
178
|
public function index(){
|
178
|
public function index(){
|
|
179
|
- $path = $this->publicpath.'images/'.input('folder').'/';
|
179
|
+ $path = "/alidata/www/dc-api/public/tables/batchPicsyn";
|
|
|
|
180
|
+
|
|
180
|
$uppath = explode('/',input('folder'));
|
181
|
$uppath = explode('/',input('folder'));
|
|
181
|
$leve = count($uppath)-1;
|
182
|
$leve = count($uppath)-1;
|
|
182
|
unset($uppath[$leve]);
|
183
|
unset($uppath[$leve]);
|
|
@@ -211,32 +212,21 @@ class Template extends Common{ |
|
@@ -211,32 +212,21 @@ class Template extends Common{ |
|
211
|
}
|
212
|
}
|
|
212
|
|
213
|
|
|
213
|
public function PackzipDownload(){
|
214
|
public function PackzipDownload(){
|
|
214
|
- $path = $this->publicpath.'images/'.input('post.folder');
|
215
|
+ $path = "/alidata/www/dc-api/public/tables/batchPicsyn";
|
|
215
|
$file=$path.input('post.filename');
|
216
|
$file=$path.input('post.filename');
|
|
216
|
//首先判断是图片还是路径
|
217
|
//首先判断是图片还是路径
|
|
217
|
if($this->isImage($file)!==false){
|
218
|
if($this->isImage($file)!==false){
|
|
218
|
//是图片
|
219
|
//是图片
|
|
219
|
$zip = new \ZipArchive;
|
220
|
$zip = new \ZipArchive;
|
|
220
|
//压缩文件名
|
221
|
//压缩文件名
|
|
221
|
- $filename = $path.'download.zip';
|
222
|
+ $filename = 'uploads/package/download.zip';
|
|
|
|
223
|
+
|
|
222
|
//新建zip压缩包
|
224
|
//新建zip压缩包
|
|
223
|
$obj = $zip->open($filename,\ZIPARCHIVE::OVERWRITE | \ZIPARCHIVE::CREATE);
|
225
|
$obj = $zip->open($filename,\ZIPARCHIVE::OVERWRITE | \ZIPARCHIVE::CREATE);
|
|
224
|
//把图片一张一张加进去压缩
|
226
|
//把图片一张一张加进去压缩
|
|
225
|
$zip->addFile($file);
|
227
|
$zip->addFile($file);
|
|
226
|
//打包zip
|
228
|
//打包zip
|
|
227
|
- $zip->close();
|
|
|
|
228
|
-
|
|
|
|
229
|
- //可以直接重定向下载
|
|
|
|
230
|
- //header('Location:'.$filename);
|
|
|
|
231
|
-
|
|
|
|
232
|
- //或者输出下载
|
|
|
|
233
|
- /*header("Cache-Control: public");
|
|
|
|
234
|
- header("Content-Description: File Transfer");
|
|
|
|
235
|
- header('Content-disposition: attachment; filename='.basename($filename)); //文件名
|
|
|
|
236
|
- header("Content-Type: application/force-download");
|
|
|
|
237
|
- header("Content-Transfer-Encoding: binary");
|
|
|
|
238
|
- header('Content-Length: '. filesize($filename)); //告诉浏览器,文件大小
|
|
|
|
239
|
- return @readfile($filename);*/
|
229
|
+ $rs = $zip->close();
|
|
240
|
}else{
|
230
|
}else{
|
|
241
|
//目录
|
231
|
//目录
|
|
242
|
$zip = new \ZipArchive;
|
232
|
$zip = new \ZipArchive;
|
|
@@ -251,20 +241,9 @@ class Template extends Common{ |
|
@@ -251,20 +241,9 @@ class Template extends Common{ |
|
251
|
}
|
241
|
}
|
|
252
|
|
242
|
|
|
253
|
//打包zip
|
243
|
//打包zip
|
|
254
|
- $zip->close();
|
|
|
|
255
|
-
|
|
|
|
256
|
- //可以直接重定向下载
|
|
|
|
257
|
- header('Location:'.$filename);exit;
|
|
|
|
258
|
-
|
|
|
|
259
|
- //或者输出下载
|
|
|
|
260
|
- header("Cache-Control: public");
|
|
|
|
261
|
- header("Content-Description: File Transfer");
|
|
|
|
262
|
- header('Content-disposition: attachment; filename='.basename($filename)); //文件名
|
|
|
|
263
|
- header("Content-Type: application/force-download");
|
|
|
|
264
|
- header("Content-Transfer-Encoding: binary");
|
|
|
|
265
|
- header('Content-Length: '. filesize($filename)); //告诉浏览器,文件大小
|
|
|
|
266
|
- return @readfile($filename);
|
244
|
+ $rs = $zip->close();
|
|
267
|
}
|
245
|
}
|
|
|
|
246
|
+ return $rs;
|
|
268
|
}
|
247
|
}
|
|
269
|
|
248
|
|
|
270
|
/**
|
249
|
/**
|
|
@@ -285,4 +264,43 @@ class Template extends Common{ |
|
@@ -285,4 +264,43 @@ class Template extends Common{ |
|
285
|
return false;
|
264
|
return false;
|
|
286
|
}
|
265
|
}
|
|
287
|
}
|
266
|
}
|
|
|
|
267
|
+
|
|
|
|
268
|
+ /**
|
|
|
|
269
|
+ * 二维码包下载页面
|
|
|
|
270
|
+ */
|
|
|
|
271
|
+ public function package(){
|
|
|
|
272
|
+ $path = 'uploads/package/'.input('folder').'/';
|
|
|
|
273
|
+
|
|
|
|
274
|
+ $uppath = explode('/',input('folder'));
|
|
|
|
275
|
+ $leve = count($uppath)-1;
|
|
|
|
276
|
+ unset($uppath[$leve]);
|
|
|
|
277
|
+ if($leve>1){
|
|
|
|
278
|
+ unset($uppath[$leve-1]);
|
|
|
|
279
|
+ $uppath = implode('/',$uppath).'/';
|
|
|
|
280
|
+ }else{
|
|
|
|
281
|
+ $uppath = '';
|
|
|
|
282
|
+ }
|
|
|
|
283
|
+ $this->assign ( 'leve',$leve);
|
|
|
|
284
|
+ $this->assign ( 'uppath',$uppath);
|
|
|
|
285
|
+ $files = glob($path.'*');
|
|
|
|
286
|
+ $folders=array();
|
|
|
|
287
|
+ foreach($files as $key => $file) {
|
|
|
|
288
|
+ $filename = basename($file);
|
|
|
|
289
|
+ if(is_dir($file)){
|
|
|
|
290
|
+ $folders[$key]['filename'] = $filename;
|
|
|
|
291
|
+ $folders[$key]['filepath'] = $file;
|
|
|
|
292
|
+ $folders[$key]['ext'] = 'folder';
|
|
|
|
293
|
+ }else{
|
|
|
|
294
|
+ $templates[$key]['filename'] = $filename;
|
|
|
|
295
|
+ $templates[$key]['filepath'] = $file;
|
|
|
|
296
|
+ $templates[$key]['ext'] = strtolower(substr($filename,strrpos($filename, '.')-strlen($filename)+1));
|
|
|
|
297
|
+ if(!in_array($templates[$key]['ext'],array('zip','gif','jpg','png','bmp'))) $templates[$key]['favicon.ico'] =1;
|
|
|
|
298
|
+ }
|
|
|
|
299
|
+ }
|
|
|
|
300
|
+ $this->assign ( 'title','二维码管理' );
|
|
|
|
301
|
+ $this->assign ( 'path',$path);
|
|
|
|
302
|
+ $this->assign ( 'folders',$folders );
|
|
|
|
303
|
+ $this->assign ( 'files',$templates );
|
|
|
|
304
|
+ return $this->fetch();
|
|
|
|
305
|
+ }
|
|
288
|
} |
306
|
} |