From a86a1a10021de5662704f5c5c0050105c72bfabb Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 16 Feb 2022 22:45:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=B4=E6=98=8E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AE=89=E8=A3=85=E6=95=99=E7=A8=8B;=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AE=89=E8=A3=85;?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=B8=8D=E6=8E=A5=E5=85=A5=E6=97=B6user=5Fhu?= =?UTF-8?q?b=E7=9A=84=E6=8F=90=E9=86=92;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 19 ++++++- app/index/controller/Common.php | 6 +++ app/index/controller/Index.php | 2 +- .../20220216140643_create_table_share.php | 50 +++++++++++++++++++ ...0220216141148_create_table_share_files.php | 47 +++++++++++++++++ view/index/index/index.html | 5 ++ 6 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 database/migrations/20220216140643_create_table_share.php create mode 100644 database/migrations/20220216141148_create_table_share_files.php diff --git a/README.md b/README.md index 231f889..e7db7b2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,24 @@ http://file-share.ulthon.com #### 安装教程 -参考网站:https://gitee.com/ulthon/ulthon_admin +``` +1.安装 +git clone https://gitee.com/ulthon/ul-file-share.git +2.进入目录 +cd ul-file-share/ +3.安装依赖 +composer install +4.初始化数据库(默认将使用sqlite,请确保扩展正常) +php think migrate:run +php think seed:run +5.使用内置服务器 +php think run -p 8010 +6.访问前台 +127.0.0.1:8010/index.php/index +7.访问后台 +127.0.0.1:8010/index.php/admin +``` + #### 版权 diff --git a/app/index/controller/Common.php b/app/index/controller/Common.php index 4bb73f6..6a6ee53 100644 --- a/app/index/controller/Common.php +++ b/app/index/controller/Common.php @@ -51,6 +51,12 @@ class Common extends BaseController public function ulthonLogin() { + if(empty(get_system_config('user_hub_key'))){ + View::assign('system_tips','没有配置user_hub用户中心,登陆功能不可用'); + View::assign('ulthon_login_url',$this->request->url()); + return false; + } + if (empty($this->modelUser) || $this->modelUser->type != 'ulthon') { $code = $this->request->param('code'); diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 2473066..5cedbca 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -64,7 +64,7 @@ class Index extends Common $post_data['times_last'] = $post_data['times']; $root_dir = App::getRootPath(); - $safe_dir = '/safe/'; + $safe_dir = 'safe'.DIRECTORY_SEPARATOR; $file_preifx = $root_dir . $safe_dir; diff --git a/database/migrations/20220216140643_create_table_share.php b/database/migrations/20220216140643_create_table_share.php new file mode 100644 index 0000000..dc4b390 --- /dev/null +++ b/database/migrations/20220216140643_create_table_share.php @@ -0,0 +1,50 @@ +table('share') + ->setComment('分享表') + ->addColumn(ColumnFormat::timestamp('create_time')) + ->addColumn(ColumnFormat::timestamp('update_time')) + ->addColumn(ColumnFormat::timestamp('delete_time')) + ->addColumn(ColumnFormat::stringNormal('uid')) + ->addColumn(ColumnFormat::stringNormal('password')) + ->addColumn(ColumnFormat::integer('times')) + ->addColumn(ColumnFormat::integer('times_last')->setComment('剩余次数')) + ->addColumn(ColumnFormat::integer('expire')) + ->addColumn(ColumnFormat::integer('total_size')) + ->addColumn(ColumnFormat::stringNormal('build_download_save_name')->setComment('合成的下载包的存储路径')) + ->addColumn(ColumnFormat::integer('user_id')) + ->addColumn(ColumnFormat::integerTypeStatus('status')) + ->addColumn(ColumnFormat::integer('times_download')) + ->addColumn(ColumnFormat::integer('visit')) + ->create(); + } +} diff --git a/database/migrations/20220216141148_create_table_share_files.php b/database/migrations/20220216141148_create_table_share_files.php new file mode 100644 index 0000000..711ae04 --- /dev/null +++ b/database/migrations/20220216141148_create_table_share_files.php @@ -0,0 +1,47 @@ +table('share_files') + ->addColumn(ColumnFormat::timestamp('create_time')) + ->addColumn(ColumnFormat::timestamp('update_time')) + ->addColumn(ColumnFormat::timestamp('delete_time')) + ->addColumn(ColumnFormat::timestamp('clear_time')->setComment('清除时间')) + ->addColumn(ColumnFormat::stringNormal('save_name')->setComment('文件存储地址')) + ->addColumn(ColumnFormat::stringNormal('file_name')->setComment('文件名')) + ->addColumn(ColumnFormat::stringNormal('mime_type')->setComment('mime_type类型')) + ->addColumn(ColumnFormat::integer('file_size')->setComment('文件大小')) + ->addColumn(ColumnFormat::stringShort('ext_name')->setComment('扩展名')) + ->addColumn(ColumnFormat::stringMd5('file_md5')) + ->addColumn(ColumnFormat::stringNormal('file_sha1')) + ->addColumn(ColumnFormat::integer('share_id')) + ->create(); + } +} diff --git a/view/index/index/index.html b/view/index/index/index.html index 2b1f72d..ffcc942 100644 --- a/view/index/index/index.html +++ b/view/index/index/index.html @@ -34,6 +34,11 @@ {include file='common/_header'/}
+ {notempty name='system_tips'} +
+
{$system_tips}
+
+ {/notempty}
发送文件