# tp_fastadmin **Repository Path**: ningdiadmin/tp_fastadmin ## Basic Information - **Project Name**: tp_fastadmin - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-10-25 - **Last Updated**: 2024-11-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README sudo chmod -R 777 * && git add . && git commit -m 'Submit Code' && git push origin master FastAdmin官网:https://doc.fastadmin.net/doc MVC C:Controller 控制器 业务逻辑 M:Model 模型 操作数据(数据库) 增删查改 数据库查询 V:View 视图(页面) 页面html显示 公司通讯录案例做法:纯源生PHP源代码 没有任何架构可言 业务逻辑、数据库查询、页面html显示 过程式的写法 Thinkphp框架5.0 PHP框架 MVC架构 常见封装(文件上传 、分页、验证码) 纯裸框架 底层框架 FastAdmin 二次开发系统 基于Thinkphp5.0版本 ERP系统标准版该有的功能(管理员/系统设置/权限管理) 30%功能 就不用做了 FastAdmin 属于在 基于Thinkphp的基础上,迭代了一些功能上去。可以帮助我们不用完全从0开始做 我们更多的精力需要放到 需求 业务逻辑的实现上面 云课堂(前台 + 后台) 自己项目的命名:fast 配置站点:www.fast.com 指向到:public/ .htaccess -> apache的URL重写文件 前台:www.fast.com 后台:www.fast.com/erp.php 账号:admin 密码:admin123 前台程序入口:public/index.php 后台程序入口:public/erp.php 应用程序目录:application 在执行命令的时候,一定要先进入到项目的根目录 前台模块:home 创建前台模块: php think build --module home 想访问home模块 application: MVC www.fast.com -> 指向到 public 目录下 application/ 应用程序的MVC的目录 config.php 应用的配置文件 'app_debug' => true, //开启调试 // 默认模块名 'default_module' => 'index', /application/index/ // 默认控制器名 'default_controller' => 'Index', /application/index/controller/Index.php // 默认操作名 'default_action' => 'index', /application/index/controller/Index.php -> public function index public/ 公共访问目录 index.php 程序的入口文件 think 框架的命令行文件 独立模块:前台(home)、后台(admin) 独立模块: MVC url地址开始入手 http://www.fast.com/index.php apache http://www.fast.com/index.php/index/index/index http://www.fast.com/index.php/模块/控制器/方法 http://www.fast.com/home/business/index 如果自己创建一个模块,需要用到命令行 php think build --module 模块的名称 php think build --module home 自己创建一个控制器,需要用到命令行 php think make:controller 模块/控制器名 php think make:controller home/Business 页面URL:http://www.fast.com/home(模块)/index(控制器)/index(方法) 控制器文件C:application/home/controller/Index.php(public index) 模板文件V:application/home/view/index/index.html 前台静态资源文件:public/assets/home/ http://www.fast.com/home/index/login 生成url地址:url('模块/控制器/方法') 模板布局:home/config.php 开启模板布局 清除缓存的命令 php think clear 通过url地址 -> 访问控制器 -> 视图 控制器:C -> 写业务逻辑 视图:V -> 显示页面 模型:M -> 数据库操作 验证器:validate 接收数据 $_POST $_GET $_FILES name="nickname" 将模型放到 公共模块 common php think make:model 模块/模型文件 php think make:model common/Business/Business php think make:model common/Business/Source 在程序调试中: 单条数据打印: $business = $this->BusinessModel->find() var_dump($businss->toArray()); //将对象集合 转换为数组 只用于打印(1位数组) 多条数据打印: $business = $this->BusinessModel->select() var_dump(collection($business)->toArray()); //将对象集合 转换为数组 只用于打印(2位数组) 调试SQL语句打印: echo $this->BusinessModel->getLastSql(); exit; helpers.php 公共函数库 composer == nodejs npm npm 包管理工具 下载插件 -> package.json composer 包管理工具 下载插件 composer.json 安装第三方插件 composer require jian1098/tp5-validate:dev-master php think make:validate common/Business/Business 创建一个前台公共的控制器 php think make:controller common/Home PHP类单继承 Business -> Home -> \think\Controller 模型获取器 -> 虚拟字段 给地区表建立一个模型 php think make:model common/Region save 插入 / 更新 save : 更新 data数据中 必须要有id主键 必须要用到函数 isUpdate(true) 用来与 插入功能做区分 邮箱认证 和 短信验证 条数收费的 YGTGG7uczA2WNmHX SMTP服务器: smtp.163.com DELETE INSERT 事务操作:保证2条语句都能够完整准确执行完毕,如果要是其中有一条语句报错了的话,那么就会执行回滚操作 前面所执行成功的语句全部会被后退 后退完之后 就相当于什么都没执行过 下订单 INSERT 支付扣钱 UPDATE 消费记录 INSERT TP框架 跳转 $this->success $this->error 框架会根据你当前的请求头来判断 如果你的请求头是异步的 那么 success error方法 将不再执行跳转 会变成返回json信息 startTrans() 开启事务 DELETE INSERT 等候中 模拟执行 rollback() 回滚事务 commit() 提交事务 创建分销的控制器 php think make:controller home/Team 安装二维码插件 composer require dh2y/think-qrcode:1.0 http://www.fast.com/home/index/login/token/b9bc1945e7e82982e960c396e2c241cd.html 查询一个字段的方法:value -> string 查询两个字段的方法:column(字段1,字段2) -> 数组 [字段1=>字段2] 不会给到模型的自定义字段 多个字段的方法:field->select() 在通过toArray打印数据 课程表1 订单表N 1对多 subject order SELECT * FROM order AS order LEFT JOIN subject AS sub ON order.subid = subid 创建课程控制器 php think make:controller home/Subject 云课堂 商城 酒店预约 线上成品:成品给人家看 域名和服务器(看你个人) 域名:备案服务器至少3个月 服务器 150 5 30 www.web20241008.com zs.web20241008.com 备案:广东 php think make:controller home/Coupon 佣金提成需求: 1、-> 2 -> 功能列表 1、第三方支付 2、课程直播 3、课程播放 4、课程评价 第三方支付: 微信支付、支付宝: A -> B 我们个人身份 无法去调用微信和支付宝的支付接口 模拟转账的方式来完成支付的调用 课程订单:subject_order 支付订单:fa_pay 支付核心点:要有两个账号(微信、支付宝),因为通过转账的方式来完成支付的流程 模拟支付的工具: 1、用户端先发起支付请求、产生一个支付的订单 2、 ------------------------------------------------- 菜单规则 -> 角色组 -> 管理员 左侧菜单(操作的功能) 先有菜单规则,角色组才可以去关联规则,管理选择角色。 后台开发功能: 1、手动去创建文件 2、命令行的方式创建文件 后台开发一个功能需要的文件有哪些: 可以将有关系的一系列的方法:放到一个顶级菜单下面 客户中心 business application/admin/controller/business 客户来源(数据列表) business/source application/admin/controller/business/Source.php 查(列表) business/source/index Source.php -> public functin index() 增(添加) business/source/add Source.php -> function add() 改(更新) business/source/edit 删(删除) business/source/del 客户公海 申请 分配 删除 客户私海 添加 编辑 删除 回收 查看资料 C控制器:application/admin/controller/business/Source.php V视图:application/admin/view/business/source/index.html... M模型:application/common/model/business/Source.php 语言包文件:application/admin/lang/business/source.php JS的控制器!:public/assets/js/backend/business/source.js 创建控制器 php think make:controller admin/business/Source 每一个控制器请求的方法对应JS模块中一个方法 PHP控制器 === JS模块控制器 PHP控制器: index add edit del JS模块控制器: index add edit del application/common/controller/Backend.php PHP公共控制器 public/assets/js/backend.js JS公共模块控制器 列表返回的数据数定死选项名 total => 列表总数 rows => 列表返回名称 回收站 恢复 删除(软删除)-> 不是真正的删除 给数据标记一个状态 销毁 (真正的删除) business/source/recyclebin 回收站 business/source/destroy 真实删除 business/source/restore 还原 公海:显示公共资源 adminid IS NULL 私海:显示自己领取的资源 adminid = 1 公海:business/highsea 查看 business/highsea/index 领取 business/highsea/apply 分配 business/highsea/allot 删除 business/highsea/del php think make:controller admin/business/Highsea Highsea 公海 business(主模型) 默认模式:没有设置关联查询的 如果我们在控制器里面 设置的 $model 主模型的话 那么 table的参数pk sortName 就会自动以主模型中的字段来查询 默认的控制器 关联主模型 那么默认情况下 是 单表查询 如果要是想让主模型多表查询 就需要 设置 关联查询 relationSearch = true 命令行: 周六:上线部署 + 直播 那个功能 客户私海:business/privatesea 查看:business/privatesea/index 添加:business/privatesea/add 销售自己录入的客户资源(添加动作insert) 分配动作 insert -> business adminid = auth->id insert -> business_receive status = allot 编辑:business/privatesea/edit 更新客户资料 删除:business/privatesea/del 软删除 回收:business/privatesea/recovery 详情:business/info php think make:controller admin/business/Privatesea php think make:controller admin/business/Info php think make:controller admin/business/Visit index add edit del 用命令行来去创建 CURD 操作 PHP控制器、JS控制器、View视图界面、菜单规则 -t 表名 -u 创建菜单 -d 删除菜单 -c 控制器 -m 模型 -l 是否为本地模型 php think crud -t business_visit -u 1 -c business/visit