更新说明文件安装教程;更新数据库安装;兼容不接入时user_hub的提醒;

This commit is contained in:
2022-02-16 22:45:10 +08:00
parent 354c75897d
commit a86a1a1002
6 changed files with 127 additions and 2 deletions

View File

@@ -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
```
#### 版权 #### 版权

View File

@@ -51,6 +51,12 @@ class Common extends BaseController
public function ulthonLogin() 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') { if (empty($this->modelUser) || $this->modelUser->type != 'ulthon') {
$code = $this->request->param('code'); $code = $this->request->param('code');

View File

@@ -64,7 +64,7 @@ class Index extends Common
$post_data['times_last'] = $post_data['times']; $post_data['times_last'] = $post_data['times'];
$root_dir = App::getRootPath(); $root_dir = App::getRootPath();
$safe_dir = '/safe/'; $safe_dir = 'safe'.DIRECTORY_SEPARATOR;
$file_preifx = $root_dir . $safe_dir; $file_preifx = $root_dir . $safe_dir;

View File

@@ -0,0 +1,50 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableShare extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->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();
}
}

View File

@@ -0,0 +1,47 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableShareFiles extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->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();
}
}

View File

@@ -34,6 +34,11 @@
<body> <body>
{include file='common/_header'/} {include file='common/_header'/}
<div class="layui-container" style="margin-top: 15px;;"> <div class="layui-container" style="margin-top: 15px;;">
{notempty name='system_tips'}
<div class="layui-row">
<blockquote class="layui-elem-quote">{$system_tips}</blockquote>
</div>
{/notempty}
<div class="layui-row"> <div class="layui-row">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-header">发送文件</div> <div class="layui-card-header">发送文件</div>