unionco / modtool
Union.co 审核工具 (Laravel 5.2 包)
1.0.2
2018-06-04 18:42 UTC
Requires
- php: >=5.5.9
- bugsnag/bugsnag-laravel: 1.*
- fideloper/proxy: ~4.0
- fzaninotto/faker: 1.*
- jedrzej/pimpable: 0.0.4
- laravel/framework: 5.2.*
- league/flysystem-aws-s3-v3: ^1.0
- predis/predis: 1.*
- venturecraft/revisionable: 1.*
This package is not auto-updated.
Last update: 2024-09-18 04:33:44 UTC
README
此工具的目的是存储/集中存储所有用户生成内容(UGC),并允许内部用户对这些提交进行审核。UGC 应通过 API(见下文)创建并存储在数据库中,而附件将存储在 Amazon S3 上,审核应通过项目的 Web 界面进行。
此工具是为 Pall Mall 创建的,已在 Camel(作为艺术家选择工具进行适配)中使用,并且足够灵活,可以适应任何需要审核或管理的 UGC 的 Laravel 项目。
要求
您需要以下软件版本才能运行项目
- PHP 5.6+
- Laravel 5.2+
- MySQL 5.X+
组件
以下是项目中使用的 Composer 组件。您可以在它们的文档中找到有用的信息。
- Bugsnag 通知器 -- 错误报告
- 可修订 -- 数据库审计跟踪
- Pimpable -- API 过滤、排序和关联
- Faker -- 用于数据库填充
- 可信代理 -- 用于处理负载均衡环境中会话的代理包
- Flysystem-AWS-S3 -- Flysystem 适配器用于 AWS SDK V3
账户
您需要在这些服务上拥有有效账户,并在 .env 文件(见下文)上设置凭证
- Amazon S3
- Bugsnag
- SMTP
API
后端应用程序仅设计为通过 API 使用,因此所有 CRUD 数据都必须通过它进行。
对于没有 API_TOKEN 的前端认证,请使用路径 /ajax/ 而不是 /api/v1。相同的路由和参数将适用。
请参阅 API 文档(Postman)这里。
对于请求集合,请点击这里。
安装
安装 PHP、Apache 和 MySQL
通过 Composer
For Laravel versions 5.5+, Package Auto-Discover will add the Service Provider for you. For versions below 5.5, add the Service Provider manually in config/app.php:
```Unionco\Modtool\ModtoolServiceProvider::class```
If you don't have the users and roles tables, run
```php artisan make:auth```
Define your tables, fields and models on the `.env` file and run
```php artisan migrate```
```php artisan db:seed```
To copy the images and compiled javascript and css to the public folder, run
```php artisan vendor:publish --tag=public```
#### .env file
All these settings must be filled in the .env file.
The MOD_TOOL_* settings are for defining tables, columns and models names, which can be from your project or new ones. Below you'll find their default values.
If your project doesn't have tables for EntityType and EntitySubtype, set the conf MOD_TOOL_CREATE_ENTITIES_TABLES to 1 and the Database Migration will create these tables for you.
```
DB_CONNECTION=mysql
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_NAME='Pall Mall Website'
MAIL_FROM_ADDRESS='pallmall@union.co'
MAIL_DEFAULT_TO_NAME='Filipe Knoedt'
MAIL_DEFAULT_TO_ADDRESS='filipe.knoedt@union.co'
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=
;AWS_URL=
BUGSNAG_API_KEY=
MOD_TOOL_STORAGE_DRIVER='s3'
MOD_TOOL_TBL_UGC='pm_mod_ugc'
MOD_TOOL_TBL_STATUS_CODES='pm_mod_status_codes'
MOD_TOOL_TBL_CONTENT_TYPE='pm_mod_content_type'
MOD_TOOL_TBL_USERS='users'
MOD_TOOL_TBL_ROLE='roles'
MOD_TOOL_TBL_ROLE_USER='role_user_test'
MOD_TOOL_CREATE_ENTITIES_TABLES=1
MOD_TOOL_TBL_ENTITY_TYPES='pm_entity_types_dummy'
MOD_TOOL_PK_ENTITY_TYPES='id'
MOD_TOOL_NAME_ENTITY_TYPES='entity_name'
MOD_TOOL_MODEL_ENTITY_TYPES='Unionco\\Modtool\\Models\\ModEntityType'
MOD_TOOL_TBL_ENTITY_SUBTYPES='pm_entity_subtypes_dummy'
MOD_TOOL_PK_ENTITY_SUBTYPES='id'
MOD_TOOL_NAME_ENTITY_SUBTYPES='subtype_name'
MOD_TOOL_MODEL_ENTITY_SUBTYPES='Unionco\\Modtool\\Models\\ModEntitySubtype'
MOD_TOOL_TBL_PROFILES='pm_epsilon_profiles'
MOD_TOOL_PK_PROFILES='profileID'
MOD_TOOL_MODEL_PROFILES='Unionco\\Modtool\\Models\\ModProfile'
```
#### Front End Setup
- npm install
- npm run watch
#### React Components
* UgcTable -- Holds the UGC data and renders the UGC table
* UsersTable -- Holds the Users data and renders the Users table
* AuditTrailTable -- Holds the Audit Trail data and renders the AuditTrial table
* BulkChangeStatus -- Handles the bulk status update logic
* ChangeStatus -- Handles the single status update logic
* Stats -- Holds and renders a Stat component for the homepage dashboard
* TableCheckbox -- Renders a checkbox
* TableCheckboxHeader -- Renders a checkbox in the table header and holds logic to select all checkboxes