删除无用的注释和文件
This commit is contained in:
@@ -10,6 +10,7 @@ use URL;
|
||||
use Gdoo\File\Models\Attachment;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AttachmentController extends DefaultController
|
||||
{
|
||||
@@ -25,9 +26,6 @@ class AttachmentController extends DefaultController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文件到草稿
|
||||
*/
|
||||
public function draftAction()
|
||||
{
|
||||
set_time_limit(0);
|
||||
@@ -69,9 +67,6 @@ class AttachmentController extends DefaultController
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看文件
|
||||
*/
|
||||
public function fileinfoAction()
|
||||
{
|
||||
$id = Request::get('id', 0);
|
||||
@@ -86,11 +81,6 @@ class AttachmentController extends DefaultController
|
||||
return $this->json('文件不存在。');
|
||||
}
|
||||
|
||||
//$isimg = '|jpg|png|gif|bmp|jpeg|', '|'.$ext.'|';
|
||||
//$isoffice = '|doc|docx|xls|xlsx|ppt|pptx|pdf|', '|'.$ext.'|';
|
||||
//$isbianju = '|doc|docx|xls|xlsx|ppt|pptx|', '|'.$ext.'|';
|
||||
//$isyulan = ',txt,log,html,htm,js,php,php3,mp4,md,cs,sql,java,json,css,asp,aspx,shtml,cpp,c,vbs,jsp,xml,bat,ini,conf,sh,', ','.$ext.',';
|
||||
|
||||
$isview = 0;
|
||||
$isimg = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
|
||||
if (in_array($file['type'], $isimg)) {
|
||||
@@ -156,9 +146,6 @@ class AttachmentController extends DefaultController
|
||||
$size = $file->getSize();
|
||||
$name = $file->getClientOriginalName();
|
||||
$extension = strtolower($file->getClientOriginalExtension());
|
||||
//$name = $paths['filename'];
|
||||
//$extension = strtolower($name);
|
||||
//$_FILES['Filedata']['size']
|
||||
|
||||
// 保存附件的表名
|
||||
$table = empty($gets['model']) ? 'attachment' : $gets['model'];
|
||||
@@ -168,24 +155,20 @@ class AttachmentController extends DefaultController
|
||||
|
||||
// 附件存放目录
|
||||
$upload_path = upload_path($path);
|
||||
/*
|
||||
if(!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0755, true);
|
||||
}
|
||||
*/
|
||||
|
||||
// 附件新名字
|
||||
$filename = date('ymdhi').str_random(4).".".$extension;
|
||||
$filename = date('ymdhi').Str::random(4).".".$extension;
|
||||
|
||||
if (in_array($extension, explode(',', $upload_type))) {
|
||||
// 移动文件
|
||||
if ($file->move($upload_path, $filename)) {
|
||||
$data = [
|
||||
'title' => $name,
|
||||
'path' => $path,
|
||||
'type' => $extension,
|
||||
'name' => $filename,
|
||||
'size' => $size,
|
||||
'add_time' => time(),
|
||||
'title' => $name,
|
||||
'path' => $path,
|
||||
'type' => $extension,
|
||||
'name' => $filename,
|
||||
'size' => $size,
|
||||
'add_time' => time(),
|
||||
'add_user_id' => Auth::id(),
|
||||
];
|
||||
|
||||
@@ -219,10 +202,7 @@ class AttachmentController extends DefaultController
|
||||
$size = $file->getSize();
|
||||
$name = $file->getClientOriginalName();
|
||||
$extension = strtolower($file->getClientOriginalExtension());
|
||||
//$name = $paths['filename'];
|
||||
//$extension = strtolower($name);
|
||||
//$_FILES['Filedata']['size']
|
||||
|
||||
|
||||
// 保存附件的表名
|
||||
$table = empty($gets['model']) ? 'attachment' : $gets['model'];
|
||||
|
||||
@@ -231,23 +211,19 @@ class AttachmentController extends DefaultController
|
||||
|
||||
// 附件存放目录
|
||||
$upload_path = upload_path($path);
|
||||
/*
|
||||
if(!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0755, true);
|
||||
}
|
||||
*/
|
||||
|
||||
// 附件新名字
|
||||
$filename = date('ymdhi').str_random(4).".".$extension;
|
||||
$filename = date('ymdhi').Str::random(4).".".$extension;
|
||||
|
||||
if (in_array($extension, explode(',', $upload_type))) {
|
||||
// 移动文件
|
||||
if ($file->move($upload_path, $filename)) {
|
||||
$insert_id = DB::table($table)->insertGetId([
|
||||
'title' => $name,
|
||||
'path' => $path,
|
||||
'type' => $extension,
|
||||
'name' => $filename,
|
||||
'size' => $size,
|
||||
'path' => $path,
|
||||
'type' => $extension,
|
||||
'name' => $filename,
|
||||
'size' => $size,
|
||||
'add_time' => time(),
|
||||
'add_user_id' => Auth::id(),
|
||||
]);
|
||||
|
||||
@@ -9,6 +9,7 @@ use Validator;
|
||||
use Gdoo\Model\Grid;
|
||||
|
||||
use Gdoo\File\Models\Certificate;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CertificateController extends DefaultController
|
||||
{
|
||||
@@ -83,13 +84,12 @@ class CertificateController extends DefaultController
|
||||
// 扩展名称
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
// 附件新名字
|
||||
$filename = date('dhis_').str_random(4).'.'.$extension;
|
||||
$filename = date('dhis_').Str::random(4).'.'.$extension;
|
||||
$filename = mb_strtolower($filename);
|
||||
$uploadSuccess = $file->move($upload_path, $filename);
|
||||
if ($uploadSuccess) {
|
||||
// 数据库写入
|
||||
$draft = new Certificate;
|
||||
//$draft->name = mb_strtolower($file->getClientOriginalName());
|
||||
$draft->name = $name;
|
||||
$draft->path = $path.'/'.$filename;
|
||||
$draft->type = $extension;
|
||||
|
||||
@@ -8,6 +8,7 @@ use Gdoo\Index\Models\Share;
|
||||
use Gdoo\File\Models\File;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class FileController extends DefaultController
|
||||
{
|
||||
@@ -105,7 +106,7 @@ class FileController extends DefaultController
|
||||
// 扩展名称
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
// 附件新名字
|
||||
$filename = date('dhis_').str_random(4).'.'.$extension;
|
||||
$filename = date('dhis_').Str::random(4).'.'.$extension;
|
||||
$filename = mb_strtolower($filename);
|
||||
|
||||
$uploadSuccess = $file->move($upload_path, $filename);
|
||||
@@ -132,12 +133,7 @@ class FileController extends DefaultController
|
||||
// 个人云盘
|
||||
public function indexAction()
|
||||
{
|
||||
$search = search_form([
|
||||
'referer' => 1,
|
||||
], []);
|
||||
|
||||
$user_id = auth()->id();
|
||||
|
||||
$parent_id = Request::get('parent_id', 0);
|
||||
|
||||
$rows = DB::table('file')
|
||||
@@ -187,11 +183,7 @@ class FileController extends DefaultController
|
||||
// 共享给我的
|
||||
public function receivedataAction()
|
||||
{
|
||||
$search = search_form([
|
||||
'referer' => 1,
|
||||
], []);
|
||||
|
||||
$user_id = Request::get('user_id');
|
||||
$user_id = Request::get('user_id');
|
||||
$parent_id = Request::get('parent_id');
|
||||
|
||||
// 共享的全部文件和文件夹
|
||||
@@ -250,20 +242,16 @@ class FileController extends DefaultController
|
||||
|
||||
$user = $row = DB::table('user')->where('id', $user_id)->first();
|
||||
return $this->display([
|
||||
'rows' => $rows,
|
||||
'rows' => $rows,
|
||||
'breadcrumb' => $breadcrumb,
|
||||
'parent_id' => $parent_id,
|
||||
'user' => $user,
|
||||
'parent_id' => $parent_id,
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
|
||||
// 我共享的
|
||||
public function shareAction()
|
||||
{
|
||||
$search = search_form([
|
||||
'referer' => 1,
|
||||
], []);
|
||||
|
||||
$user_id = Request::get('user_id', auth()->id());
|
||||
|
||||
// 共享的全部文件和文件夹
|
||||
@@ -323,9 +311,9 @@ class FileController extends DefaultController
|
||||
}
|
||||
|
||||
return $this->display([
|
||||
'rows' => $rows,
|
||||
'rows' => $rows,
|
||||
'breadcrumb' => $breadcrumb,
|
||||
'parent_id' => $parent_id,
|
||||
'parent_id' => $parent_id,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -345,8 +333,6 @@ class FileController extends DefaultController
|
||||
|
||||
$rows = [
|
||||
'name' => '公共网盘', 'type' => '',
|
||||
'name' => '公共网盘',
|
||||
'name' => '公共网盘',
|
||||
];
|
||||
|
||||
return $this->display([
|
||||
|
||||
@@ -9,6 +9,7 @@ use Validator;
|
||||
use Gdoo\Model\Grid;
|
||||
|
||||
use Gdoo\File\Models\InspectReport;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class InspectReportController extends DefaultController
|
||||
{
|
||||
@@ -83,13 +84,12 @@ class InspectReportController extends DefaultController
|
||||
// 扩展名称
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
// 附件新名字
|
||||
$filename = date('dhis_').str_random(4).'.'.$extension;
|
||||
$filename = date('dhis_').Str::random(4).'.'.$extension;
|
||||
$filename = mb_strtolower($filename);
|
||||
$uploadSuccess = $file->move($upload_path, $filename);
|
||||
if ($uploadSuccess) {
|
||||
// 数据库写入
|
||||
$draft = new InspectReport;
|
||||
//$draft->name = mb_strtolower($file->getClientOriginalName());
|
||||
$draft->name = $name;
|
||||
$draft->path = $path.'/'.$filename;
|
||||
$draft->type = $extension;
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
<?php namespace Gdoo\File\Controllers;
|
||||
|
||||
use Request;
|
||||
use URL;
|
||||
|
||||
use Gdoo\Index\Controllers\Controller;
|
||||
|
||||
class WidgetController extends Controller
|
||||
{
|
||||
public $permission = ['index', 'download'];
|
||||
|
||||
public $rows = [/*[
|
||||
'title' => '盛华管理手机客户端',
|
||||
'date' => '2018-04-09',
|
||||
'android_url' => '/uploads/com.shenghua.oa/1.0.12.apk',
|
||||
'ios_url' => ''
|
||||
],[
|
||||
'title' => '盛华市场手机客户端',
|
||||
'date' => '2018-04-07',
|
||||
'android_url' => '/uploads/com.shenghua.customer/1.0.3.apk',
|
||||
'ios_url' => '/uploads/com.shenghua.customer/1.0.3.ipa'
|
||||
],*/[
|
||||
'title' => '身份验证器(GoogleAuthenticator)',
|
||||
'date' => '2015-06-17',
|
||||
'android_url' => '/uploads/android/authenticator2_21.apk',
|
||||
'ios_url' => ''
|
||||
],[
|
||||
'title' => '日历同步助手(Caldav)',
|
||||
'date' => '2017-06-29',
|
||||
'android_url' => '/uploads/android/calendar.caldav.sync.apk',
|
||||
'ios_url' => ''
|
||||
]];
|
||||
|
||||
public function downloadAction()
|
||||
{
|
||||
$key = Request::get('key');
|
||||
$row = $this->rows[$key];
|
||||
|
||||
$file = '';
|
||||
|
||||
if (get_device_type() == 'ios') {
|
||||
if ($row['ios_url']) {
|
||||
$file = url($row['ios_url']);
|
||||
}
|
||||
$img = '/assets/images/ios_download.png';
|
||||
} else {
|
||||
if ($row['android_url']) {
|
||||
$file = url($row['android_url']);
|
||||
}
|
||||
$img = '/assets/images/android_download.png';
|
||||
}
|
||||
|
||||
if (is_weixin()) {
|
||||
echo '<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title></title>
|
||||
<style>
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
background-color:#a2a2a2;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<img src="'.$img.'" />
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
} else {
|
||||
if ($file) {
|
||||
echo "<form action='".$file."' id='go' method='GET'></form><script type='text/javascript'>document.getElementById('go').submit();</script>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
if (Request::isJson()) {
|
||||
foreach ($this->rows as $k => &$row) {
|
||||
$url = '';
|
||||
|
||||
if ($row['android_url']) {
|
||||
$url .= '<a class="option" href="'.url($row['android_url']).'"><i class="fa fa-fw fa-android"></i></a>';
|
||||
}
|
||||
|
||||
if ($row['ios_url']) {
|
||||
$url .= ' <a class="option" href="'.url($row['ios_url']).'"><i class="fa fa-fw fa-apple"></i></a>';
|
||||
} else {
|
||||
$url .= ' <span class="text-muted" href="javascript:;"><i class="fa fa-fw fa-apple"></i></span>';
|
||||
}
|
||||
|
||||
$qrcodeURL = url('index/api/qrcode', ['size' => 6, 'data' => url('file/widget/download', ['key' => $k])]);
|
||||
|
||||
$url .= ' <a class="option" href="javascript:;" onclick=\'$.messager.alert("'.$row['title'].'","<div align=\"center\"><img src=\"'.$qrcodeURL.'\"></div>");\'><i class="fa fa-fw fa-qrcode"></i></a>';
|
||||
|
||||
$row['option'] = $url;
|
||||
}
|
||||
|
||||
$json['total'] = sizeof($this->rows);
|
||||
$json['data'] = $this->rows;
|
||||
return response()->json($json);
|
||||
}
|
||||
return $this->render();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<table id="widget-file-file">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-field="title" data-align="left">标题</th>
|
||||
<th data-field="date" data-width="160" data-align="center">日期</th>
|
||||
<th data-field="option" data-width="200" data-align="center">下载</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
var $table = $('#widget-file-file');
|
||||
$table.bootstrapTable({
|
||||
sidePagination: 'server',
|
||||
showColumns: false,
|
||||
showHeader: false,
|
||||
height: 200,
|
||||
pagination: false,
|
||||
url: '{{url("file/widget/index")}}',
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
Reference in New Issue
Block a user