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}
发送文件