-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
增加阿里云OSS组件,增加附件上传功能,优化代码风格,删除文章模型读取监听,增加目录与用户填充,升级laravel
- Loading branch information
Showing
29 changed files
with
1,707 additions
and
1,154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Modules/Admin/Http/Controllers/Attachment/AttachmentController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Modules\Admin\Http\Controllers\Attachment; | ||
|
||
use App\Model\Attachment; | ||
use App\Model\Code; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Response; | ||
use Modules\Admin\Http\Controllers\AdminController; | ||
|
||
/** | ||
* 附件控制器 | ||
* Class AttachmentController | ||
* @package Modules\Admin\Http\Controllers\Attachment | ||
*/ | ||
class AttachmentController extends AdminController | ||
{ | ||
protected static $rules = [ | ||
'postUpload' => [ | ||
'file' => 'required|file', | ||
'directory' => 'string', | ||
], | ||
]; | ||
|
||
/** | ||
* 上传文件 | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
* @throws \Throwable | ||
*/ | ||
public function postUpload(Request $request): Response | ||
{ | ||
$this->checkValidate($request->all(), __FUNCTION__); | ||
if (!$request->hasFile('file')) { | ||
Code::setCode(Code::ERR_PARAMETER); | ||
return $this->response(); | ||
} | ||
$file = $request->file('file'); | ||
$directory = trim($request->input('directory', '')); | ||
$attachment = Attachment::upload($file, $directory) ?: null; | ||
return $this->response($attachment); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
## Website of WebmasterClub at Shanghai Dianji University | ||
# Website of WebmasterClub at Shanghai Dianji University | ||
|
||
[https://www.djwebclub.com](https://www.djwebclub.com) | ||
|
||
### Instruction for deployment | ||
## Instruction for deployment | ||
|
||
#### Configure | ||
### Configure | ||
|
||
Copy the *environment configuration* | ||
|
||
|
@@ -18,39 +18,63 @@ and add your *database connection* and *SMTP Server* info to it. | |
vim .env | ||
``` | ||
|
||
#### Install the infrastructure | ||
### Install | ||
|
||
1. Generate the key for the application | ||
2. Migrate the database tables | ||
3. Install the Laravel Passport used to support OAuth Server | ||
Just run | ||
|
||
```bash | ||
./install.sh | ||
``` | ||
|
||
It will execute the following instructions. | ||
|
||
```bash | ||
# 0. Install some dependencies | ||
if hash pecl 2>/dev/null; then | ||
pecl install igbinary redis xdebug | ||
else | ||
if hash apt-get 2>/dev/null; then | ||
apt-get install php-igbinary php-redis php-xdebug php-bcmath php-mbstring | ||
fi | ||
fi | ||
|
||
composer install | ||
|
||
# 1. Generate the key for the application. | ||
./artisan key:generate | ||
./artisan migrate | ||
# 2. Drop all existing tables in your specific database. | ||
./artisan migrate:reset | ||
# 2. Migrate the tables. | ||
# 3. Fill up your database with init data. | ||
./artisan migrate --force --seed | ||
# 4. Install the Laravel Passport used to support OAuth Server. | ||
./artisan passport:install --force | ||
``` | ||
|
||
#### Fill up your database | ||
|
||
Seed some base data to your database. | ||
### Default User | ||
|
||
```bash | ||
./artisan db:seed | ||
``` | ||
| Username | Mobile | Password | Role | | ||
|:-----------------:|:---------:|:--------:|:-----------:| | ||
| [email protected] |18181818181| 123456 | Super Admin | | ||
|
||
**Make sure to run it once precisely or duplicated data will be added** | ||
## Reinstall | ||
|
||
### Reinstall | ||
Reinstall like an new application according to *Instruction for deployment* | ||
|
||
#### Clean your database | ||
Just run | ||
|
||
```bash | ||
./artisan migrate:reset | ||
```shell | ||
./install.sh | ||
``` | ||
|
||
#### Reinstall | ||
## Uninstall | ||
|
||
Reinstall like an new application according to *Instruction for deployment* | ||
## Clean your database | ||
|
||
```bash | ||
./artisan migrate:reset | ||
``` | ||
|
||
## Laravel | ||
|
||
|
@@ -63,59 +87,6 @@ Reinstall like an new application according to *Instruction for deployment* | |
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a> | ||
</p> | ||
|
||
## About Laravel | ||
|
||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: | ||
|
||
- [Simple, fast routing engine](https://laravel.com/docs/routing). | ||
- [Powerful dependency injection container](https://laravel.com/docs/container). | ||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. | ||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). | ||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations). | ||
- [Robust background job processing](https://laravel.com/docs/queues). | ||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). | ||
|
||
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. | ||
|
||
## Learning Laravel | ||
|
||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of any modern web application framework, making it a breeze to get started learning the framework. | ||
|
||
If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. | ||
|
||
## Laravel Sponsors | ||
|
||
We would like to extend our thanks to the following sponsors for helping fund on-going Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell): | ||
|
||
- **[Vehikl](https://vehikl.com/)** | ||
- **[Tighten Co.](https://tighten.co)** | ||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** | ||
- **[Cubet Techno Labs](https://cubettech.com)** | ||
- **[British Software Development](https://www.britishsoftware.co)** | ||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)** | ||
- [UserInsights](https://userinsights.com) | ||
- [Fragrantica](https://www.fragrantica.com) | ||
- [SOFTonSOFA](https://softonsofa.com/) | ||
- [User10](https://user10.com) | ||
- [Soumettre.fr](https://soumettre.fr/) | ||
- [CodeBrisk](https://codebrisk.com) | ||
- [1Forge](https://1forge.com) | ||
- [TECPRESSO](https://tecpresso.co.jp/) | ||
- [Runtime Converter](http://runtimeconverter.com/) | ||
- [WebL'Agence](https://weblagence.com/) | ||
- [Invoice Ninja](https://www.invoiceninja.com) | ||
- [iMi digital](https://www.imi-digital.de/) | ||
- [Earthlink](https://www.earthlink.ro/) | ||
- [Steadfast Collective](https://steadfastcollective.com/) | ||
|
||
## Contributing | ||
|
||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). | ||
|
||
## Security Vulnerabilities | ||
|
||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed. | ||
|
||
## License | ||
|
||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). | ||
The Website is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.