# fasty **Repository Path**: cw_77_0/fasty ## Basic Information - **Project Name**: fasty - **Description**: Thinkphp+FastAdmin - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-02-19 - **Last Updated**: 2025-04-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README sudo chmod -R 777 * && git add . && git commit -m 'submit code' && git push origin master Thinkphp + FastAdmin(二次开发) + redis + swoole + easywechat + memcached + 支付功能 Thinkphp5:https://www.thinkphp.cn/ FastAdmin:https://doc.fastadmin.net/doc 配置项目的站点来进行访问: www.fast.com 指向的目录 /public ping www.fast.com -> 127.0.0.1 修改hosts文件 项目:Fast(在线教育云课堂) 前台+后台 目录:fast 域名:www.fast.com 数据库:fast 编码:utf8mb4_general_ci Thinkphp框架 -> MVC架构方式 公司通讯录 company php+mysql 源生开发形式 PersonAdd.php 文件 (控制器 + 模型 + 视图) 上方:php业务逻辑的代码(控制器 + 模型) 业务逻辑 + sql数据查询 下方:html + css 页面(视图) C:Controller 控制器(业务逻辑) M:Model 模型(数据库增删查改) V:View 视图(html页面) addons FastAdmin插件目录 extend Thinkphp框架拓展 runtime Thinkphp 框架在运行时所产生缓存文件 thinkphp 框架的源代码目录 vendor 框架底层的依赖包目录 bower.json -> bower前端安装包工具 composer.json -> composer 安装工具包 think -> thinkphp框架的命令行文件 public 程序公共目录 /assets/ 项目资源css/js/images/ /template/ 目模板资源 /uploads 上传资源目录 erp.php 后台程序入口文件 index.php 程序入口 router.php 路由程序 application command.php -> 命令行文件 config.php -> 框架的系统配置文件 database.php -> 数据库配置文件 common.php -> helpers.php 公共函数库文件 admin -> 后台模块 每个模块文件夹 就是一个独立的MVC api -> 接口模块 index -> 自带demo模块 fastadmin的前台 extra -> 系统配置信息模块 common -> 公共模块 应用命名空间:app == application 后台:admin 目录:application/admin/ 前台:home 目录:application/home/ www.fast.com -> public www.fast.com/index.php/模块/控制器/方法 访问的地址:www.fast.com/index.php/index/index/index 默认访问:application/config.php 默认访问的模块:index -> application/index/ 默认访问的控制器:Index -> application/index/Controller/Index.php 默认操作名:index -> application/index/Controller/Index.php -> public function index() 先进入到 fast文件夹中 php配置环境变量 https://blog.csdn.net/niuren3212/article/details/134865955 创建自己的home模块 php think build --module home 访问你的模块 www.fast.com/index.php/home/index/index 文件路径:application/home/controller/Index.php -> function index URL地址 -> 找出控制器 -> 在找到视图 http://www.fast.com/index.php/home/index/index 我们自己构建的控制器 必须要 依赖 Thinkphp底层的控制器文件 config.php -> 打开调试模式 debug => true 控制器文件:application/home/controller/ 视图文件:application/home/view/ www.fast.com/index.php/home/index/index application/home/controller/Index.php -> function index add edit del application/home/controller/User.php -> function index add edit del application/home/view/index/index.html application/home/view/index/add.html application/home/view/index/edit.html application/home/view/user/index.html function index return $this->view->fetch(); 会自动匹配视图的目录结构 我们最好就不要自己给别的视图目录 就让系统自动生成 这样 让 控制器和视图 统一规范 不要把所有的方法写到一个控制器里面 用命令行构建控制器文件 php think make:controller home/Business 要使用 tp 当中的 url跳转函数 php : url('模块/控制器/方法') html : {:url('模块/控制器/方法')} URL重写 ;public/.htaccess 控制器:C 视图:V 模型:M 构建模型的命令 php think make:model common/Business/Business php think make:model common/Business/Source application/common/model/Business/Business.php Business/Business.php Business/Address.php Business/Record.php 调试的 打印一条数据的方法:$one->toArray(); 前提 $one变量 一定要能查询到数据 打印多条数据的方法:collection($all)->toArray(); 多条数据的打印是返回二维数组 打印sql语句的方法:$this->BusinessModel->getLastSql(); 模型:数据库的增删查改 验证器validate:在更新和插入之前做的一个数据验证的功能 Thinkphp5 没有命令去生成 save($data) 方法 插入:$data 没有 id 就说明是插入语句 更新:$data 有 id 并且是有值的 说明是更新语句 添加一个方法 isUpdate(true) 单继承产物 Business Home Controller 公共common php think make:controller common/Home 打开:基本资料界面 到 登录界面 C -> V 控制器 将数据赋值给 视图 success error 会根据你当前的请求 自动分别出 是要做重定向跳转 还是返回json 域名和服务器 URL重写 -> apache功能 -> LoadModule rewrite_module lib/apache2/modules/mod_rewrite.so 模型 -> 获取器 -> 虚拟字段 只有查询的时候有效 会在你查询的记录上增加额外数据字段 business -> province city district(地区码) province province_text city city_text district district_text 创建一个地区模型 php think make:model common/Region FAST邮箱认证 验证码:【】有效期:24个小时 http https git svn ftp ssl socket 邮件 smtp pop3 imap 不能一直批量去发邮件 fa_ems 插入 验证码 fa_business 更新 auth = '1' innodb 表引擎 事务 行级锁定 外键约束 崩溃恢复 事务操作:下订单、更新用户余额,商品扣库存,删除购物车 回滚:倒叙回滚 提交:删除 更新 正序 创建一个新的控制器 php think make:controller home/Team nodejs -> npm yarn npm 下载第三方包管理工具 php -> composer linux -> yum apt-get python -> pip 基于composer 去安装我们的第三方拓展 composer.json -> require选项下 "dh2y/think-qrcode":"1.*", 安装所有的包 composer可以设置忽略版本匹配 -ignore-platform-reqs composer install --ignore-platform-reqs 我的优惠券: 我的收藏:fa_business_collection WHERE busid = 自己的ID AND type = 'subject' 如何 type = subject colletid收藏id 对应的就是 fa_subject 主键id 我的关注:fa_subject_teacher_follow WHERE busid = 自己的ID 消费记录表:fa_business_record WHERE busid = 自己的ID 提现:fa_business_commission WHERE busid = 自己的ID 搜索:fa_subject 名师:fa_teacher --------------------------------------------------------------------------- 清除缓存文件 php think clear 建模块 php think build --module test 控制器 php think make:controller test/Business 模型 php think make:model test/Collection php think make:model test/Subject 模型来去操作 数据库当中提供的 DB 类去做查询 join 方法做链表查询 模型中的 关联方法 创建一个课程的控制器 php think make:controller home/Subject 收藏、取消收藏: 1、发送ajax请求 2、查询用户的收藏表 business_collection where busid = 当前的登录用户 AND type = 'subject' AND collectid = subid 3、如果有找到这条记录就说明有收藏过 收藏过 -> 取消收藏 -> DELETE 没收藏过 -> 增加收藏 -> INSERT 4、返回成功和失败的结果 顺带返回一个 data数据 来给到前台去判断 是收藏动作还是取消动作 新建一个优惠券的控制器 php think make:controller home/Coupon 只有 save 这个方法 才会触发验证器 validate 验证 update insert() 自动插入时间戳 -> 模型里面设置的 ->save这个方法才能够完成的 模型操作数据库 DB类操作数据库 创建一个订单的控制器 php think make:controller home/Order 学员评论:subject_comment 关联查询(business、subject) 提现功能:查询提现表:fa_business_commission 找出自己的提现记录:where parentid = 当前登录人的ID AND type = 'subject' status = 0 未提现 1 已提现 提现功能:事务操作 fa_business_commission Update更新 status = 1 business 更新 money 联系我们:3个联系资料,录入到后台的系统配置当中 config('site.name') 公司banner图:多图集结构 市场销售: 技术支持: 产品售后: ------------------------------------------------------------------------------------------------------------ 微信支付、支付宝支付、支付牌照100w H5支付、公众号支付、小程序支付、扫码支付、刷脸支付 https://pay.weixin.qq.com/ 微信支付 -> 申请商户号 -> 企业资料 微信支付 -> 第三方(私企公司) -> 子用户(签约用户) -> --------------------------------------------------------------------------------------- 后台功能:RBAC 1、录入菜单规则(控制器的方法地址) 2、创建角色组 3、创建管理员 菜单规则控制器:application/admin/Controller 客户中心 一级菜单规则 business 客户来源(business_source) 增删查改 business/source 列表 business/source/index 添加 business/source/add 编辑 business/source/edit 删除 business/source/del 客户公海 business/highsea business WHERE adminid IS NULL 没有被人认领过的 列表:business/highsea/index 领取:business/highsea/apply 分配:business/highsea/allot 删除:business/highsea/del 客户私海 business/privatesea WHERE adminid = 当前登录的管理员 被管理员所认领过的 列表 business/privatesea/index 添加 business/privatesea/add 添加的客户资源直接流入到自己的私海领域 编辑 business/privatesea/edit 删除 business/privatesea/del 回收 business/privatesea/recovery 客户详情 business/info 回收站 创建后台的控制器 php think make:controller admin/business/Source 控制器、模型、视图 访问的URL:www.fast.com/erp.php/business/source 控制器:application/admin/controller/business/Source.php public function index add edit del 视图:application/admin/view/business/source/index.html 模型:application/common/model/business/Source.php 语言包:application/admin/lang/zh-cn/business/source.php JS控制器:public/assets/js/backend/business/source.js index add edit del PHP和JS的控制器两个文件 都要同时拥有 __() | {:__('语言项的名称')} 调用语言包 加载公共语言包:/application/admin/lang/zh-ch/zh-ch.php 加载特定的控制器语言包:/application/admin/lang/zh-ch/business/source.php 修改表格的默认功能,需要修改全局的插件文件:/public/assets/js/require-table.js search: false, //是否启用快速搜索 searchFormVisible: true, //是否始终显示搜索表单 $auth->check('权限地址') -> 验证当前的管理员是否拥有权限 返回true 否则返回false 云课堂 课程分类 课程管理 订单管理 讲师管理 回收站 客户中心 客户来源 客户公海 客户私海 回收站 创建公海控制器 php think make:controller admin/business/Highsea index.html
business.js buttons:[ { name: 'add' } ] btn-dialog(弹出新窗口)/btn-ajax(发送ajax)/btn-addtabs(打开一个新的选项卡) 领取: business 更新 adminid = 当前管理员id business_receive 领取记录表 插入 分配: business 更新 adminid = 当前管理员id business_receive 领取记录表 插入 控制器中 视图中 可以获取到管理员的信息 home -> $AutoLogin admin -> $auth 管理员权限控制对象 $auth == fa_admin 表的数据 将登陆的整条admin的数据都存入到 auth对象当中 后台当中 如果 我们做了 with 关联查询 一定要把后台当中 关联查询的开关要开启 relationSearch = true 开启的主要目的是 为了区分开多个表当中的重复字段 对排序 条件的 重复字段 增加 表的前缀 $("#info") 获取jquery元素 id="info" 插件管理 命令行 php think crud -t subject_category -c subject/Category -u 1 回收站菜单规则: 客户回收站:business/recyclebin 列表:business/recyclebin/index 恢复:business/recyclebin/restore 销毁:business/recyclebin/destroy 真实删除 一定要删除图片资源 删除:business/privatesea/del 软删除 客户中心、云课堂、优惠券、Thinkphp云课堂项目 商品管理、进销存管理 Vue商城 + Vue环境 php phpstudy 多版本 Nodejs 多版本 nvm 创建vue脚手架项目 npm create vite@latest 双向绑定 ES6 -> Proxy Object 属性和方法 进行监听 thinkphp public function __construct() 生命周期函数 vue2: 8个 创建前后、挂载前后,更新前后,销毁前后 vue3: 7个 setup、挂载前后,更新前后,销毁前后 npm run dev onRenderTracked onRenderTriggered 调试的钩子 onErrorCaptured 错误异常捕获钩子 父 -> 子 用props 属性 用属性 子 -> 父 用事件 父 -> 子 数据通信 也可以给vue设置全局的属性 或者全局的方法 common.php provide / inject M(模型) V(视图) C(控制器) MVVM MVT python django 插槽 安装vue的路由 -S dependencies 生产依赖下面 npm install vue-router@4 -S -D devDependencies 开发依赖下面 npm install vue-router@4 -D vue 路由的概念 thinkphp -> 路由 -> url -> 控制器 路由 -> 组件 http://localhost:5173/#/login -> src/components/pages/login.vue http://localhost:5173/#/business http://localhost:5173/#/product http://localhost:5173/login.html http://localhost:5173/product.html Vue -> 单页面应用 vue-router 动态加载路由对应视图组件 == 路由跳转 path == to 2种方式传参 1、路由规则中 path 设置传递的参数 一旦规定了参数 就必须要给 不给就404 2、传统的 get 请求参数 query 形式 $_GET :to="{path: '跳转地址', query: {传参}}" useRoute -> 专门用于获取数据类的 query path name useRouter -> 专门用于功能类的 js location reload push history.go 路由嵌套功能 /business 二级路由 /business/profile /business/email /business 加载一级路由 business.vue /profile 加载二级路由 创建一个新的脚手架项目 npm create vite@latest 安装第三方依赖 npm install ---------------------------------------------------项目部署 云课堂 vue 用二级域名的方式来去构建站点 *.luckyxixi.cn 泛域名解析 -> 通配所有的二级域名 teacherfast.luckyxixi.cn teachershop.luckyxixi.cn 在服务器终端 执行 git clone 克隆 将 fast的项目克隆 linux -> php 执行项目的时候 php运行的权限 php -> www用户 需要将 fast 目录设置 权限 和 所属用户组 都归属于 www 设置权限 sudo chmod -R 777 目录名称 设置归属用户组 sudo chown -R www:www 目录名称 添加站点 数据库 vue 修改 vite.config.js 将代理的接口地址改成 线上地址 然后在进行 npm run build 打包命令 扔到线上 配置反向代理 ---------------------------------------------------Uniapp Uniapp:https://uniapp.dcloud.net.cn/ 微信小程序:https://developers.weixin.qq.com/miniprogram/dev/framework/ uniapp 本身 也是 基于 vue开发 集成类的框架 vue 微信小程序...小程序 uniapp: 写一套代码 打包出来 多个不同种类的项目 uniapp 混合app 前端的代码 + android / ios app 混合app uniapp android ios 系统底层应用外壳 是 在应用的外壳里面 嵌套了一个web浏览器进去 纯原生 android ios uniapp hbuilderx -> dclound uniapp(vue + 小程序 + app) web 小程序 app 创建uniapp(vue3的版本) npx degit dcloudio/uni-preset-vue#vite 项目名称 npx degit dcloudio/uni-preset-vue#vite track 创建一个小程序的账号 https://mp.weixin.qq.com/wxopen/waregister?action=step1&source=mpregister&token=&lang=zh_CN dev:平台 开发模式运行 build:平台 打包模式运行 在vue中 vue-router 路由 找 组件页面 在uniapp pages.json 这个文件就是我们的路由 写业务逻辑:Vue这个框架 小程序当中:不是用 html + css + js html a p table form p == text 页面语言:wxml + wxss + wxs h5:npm run dev:h5 微信小程序:npm run dev:mp-weixin 混合app: npm run dev:app-plus App端编译: 直接插入手机的usb数据线 -> 手机 开启 usb开发者调试 安装模拟器:逍遥 夜神 mumu 安装UI框架 npm i @climblee/uv-ui -S 安装sass npm install sass -D npm install unplugin-auto-import@0.19.0 -D uv- 都是 uvui这个UI插件的组件开头 终端的条件判断 uniapp小程序 vue 有生命周期 2个种类的生命周期: 应用生命周期:仅在打开App应用的时候触发一次 onLaunch 初始化完成时触发的 onShow 渲染完成时触发的 onHide 隐藏时触发的 onError 报错 onPageNotFound 页面不存在 onThemeChange 监听主题颜色变化 onLastPageBackPress 后一个页面按下Android back键,常用于自定义退出 onExit 监听应用退出 页面生命周期:(小程序) vue生命周期的钩子函数:8个生命周期 onLoad(params) 监听页面加载完成时触发的,这个钩子函数可以结束上一个页面传递的参数,只有这个钩子能接收 onShow 监听页面的显示 onReady 渲染完成 onHide 页面隐藏 onUnload 页面卸载 onResize 页面窗口尺寸改变 onPullDownRefresh 下拉刷新 onReachBottom 上拉加载 onTabItemTap 点击底部的导航栏触发 onShareAppMessage 分享动作触发的 onPageScroll 监听页面滚动 发送请求:调用uniapp当中网络请求的API接口 教程、全局文件: 用于介绍 uniapp工程中 文件和文件配置的说明 组件: 介绍 小程序中 标签的作用,以及兼容性(app/h5/小程序) API: 可以调用的程序接口,包括:网络请求、通讯录、摄像头、wifi、蓝牙、硬件、微信对接API、获取到这个微信用户的信息、手机号、推送消息. uni. uniapp框架中的元素 uv- uv-ui UI框架的元素 wx. 微信小程序官方的元素 wx.request ali.request baidu.request uni.request 请求: h5: 基于web程序 就和我们的vue是一样 走反向代理 vue中发出的: http://localhost:5173/work/ 反向代理:http://www.fast.com/work/business/login app/小程序: api接口就是完整的 域名+请求的模块的地址 api:http://www.fast.com/work/business/login uv-ui uni.$uv.http -> axios -> http异步请求 -> promise uniapp 当中 proxy 对象 跟我们vue 当中 proxy 是一样的。 但是 proxy当中包含了有 uniapp的东西