• CMD下导入SQL

d:
cd D:\phpstudy_pro\Extensions\MySQL5.7.26\bin
mysql.exe -h 127.0.0.1 -u root -p app_homelab < app_homelab.sql
  • 开启 SQL 及错误日志

// @backend/application/config.php 
'log' => [
    // 日志记录级别
    'level' => ['sql','error'],
],
# @backend/.env 
[app]
debug = true
trace = false

[database]
debug = true
  • 菜单权限

# 访问示例
http://www.finance.test/aXHyIkWioq.php/qingdongams/cdd/aml_report/index?ref=addtabs
# 菜单权限
qingdongams/cdd/aml_report/index
# 完整规则
http://www.finance.test/aXHyIkWioq.php/auth/rule?ref=addtabs
  • 一键生成菜单

# 一键生成 finance/test 控制器的权限菜单
php think menu -c finance/test
# 删除 test 控制器生成的菜单
php think menu -c finance/test -d 1
  • 一键生成CRUD

php think crud -t test -u 1 -c finance/test -d 1
  • `- t` 表名,带不带表前缀均可
  • `- m` 生成的模型名,可选,默认根据表名进行自动解析
  • `- c` 生成的控制器名,可选,默认根据表名进行自动解析
  • `- d` 删除模式,将删除之前使用CRUD命令生成的相关文件
  • `- u` 菜单模式,生成CRUD后将继续一键生成菜单
cd D:\workspace\www\finance\backend
php think crud -t fa_aml_report -m qingdongams/cdd/AmlReport -c qingdongams/cdd/AmlReport -u 1 -d 1
# addons\qingdongams\model\AmlReport.php
php think crud -t fa_aml_report -m qingdongams/cdd/AmlReportTmp -c qingdongams/cdd/AmlReport -u 1 -d 1

# http://www.finance.test/aXHyIkWioq.php/qingdongams/cdd/aml_report?ref=addtabs
cd D:\workspace\www\finance\backend> php think crud -t fa_aml_report -m qingdongams/cdd/AmlReport -c qingdongams/cdd/AmlReport -u 1 -d 1
# application/admin\controller\qingdongams\cdd\AmlReport.php
# application/admin\model\qingdongams\cdd\AmlReport.php
# application/admin\validate\qingdongams\cdd\AmlReport.php
# application\admin\view\qingdongams\cdd\aml_report\add.html
# application\admin\view\qingdongams\cdd\aml_report\edit.html
# application\admin\view\qingdongams\cdd\aml_report\index.html
# application\admin\view\qingdongams\cdd\aml_report\recyclebin.html
# application\admin\lang\zh-cn\qingdongams\cdd\aml_report.php
# public\assets\js\backend\qingdongams\cdd\aml_report.js
# Are you sure you want to delete all those files?  Type 'yes' to continue:

# 先生成,然后修正
- application\admin\validate\qingdongams\cdd\AmlReportTmp.php # 重命名验证
- application\admin\model\qingdongams/cdd/AmlReportTmp.php    # 删除临时模型
- application\admin\controller\qingdongams\cdd\AmlReport.php  # 修正控制器使用的模型
  • 一键生成API文档

# API 自定义模板文件
# application/admin/command/Api/template/index.html

# https://doc.fastadmin.net/doc/163.html

# https://cdnjs.com/libraries/twitter-bootstrap/3.4.1
# https://cdnjs.com/libraries/font-awesome/4.7.0
# https://cdnjs.com/libraries/jquery/3.6.0

# http://www.finance.test/aXHyIkWioq.php

php think api -e mytemplate.html -u http://www.finance.test/index.php --force=true
file:///D:/workspace/www/finance/backend/public/api.html#1901606e
http://www.finance.test/api.html