Downloads
Stars
Version
COTA-ADMIN 基于Laravel 6开发,用于一般商城、网站开发用的后台及前端接口框架。
composer create-project --prefer-dist cootaa/admin myproject
adminlte 3
开发;cota:data-init
;https://learnku.com/docs/laravel-specification
阿里云:https://developer.aliyun.com/mirror
清华:https://mirrors.tuna.tsinghua.edu.cn/
brew 镜像设置:https://mirror.tuna.tsinghua.edu.cn/help/homebrew/
Log
Facades
保存在log文件中,暂未接入阿里云日志服务;vue-element-admin
Api\Admin\Controller
;Api\Controller
;Request
类,统一继承BaseRequest
类;Policy
;App\Libaries
;composer
安装库;app\helpers.php
;app\Handlers
;routes\admin_api.php
,前端接口路由设置routes\api.php
;MySQL Workbench
;.env
文件里的常量不能直接通过env('XXX')
在代码中直接使用,必须写相应的 config 文件保存在app\config
目录,然后在代码中通过config('xxx.xx.xx')
调用;DingoApi
框架处理 api 接口,直接用原生的 routes;password_confirmation
,其他确认字段名xxx_confirmation
;utf8mb4
和utf8mb4-unicode-ci
;.env
文件里新增加了设置,需要同步到.env.example
文件;route()
方法统一输出路径。绝对不能在页面上 hard code 写上各种路径。adminlte 3
;resources
/views
;js
,css
等位于目录public
/static
;单图片上传组件
和百度编辑器
,图片上传均直传到OSS,编辑器支持批量上传图片
,涂鸦
,视频
,附件
;session
,接口使用jwt
,登录后会在浏览器记录jwt
的 cookie
,过期时间与session
一样,默认 120 分钟,当cookie
过期的同时session
会强行过期;1. 权限控制Policy 丢弃
1. 权限控制Policy 丢弃
composer install
;.env.example
为.env
,修改.env
中的相关设置;php artisan key:generate
和php artisan jwt:secret
生成新的密匙;AppServiceProvider
的27
行,否则数据库索引报错;php artisan migrate
,建立数据表结构。如果需要测试数据,就运行php artisan migrate --seed
;php artisan cota:data-init
,导入初始化数据;php artisan serve
,打开本地网站;server {
listen 80;
server_name www.domain.com #域名
# SSL设置
# listen 443 ssl;
# ssl_certificate /.../fullchain.pem;
# ssl_certificate_key /.../privkey.pem;
# ssl_session_timeout 5m;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
# ssl_prefer_server_ciphers on;
# error_page 497 https://$host&uri?$args;
root /.../php/public; #根目录
index index.html index.htm index.php;
charset utf-8;
# 跨域
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'DELETE, OPTION, POST, GET';
add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type, Authorization';
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
add_header X-Content-Type-Options nosniff;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9073;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
storage
和bootstrap/cache
需要可写权限;php artisan key:generate
和php artisan jwt:secret
生成新的密匙;php artisan config:cache
和php artisan route:cache
优化;php artisan config:clear
,php artisan config:cache
,php artisan route:clear
,php artisan route:cache
;php artisan clear-compiled
,php artisan optimize --force
优化类加载;composer dumpautoload -o
,如果运行了php artisan optimize --force
就不需要了;redis
缓存;debug
,APP_DEBUG=false
;扩展包 | 一句话描述 | 本项目应用场景 |
---|---|---|
caouecs/laravel-lang | 验证规则语言包 | 验证规则错误中文回复 |
fruitcake/laravel-cors | Laravel CORS接口处理 | 为接口增加跨域支持 |
gregwar/captcha | 图形验证码 | 图形验证码 |
intervention/image | 图片处理 | 图片上传后压缩裁减加水印 |
overtrue/easy-sms | 发送手机验证码 | 登录,注册,绑定手机时验证手机号 |
overtrue/wechat | EasyWechat微信处理框架 | 微信登录,小程序登录,公众号,小程序,支付,开放平台等微信相关 |
tymon/jwt-auth | JWT验证 | 接口授权 |
guzzlehttp/guzzle | HTTP 请求套件 | 请求通莞金服接口 |
php artisan cota:data-init